コード例 #1
0
        /// <summary>
        /// 自由审批完成
        /// </summary>
        /// <param name="workFlowManager">流程控制管理器</param>
        /// <param name="workFlowAuditInfo">流程信息</param>
        /// <returns>影响行数</returns>
        public string FreeAuditComplete(IWorkFlowManager workFlowManager, BaseWorkFlowAuditInfo workFlowAuditInfo)
        {
            // 返回值
            string result = string.Empty;

            // 这里用锁的机制,提高并发控制能力
            lock (WorkFlowCurrentLock)
            {
                try
                {
                    // 开始事务
                    this.DbHelper.BeginTransaction();
                    // 进行更新操作
                    this.StepAuditComplete(workFlowAuditInfo.Id, workFlowAuditInfo.AuditIdea);
                    BaseWorkFlowCurrentEntity workFlowCurrentEntity = this.GetObject(workFlowAuditInfo.Id);
                    // 发送提醒信息
                    if (workFlowManager != null)
                    {
                        workFlowManager.OnAutoAuditComplete(workFlowCurrentEntity);
                        workFlowManager.SendRemindMessage(workFlowCurrentEntity, AuditStatus.AuditComplete, new string[] { workFlowCurrentEntity.CreateUserId, workFlowAuditInfo.ToUserId }, workFlowAuditInfo.ToDepartmentId, workFlowAuditInfo.ToRoleId);
                    }
                    this.StatusMessage = this.GetStateMessage(this.StatusCode);
                    result             = workFlowAuditInfo.Id;
                    this.DbHelper.CommitTransaction();
                }
                catch (Exception ex)
                {
                    this.DbHelper.RollbackTransaction();
                    BaseExceptionManager.LogException(dbHelper, this.UserInfo, ex);
                    this.StatusCode = Status.Error.ToString();
                    // throw;
                }
                finally
                {
                    this.DbHelper.Close();
                }

                return(result);
            }
        }