public List <DeptInfo> GetDepartmentListByUser(UserInfo LoginUser, string DeptId) { List <DeptInfoView> DepList = new List <DeptInfoView>(); List <DeptInfo> DepListAll = new List <DeptInfo>(); List <DeptInfo> TreeLists = new List <DeptInfo>(); List <DeptInfoView> TreeListAll = new List <DeptInfoView>(); if (LoginUser.UserDeptcode != null) { DeptInfo di = _iDeptInfoDao.GetDeptInfoById(LoginUser.EnterId); DeptInfoView d = new DeptInfoView(); d.Isdel = "0"; d.Businessdivisioncode = di.Businessdivisioncode; DepList = (List <DeptInfoView>)GetDeptInfoViewPage(d); if (DepList != null) { foreach (DeptInfoView div in DepList) { DeptInfo DepObj = new DeptInfo(); DepObj.Businessdivisionid = div.Businessdivisionid; DepObj.Businessdivisionname = div.Businessdivisionname; DepObj.Businessdivisioncode = div.Businessdivisioncode; DepObj.Fatherid = div.Fatherid; DeptInfo fa = new DeptInfo(); fa.Businessdivisionid = div.Fatherid; fa.Businessdivisionname = div.Fbusinessdivisionname; fa.Businessdivisioncode = div.Fbusinessdivisioncode; DepObj.FatherDepartmentObj = fa; DepListAll.Add(DepObj); } TreeLists = DepListAll.FindAll(x => x.Businessdivisioncode == di.Businessdivisioncode); foreach (DeptInfo deptInfo in TreeLists) { deptInfo.ListDepartmentSub = CreateDepartment(deptInfo, DepListAll); } } return(TreeLists); } else { if (DeptId != null) { DeptInfo di = _iDeptInfoDao.GetDeptInfoById(DeptId); TreeLists.Add(di); return(TreeLists); } else { return(null); } } }
public DeptInfo GetDeptInfo(string DeptId) { return(_iDeptInfoDao.GetDeptInfoById(DeptId)); }