public ActionResult SalaryPaymentView() { ISalaryGrantBLL bLL = new SalaryGrantBLL(); IOrgBLL orgBLL = new OrgBLL(); List <SalaryPayment> list = bLL.GetAllSalaryPaymentFromDB(); List <Models.SalaryPayment> salaryPaymentList = new List <Models.SalaryPayment>(); if (list != null) { foreach (var sp in list) { Models.SalaryPayment salaryPayment = new Models.SalaryPayment { Id = sp.Id, FileNumber = sp.FileNumber, TotalPerson = sp.TotalPerson, TotalAmout = sp.TotalAmout, RegistTime = sp.RegistTime, FileState = sp.FileState }; ThirdOrg thirdOrg = orgBLL.GetThirdOrgById(sp.TOrgId); SecondOrg secondOrg = orgBLL.GetSecondOrgById(thirdOrg.ParentOrgId); FirstOrg firstOrg = orgBLL.GetFirstOrgById(secondOrg.ParentOrgId); Models.FirstOrg firstOrgView = new Models.FirstOrg { Id = firstOrg.Id, OrgLevel = firstOrg.OrgLevel, OrgName = firstOrg.OrgName }; Models.SecondeOrg secondeOrgView = new Models.SecondeOrg { Id = secondOrg.Id, OrgName = secondOrg.OrgName, OrgLevel = secondOrg.OrgLevel, ParentOrg = firstOrgView }; Models.ThirdOrg thirdOrgView = new Models.ThirdOrg { Id = thirdOrg.Id, ParentOrg = secondeOrgView, OrgLevel = thirdOrg.OrgLevel, OrgName = thirdOrg.OrgName }; salaryPayment.ThirdOrg = thirdOrgView; salaryPaymentList.Add(salaryPayment); } } ViewData["salaryPaymentList"] = salaryPaymentList; return(View()); }
public ActionResult DynamicThirdOrg(string id) { IOrgBLL bLL = new OrgBLL(); List <Models.ThirdOrg> list = new List <Models.ThirdOrg>(); List <ThirdOrg> tempList = bLL.GetThirdOrgBySecondOrgId(Convert.ToInt32(id)); if (tempList != null) { foreach (var to in tempList) { Models.ThirdOrg thirdOrg = new Models.ThirdOrg { Id = to.Id, OrgName = to.OrgName, OrgLevel = to.OrgLevel }; list.Add(thirdOrg); } } return(Json(list)); }
public ActionResult PaymentSearch(FormCollection formCollection) { ISalaryGrantBLL salaryGrantBLL = new SalaryGrantBLL(); IOrgBLL orgBLL = new OrgBLL(); List <SalaryPayment> list = salaryGrantBLL.GetAllSalaryPaymentFromDB(); if (formCollection["State"] != "10") { var l = from p in list where p.FileState == (EnumState.SalaryPaymentStateEnum)Convert.ToInt32(formCollection["State"]) select p; list = l.ToList(); } if (formCollection["BeginDate"] != "") { var l = from p in list where p.CheckTime.Date >= Convert.ToDateTime(formCollection["BeginDate"]) select p; list = l.ToList(); if (formCollection["EndDate"] != "") { var l2 = from p in list where p.CheckTime.Date <= Convert.ToDateTime(formCollection["EndDate"]) select p; list = l2.ToList(); } } else { if (formCollection["EndDate"] != "") { var l = from p in list where p.CheckTime.Date <= Convert.ToDateTime(formCollection["EndDate"]) select p; list = l.ToList(); } } List <Models.SalaryPayment> salaryPaymentList = new List <Models.SalaryPayment>(); if (list != null) { foreach (var sp in list) { Models.SalaryPayment salaryPayment = new Models.SalaryPayment { Id = sp.Id, FileNumber = sp.FileNumber, TotalPerson = sp.TotalPerson, TotalAmout = sp.TotalAmout, RegistTime = sp.RegistTime, FileState = sp.FileState }; ThirdOrg thirdOrg = orgBLL.GetThirdOrgById(sp.TOrgId); SecondOrg secondOrg = orgBLL.GetSecondOrgById(thirdOrg.ParentOrgId); FirstOrg firstOrg = orgBLL.GetFirstOrgById(secondOrg.ParentOrgId); Models.FirstOrg firstOrgView = new Models.FirstOrg { Id = firstOrg.Id, OrgLevel = firstOrg.OrgLevel, OrgName = firstOrg.OrgName }; Models.SecondeOrg secondeOrgView = new Models.SecondeOrg { Id = secondOrg.Id, OrgName = secondOrg.OrgName, OrgLevel = secondOrg.OrgLevel, ParentOrg = firstOrgView }; Models.ThirdOrg thirdOrgView = new Models.ThirdOrg { Id = thirdOrg.Id, ParentOrg = secondeOrgView, OrgLevel = thirdOrg.OrgLevel, OrgName = thirdOrg.OrgName }; salaryPayment.ThirdOrg = thirdOrgView; salaryPaymentList.Add(salaryPayment); } } ViewData["salaryPaymentList"] = salaryPaymentList; return(View("SalaryPaymentView")); }
public ActionResult EditThirdOrg(string id) { IOrgBLL bLL = new OrgBLL(); ThirdOrg thirdOrg = bLL.GetThirdOrgById(Convert.ToInt32(id)); Models.ThirdOrg thirdOrgView = new Models.ThirdOrg { Id = thirdOrg.Id, OrgName = thirdOrg.OrgName, OrgLevel = thirdOrg.OrgLevel }; //找出3级机构的所属2级机构 SecondOrg secondOrg = bLL.GetSecondOrgById(thirdOrg.ParentOrgId); Models.SecondeOrg secondOrgView = new Models.SecondeOrg { Id = secondOrg.Id, OrgName = secondOrg.OrgName, OrgLevel = secondOrg.OrgLevel }; thirdOrgView.ParentOrg = secondOrgView; //找出3级机构的所属2级机构的所属1级机构 FirstOrg firstOrg = bLL.GetFirstOrgById(secondOrg.ParentOrgId); secondOrgView.ParentOrg = new Models.FirstOrg { Id = firstOrg.Id, OrgName = firstOrg.OrgName, OrgLevel = firstOrg.OrgLevel }; ViewData["thirdOrgView"] = thirdOrgView; //装载所有2级机构,用于下拉框 List <Models.SecondeOrg> secondOrgList = new List <Models.SecondeOrg>(); foreach (var so in bLL.GetAllSecondOrg()) { Models.SecondeOrg tempSecondOrg = new Models.SecondeOrg { Id = so.Id, OrgName = so.OrgName, OrgLevel = so.OrgLevel }; FirstOrg tempFirstOrg = bLL.GetFirstOrgById(so.ParentOrgId); tempSecondOrg.ParentOrg = new Models.FirstOrg { Id = tempFirstOrg.Id, OrgName = tempFirstOrg.OrgName, OrgLevel = tempFirstOrg.OrgLevel }; secondOrgList.Add(tempSecondOrg); } ViewData["secondOrgList"] = secondOrgList; //装载所有1级机构,用于所属机构选择下拉框 List <Models.FirstOrg> firstOrgList = new List <Models.FirstOrg>(); foreach (var fo in bLL.GetAllFirstOrg()) { Models.FirstOrg tempFirstOrg = new Models.FirstOrg { Id = fo.Id, OrgName = fo.OrgName, OrgLevel = fo.OrgLevel }; firstOrgList.Add(tempFirstOrg); } ViewData["firstOrgList"] = firstOrgList; return(View()); }
/// <summary> /// 处理机构管理请求 /// </summary> /// <returns>返回视图,包含所有机构的信息</returns> public ActionResult OrgSettings() { IOrgBLL bLL = new OrgBLL(); //装载所有1级机构 List <Models.FirstOrg> firstOrgList = new List <Models.FirstOrg>(); foreach (var fo in bLL.GetAllFirstOrg()) { Models.FirstOrg firstOrg = new Models.FirstOrg { Id = fo.Id, OrgName = fo.OrgName, OrgLevel = fo.OrgLevel }; firstOrgList.Add(firstOrg); } ViewData["firstOrgList"] = firstOrgList; //装载所有2级机构 List <Models.SecondeOrg> secondOrgList = new List <Models.SecondeOrg>(); foreach (var so in bLL.GetAllSecondOrg()) { Models.SecondeOrg secondeOrg = new Models.SecondeOrg { Id = so.Id, OrgName = so.OrgName, OrgLevel = so.OrgLevel, }; FirstOrg tempFirstOrg = bLL.GetFirstOrgById(so.ParentOrgId); secondeOrg.ParentOrg = new Models.FirstOrg { Id = tempFirstOrg.Id, OrgName = tempFirstOrg.OrgName, OrgLevel = tempFirstOrg.OrgLevel }; secondOrgList.Add(secondeOrg); } ViewData["secondOrgList"] = secondOrgList; //装载所有3级机构 List <Models.ThirdOrg> thirdOrgList = new List <Models.ThirdOrg>(); foreach (var to in bLL.GetAllThirdOrg()) { Models.ThirdOrg thirdOrg = new Models.ThirdOrg { Id = to.Id, OrgName = to.OrgName, OrgLevel = to.OrgLevel, }; SecondOrg tempSecondeOrg = bLL.GetSecondOrgById(to.ParentOrgId); FirstOrg tempFirstOrg = bLL.GetFirstOrgById(tempSecondeOrg.ParentOrgId); thirdOrg.ParentOrg = new Models.SecondeOrg { Id = tempSecondeOrg.Id, OrgName = tempSecondeOrg.OrgName, OrgLevel = tempSecondeOrg.OrgLevel, ParentOrg = new Models.FirstOrg { Id = tempFirstOrg.Id, OrgLevel = tempFirstOrg.OrgLevel, OrgName = tempFirstOrg.OrgName } }; thirdOrgList.Add(thirdOrg); } ViewData["thirdOrgList"] = thirdOrgList; return(View()); }
/// <summary> /// 根据条件查询档案 /// </summary> /// <param name="formCollection">查询条件</param> /// <returns>返回符合条件的员工档案列表视图</returns> public ActionResult StaffSearch(FormCollection formCollection) { IStaffBLL staffBLL = new StaffBLL(); IOrgBLL orgBLL = new OrgBLL(); IOccupationBLL occupationBLL = new OccupationBLL(); List <Staff> list = new List <Staff>(); List <Staff> tempList = new List <Staff>(); if (formCollection["ThirdOrgId"] != "0") { list = staffBLL.GetAllStaffByTOrgId(Convert.ToInt32(formCollection["ThirdOrgId"])); tempList = list; if (formCollection["BeginDate"] != "") { var l = from s in list where s.RegistTime > Convert.ToDateTime(formCollection["BeginDate"]) select s; tempList = l.ToList(); if (formCollection["EndDate"] != "") { var l2 = from s in tempList where s.RegistTime < Convert.ToDateTime(formCollection["EndDate"]) select s; tempList = l2.ToList(); } } else { if (formCollection["EndDate"] != "") { var l2 = from s in list where s.RegistTime < Convert.ToDateTime(formCollection["EndDate"]) select s; tempList = l2.ToList(); } } list = tempList; } else { if (formCollection["SecondOrgId"] != "0") { list = staffBLL.GetAllStaffBySOrgId(Convert.ToInt32(formCollection["SecondOrgId"])); tempList = list; if (formCollection["BeginDate"] != "") { var l = from s in list where s.RegistTime > Convert.ToDateTime(formCollection["BeginDate"]) select s; tempList = l.ToList(); if (formCollection["EndDate"] != "") { var l2 = from s in tempList where s.RegistTime < Convert.ToDateTime(formCollection["EndDate"]) select s; tempList = l2.ToList(); } } else { if (formCollection["EndDate"] != "") { var l2 = from s in list where s.RegistTime < Convert.ToDateTime(formCollection["EndDate"]) select s; tempList = l2.ToList(); } } list = tempList; } else { if (formCollection["FirstOrgId"] != "0") { list = staffBLL.GetAllStaffByFOrgId(Convert.ToInt32(formCollection["FirstOrgId"])); tempList = list; if (formCollection["BeginDate"] != "") { var l = from s in list where s.RegistTime > Convert.ToDateTime(formCollection["BeginDate"]) select s; tempList = l.ToList(); if (formCollection["EndDate"] != "") { var l2 = from s in tempList where s.RegistTime < Convert.ToDateTime(formCollection["EndDate"]) select s; tempList = l2.ToList(); } } else { if (formCollection["EndDate"] != "") { var l2 = from s in list where s.RegistTime < Convert.ToDateTime(formCollection["EndDate"]) select s; tempList = l2.ToList(); } } list = tempList; } else { list = staffBLL.GetAllStaffNormal(); tempList = list; if (formCollection["BeginDate"] != "") { var l = from s in list where s.RegistTime > Convert.ToDateTime(formCollection["BeginDate"]) select s; tempList = l.ToList(); if (formCollection["EndDate"] != "") { var l2 = from s in tempList where s.RegistTime < Convert.ToDateTime(formCollection["EndDate"]) select s; tempList = l2.ToList(); } } else { if (formCollection["EndDate"] != "") { var l2 = from s in list where s.RegistTime < Convert.ToDateTime(formCollection["EndDate"]) select s; tempList = l2.ToList(); } } list = tempList; } } } if (formCollection["OccNameId"] != "0") { int occNameId = Convert.ToInt32(formCollection["OccNameId"]); var l = from s in list where s.OccId == occNameId select s; list = l.ToList(); } else { if (formCollection["OccClassId"] != "0") { int occClassId = Convert.ToInt32(formCollection["OccClassId"]); List <OccupationName> occNameList = occupationBLL.GetAllOccNameByClassId(occClassId); List <int> ints = new List <int>(); foreach (var oc in occNameList) { ints.Add(oc.Id); } var l = from s in list where ints.Contains(s.OccId) select s; list = l.ToList(); } } List <Models.Staff> staffListView = new List <Models.Staff>(); if (list != null) { foreach (var staff in list) { Models.Staff tempStaff = new Models.Staff { Id = staff.Id, StaffFileNumber = staff.StaffFileNumber, StaffName = staff.StaffName, FileState = staff.FileState, IsDel = staff.IsDel }; ThirdOrg thirdOrg = orgBLL.GetThirdOrgById(staff.ThirdOrgId); SecondOrg secondOrg = orgBLL.GetSecondOrgById(thirdOrg.ParentOrgId); FirstOrg firstOrg = orgBLL.GetFirstOrgById(secondOrg.ParentOrgId); tempStaff.FirstOrg = new Models.FirstOrg { Id = firstOrg.Id, OrgLevel = firstOrg.OrgLevel, OrgName = firstOrg.OrgName }; tempStaff.SecondeOrg = new Models.SecondeOrg { Id = secondOrg.Id, OrgName = secondOrg.OrgName, OrgLevel = secondOrg.OrgLevel, ParentOrg = tempStaff.FirstOrg }; tempStaff.ThirdOrg = new Models.ThirdOrg { Id = thirdOrg.Id, ParentOrg = tempStaff.SecondeOrg, OrgLevel = thirdOrg.OrgLevel, OrgName = thirdOrg.OrgName }; OccupationName occupationName = occupationBLL.GetOccupationNameById(staff.OccId); tempStaff.OccupationName = new Models.OccupationName { Id = occupationName.Id, Name = occupationName.Name }; staffListView.Add(tempStaff); } } ViewData["staffListView"] = staffListView; //装载1级机构 List <FirstOrg> fList = orgBLL.GetAllFirstOrg(); List <Models.FirstOrg> firstOrgList = new List <Models.FirstOrg>(); foreach (var fo in fList) { Models.FirstOrg tempFo = new Models.FirstOrg { Id = fo.Id, OrgName = fo.OrgName, OrgLevel = fo.OrgLevel }; firstOrgList.Add(tempFo); } ViewData["firstOrgList"] = firstOrgList; if (formCollection["FirstOrgId"] != "0") { //装载2级机构 List <SecondOrg> sList = orgBLL.GetSecondOrgByFirstOrgId(Convert.ToInt32(formCollection["FirstOrgId"])); List <Models.SecondeOrg> secondOrgList = new List <Models.SecondeOrg>(); foreach (var so in sList) { Models.SecondeOrg tempSo = new Models.SecondeOrg { Id = so.Id, OrgName = so.OrgName }; secondOrgList.Add(tempSo); } ViewData["secondOrgList"] = secondOrgList; } if (formCollection["SecondOrgId"] != "0") { //装载3级机构 List <ThirdOrg> tList = orgBLL.GetThirdOrgBySecondOrgId(Convert.ToInt32(formCollection["SecondOrgId"])); List <Models.ThirdOrg> thirdOrgList = new List <Models.ThirdOrg>(); foreach (var to in tList) { Models.ThirdOrg tempTo = new Models.ThirdOrg { Id = to.Id, OrgName = to.OrgName }; thirdOrgList.Add(tempTo); } ViewData["thirdOrgList"] = thirdOrgList; } //装载职位类型 List <OccupationClass> ocList = occupationBLL.GetAllOccupationClass(); List <Models.OccupationClass> occClassList = new List <Models.OccupationClass>(); foreach (var oc in ocList) { Models.OccupationClass tempClass = new Models.OccupationClass { Id = oc.Id, Name = oc.Name }; occClassList.Add(tempClass); } ViewData["occClassList"] = occClassList; if (formCollection["OccClassId"] != "0") { //装载职位 List <OccupationName> onList = occupationBLL.GetAllOccNameByClassId(Convert.ToInt32(formCollection["OccClassId"])); List <Models.OccupationName> occNameList2 = new List <Models.OccupationName>(); foreach (var on in onList) { Models.OccupationName tempName = new Models.OccupationName { Id = on.Id, Name = on.Name }; occNameList2.Add(tempName); } ViewData["occNameList"] = occNameList2; } return(View("StaffView")); }