Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="permission"></param>
        /// <returns></returns>
        private XElement Save(PermissionDocument permission)
        {
            XElement xe = new XElement("Permission");

            foreach (var vv in permission.Permissions)
            {
                xe.Add(Save(vv.Value));
            }
            return(xe);
        }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="element"></param>
        /// <returns></returns>
        public PermissionDocument LoadPermission(XElement element)
        {
            PermissionDocument re = new PermissionDocument();

            re.Permissions = new Dictionary <string, PermissionItem>();
            foreach (var vv in element.Elements())
            {
                var pp = LoadPermissionItem(vv);
                if (!re.Permissions.ContainsKey(pp.Name))
                {
                    re.Permissions.Add(pp.Name, pp);
                }
            }
            return(re);
        }