예제 #1
0
 /// <summary>
 /// 保存表单(新增、修改)
 /// </summary>
 /// <param name="keyValue">主键值</param>
 /// <param name="entity">实体对象</param>
 /// <returns></returns>
 public int SaveForm(string keyValue, HighRiskApplyEntity entity)
 {
     try
     {
         service.SaveForm(keyValue, entity);
         return(1);
     }
     catch (Exception)
     {
         return(0);
     }
 }
예제 #2
0
        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("操作成功。"));
        }