Esempio n. 1
0
        /// <summary>
        /// 从某个根节点递归出其下所有子节点
        /// </summary>
        /// <param name="list">所有权限</param>
        /// <param name="curPermission">当前权限</param>
        public void AddPermission(List <RightsParentSearchMiddlecs> list, RightsParentSearchMiddlecs curPermission)
        {
            List <RightsParentSearchMiddlecs> sonPermissions = list.Where(p => p.ParentId == curPermission.Id.ToString()).ToList();

            curPermission.Children = sonPermissions;
            foreach (var p in sonPermissions)
            {
                AddPermission(list, p);
            }
        }
        private void AddPrimission(List <RightsParentSearchMiddlecs> list, RightsParentSearchMiddlecs curPrimission)
        {
            List <RightsParentSearchMiddlecs> primission = list.Where(p => p.ParentId == curPrimission.code.ToString()).ToList();

            curPrimission.Children = primission;
            foreach (var p in primission)
            {
                AddPrimission(list, p);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 从某个根节点递归出其下所有子节点
        /// </summary>
        /// <param name="list">所有权限</param>
        /// <param name="curPermission">当前权限</param>
        public void AddPermission(List <RightsParentSearchMiddlecs> list, RightsParentSearchMiddlecs curPermission)
        {
            List <RightsParentSearchMiddlecs> sonPermissions = list.Where(p => p.ParentId == curPermission.Id.ToString()).ToList();

            if (sonPermissions.Count != 0)
            {
                sonPermissions         = sonPermissions.OrderBy(x => x.Sort).ToList();//按照sort 字段排序
                curPermission.Children = sonPermissions;
            }
            foreach (var p in sonPermissions)
            {
                AddPermission(list, p);
            }
        }