public PrivilegeNode(PrivilegeInfo node)
 {
     Children = new ObservableCollection<PrivilegeNode>();
     PrivilegeTreeNode = node;
     //Text = text;
     //Id = id;
     //PID = pID;
 }
 public PrivilegeNode(PrivilegeInfo node)
 {
     Children          = new ObservableCollection <PrivilegeNode>();
     PrivilegeTreeNode = node;
     //Text = text;
     //Id = id;
     //PID = pID;
 }
 /// <summary>
 /// 添加权限
 /// </summary>
 public void AddPrivilegeExecute()
 {
     string id = Guid.NewGuid().ToString("n");
     CurPrivilegeInfo = new PrivilegeInfo();
     CurPrivilegeInfo.PrivilegeId = id;
     CurPrivilegeInfo.PrivilegeName = "";
     PrivilegeNode newNode = new PrivilegeNode(CurPrivilegeInfo);
     if (CurPrivilegeNode == null)//添加根级节点
     {
         CurPrivilegeInfo.ParentPrivilegeID = "";
         CurPrivilegeInfo.ParentPrivilegeName = "";
         PrivilegeTreeNodeList.Add(newNode);
     }
     else
     {
         //CurPrivilegeInfo.ParentPrivilegeID = CurPrivilegeNode.Id;
         //CurPrivilegeInfo.ParentPrivilegeName = CurPrivilegeNode.Text;
         //newNode.PID = CurPrivilegeNode.PID;
         CurPrivilegeInfo.ParentPrivilegeID = CurPrivilegeNode.PrivilegeTreeNode.PrivilegeId;
         CurPrivilegeInfo.ParentPrivilegeName = CurPrivilegeNode.PrivilegeTreeNode.PrivilegeName;
         //newNode.PrivilegeTreeNode.ParentPrivilegeID
         CurPrivilegeNode.Children.Add(newNode);
     }
     PrivilegeList.Add(CurPrivilegeInfo);
     newNode.IsNewNode = true;
     CurPrivilegeNode = newNode;
 }
        /// <summary>
        ///5.2.2	修改权限数据
        /// </summary>
        /// <param name="loginID">登录ID</param>
        /// <param name="roleInfo">权限信息</param>
        /// <returns></returns>
        public ErrType UpdatePrivileges(string loginID, PrivilegeInfo privilegeInfo)
        {
            try
            {
                PrivilegeEntity privilegeEntity = MyConverter.ToPrivilegeEntity(privilegeInfo);

                EntityBase result = ManagerService.UpdatePrivileges(loginID, privilegeEntity);
                if (!result.Result)
                    return new ErrType(ERR.SERVICE, result.Desc);

                return GeneralErr.Success;
            }
            catch (TimeoutException te)
            {
                FileLog.WriteLog("", Assembly.GetExecutingAssembly().GetName().Name, this.GetType().Name, new StackTrace().GetFrame(0).GetMethod().Name, te.Message); return new ErrType(ERR.EXEPTION, ErrorText.TimeoutException);
            }
            catch (Exception ex)
            {
                FileLog.WriteLog("", Assembly.GetExecutingAssembly().GetName().Name, this.GetType().Name,
             new StackTrace().GetFrame(0).GetMethod().Name, ex.Message);
                return new ErrType(ERR.EXEPTION, ErrorText.OperationError);
            }
        }
Exemplo n.º 5
0
 internal static PrivilegeEntity ToPrivilegeEntity(PrivilegeInfo privilegeInfo)
 {
     PrivilegeEntity privilegeEntity = new PrivilegeEntity();
     privilegeEntity.Check = privilegeInfo.Check;
     privilegeEntity.ParentPrivilegeId = privilegeInfo.ParentPrivilegeID;
     privilegeEntity.ParentPrivilegeName = privilegeInfo.ParentPrivilegeName;
     privilegeEntity.PrivilegeId = privilegeInfo.PrivilegeId;
     privilegeEntity.PrivilegeName = privilegeInfo.PrivilegeName;
     privilegeEntity.Displayorder = privilegeInfo.Displayorder;
     return privilegeEntity;
 }