private List<PortalArticleListTree> selectchildren(Int64 listid, List<PortalArticleList> _list)
 {
     List<PortalArticleListTree> lists = new List<PortalArticleListTree>();
     foreach (PortalArticleList item in _list)
     {
         if (item.FParentListId == listid)
         {
             PortalArticleListTree newitem = new PortalArticleListTree();
             newitem.FListId = item.FListId;
             newitem.FListCode = item.FListCode;
             newitem.FListName = item.FListName;
             newitem.FListOrder = item.FListOrder;
             newitem.FParentListId = item.FParentListId;
             newitem.children = selectchildren(item.FListId, _list);
             lists.Add(newitem);
         }
     }
     return lists;
 }
Exemplo n.º 2
0
 public void GetArticleList()
 {
     List<PortalArticleListTree> lists = new List<PortalArticleListTree>();
     List<PortalArticleList> lists1 = new List<PortalArticleList>();
     PortalArticleListBiz biz = new PortalArticleListBiz();
     lists1 = biz.Select();
     PortalArticleListTreeBiz treebiz = new PortalArticleListTreeBiz();
     lists = treebiz.select(lists1);
     PortalArticleListTree newitem = new PortalArticleListTree();
     newitem.FListId = 0;
     newitem.FListCode = "";
     newitem.FListName = "根目录";
     newitem.FListOrder = 10;
     newitem.FParentListId = 0;
     newitem.children = lists;
     List<PortalArticleListTree> newlists = new List<PortalArticleListTree>();
     newlists.Add(newitem);
     string datasource = treebiz.ConvertToJson(newlists);
     Response.Write(datasource);
 }