Beispiel #1
0
        public IList<TreeNode> BuidTree(IList<TreeNode> treeList, IList<Resource> list, IList<Resource> listall)
        {
            foreach (var li in list)
            {

                var count = listall.Count(r => r.F_ResourceID.Equals(li.ResourceID));
                if (count == 0)
                {
                    TreeFile treeFile = new TreeFile();
                    treeFile.text = li.ResourcName;
                    treeFile.id = li.ResourceID;
                    treeFile.url = li.URL;
                    treeList.Add(treeFile);
                }
                else
                {
                    TreeFolder treefolder = new TreeFolder();
                    var TempList = listall.Where(s => s.F_ResourceID.Equals(li.ResourceID));
                    treefolder.id = li.ResourceID;
                    treefolder.url = li.URL;
                    treefolder.text = li.ResourcName;
                    IList<TreeNode> listchild = new List<TreeNode>();
                    treefolder.children = BuidTree(listchild, TempList.ToList(), listall);
                    treeList.Add(treefolder);
                }

            }
            return treeList;
        }
Beispiel #2
0
 public IList<TreeNode> BuidTree(IList<Resource> list, string ReFcode)
 {
     IList<TreeNode> treelist = new List<TreeNode>();
     var Father = list.Where(r => r.F_ResourceID.ToString().Equals(ReFcode));
     foreach (var li in Father)
     {
         TreeFolder treeFolder = new TreeFolder();
         treeFolder.id = li.ResourceID;
         treeFolder.text = li.ResourcName;
         treeFolder.url = li.URL;
         IList<TreeNode> Templist = new List<TreeNode>();
         var TempBean = list.Where(s => s.F_ResourceID.Equals(li.ResourceID));
         treeFolder.children = this.BuidTree(Templist, TempBean.ToList(), list);
         treelist.Add(treeFolder);
     }
     return treelist;
 }