public IList <EasyuiTree> getDepartmentTree() { using (ISession session = getSession()) { IList <EasyuiTree> resultList = new List <EasyuiTree>(); ICriteria ic = session.CreateCriteria(typeof(School)); IList <School> list = ic.List <School>(); foreach (School s in list) { Hashtable sht = new Hashtable(); sht.Add("type", "学校"); School s_get = session.Get <School>(s.Id); EasyuiTree SchoolNode = new EasyuiTree(s_get.Id, s_get.Name, "open", "icon-school", sht, null); IList <EasyuiTree> FacultyNodeList = new List <EasyuiTree>(); ISet <Faculty> facultyList = s_get.facultyList; foreach (Faculty f in facultyList) { Hashtable fht = new Hashtable(); fht.Add("type", "院系"); Faculty f_get = session.Get <Faculty>(f.Id); EasyuiTree FacultyNode = new EasyuiTree(f_get.Id, f_get.Name, "open", "icon-faculty", fht, null); IList <EasyuiTree> ProfessionNodeList = new List <EasyuiTree>(); ISet <Profession> professionList = f_get.professionList; foreach (Profession p in professionList) { Hashtable pht = new Hashtable(); pht.Add("type", "专业"); Profession p_get = session.Get <Profession>(p.Id); EasyuiTree ProfessionNode = new EasyuiTree(p_get.Id, p_get.Name, "open", "icon-profession", pht, null); IList <EasyuiTree> classGradeNodeList = new List <EasyuiTree>(); ISet <ClassGrade> classGradeList = p_get.classGradeList; foreach (ClassGrade c in classGradeList) { Hashtable cht = new Hashtable(); cht.Add("type", "班级"); ClassGrade c_get = session.Get <ClassGrade>(c.Id); EasyuiTree ClassGradeNode = new EasyuiTree(c_get.Id, c_get.Name, "open", "icon-classgrade", cht, null); classGradeNodeList.Add(ClassGradeNode); } ProfessionNode.children = classGradeNodeList; ProfessionNodeList.Add(ProfessionNode); } FacultyNode.children = ProfessionNodeList; FacultyNodeList.Add(FacultyNode); } SchoolNode.children = FacultyNodeList; resultList.Add(SchoolNode); } return(resultList); } }
private EasyuiTree GetMenusChildsEasyuiTreeData(SysMenus menu, List <SysMenus> source) { var model = new EasyuiTree { id = menu.MenuId.ToString(), text = menu.Title }; var childs = source.Where(s => s.PMenuId == menu.MenuId && s.Status == true); if (childs.Count() > 0) { model.children = new List <EasyuiTree>(); childs.Each(t => { model.children.Add(GetMenusChildsEasyuiTreeData(t, source)); }); } return(model); }
/// <summary> /// 构造菜单下拉树子集数据 /// </summary> /// <param name="menu"></param> /// <param name="source"></param> /// <returns></returns> private EasyuiTree GetOrgChildsEasyuiTreeData(SysDepartmentsModel data, List <SysDepartmentsModel> source) { var model = new EasyuiTree { id = data.DepId.ToString(), text = data.Title }; var childs = source.Where(s => s.PDepId == data.DepId); if (childs.Count() > 0) { model.children = new List <EasyuiTree>(); childs.Each(t => { model.children.Add(GetOrgChildsEasyuiTreeData(t, source)); }); } return(model); }
public ActionResult GetDictionaryTypeTree() { var totalCount = 0; var result = svc.FilterDictionary(new DictionaryType(), out totalCount, null); IList <EasyuiTree> treeList = new List <EasyuiTree>(); EasyuiTree tree = new EasyuiTree() { id = "top_top", text = "数据字典类型" }; treeList.Add(tree); var childs = (from dic in result select new EasyuiTree() { id = dic.Code, text = dic.Name, url = "true" }).ToList(); tree.children = childs; return(Json(treeList)); }