private void GetSelectedChildren(TreeListNode _fnode, List <UserRightInfo> _ret) { foreach (TreeListNode _node in _fnode.Nodes) { TObj_RightItem _ritem = treeList2.GetDataRecordByNode(_node) as TObj_RightItem; if (_ritem.HaveRight) { _ret.Add(_ritem.Data); } GetSelectedChildren(_node, _ret); } }
private void AddChildrenRightItem(TObj_RightItem _fitem, List <UserRightInfo> _rightList) { UserRightFinder _finder = new UserRightFinder(_fitem.ID); List <UserRightInfo> _ChildRightList = _rightList.FindAll(new Predicate <UserRightInfo>(_finder.FindByFatherID)); _ChildRightList.Sort(new UserRightInfoComparer()); foreach (UserRightInfo _ri in _ChildRightList) { TObj_RightItem _ritem = new TObj_RightItem(_ri); _fitem.Children.Add(_ritem); AddChildrenRightItem(_ritem, _rightList); } }
/// <summary> /// 取用户选择的所有功能权限 /// </summary> /// <returns></returns> private List <UserRightInfo> GetSelectedFunctionRights() { List <UserRightInfo> _ret = new List <UserRightInfo>(); foreach (TreeListNode _node in this.treeList2.Nodes) { TObj_RightItem _ritem = treeList2.GetDataRecordByNode(_node) as TObj_RightItem; if (_ritem.HaveRight) { _ret.Add(_ritem.Data); } GetSelectedChildren(_node, _ret); } return(_ret); }
private void InitRigtTree() { if (CurrentPost != null) { using (SinoSZClientBase.UserManagerService.UserManagerServiceClient _umsc = new SinoSZClientBase.UserManagerService.UserManagerServiceClient()) { List <UserRightInfo> _rightList = _umsc.GetRightListByPostID(CurrentPost.PostID).ToList <UserRightInfo>(); UserRightFinder _finder = new UserRightFinder("-1"); List <UserRightInfo> _TopRightList = _rightList.FindAll(new Predicate <UserRightInfo>(_finder.FindByFatherID)); _TopRightList.Sort(new UserRightInfoComparer()); TObj_RightItemList RightList = new TObj_RightItemList(); foreach (UserRightInfo _ri in _TopRightList) { TObj_RightItem _ritem = new TObj_RightItem(_ri); RightList.Add(_ritem); AddChildrenRightItem(_ritem, _rightList); } this.treeList2.BeginUpdate(); this.treeList2.DataSource = RightList; this.treeList2.ExpandAll(); this.treeList2.EndUpdate(); } } }