예제 #1
0
        private static int ResolveDeptCollection(List<Dept> dbDepts, Dept parentDept, int level)
        {
            int count = 0;
            foreach (var dept in dbDepts.Where(d => d.Parent == parentDept))
            {
                count++;

                _depts.Add(dept);
                dept.TreeLevel = level;
                dept.IsTreeLeaf = true;
                dept.Enabled = true;

                level++;
                // 如果这个节点下没有子节点,则这是个终结节点
                int childCount = ResolveDeptCollection(dbDepts, dept, level);
                if (childCount != 0)
                {
                    dept.IsTreeLeaf = false;
                }
                level--;

            }

            return count;
        }
예제 #2
0
파일: Dept.cs 프로젝트: NewTestTec/ATP
 public object Clone()
 {
     Dept dept = new Dept
     {
         ID = ID,
         Name = Name,
         Remark = Remark,
         SortIndex = SortIndex,
         TreeLevel = TreeLevel,
         Enabled = Enabled,
         IsTreeLeaf = IsTreeLeaf
     };
     return dept;
 }