AJH.CMS.Core.Data.MenuManager.SetAttributeMenuNode C# (CSharp) Method

SetAttributeMenuNode() private static method

private static SetAttributeMenuNode ( XmlElement xmlEle, Menu menuItem ) : void
xmlEle System.Xml.XmlElement
menuItem AJH.CMS.Core.Entities.Menu
return void
        private static void SetAttributeMenuNode(XmlElement xmlEle, Menu menuItem)
        {
            XmlAttribute xmlAtt = xmlEle.OwnerDocument.CreateAttribute("ID");
            xmlAtt.Value = menuItem.ID.ToString();
            xmlEle.Attributes.Append(xmlAtt);

            xmlAtt = xmlEle.OwnerDocument.CreateAttribute("Description");
            xmlAtt.Value = menuItem.Description;
            xmlEle.Attributes.Append(xmlAtt);

            xmlAtt = xmlEle.OwnerDocument.CreateAttribute("Image");
            xmlAtt.Value = menuItem.Image;
            xmlEle.Attributes.Append(xmlAtt);

            xmlAtt = xmlEle.OwnerDocument.CreateAttribute("Name");
            xmlAtt.Value = menuItem.Name;
            xmlEle.Attributes.Append(xmlAtt);

            xmlAtt = xmlEle.OwnerDocument.CreateAttribute("PageID");
            xmlAtt.Value = menuItem.PageID.ToString();
            xmlEle.Attributes.Append(xmlAtt);

            xmlAtt = xmlEle.OwnerDocument.CreateAttribute("ParentID");
            xmlAtt.Value = menuItem.ParentID.ToString();
            xmlEle.Attributes.Append(xmlAtt);

            switch (menuItem.MenuType)
            {
                case Enums.CMSEnums.MenuType.Static:
                    NameValueCollection valueCollection = HttpUtility.ParseQueryString(menuItem.URL);
                    if (string.IsNullOrEmpty(valueCollection[CMSConfig.QueryString.MenuID]))
                    {
                        if (menuItem.URL.Contains("?"))
                        {
                            menuItem.URL += "&" + CMSConfig.QueryString.MenuID + "=" + menuItem.ID;
                        }
                        else
                        {
                            menuItem.URL += "?" + CMSConfig.QueryString.MenuID + "=" + menuItem.ID;
                        }
                    }
                    break;
            }
            if (menuItem.GalleryCategoryID > 0)
            {
                if (menuItem.URL.Contains("?"))
                {
                    menuItem.URL += "&" + CMSConfig.QueryString.CategoryID + "=" + menuItem.GalleryCategoryID;
                }
                else
                {
                    menuItem.URL += "?" + CMSConfig.QueryString.CategoryID + "=" + menuItem.GalleryCategoryID;
                }
            }
            xmlAtt = xmlEle.OwnerDocument.CreateAttribute("URL");
            xmlAtt.Value = menuItem.URL;
            xmlEle.Attributes.Append(xmlAtt);

            xmlAtt = xmlEle.OwnerDocument.CreateAttribute("MenuType");
            xmlAtt.Value = ((int)(menuItem.MenuType)).ToString();
            xmlEle.Attributes.Append(xmlAtt);

            xmlAtt = xmlEle.OwnerDocument.CreateAttribute("Order");
            xmlAtt.Value = menuItem.Order.ToString();
            xmlEle.Attributes.Append(xmlAtt);

            xmlAtt = xmlEle.OwnerDocument.CreateAttribute("CategoryID");
            xmlAtt.Value = menuItem.CategoryID.ToString();
            xmlEle.Attributes.Append(xmlAtt);

            xmlAtt = xmlEle.OwnerDocument.CreateAttribute("GalleryCategoryID");
            xmlAtt.Value = menuItem.GalleryCategoryID.ToString();
            xmlEle.Attributes.Append(xmlAtt);
        }
    }