/// <summary> /// 添加工作流 /// </summary> /// <param name="userInfo">当前用户</param> /// <param name="entity">工作流定义实体</param> /// <returns>主键</returns> public string Add(BaseUserInfo userInfo, BaseWorkFlowActivityEntity entity) { string result = string.Empty; var parameter = ServiceInfo.Create(userInfo, MethodBase.GetCurrentMethod()); ServiceUtil.ProcessWorkFlowDb(userInfo, parameter, (dbHelper) => { var workFlowActivityManager = new BaseWorkFlowActivityManager(dbHelper, userInfo); result = workFlowActivityManager.Add(entity); }); return(result); }
/// <summary> /// 添加工作流 /// </summary> /// <param name="userInfo">当前用户</param> /// <param name="workFlowActivityEntity">工作流定义实体</param> /// <param name="statusCode">状态码</param> /// <param name="statusMessage">状态信息</param> /// <returns>主键</returns> public string Add(BaseUserInfo userInfo, BaseWorkFlowActivityEntity workFlowActivityEntity) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif string returnValue = string.Empty; using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.WorkFlowDbType)) { try { dbHelper.Open(WorkFlowDbConnection); // 数据库事务开始 // dbHelper.BeginTransaction(); BaseWorkFlowActivityManager workFlowActivityManager = new BaseWorkFlowActivityManager(dbHelper, userInfo); returnValue = workFlowActivityManager.Add(workFlowActivityEntity); // 写入日志信息 BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, MethodBase.GetCurrentMethod()); // 数据库事务提交 // dbHelper.CommitTransaction(); } catch (Exception ex) { // 数据库事务回滚 // dbHelper.RollbackTransaction(); // 记录异常信息 BaseExceptionManager.LogException(dbHelper, userInfo, ex); throw ex; } finally { dbHelper.Close(); } } // 写入调试信息 #if (DEBUG) BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart); #endif return(returnValue); }