private List <NodeObject> GetTree(SysRegister[] Ent, string ParentID) { List <NodeObject> list = new List <NodeObject>(); SysRegister[] TempEnt = Ent.Where(ten => ten.ParentID == ParentID).ToArray(); //递归调用 foreach (var item in TempEnt) { NodeObject tree = new NodeObject(); tree.ID = item.ID; tree.ParentID = item.ParentID; tree.Name = item.Name; tree.RegisterKey = item.RegisterKey; tree.RegisterValue = item.RegisterValue; tree.Path = item.Path; tree.Remark = item.Remark; tree.CreateTime = item.CreateTime; var hasLeaf = Ent.Any(ten => ten.ParentID == item.ID); if (hasLeaf) { tree.leaf = false; tree.children = GetTree(Ent, item.ID); list.Add(tree); } else { tree.leaf = true; tree.children = null; list.Add(tree); } } return(list); }
private List <NodeObject> GetOrgTree(SysGroupOrRole[] Ent, string ParentID) { List <NodeObject> list = new List <NodeObject>(); var TempEnt = Ent.Where(ten => ten.ParentID == ParentID).ToArray(); foreach (var item in TempEnt) { NodeObject tree = new NodeObject(); //自定义属性 tree.id = item.ID; tree.text = item.GroupName; tree.ID = item.ID; if (ParentID == "root") //展开Root下节点 { tree.expanded = true; } var havaChild = Ent.Any(ten => ten.ParentID == item.ID); if (havaChild) { tree.leaf = false; tree.children = GetOrgTree(Ent, item.ID); list.Add(tree); } else { tree.leaf = true; tree.children = null; list.Add(tree); } } return(list); }
private List <NodeObject> GetModelTree(DataModel.SysModule[] Ent, List <string> CheckedIds, string ParentID) { List <NodeObject> list = new List <NodeObject>(); DataModel.SysModule[] TempEnt = Ent.Where(ten => ten.ParentID == ParentID).ToArray(); //递归调用 foreach (var item in TempEnt) { NodeObject tree = new NodeObject(); if (item.Type.HasValue && item.Type == 0) { tree.icon = "../icons/house-png/ext.axd"; } //展开指定节点 if (item.Path.Contains("root")) { tree.expanded = true; } tree.ID = item.ID; tree.ParentID = item.ParentID; tree.SortIndex = item.SortIndex; tree.Type = item.Type.GetValueOrDefault() + ""; tree.Name = item.Name; tree.Code = item.Code; if (CheckedIds.Count > 0) { bool Checked = CheckedIds.Any(ten => ten == item.ID); if (Checked) { tree.check = true; } } else { tree.check = false; } var hasLeaf = Ent.Any(ten => ten.ParentID == item.ID); if (hasLeaf) { tree.leaf = false; tree.children = GetModelTree(Ent, CheckedIds, item.ID); list.Add(tree); } else { tree.leaf = true; tree.children = null; list.Add(tree); } } return(list); }
private List <NodeObject> GetOrgTree(SysOrganization[] Ent, List <string> CheckedIds, string ParentID) { List <NodeObject> list = new List <NodeObject>(); SysOrganization[] TempEnt = Ent.Where(ten => ten.ParentID == ParentID).ToArray(); //递归调用 foreach (var item in TempEnt) { NodeObject tree = new NodeObject(); if (!string.IsNullOrEmpty(item.OrgType) && item.OrgType == "position") //职务 { tree.icon = "../icons/user-png/ext.axd"; } //自定义属性 tree.id = item.ID; tree.text = item.Name; tree.expanded = true; if (CheckedIds.Count > 0) { bool Checked = CheckedIds.Any(ten => ten == item.ID); if (Checked) { tree.check = true; } } else { tree.check = false; } if (ParentID == "root") //展开Root下节点 { tree.expanded = true; } var havaChild = Ent.Any(ten => ten.ParentID == item.ID); if (havaChild) { tree.leaf = false; tree.children = GetOrgTree(Ent, CheckedIds, item.ID); list.Add(tree); } else { tree.leaf = true; tree.children = null; list.Add(tree); } } return(list); }
private List <NodeObject> GetTree(SysOrganization[] Ent, string ParentID) { List <NodeObject> list = new List <NodeObject>(); SysOrganization[] TempEnt = Ent.Where(ten => ten.ParentID == ParentID).ToArray(); //递归调用 foreach (var item in TempEnt) { NodeObject tree = new NodeObject(); if (!string.IsNullOrEmpty(item.OrgType) && item.OrgType == "position") //职务 { tree.icon = "../icons/user-png/ext.axd"; } //自定义属性 tree.id = item.ID; tree.text = item.Name; tree.ID = item.ID; tree.ParentID = item.ParentID; tree.Code = item.Code; tree.Name = item.Name; tree.Path = item.Path; tree.OrgType = item.OrgType; tree.State = item.State; tree.SortIndex = item.SortIndex; tree.CreateTime = item.CreateTime; tree.expanded = false; if (ParentID == "root") //展开Root下节点 { tree.expanded = true; } var havaChild = Ent.Any(ten => ten.ParentID == item.ID); if (havaChild) { tree.leaf = false; tree.children = GetTree(Ent, item.ID); list.Add(tree); } else { tree.leaf = true; tree.children = null; list.Add(tree); } } return(list); }
private List <NodeObject> GetTree(SysGroupOrRole[] Ent, string ParentID) { List <NodeObject> list = new List <NodeObject>(); SysGroupOrRole[] TempEnt = Ent.Where(ten => ten.ParentID == ParentID).ToArray(); //递归调用 foreach (var item in TempEnt) { NodeObject tree = new NodeObject(); //自定义属性 tree.id = item.ID; tree.text = item.GroupName; tree.ID = item.ID; tree.ParentID = item.ParentID; tree.GroupName = item.GroupName; tree.GroupCode = item.GroupCode; tree.Path = item.Path; tree.Type = item.Type; tree.Remark = item.Remark; tree.State = item.State; tree.SortIndex = item.SortIndex; tree.CreateTime = item.CreateTime; tree.expanded = false; if (ParentID == "root") //展开Root下节点 { tree.expanded = true; } var havaChild = Ent.Any(ten => ten.ParentID == item.ID); if (havaChild) { tree.leaf = false; tree.children = GetTree(Ent, item.ID); list.Add(tree); } else { tree.leaf = true; tree.children = null; list.Add(tree); } } return(list); }
private List <NodeObject> GetTree(DataModel.SysModule[] Ent, string ParentID) { List <NodeObject> list = new List <NodeObject>(); DataModel.SysModule[] TempEnt = Ent.Where(ten => ten.ParentID == ParentID).ToArray(); //递归调用 foreach (var item in TempEnt) { NodeObject tree = new NodeObject(); if (item.Type.HasValue && item.Type == 0) { tree.icon = "../icons/house-png/ext.axd"; } tree.ID = item.ID; tree.ParentID = item.ParentID; tree.SortIndex = item.SortIndex; tree.Status = item.Status; tree.Url = item.Url; tree.Name = item.Name; tree.LastModifiedDate = item.LastModifiedDate; tree.Code = item.Code; tree.CreateDate = item.CreateDate; tree.Description = item.Description; tree.Type = item.Type; var hasLeaf = Ent.Any(ten => ten.ParentID == item.ID); if (hasLeaf) { tree.leaf = false; tree.children = GetTree(Ent, item.ID); list.Add(tree); } else { tree.leaf = true; tree.children = null; list.Add(tree); } } return(list); }
private List <NodeObject> GetTree(DataModel.SysModule[] Ent, string ParentID) { List <NodeObject> list = new List <NodeObject>(); DataModel.SysModule[] TempEnt = Ent.Where(ten => ten.ParentID == ParentID).ToArray(); //递归调用 foreach (var item in TempEnt) { NodeObject tree = new NodeObject(); tree.ParentID = item.ParentID; tree.SortIndex = item.SortIndex; tree.Status = item.Status; tree.Url = item.Url; tree.Name = item.Name; tree.LastModifiedDate = item.LastModifiedDate; tree.Code = item.Code; tree.CreateDate = item.CreateDate; tree.Description = item.Description; tree.Type = item.Type; var TempRecd = Ent.Where(ten => ten.ParentID == item.ID).ToArray(); if (TempRecd.Count() > 0) { tree.leaf = false; tree.children = GetTree(Ent, item.ID); list.Add(tree); } else { tree.leaf = true; tree.children = null; list.Add(tree); } } return(list); }
private List <NodeObject> GetTree(DataModel.SysDict[] Ent, string ParentID) { List <NodeObject> list = new List <NodeObject>(); DataModel.SysDict[] TempEnt = Ent.Where(ten => ten.ParentID == ParentID).ToArray(); //递归调用 foreach (var item in TempEnt) { NodeObject tree = new NodeObject(); tree.ID = item.ID; tree.ParentID = item.ParentID; tree.SortIndex = item.SortIndex; tree.Name = item.Name; tree.Value = item.Value; tree.Code = item.Code; tree.Path = item.Path; tree.Remarks = item.Remarks; tree.CreateDate = item.CreateDate; var hasLeaf = Ent.Any(ten => ten.ParentID == item.ID); if (hasLeaf) { tree.leaf = false; tree.children = GetTree(Ent, item.ID); list.Add(tree); } else { tree.leaf = true; tree.children = null; list.Add(tree); } } return(list); }