Esempio n. 1
0
        internal TabPermission(XmlNode tabPermissionNode, int tabIndex, int permIndex)
        {
            string parentXPath = string.Format("/tabs/tab[{0}]/permissions/permission[{1}]", tabIndex, permIndex);

            this.IsDefault =
                Helper.ConvertToBool(tabPermissionNode.SelectSingleNode(parentXPath + "/isdefault").InnerText);

            this.Level =
                (Enums.PermissionLevel)Enum.Parse(typeof(Enums.PermissionLevel),
                                                  tabPermissionNode.SelectSingleNode(parentXPath + "/level").InnerText, true);

            this.OnForms =
                TabPermission.ParseForms(tabPermissionNode.SelectSingleNode(parentXPath + "/onforms").InnerText);

            this.BySPPrinciplesOperator = (Enums.Operator)Enum.Parse(typeof(Enums.Operator),
                                                                     tabPermissionNode.SelectSingleNode(parentXPath + "/forprinciples").
                                                                     InnerText.Split(Constants.XmlElementTextSeparator.ToCharArray(),
                                                                                     StringSplitOptions.RemoveEmptyEntries)[0], true);

            this.ForSPPrinciples =
                tabPermissionNode.SelectSingleNode(parentXPath + "/forprinciples").
                InnerText.Split(Constants.XmlElementTextSeparator.ToCharArray(),
                                StringSplitOptions.RemoveEmptyEntries)[1];

            this.Conditions =
                Conditions.LoadConditions(tabPermissionNode.SelectNodes(parentXPath + "/conditions/condition"));
        }
Esempio n. 2
0
        internal Tab(XmlNode tabNode, int tabIndex)
        {
            string parentXPath = string.Format("/tabs/tab[{0}]", tabIndex);

            this.Index       = Convert.ToUInt16(tabNode.SelectSingleNode(parentXPath + "/index").InnerText);
            this.Title       = Helper.HtmlDecode(tabNode.SelectSingleNode(parentXPath + "/title").InnerText);
            this.Description = Helper.HtmlDecode(tabNode.SelectSingleNode(parentXPath + "/description").InnerText);
            this.IsSelected  = Helper.ConvertToBool(tabNode.SelectSingleNode(parentXPath + "/isselected").InnerText);

            XmlNodeList fieldNode = tabNode.SelectNodes(parentXPath + "/fields/field");

            this.Fields = new Fields();

            int fieldIndex = 1;

            foreach (XmlNode node in fieldNode)
            {
                Field f = new Field(this, node, tabIndex, fieldIndex);
                this.Fields.Add(f);
                fieldIndex++;
            }

            XmlNodeList tabPermission = tabNode.SelectNodes(parentXPath + "/permissions/permission");

            this.Permissions = new TabPermissions();

            int permIndex = 1;

            foreach (XmlNode node in tabPermission)
            {
                TabPermission tp = new TabPermission(node, tabIndex, permIndex);
                this.Permissions.Add(tp);
                permIndex++;
            }
        }