/// <summary> /// 保存表单(新增、修改) /// </summary> /// <param name="keyValue">主键值</param> /// <param name="entity">实体对象</param> /// <returns></returns> public void SaveForm(string keyValue, HighRiskCheckEntity entity) { try { service.SaveForm(keyValue, entity); } catch (Exception) { throw; } }
public ActionResult SaveForm(string keyValue, HighRiskApplyEntity entity, string verifyids, string approveids) { Operator usercurrent = OperatorProvider.Provider.Current(); if (highriskapplybll.SaveForm(keyValue, entity) > 0) { //保存关联的从表记录(高危险作业审核/审批表) if (verifyids.Length > 0) { HighRiskCheckBLL highriskcheckbll = new HighRiskCheckBLL(); if (highriskcheckbll.Remove(entity.Id) > 0) { if (!string.IsNullOrEmpty(verifyids))//审核人 { string[] array = verifyids.Split(','); foreach (var item in array) { UserEntity user = userBLL.GetEntity(item); if (user != null) { var dept = departmentBLL.GetEntity(user.DepartmentId); HighRiskCheckEntity checkentity = new HighRiskCheckEntity(); checkentity.ApprovePerson = item; checkentity.ApprovePersonName = user.RealName; checkentity.ADeptId = user.DepartmentId; checkentity.ADeptCode = user.DepartmentCode; checkentity.ADeptName = dept == null ? usercurrent.OrganizeName : dept.FullName; checkentity.ApproveStep = "1";//审核 checkentity.ApproveState = "0"; checkentity.ApproveId = entity.Id; highriskcheckbll.SaveForm("", checkentity); } } } if (!string.IsNullOrEmpty(approveids))//审批人 { string[] array = approveids.Split(','); foreach (var item in array) { UserEntity user = userBLL.GetEntity(item); if (user != null) { var dept = departmentBLL.GetEntity(user.DepartmentId); HighRiskCheckEntity checkentity = new HighRiskCheckEntity(); checkentity.ApprovePerson = item; checkentity.ApprovePersonName = user.RealName; checkentity.ADeptId = user.DepartmentId; checkentity.ADeptCode = user.DepartmentCode; checkentity.ADeptName = dept == null ? usercurrent.OrganizeName : dept.FullName; checkentity.ApproveStep = "2";//审批 checkentity.ApproveState = "0"; checkentity.ApproveId = entity.Id; highriskcheckbll.SaveForm("", checkentity); } } } } } } return(Success("操作成功。")); }