public string Add(AddApprovalModel model) { #region 判断是否存在同一部门、同一单据类别的审批规则 if (ApprovalRuleModel.Exists("Doc_Type = @0 and DepartmentID = @1 and Del_Flag = 0", model.Type, model.DepartmentId)) { return "当前部门已存在同一单据类别的审批规则"; } #endregion if (ModelState.IsValid) { ApprovalRuleModel process = new ApprovalRuleModel(); process.DocType = model.Type; //单据类别 process.Process = model.Process; //审批流程 process.Roleid = model.RoleId; //审批角色 process.Departmentid = model.DepartmentId.ToInt(); //部门 process.DelFlag = 0; //有效状态 process.CreateMan = SysConfig.CurrentUser.Id; //创建人 process.CreateTime = DateTime.Now; //创建时间 int result = process.Insert().ToInt(); if (result > 0) { //记录操作日志 CommonMethod.Log(SysConfig.CurrentUser.Id, "Insert", "Sys_Approval_Rule", "添加审批规则"); return "1"; } } return "0"; }
public static ApprovalRule ToEntity(this ApprovalRuleModel model, ApprovalRule destination, IObjectMapper ObjectMapper) { return(model.MapTo(destination, ObjectMapper)); }