/// <summary> /// 处理在编辑或添加薪酬标准时发出的添加适用职位请求 /// </summary> /// <param name="formCollection">提交上来的表单容器</param> /// <returns>返回添加职位选项后的视图</returns> public ActionResult StandardAddOccName(FormCollection formCollection) { ViewData["formCollection"] = formCollection; ISalaryItemBLL salaryItemBLL = new SalaryItemBLL(); IOccupationBLL occupationBLL = new OccupationBLL(); //装载所有职位类型 List <OccupationClass> occClassList = occupationBLL.GetAllOccupationClass(); List <Models.OccupationClass> occClassListView = new List <Models.OccupationClass>(); foreach (var oc in occClassList) { Models.OccupationClass tempClass = new Models.OccupationClass { Id = oc.Id, Name = oc.Name }; occClassListView.Add(tempClass); } ViewData["occClassListView"] = occClassListView; //装载所有职位 List <OccupationName> occNameList = occupationBLL.GetAllOccupationName(); List <Models.OccupationName> occNameListView = new List <Models.OccupationName>(); foreach (var on in occNameList) { Models.OccupationName tempName = new Models.OccupationName { Id = on.Id, Name = on.Name }; OccupationClass tempClass = occupationBLL.GetOccupationClassById(on.ClassId); tempName.OccupationClass = new Models.OccupationClass { Id = tempClass.Id, Name = tempClass.Name }; occNameListView.Add(tempName); } ViewData["occNameListView"] = occNameListView; //装载所有薪酬项目 List <SalaryItem> itemList = salaryItemBLL.GetAllSalaryItem(); List <Models.SalaryItem> itemListView = new List <Models.SalaryItem>(); foreach (var item in itemList) { Models.SalaryItem tempItem = new Models.SalaryItem { Id = item.Id, Name = item.Name }; itemListView.Add(tempItem); } ViewData["itemListView"] = itemListView; return(View()); }
public ActionResult EditOccupationClass(string id) { IOccupationBLL bLL = new OccupationBLL(); OccupationClass occupationClass = bLL.GetOccupationClassById(Convert.ToInt32(id)); Models.OccupationClass occupationClassView = new Models.OccupationClass { Id = occupationClass.Id, Name = occupationClass.Name }; ViewData["occupationClassView"] = occupationClassView; return(View()); }
/// <summary> /// 处理职位管理请求 /// </summary> /// <returns>返回视图,包含所有职位信息</returns> public ActionResult OccupationSettings() { IOccupationBLL bLL = new OccupationBLL(); //装载所有职位类型 List <Models.OccupationClass> occupationClassList = new List <Models.OccupationClass>(); foreach (var oc in bLL.GetAllOccupationClass()) { Models.OccupationClass occupationClass = new Models.OccupationClass { Id = oc.Id, Name = oc.Name }; occupationClassList.Add(occupationClass); } ViewData["occupationClassList"] = occupationClassList; //装载所有职位名称 List <Models.OccupationName> occupationNameList = new List <Models.OccupationName>(); foreach (var on in bLL.GetAllOccupationName()) { Models.OccupationName occupationName = new Models.OccupationName { Id = on.Id, Name = on.Name }; OccupationClass tempClass = bLL.GetOccupationClassById(on.ClassId); occupationName.OccupationClass = new Models.OccupationClass { Id = tempClass.Id, Name = tempClass.Name }; occupationNameList.Add(occupationName); } ViewData["occupationNameList"] = occupationNameList; return(View()); }
public ActionResult EditOccupationName(string id) { IOccupationBLL bLL = new OccupationBLL(); OccupationName occupationName = bLL.GetOccupationNameById(Convert.ToInt32(id)); Models.OccupationName occupationNameView = new Models.OccupationName { Id = occupationName.Id, Name = occupationName.Name }; OccupationClass occupationClass = bLL.GetOccupationClassById(occupationName.ClassId); Models.OccupationClass occupationClassView = new Models.OccupationClass { Id = occupationClass.Id, Name = occupationClass.Name }; occupationNameView.OccupationClass = occupationClassView; ViewData["occupationNameView"] = occupationNameView; //装载所有的职位类型,用于职位类型选择的下拉框 List <Models.OccupationClass> occupationClassList = new List <Models.OccupationClass>(); foreach (var oc in bLL.GetAllOccupationClass()) { Models.OccupationClass tempOccupationClass = new Models.OccupationClass { Id = oc.Id, Name = oc.Name }; occupationClassList.Add(tempOccupationClass); } ViewData["occupationClassList"] = occupationClassList; return(View()); }
/// <summary> /// 控制器内部方法,通过id获取薪酬标准的详细信息 /// </summary> /// <param name="id">薪酬标准的id</param> private void GetStandardById(string id) { ISalaryBLL salaryBLL = new SalaryBLL(); ISalaryItemBLL salaryItemBLL = new SalaryItemBLL(); IOccupationBLL occupationBLL = new OccupationBLL(); //通过id查找到薪酬标准 SalaryStandard salaryStandard = salaryBLL.GetSalaryStandardById(Convert.ToInt32(id)); //视图模型薪酬标准 Models.SalaryStandard salaryStandardView = new Models.SalaryStandard { Id = salaryStandard.Id, StandardName = salaryStandard.StandardName, StandardFileNumber = salaryStandard.StandardFileNumber, Registrant = salaryStandard.Registrant, RegistTime = salaryStandard.RegistTime, DesignBy = salaryStandard.DesignBy, Total = salaryStandard.Total, StandardState = salaryStandard.StandardState, CheckDesc = salaryStandard.CheckDesc, CheckBy = salaryStandard.CheckBy }; //通过薪酬标准的id找到所有的项目映射关系 List <StandardMapItem> tempMapList = salaryBLL.GetAllStandardMapItemByStandardId(salaryStandard.Id); //遍历映射关系,并把薪酬项目和薪酬项目的金额装载到视图模型薪酬标准的字典中 foreach (var m in tempMapList) { SalaryItem tempSalaryItem = salaryItemBLL.GetSalaryItemById(m.ItemId); Models.SalaryItem salaryItemView = new Models.SalaryItem { Id = tempSalaryItem.Id, Name = tempSalaryItem.Name }; salaryStandardView.ItemAmout.Add(salaryItemView, m.Amout); } //通过薪酬标准的id找到所有的职位映射关系 List <StandardMapOccupationName> occList = salaryBLL.GetAllStandardMapOccByStandardId(salaryStandard.Id); if (occList != null) { foreach (var o in occList) { OccupationName tempOccName = occupationBLL.GetOccupationNameById(o.OccupationNameId); Models.OccupationName occupationNameView = new Models.OccupationName { Id = tempOccName.Id, Name = tempOccName.Name }; OccupationClass tempOccClass = occupationBLL.GetOccupationClassById(tempOccName.ClassId); occupationNameView.OccupationClass = new Models.OccupationClass { Id = tempOccClass.Id, Name = tempOccClass.Name }; salaryStandardView.OccList.Add(occupationNameView); } } ViewData["salaryStandardView"] = salaryStandardView; //装载所有薪酬项目 List <SalaryItem> salaryList = salaryItemBLL.GetAllSalaryItem(); List <Models.SalaryItem> itemList = new List <Models.SalaryItem>(); foreach (var item in salaryList) { Models.SalaryItem tempItem = new Models.SalaryItem { Id = item.Id, Name = item.Name }; itemList.Add(tempItem); } ViewData["itemList"] = itemList; //装载所有职位类型 List <OccupationClass> occClassList = occupationBLL.GetAllOccupationClass(); List <Models.OccupationClass> occClassListView = new List <Models.OccupationClass>(); if (occClassList != null) { foreach (var oc in occClassList) { Models.OccupationClass tempClass = new Models.OccupationClass() { Id = oc.Id, Name = oc.Name }; occClassListView.Add(tempClass); } } ViewData["occClassListView"] = occClassListView; //装载所有该薪酬标准的职位类型下的所有职位 List <Models.OccupationName> occNameList = new List <Models.OccupationName>(); for (int i = 0; i < salaryStandardView.OccList.Count; i++) { List <OccupationName> tempList = occupationBLL.GetAllOccNameByClassId(salaryStandardView.OccList[i].OccupationClass.Id); foreach (var on in tempList) { Models.OccupationName tempOccupationName = new Models.OccupationName { Id = on.Id, Name = on.Name, OccupationClass = salaryStandardView.OccList[i].OccupationClass }; occNameList.Add(tempOccupationName); } } ViewData["occNameList"] = occNameList; }
/// <summary> /// 薪酬标准详情 /// </summary> /// <param name="id">薪酬标准的id</param> /// <returns>薪酬标准详情页</returns> public ActionResult DetailSalaryStandard(string id) { ISalaryBLL salaryBLL = new SalaryBLL(); ISalaryItemBLL salaryItemBLL = new SalaryItemBLL(); IOccupationBLL occupationBLL = new OccupationBLL(); //通过id查找到薪酬标准 SalaryStandard salaryStandard = salaryBLL.GetSalaryStandardById(Convert.ToInt32(id)); //视图模型薪酬标准 Models.SalaryStandard salaryStandardView = new Models.SalaryStandard { Id = salaryStandard.Id, StandardName = salaryStandard.StandardName, StandardFileNumber = salaryStandard.StandardFileNumber, Registrant = salaryStandard.Registrant, RegistTime = salaryStandard.RegistTime, DesignBy = salaryStandard.DesignBy, Total = salaryStandard.Total, StandardState = salaryStandard.StandardState, CheckDesc = salaryStandard.CheckDesc, CheckBy = salaryStandard.CheckBy }; //通过薪酬标准的id找到所有的项目映射关系 List <StandardMapItem> tempMapList = salaryBLL.GetAllStandardMapItemByStandardId(salaryStandard.Id); //遍历映射关系,并把薪酬项目和薪酬项目的金额装载到视图模型薪酬标准的字典中 foreach (var m in tempMapList) { SalaryItem tempSalaryItem = salaryItemBLL.GetSalaryItemById(m.ItemId); Models.SalaryItem salaryItemView = new Models.SalaryItem { Id = tempSalaryItem.Id, Name = tempSalaryItem.Name }; salaryStandardView.ItemAmout.Add(salaryItemView, m.Amout); } //通过薪酬标准的id找到所有的职位映射关系 List <StandardMapOccupationName> occList = salaryBLL.GetAllStandardMapOccByStandardId(salaryStandard.Id); if (occList != null) { foreach (var o in occList) { OccupationName tempOccName = occupationBLL.GetOccupationNameById(o.OccupationNameId); Models.OccupationName occupationNameView = new Models.OccupationName { Id = tempOccName.Id, Name = tempOccName.Name }; OccupationClass tempOccClass = occupationBLL.GetOccupationClassById(tempOccName.ClassId); occupationNameView.OccupationClass = new Models.OccupationClass { Id = tempOccClass.Id, Name = tempOccClass.Name }; salaryStandardView.OccList.Add(occupationNameView); } } ViewData["salaryStandardView"] = salaryStandardView; return(View()); }
/// <summary> /// 控制器内部方法 /// </summary> /// <param name="id">通过id装载视图模型Staff</param> private void GetStaffById(string id) { IStaffBLL staffBLL = new StaffBLL(); IOrgBLL orgBLL = new OrgBLL(); IOccupationBLL occupationBLL = new OccupationBLL(); ISalaryBLL salaryBLL = new SalaryBLL(); Staff staff = staffBLL.GetStaffById(Convert.ToInt32(id)); Models.Staff staffView = new Models.Staff(); Type type = typeof(Models.Staff); Type modelType = typeof(Staff); var props = type.GetProperties(); foreach (var p in props) { if (modelType.GetProperty(p.Name) != null) { p.SetValue(staffView, modelType.GetProperty(p.Name).GetValue(staff)); } } ThirdOrg thirdOrg = orgBLL.GetThirdOrgById(staff.ThirdOrgId); SecondOrg secondOrg = orgBLL.GetSecondOrgById(thirdOrg.ParentOrgId); FirstOrg firstOrg = orgBLL.GetFirstOrgById(secondOrg.ParentOrgId); OccupationName occupationName = occupationBLL.GetOccupationNameById(staff.OccId); OccupationClass occupationClass = occupationBLL.GetOccupationClassById(occupationName.ClassId); SalaryStandard salaryStandard = salaryBLL.GetSalaryStandardById(staff.StandardId); TechnicalTitle technicalTitle = occupationBLL.GetTechnicalTitleById(staff.TechnicalTitleId); staffView.FirstOrg = new Models.FirstOrg { Id = firstOrg.Id, OrgLevel = firstOrg.OrgLevel, OrgName = firstOrg.OrgName }; staffView.SecondeOrg = new Models.SecondeOrg { Id = secondOrg.Id, OrgName = secondOrg.OrgName, OrgLevel = secondOrg.OrgLevel, ParentOrg = staffView.FirstOrg }; staffView.ThirdOrg = new Models.ThirdOrg { Id = thirdOrg.Id, ParentOrg = staffView.SecondeOrg, OrgLevel = thirdOrg.OrgLevel, OrgName = thirdOrg.OrgName }; staffView.OccupationClass = new Models.OccupationClass { Id = occupationClass.Id, Name = occupationClass.Name }; staffView.OccupationName = new Models.OccupationName { Id = occupationName.Id, Name = occupationName.Name, OccupationClass = staffView.OccupationClass }; staffView.SalaryStandard = new Models.SalaryStandard { Id = salaryStandard.Id, StandardName = salaryStandard.StandardName, Total = salaryStandard.Total }; staffView.TechnicalTitle = new Models.TechnicalTitle { Id = technicalTitle.Id, Name = technicalTitle.Name }; ViewData["staffView"] = staffView; //装载所有职称 List <Models.TechnicalTitle> list = new List <Models.TechnicalTitle>(); List <TechnicalTitle> tempList = occupationBLL.GetAllTechnicalTitle(); foreach (var tt in tempList) { Models.TechnicalTitle tempTechnicalTitle = new Models.TechnicalTitle { Id = tt.Id, Name = tt.Name }; list.Add(tempTechnicalTitle); } ViewData["tTitleList"] = list; //装载该职位的所有薪酬标准 List <SalaryStandard> standardList = salaryBLL.GetAllStandardByOccId(staff.OccId); List <Models.SalaryStandard> standardListView = new List <Models.SalaryStandard>(); foreach (var s in standardList) { Models.SalaryStandard tempStandard = new Models.SalaryStandard { Id = s.Id, StandardName = s.StandardName, Total = s.Total }; standardListView.Add(tempStandard); } ViewData["standardListView"] = standardListView; }