private void GenerateChild(TheTreeNode dict, List <Bse_Components> allData) { dict.childrenenum = (from c in allData where c.Comp_Customer == dict.state select new TheTreeNode { parent = dict.state, state = c.Comp_CCode, data = c.Comp_CCode }).Distinct(o => o.state).ToList(); //if (dict.childrenenum.Count() == 0) //{ // return; //} //foreach (var d in dict.childrenenum) //{ // GenerateChild(d, allData); //} }
private void GenerateTree(TheTreeNode node, List <Bse_Dict> allData) { var list = allData.Where(o => !string.IsNullOrEmpty(o.Dict_PCode) && (o.Dict_PCode.ToUpper() == node.attr.id.ToUpper())); node.children = (from d in list select new TheTreeNode { data = d.Dict_Name, attr = new Attr { id = d.Dict_Code } }).ToList(); if (node.children.Count() == 0) { return; } foreach (var d in node.children) { GenerateTree(d, allData); } }
private void GenerateTree(TheTreeNode node, List <Bse_Department> allData) { var list = allData.Where(o => o.Dept_PCode == node.attr.id); node.children = (from d in list select new TheTreeNode { data = d.Dept_Name, attr = new Attr { id = d.Dept_Code } }).ToList(); if (node.children.Count == 0) { return; } foreach (var d in node.children) { GenerateTree(d, allData); } }