コード例 #1
0
 ///// <summary>
 ///// 节点文本
 ///// </summary>
 //public String Text
 //{
 //    get { return text; }
 //    set
 //    {
 //        text = value;
 //        RaisePropertyChanged("Text");
 //    }
 //}
 //public PrivilegeNode(String text,string id,string pID)
 //{
 //    Children = new ObservableCollection<PrivilegeNode>();
 //    Text = text;
 //    Id = id;
 //    PID = pID;
 //}
 public void Add(PrivilegeNode node)
 {
     children.Add(node);
     RaisePropertyChanged ("Children");
 }
コード例 #2
0
 public void Delete(PrivilegeNode node)
 {
     children.Remove(node);
     RaisePropertyChanged("Children");
 }
コード例 #3
0
 /// <summary>
 /// 创建权限树子节点
 /// </summary>
 /// <param name="pNode"></param>
 private void CreateChildTree(PrivilegeNode pNode)
 {
     IEnumerable<PrivilegeInfo> rootNodeList = _PrivilegeList.Where(p => p.ParentPrivilegeID == pNode.PrivilegeTreeNode.PrivilegeId).OrderBy(p => p.Displayorder);
     foreach (PrivilegeInfo privilegeInfo in rootNodeList)
     {
         PrivilegeNode node = new PrivilegeNode(privilegeInfo);
         if (_accName != "admin" && privilegeInfo.PrivilegeName == "权限管理")
             continue;
         else
             pNode.Add(node);
         CreateChildTree(node);
     }
 }
コード例 #4
0
 /// <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;
 }
コード例 #5
0
        /// <summary>
        /// 获取所有用户权限集合
        /// </summary>
        public void GetPrivileges()
        {
            IsBusy = true;
            if (_PrivilegeList == null)
                _PrivilegeList = new ObservableCollection<PrivilegeInfo>();
            else
                _PrivilegeList.Clear();
            ErrType err = _businessService.GetPrivileges(_loginID, ref _PrivilegeList);
            if (err.Err != ERR.SUCCESS)
            {
                MessageBox.Show(err.ErrMsg, err.ErrTitle, MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            if (_PrivilegeList != null)
            {

                PrivilegeTreeNodeList = new ObservableCollection<PrivilegeNode>();
                // PrivilegeNodeList = new ObservableCollection<PrivilegeNode>();
                IEnumerable<PrivilegeInfo> rootPrivilegeInfoList = _PrivilegeList.Where(p => string.IsNullOrEmpty(p.ParentPrivilegeID)).OrderBy(p => p.Displayorder);
                foreach (PrivilegeInfo privilegeInfo in rootPrivilegeInfoList)
                {
                    PrivilegeNode node = new PrivilegeNode(privilegeInfo);
                    PrivilegeTreeNodeList.Add(node);
                    //PrivilegeNodeList.Add(node);
                    CreateChildTree(node);
                }
            }
            IsBusy = false;
        }
コード例 #6
0
 /// <summary>
 /// 权限树选择项改变事件
 /// </summary>
 /// <param name="curNode"></param>
 public void GetCurCurPrivilege(PrivilegeNode curNode)
 {
     if (PrivilegeList != null && curNode != null)
         //CurPrivilegeInfo = PrivilegeList.Where(p => p.PrivilegeId == curNode.PrivilegeTreeNode.PrivilegeId).FirstOrDefault();
         CurPrivilegeInfo = curNode.PrivilegeTreeNode;
 }
コード例 #7
0
 private void DelCNode(PrivilegeNode pNode)
 {
     foreach (PrivilegeNode node in pNode.Children)
     {
         if (node.PrivilegeTreeNode.PrivilegeId == CurPrivilegeNode.PrivilegeTreeNode.PrivilegeId)
         {
             pNode.Children.Remove(node);
             MessageBox.Show("删除成功!", "提示信息", MessageBoxButton.OK, MessageBoxImage.Information);
             return;
         }
         else
         {
             DelCNode(node);
         }
     }
 }
コード例 #8
0
 public void Delete(PrivilegeNode node)
 {
     children.Remove(node);
     RaisePropertyChanged("Children");
 }
コード例 #9
0
 ///// <summary>
 ///// 节点文本
 ///// </summary>
 //public String Text
 //{
 //    get { return text; }
 //    set
 //    {
 //        text = value;
 //        RaisePropertyChanged("Text");
 //    }
 //}
 //public PrivilegeNode(String text,string id,string pID)
 //{
 //    Children = new ObservableCollection<PrivilegeNode>();
 //    Text = text;
 //    Id = id;
 //    PID = pID;
 //}
 public void Add(PrivilegeNode node)
 {
     children.Add(node);
     RaisePropertyChanged("Children");
 }