public ActionResult Edit(STCheckPeopleSaveViewModel model) { ControllerResult result = ControllerResult.SuccResult; result.IsSucc = true; STCheckPeopleSaveModel editModel = new STCheckPeopleSaveModel(); try { DateTime?postnumstartdate = null; DateTime?postnumenddate = null; CommonUtils.GetLayuiDateRange(model.Postnumdate, out postnumstartdate, out postnumenddate); model.postnumstartdate = postnumstartdate; model.postnumenddate = postnumenddate; editModel.People = new t_bp_People_ST() { PostDate = model.PostDate, Id = model.Id, Name = model.Name, Customid = model.Customid, Sex = model.Sex, Birthday = model.Birthday, SelfNum = model.SelfNum, PostNum = model.PostNum, ishaspostnum = model.ishaspostnum, postnumstartdate = model.postnumstartdate, postnumenddate = model.postnumenddate, School = model.School, Education = model.Education, Title = model.Title, Professional = model.Professional, Tel = model.Tel, zw = model.zw, Email = model.Email, SBNum = model.SBNum, isjs = model.isjs, ismanager = model.ismanager, issy = model.issy, PostType = model.PostType, postDelayReg = model.postDelayReg, selfnumPath = model.selfnumPath, educationpath = model.educationpath, PhotoPath = model.PhotoPath, PostPath = model.PostPath, sbnumpath = model.sbnumpath }; editModel.PeoAward = new List <t_bp_PeoAwards_ST>(); editModel.PeoChange = new List <t_bp_PeoChange_ST>(); editModel.PeoPunish = new List <t_bp_PeoPunish_ST>(); editModel.PeoEducation = new List <t_bp_PeoEducation_ST>(); if (model.peoAward != null) { foreach (var item in model.peoAward) { item.PeopleId = model.Id; editModel.PeoAward.Add(item); } } if (model.peoPunish != null) { foreach (var item in model.peoPunish) { item.PeopleId = model.Id; editModel.PeoPunish.Add(item); } } if (model.peoEducation != null) { foreach (var item in model.peoEducation) { item.PeopleId = model.Id; editModel.PeoEducation.Add(item); } } if (model.peoChange != null) { foreach (var item in model.peoChange) { item.PeopleId = model.Id; editModel.PeoChange.Add(item); } } string erroMsg = string.Empty; if (!sTCheckPeopleService.EditPeople(editModel, out erroMsg)) { result = ControllerResult.FailResult; result.ErroMsg = erroMsg; result.IsSucc = false; } else { LogUserAction("进行了商砼人员信息修改操作,id为{0}".Fmt(model.Id)); } } catch (Exception ex) { result = ControllerResult.FailResult; result.ErroMsg = ex.Message; result.IsSucc = false; } return(Content(result.ToJson())); }
public ActionResult Create(STCheckPeopleSaveViewModel model) { ControllerResult result = ControllerResult.SuccResult; result.IsSucc = true; STCheckPeopleSaveModel createModel = new STCheckPeopleSaveModel(); try { if (repCustom.GetByCondition(r => r.Id == model.Customid).Count == 0) { result = ControllerResult.FailResult; result.ErroMsg = "新增失败,该机构系统中不存在!"; return(Content(result.ToJson())); } DateTime?postnumstartdate = null; DateTime?postnumenddate = null; CommonUtils.GetLayuiDateRange(model.Postnumdate, out postnumstartdate, out postnumenddate); model.postnumstartdate = postnumstartdate; model.postnumenddate = postnumenddate; createModel.People = new t_bp_People_ST() { Approvalstatus = "0", Name = model.Name, Customid = model.Customid, Sex = model.Sex, PostDate = model.PostDate, Birthday = model.Birthday, SelfNum = model.SelfNum, PostNum = model.PostNum, ishaspostnum = model.ishaspostnum, postnumstartdate = model.postnumstartdate, postnumenddate = model.postnumenddate, School = model.School, Education = model.Education, Title = model.Title, Professional = model.Professional, Tel = model.Tel, zw = model.zw, Email = model.Email, SBNum = model.SBNum, isjs = model.isjs, ismanager = model.ismanager, issy = model.issy, PostType = model.PostType, postDelayReg = model.postDelayReg, selfnumPath = model.selfnumPath, educationpath = model.educationpath, PhotoPath = model.PhotoPath, PostPath = model.PostPath, sbnumpath = model.sbnumpath }; createModel.PeoAward = new List <t_bp_PeoAwards_ST>(); createModel.PeoChange = new List <t_bp_PeoChange_ST>(); createModel.PeoPunish = new List <t_bp_PeoPunish_ST>(); createModel.PeoEducation = new List <t_bp_PeoEducation_ST>(); if (model.peoAward != null) { foreach (var item in model.peoAward) { createModel.PeoAward.Add(item); } } if (model.peoPunish != null) { foreach (var item in model.peoPunish) { createModel.PeoPunish.Add(item); } } if (model.peoEducation != null) { foreach (var item in model.peoEducation) { createModel.PeoEducation.Add(item); } } if (model.peoChange != null) { foreach (var item in model.peoChange) { createModel.PeoChange.Add(item); } } string erroMsg = string.Empty; if (!sTCheckPeopleService.CreatePeople(createModel, out erroMsg)) { result = ControllerResult.FailResult; result.ErroMsg = erroMsg; result.IsSucc = false; } else { LogUserAction("进行了商砼人员信息新增操作,姓名为{0},身份证号为{1}".Fmt(model.Name, model.SelfNum)); } } catch (Exception ex) { result = ControllerResult.FailResult; result.ErroMsg = ex.Message; result.IsSucc = false; } return(Content(result.ToJson())); }