public static String OrganizationList() { OrganizationListViewData view = new OrganizationListViewData(); view.List = new List <Organization>(); List <TreeNode> list; view.PageData = new PaginationData(); view.PageData.PageIndex = 1; view.PageData.PageSize = 10; view.PageData.PagintionJsFunction = "window.System.OrganizationList.search()"; view.PageData.OrderBy = "Code"; string sql = @"SELECT Name AS Text, CAST(UnitGuid AS NVARCHAR(36)) AS ID, CAST(ParentGuid AS NVARCHAR(36)) AS ParentID, '<i class=''ace-icon ' + Icon + '''></i>' AS Icon FROM dbo.Organization ORDER BY Code"; using (DbConnectionScope dcs = new DbConnectionScope()) { list = DbHelper.Db(sql).ToList <TreeNode>(); view.treeList = TreeNodeList.ToTreeNodeJson(list); } view.treeTitle = "组织架构"; TreeNode tr = list.FirstOrDefault(); if (tr == null) { tr = new TreeNode(); } sql = @"SELECT A.*, B.Name AS ParentName FROM dbo.Organization AS A LEFT JOIN dbo.Organization AS B ON A.ParentGuid = B.UnitGuid WHERE A.ParentGuid = @ParentGuid"; view.List = new Pagintion(sql, new { ParentGuid = tr.ID }, view.PageData).ToList <Organization>(); return(PageViewHelper.LoadPage("/System/OrganizationList.aspx", view)); }
public String SystemTree() { TreeViewData view = new TreeViewData(); view.Title = "系统"; string sql = @"SELECT Name AS Text, CAST(SystemGuid AS NVARCHAR(36)) AS ID, CAST(NULL AS NVARCHAR(36)) AS ParentID, '<i class=''ace-icon ''></i>' AS Icon FROM dbo.SystemInfo ORDER BY Code"; view.List = "[]"; using (DbConnectionScope dcs = new DbConnectionScope()) { view.List = TreeNodeList.ToTreeNodeJson(DbHelper.Db(sql).ToList <TreeNode>()); } return(PageViewHelper.LoadPage("/System/CommonPage/SingleSelectedTree.aspx", view)); }
public String DepartmentTree() { TreeViewData view = new TreeViewData(); view.Title = "部门"; string sql = @"SELECT Name AS Text, CAST(UnitGuid AS NVARCHAR(36)) AS ID, CAST(ParentGuid AS NVARCHAR(36)) AS ParentID, '<i class=''ace-icon ' + Icon + '''></i>' AS Icon FROM dbo.Organization --WHERE ParentGuid IS NOT NULL ORDER BY Code"; view.List = "[]"; using (DbConnectionScope dcs = new DbConnectionScope()) { view.List = TreeNodeList.ToTreeNodeJson(DbHelper.Db(sql).ToList <TreeNode>()); } return(PageViewHelper.LoadPage("/System/CommonPage/SingleSelectedTree.aspx", view)); }