public static List <TreeNode> GetAllPhoneBookOfUser(Guid userGuid) { Business.PhoneBook phoneBookController = new Business.PhoneBook(); try { List <DataRow> lstGroups = phoneBookController.GetPhoneBookUser(userGuid, Guid.Empty, string.Empty, true).AsEnumerable().ToList(); List <DataRow> lstRoots = lstGroups.Where(row => Helper.GetGuid(row["ParentGuid"]) == Guid.Empty).ToList(); var nodes = new List <TreeNode>(); foreach (DataRow row in lstRoots) { var node = new TreeNode(); node.id = string.Format("'{0}'", row["Guid"]); node.state = "open"; node.text = row["Name"].ToString(); node.attributes = new { count = row["CountPhoneNumbers"].ToString(), type = Helper.GetInt(row["Type"], 1) }; node.children = GenerateTree(lstGroups, Helper.GetGuid(row["Guid"])); nodes.Add(node); } return(nodes); } catch { return(new List <TreeNode>()); } }
public static DataTable GetPhoneBookOfUser(Guid userGuid, Guid parentNodeGuid, string name, bool loadAllPhoneBook = false) { Business.PhoneBook phoneBookController = new Business.PhoneBook(); return(phoneBookController.GetPhoneBookUser(userGuid, parentNodeGuid, name, loadAllPhoneBook)); }
public static DataTable GetPhoneBookOfUser(Guid userGuid) { Business.PhoneBook phoneBookController = new Business.PhoneBook(); return(phoneBookController.GetPhoneBookUser(userGuid)); }