private object GetOrganizeList() { OrganizeApp organizeApp = new OrganizeApp(); var data = organizeApp.GetList(); Dictionary <string, object> dictionary = new Dictionary <string, object>(); foreach (OrganizeEntity item in data) { var fieldItem = new { encode = item.F_EnCode, fullname = item.F_FullName }; dictionary.Add(item.F_Id, fieldItem); } return(dictionary); }
private object GetOrganizeList() { OrganizeApp organizeApp = new OrganizeApp(); var data = organizeApp.GetList(); Dictionary <string, object> dictionary = new Dictionary <string, object>(); foreach (Sys_Organize item in data) { var fieldItem = new { encode = item.F_EnCode, fullname = item.F_FullName }; dictionary.Add(item.F_Id, fieldItem); } Common.BIBasicList["organize"] = dictionary; return(dictionary); }
//获取维修商 private object GetMaintainList() { List <MaintainEntity> datalist = new List <MaintainEntity>(); MaintainApp maintainApp = new MaintainApp(); OrganizeApp organizeApp = new OrganizeApp(); var maintainlist = maintainApp.GetList(); List <OrganizeEntity> orgList = new List <OrganizeEntity>(); if (OperatorProvider.Provider.GetCurrent().IsSystem) { orgList = organizeApp.GetList(); } else { orgList = organizeApp.GetSelectEntitys(OperatorProvider.Provider.GetCurrent().CompanyId, ""); } datalist = (from c in maintainlist join o in orgList on c.FOrganizeId equals o.FId select c).ToList(); Dictionary <string, object> dictionary = new Dictionary <string, object>(); foreach (MaintainEntity item in datalist) { var fieldItem = new { FId = item.FId, FShortName = item.FShortName, FNumber = item.FNumber, FFullName = item.FFullName, FLinkMan = item.FLinkMan }; dictionary.Add(item.FId, fieldItem); } return(dictionary); }
public ActionResult GetTreeJson(string organize_id) { var treeList = new List <TreeViewModel>(); //获取所有分公司和部门信息 var data = organizeApp.GetList(); //分公司 OrganizeEntity company = organizeApp.GetOrgById(organize_id); TreeViewModel tree = new TreeViewModel(); List <OrganizeEntity> departmentList = data.FindAll(t => t.F_ParentId == company.F_Id); bool hasChildren = departmentList.Count == 0 ? false : true; tree.id = company.F_Id; tree.text = company.F_FullName; tree.value = company.F_EnCode; tree.parentId = company.F_ParentId; tree.isexpand = true; tree.complete = true; tree.hasChildren = hasChildren; tree.nodeDepth = 1; treeList.Add(tree); //部门 if (hasChildren) { for (int i = 0; i < departmentList.Count; i++) { OrganizeEntity department = departmentList[i]; TreeViewModel departmentTree = new TreeViewModel(); var roleData = roleApp.GetDutyList(); List <RoleEntity> dutyList = roleData.FindAll(t => t.F_OrganizeId == department.F_Id && t.F_Category == 2); hasChildren = dutyList.Count == 0 ? false : true; departmentTree.id = department.F_Id; departmentTree.text = department.F_FullName; departmentTree.value = department.F_EnCode; departmentTree.parentId = company.F_Id; departmentTree.isexpand = true; departmentTree.complete = true; departmentTree.hasChildren = hasChildren; departmentTree.nodeDepth = 2; treeList.Add(departmentTree); //岗位 if (hasChildren) { for (int j = 0; j < dutyList.Count; j++) { RoleEntity duty = dutyList[j]; TreeViewModel dutyTree = new TreeViewModel(); var userData = userApp.GetList(); List <UserEntity> userList = userData.FindAll(t => t.F_DutyId == duty.F_Id && t.F_OrganizeId == company.F_Id && t.F_DepartmentId == department.F_Id); hasChildren = userList.Count == 0 ? false : true; dutyTree.id = duty.F_Id; dutyTree.text = duty.F_FullName; dutyTree.value = duty.F_EnCode; dutyTree.parentId = department.F_Id; dutyTree.isexpand = true; dutyTree.complete = true; dutyTree.hasChildren = hasChildren; dutyTree.nodeDepth = 3; treeList.Add(dutyTree); if (hasChildren) { for (int k = 0; k < userList.Count; k++) { UserEntity user = userList[k]; TreeViewModel userTree = new TreeViewModel(); hasChildren = false; userTree.id = user.F_Id; userTree.text = user.F_RealName; userTree.value = user.F_Id; userTree.parentId = duty.F_Id; userTree.isexpand = true; userTree.complete = true; userTree.hasChildren = hasChildren; userTree.nodeDepth = 4; treeList.Add(userTree); } } } } } } return(Content(treeList.TreeViewJson(company.F_ParentId))); }