示例#1
0
        internal XmlNode ToXmlOne(XmlNode rootNode, RbacEntitlementMenu subMenu)
        {
            XmlNode nodeElement = rootNode.OwnerDocument.CreateElement("RbacEntitlementMenu");

            XmlAttribute name = rootNode.OwnerDocument.CreateAttribute("Name");

            name.Value = subMenu.Name;
            nodeElement.Attributes.Append(name);

            XmlAttribute text = rootNode.OwnerDocument.CreateAttribute("Text");

            text.Value = subMenu.Text;
            nodeElement.Attributes.Append(text);

            XmlAttribute visible = rootNode.OwnerDocument.CreateAttribute("Visible");

            visible.Value = subMenu.Visible ? "true" : "false";
            nodeElement.Attributes.Append(visible);

            XmlAttribute enabled = rootNode.OwnerDocument.CreateAttribute("Enabled");

            enabled.Value = subMenu.Enabled ? "true" : "false";
            nodeElement.Attributes.Append(enabled);


            foreach (RbacEntitlementMenu subsubsubMenu in subMenu.SubMenus)
            {
                nodeElement.AppendChild(ToXmlOne(nodeElement, subsubsubMenu));
            }
            return(nodeElement);
        }
示例#2
0
        private static RbacEntitlementMenu FromXmlOne(XmlNode node)
        {
            RbacEntitlementMenu nodeElement = new RbacEntitlementMenu();

            nodeElement.Name    = node.Attributes["Name"].Value;
            nodeElement.Text    = node.Attributes["Text"].Value;
            nodeElement.Enabled = node.Attributes["Enabled"].Value.ToLower() == "true" ? true : false;
            nodeElement.Visible = node.Attributes["Visible"].Value.ToLower() == "true" ? true : false;

            foreach (XmlNode childNode in node)
            {
                nodeElement.SubMenus.Add(FromXmlOne(childNode));
            }
            return(nodeElement);
        }
示例#3
0
        public static RbacEntitlementMenus FromXml(XmlNode menusNode)
        {
            RbacEntitlementMenus menus = new RbacEntitlementMenus();

            foreach (XmlNode node in menusNode.ChildNodes)
            {
                if (node.NodeType == XmlNodeType.Comment)
                {
                    continue;
                }
                else if (node.Name == "RbacEntitlementMenu")
                {
                    menus.Menu.Add(RbacEntitlementMenu.FromXml(node));
                }
            }
            return(menus);
        }
示例#4
0
        public static RbacEntitlementMenu FromXml(XmlNode node)
        {
            RbacEntitlementMenu rootElement = new RbacEntitlementMenu();

            rootElement.Name    = node.Attributes["Name"].Value;
            rootElement.Text    = node.Attributes["Text"].Value;
            rootElement.Enabled = node.Attributes["Enabled"].Value.ToLower() == "true" ? true : false;
            rootElement.Visible = node.Attributes["Visible"].Value.ToLower() == "true" ? true : false;

            if (node.ChildNodes.Count == 0)
            {
                return(rootElement);
            }
            else
            {
                foreach (XmlNode childNode in node)
                {
                    rootElement.SubMenus.Add(FromXmlOne(childNode));
                }
            }
            return(rootElement);
        }