/// <summary>
 /// 审核通过
 /// </summary>
 /// <param name="id">当前主键</param>
 /// <param name="auditIdea">批示</param>
 /// <returns>影响行数</returns>
 public int AuditPass(IWorkFlowManager workFlowManager, string currentId, string auditIdea, BaseWorkFlowActivityEntity workFlowActivityEntity)
 {
     int returnValue = 0;
     // 进行更新操作
     returnValue = this.StepAuditPass(currentId, auditIdea, workFlowActivityEntity);
     if (returnValue == 0)
     {
         // 数据可能被删除
         this.ReturnStatusCode = StatusCode.ErrorDeleted.ToString();
     }
     BaseWorkFlowCurrentEntity workFlowCurrentEntity = this.GetEntity(currentId);
     // 发送提醒信息
     if (workFlowManager != null)
     {
         if (!string.IsNullOrEmpty(workFlowActivityEntity.AuditUserId))
         {
             workFlowActivityEntity.AuditDepartmentId = null;
             workFlowActivityEntity.AuditRoleId = null;
         }
         workFlowManager.OnAutoAuditPass(workFlowCurrentEntity);
         workFlowManager.SendRemindMessage(workFlowCurrentEntity, AuditStatus.AuditPass, new string[] { workFlowCurrentEntity.CreateUserId, workFlowActivityEntity.AuditUserId }, workFlowActivityEntity.AuditDepartmentId, workFlowActivityEntity.AuditRoleId);
     }
     this.ReturnStatusMessage = this.GetStateMessage(this.ReturnStatusCode);
     return returnValue;
 }
 /// <summary>
 /// 自由审批
 /// </summary>
 /// <param name="workFlowManager"></param>
 /// <param name="currentId"></param>
 /// <param name="toUserId"></param>
 /// <param name="toDepartmentId"></param>
 /// <param name="toRoleId"></param>
 /// <param name="auditIdea"></param>
 /// <returns></returns>
 public int FreeAuditPass(IWorkFlowManager workFlowManager, string currentId, string toUserId, string toDepartmentId = null, string toRoleId = null, string auditIdea = null)
 {
     // 返回值
     int returnValue = 0;
     // 这里用锁的机制,提高并发控制能力
     lock (WorkFlowCurrentLock)
     {
         BaseWorkFlowActivityEntity workFlowActivityEntity = new BaseWorkFlowActivityEntity();
         // FreeWorkFlow 自由工作流
         workFlowActivityEntity.WorkFlowId = 0;
         // 获取排序码
         workFlowActivityEntity.SortCode = int.Parse(new BaseSequenceManager().GetSequence("FreeWorkFlow", 10000000));
         // 是否提交给用户审批
         if (!string.IsNullOrEmpty(toUserId))
         {
             workFlowActivityEntity.AuditUserId = toUserId;
             workFlowActivityEntity.AuditUserRealName = new BaseUserManager().GetEntity(toUserId).RealName;
         }
         // 是否提交给部门审批
         if (!string.IsNullOrEmpty(toDepartmentId))
         {
             workFlowActivityEntity.AuditDepartmentId = toDepartmentId;
             workFlowActivityEntity.AuditDepartmentName = new BaseOrganizeManager().GetEntity(toDepartmentId).FullName;
         }
         // 是否提交给角色审批
         if (!string.IsNullOrEmpty(toRoleId))
         {
             workFlowActivityEntity.AuditRoleId = toRoleId;
             workFlowActivityEntity.AuditRoleRealName = new BaseRoleManager().GetEntity(toRoleId).RealName;
         }
         // 进行更新操作
         returnValue = this.StepAuditPass(currentId, auditIdea, workFlowActivityEntity);
         if (returnValue == 0)
         {
             // 数据可能被删除
             this.ReturnStatusCode = StatusCode.ErrorDeleted.ToString();
         }
         BaseWorkFlowCurrentEntity workFlowCurrentEntity = this.GetEntity(currentId);
         // 发送提醒信息
         if (workFlowManager != null)
         {
             if (!string.IsNullOrEmpty(workFlowActivityEntity.AuditUserId))
             {
                 workFlowActivityEntity.AuditDepartmentId = null;
                 workFlowActivityEntity.AuditRoleId = null;
             }
             workFlowManager.OnAutoAuditPass(workFlowCurrentEntity);
             workFlowManager.SendRemindMessage(workFlowCurrentEntity, AuditStatus.AuditPass, new string[] { workFlowCurrentEntity.CreateUserId, workFlowActivityEntity.AuditUserId }, workFlowActivityEntity.AuditDepartmentId, workFlowActivityEntity.AuditRoleId);
         }
         this.ReturnStatusMessage = this.GetStateMessage(this.ReturnStatusCode);
         return returnValue;
     }
 }
        /// <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;
        }
 /// <summary>
 /// 批量保存
 /// </summary>
 /// <param name="dataTable">数据表</param>
 /// <returns>影响行数</returns>
 public override int BatchSave(DataTable dataTable)
 {
     int returnValue = 0;
     BaseWorkFlowActivityEntity workFlowActivityEntity = new BaseWorkFlowActivityEntity();
     foreach (DataRow dataRow in dataTable.Rows)
     {
         // 删除状态
         if (dataRow.RowState == DataRowState.Deleted)
         {
             string id = dataRow[BaseRoleEntity.FieldId, DataRowVersion.Original].ToString();
             if (id.Length > 0)
             {
                 returnValue += this.Delete(id);
             }
         }
         // 被修改过
         if (dataRow.RowState == DataRowState.Modified)
         {
             string id = dataRow[BaseRoleEntity.FieldId, DataRowVersion.Original].ToString();
             if (!String.IsNullOrEmpty(id))
             {
                 workFlowActivityEntity.GetFrom(dataRow);
                 returnValue += this.UpdateEntity(workFlowActivityEntity);
             }
         }
         // 添加状态
         if (dataRow.RowState == DataRowState.Added)
         {
             workFlowActivityEntity.GetFrom(dataRow);
             returnValue += this.AddEntity(workFlowActivityEntity).Length > 0 ? 1 : 0;
         }
         if (dataRow.RowState == DataRowState.Unchanged)
         {
             continue;
         }
         if (dataRow.RowState == DataRowState.Detached)
         {
             continue;
         }
     }
     return returnValue;
 }
        /// <summary>
        /// 获取第一步审核的
        /// </summary>
        /// <param name="categoryCode">单据分类</param>
        /// <param name="workFlowCode">审批流程编号</param>
        /// <returns>审核步骤</returns>
        public BaseWorkFlowActivityEntity GetFirstActivityEntity(string workFlowCode, string categoryCode = null)
        {
            BaseWorkFlowActivityEntity workFlowActivityEntity = null;

            string workFlowId = string.Empty;
            List<KeyValuePair<string, object>> parameters = new List<KeyValuePair<string, object>>();
            // 这里是获取用户的工作流, 按用户主键,按模板编号
            if (string.IsNullOrEmpty(workFlowCode))
            {
                parameters.Add(new KeyValuePair<string, object>(BaseWorkFlowBillTemplateEntity.FieldCategoryCode, categoryCode));
                parameters.Add(new KeyValuePair<string, object>(BaseWorkFlowBillTemplateEntity.FieldDeletionStateCode, 0));
                BaseWorkFlowBillTemplateManager templateManager = new BaseWorkFlowBillTemplateManager(this.DbHelper, this.UserInfo);
                DataTable dt = templateManager.GetDataTable(parameters);
                BaseWorkFlowBillTemplateEntity templateEntity = new BaseWorkFlowBillTemplateEntity(dt);
                if (!string.IsNullOrEmpty(templateEntity.Id))
                {
                    workFlowCode = this.UserInfo.Id + "_" + templateEntity.Id;
                }
            }
            if (string.IsNullOrEmpty(workFlowCode))
            {
                return null;
            }
            // 1. 先检查工作流是否存在?
            BaseWorkFlowProcessManager workFlowProcessManager = new BaseWorkFlowProcessManager(this.DbHelper, this.UserInfo);

            parameters = new List<KeyValuePair<string, object>>();
            parameters.Add(new KeyValuePair<string, object>(BaseWorkFlowProcessEntity.FieldCode, workFlowCode));
            parameters.Add(new KeyValuePair<string, object>(BaseWorkFlowProcessEntity.FieldEnabled, 1));
            parameters.Add(new KeyValuePair<string, object>(BaseWorkFlowProcessEntity.FieldDeletionStateCode, 0));

            string[] names = new string[] { BaseWorkFlowProcessEntity.FieldCode, BaseWorkFlowProcessEntity.FieldEnabled, BaseWorkFlowProcessEntity.FieldDeletionStateCode };  // 2010.01.25 LiangMingMing 将 BaseWorkFlowProcessEntity.FieldCode 改 BaseWorkFlowProcessEntity.FieldId
            object[] values = new object[] { workFlowCode, 1, 0 };
            workFlowId = workFlowProcessManager.GetId(parameters);
            if (string.IsNullOrEmpty(workFlowId))
            {
                return null;
            }
            // 2. 查找第一步是按帐户审核?还是按角色审核?
            BaseWorkFlowActivityManager workFlowActivityManager = new BaseWorkFlowActivityManager(this.DbHelper, this.UserInfo);
            // 2010.01.25 LiangMingMing 新加了两个参数new string[] { BaseWorkFlowActivityEntity.FieldWorkFlowId }, new string[] { Convert.ToString(workFlowId) },(具体获取哪个流程的步骤)

            parameters = new List<KeyValuePair<string, object>>();
            parameters.Add(new KeyValuePair<string, object>(BaseWorkFlowActivityEntity.FieldWorkFlowId, workFlowId.ToString()));
            parameters.Add(new KeyValuePair<string, object>(BaseWorkFlowActivityEntity.FieldEnabled, 1));
            parameters.Add(new KeyValuePair<string, object>(BaseWorkFlowActivityEntity.FieldDeletionStateCode, 0));

            DataTable dataTable = workFlowActivityManager.GetDataTable(parameters);
            // 3. 取第一个排序的数据
            if (dataTable.Rows.Count == 0)
            {
                return null;
            }
            workFlowActivityEntity = new BaseWorkFlowActivityEntity(dataTable.Rows[0]);
            if ((workFlowActivityEntity.AuditUserId == null) && (workFlowActivityEntity.AuditRoleId == null))
            {
                return null;
            }
            return workFlowActivityEntity;
        }
        public BaseWorkFlowActivityEntity GetNextWorkFlowActivity(BaseWorkFlowCurrentEntity workFlowCurrentEntity)
        {
            BaseWorkFlowActivityEntity workFlowActivityEntity = null;
            DataTable dataTable = null;

            // 工作流主键
            string workFlowId = workFlowCurrentEntity.WorkFlowId.ToString();

            // 1. 从工作流审核步骤里选取审核步骤
            BaseWorkFlowStepManager workFlowStepManager = new BaseWorkFlowStepManager(this.DbHelper, this.UserInfo);

            List<KeyValuePair<string, object>> parameters = new List<KeyValuePair<string, object>>();
            parameters.Add(new KeyValuePair<string, object>(BaseWorkFlowStepEntity.FieldCategoryCode, workFlowCurrentEntity.CategoryCode));
            parameters.Add(new KeyValuePair<string, object>(BaseWorkFlowStepEntity.FieldObjectId, workFlowCurrentEntity.ObjectId));
            parameters.Add(new KeyValuePair<string, object>(BaseWorkFlowStepEntity.FieldWorkFlowId, workFlowId));
            parameters.Add(new KeyValuePair<string, object>(BaseWorkFlowStepEntity.FieldEnabled, 1));
            parameters.Add(new KeyValuePair<string, object>(BaseWorkFlowStepEntity.FieldDeletionStateCode, 0));

            dataTable = workFlowStepManager.GetDataTable(parameters, BaseWorkFlowStepEntity.FieldSortCode);

            if (dataTable.Rows.Count > 0)
            {
                dataTable.Columns.Remove(BaseWorkFlowStepEntity.FieldId);
                dataTable.Columns[BaseWorkFlowStepEntity.FieldActivityId].ColumnName = BaseWorkFlowStepEntity.FieldId;
            }
            else
            {
                // 2. 从工作流审核模板里选取审核步骤 下一步是多少?按工作流进行查找审核步骤
                BaseWorkFlowActivityManager workFlowActivityManager = new BaseWorkFlowActivityManager(this.DbHelper, this.UserInfo);

                parameters = new List<KeyValuePair<string, object>>();
                parameters.Add(new KeyValuePair<string, object>(BaseWorkFlowActivityEntity.FieldWorkFlowId, workFlowId));
                parameters.Add(new KeyValuePair<string, object>(BaseWorkFlowActivityEntity.FieldEnabled, 1));
                parameters.Add(new KeyValuePair<string, object>(BaseWorkFlowActivityEntity.FieldDeletionStateCode, 0));

                dataTable = workFlowActivityManager.GetDataTable(parameters, BaseWorkFlowActivityEntity.FieldSortCode);
            }

            // 审核步骤主键
            string activityId = string.Empty;
            if (workFlowCurrentEntity.ActivityId != null)
            {
                activityId = workFlowCurrentEntity.ActivityId.ToString();
            }
            if (dataTable.Rows.Count == 0)
            {
                return workFlowActivityEntity;
            }
            string nextActivityId = string.Empty;
            if (!string.IsNullOrEmpty(activityId))
            {
                nextActivityId = BaseSortLogic.GetNextId(dataTable, activityId.ToString());
            }
            else
            {
                nextActivityId = dataTable.Rows[0][BaseWorkFlowActivityEntity.FieldId].ToString();
            }
            if (!string.IsNullOrEmpty(nextActivityId))
            {
                // workFlowActivityEntity = workFlowActivityManager.GetEntity(nextActivityId);
                DataRow dataRow = BaseBusinessLogic.GetDataRow(dataTable, nextActivityId);
                workFlowActivityEntity = new BaseWorkFlowActivityEntity(dataRow);
            }
            return workFlowActivityEntity;
        }
 /// <summary>
 /// 设置实体
 /// </summary>
 /// <param name="baseWorkFlowActivityEntity">实体</param>
 private void SetEntity(SQLBuilder sqlBuilder, BaseWorkFlowActivityEntity baseWorkFlowActivityEntity)
 {
     sqlBuilder.SetValue(BaseWorkFlowActivityEntity.FieldWorkFlowId, baseWorkFlowActivityEntity.WorkFlowId);
     sqlBuilder.SetValue(BaseWorkFlowActivityEntity.FieldCode, baseWorkFlowActivityEntity.Code);
     sqlBuilder.SetValue(BaseWorkFlowActivityEntity.FieldFullName, baseWorkFlowActivityEntity.FullName);
     sqlBuilder.SetValue(BaseWorkFlowActivityEntity.FieldAuditDepartmentId, baseWorkFlowActivityEntity.AuditDepartmentId);
     sqlBuilder.SetValue(BaseWorkFlowActivityEntity.FieldAuditDepartmentName, baseWorkFlowActivityEntity.AuditDepartmentName);
     sqlBuilder.SetValue(BaseWorkFlowActivityEntity.FieldAuditUserId, baseWorkFlowActivityEntity.AuditUserId);
     sqlBuilder.SetValue(BaseWorkFlowActivityEntity.FieldAuditUserCode, baseWorkFlowActivityEntity.AuditUserCode);
     sqlBuilder.SetValue(BaseWorkFlowActivityEntity.FieldAuditUserRealName, baseWorkFlowActivityEntity.AuditUserRealName);
     sqlBuilder.SetValue(BaseWorkFlowActivityEntity.FieldAuditRoleId, baseWorkFlowActivityEntity.AuditRoleId);
     sqlBuilder.SetValue(BaseWorkFlowActivityEntity.FieldAuditRoleRealName, baseWorkFlowActivityEntity.AuditRoleRealName);
     sqlBuilder.SetValue(BaseWorkFlowActivityEntity.FieldActivityType, baseWorkFlowActivityEntity.ActivityType);
     sqlBuilder.SetValue(BaseWorkFlowActivityEntity.FieldAllowPrint, baseWorkFlowActivityEntity.AllowPrint);
     sqlBuilder.SetValue(BaseWorkFlowActivityEntity.FieldAllowEditDocuments, baseWorkFlowActivityEntity.AllowEditDocuments);
     sqlBuilder.SetValue(BaseWorkFlowActivityEntity.FieldSortCode, baseWorkFlowActivityEntity.SortCode);
     sqlBuilder.SetValue(BaseWorkFlowActivityEntity.FieldEnabled, baseWorkFlowActivityEntity.Enabled);
     sqlBuilder.SetValue(BaseWorkFlowActivityEntity.FieldDeletionStateCode, baseWorkFlowActivityEntity.DeletionStateCode);
     sqlBuilder.SetValue(BaseWorkFlowActivityEntity.FieldDescription, baseWorkFlowActivityEntity.Description);
 }
 /// <summary>
 /// 更新实体
 /// </summary>
 /// <param name="baseWorkFlowActivityEntity">实体</param>
 public int UpdateEntity(BaseWorkFlowActivityEntity baseWorkFlowActivityEntity)
 {
     SQLBuilder sqlBuilder = new SQLBuilder(DbHelper);
     sqlBuilder.BeginUpdate(this.CurrentTableName);
     this.SetEntity(sqlBuilder, baseWorkFlowActivityEntity);
     if (UserInfo != null)
     {
         sqlBuilder.SetValue(BaseWorkFlowActivityEntity.FieldModifiedUserId, UserInfo.Id);
         sqlBuilder.SetValue(BaseWorkFlowActivityEntity.FieldModifiedBy, UserInfo.RealName);
     }
     sqlBuilder.SetDBNow(BaseWorkFlowActivityEntity.FieldModifiedOn);
     sqlBuilder.SetWhere(BaseWorkFlowActivityEntity.FieldId, baseWorkFlowActivityEntity.Id);
     return sqlBuilder.EndUpdate();
 }
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="baseWorkFlowActivityEntity">实体</param>
 public int Update(BaseWorkFlowActivityEntity baseWorkFlowActivityEntity)
 {
     return this.UpdateEntity(baseWorkFlowActivityEntity);
 }
 /// <summary>
 /// 获取实体
 /// </summary>
 /// <param name="id">主键</param>
 public BaseWorkFlowActivityEntity GetEntity(string id)
 {
     BaseWorkFlowActivityEntity baseWorkFlowActivityEntity = new BaseWorkFlowActivityEntity(this.GetDataTable(new KeyValuePair<string, object>(BaseWorkFlowActivityEntity.FieldId, id)));
     return baseWorkFlowActivityEntity;
 }
 /// <summary>
 /// 添加实体
 /// </summary>
 /// <param name="workFlowActivityEntity">实体</param>
 public string AddEntity(BaseWorkFlowActivityEntity workFlowActivityEntity)
 {
     string sequence = string.Empty;
     if (workFlowActivityEntity.SortCode == null || workFlowActivityEntity.SortCode == 0)
     {
         BaseSequenceManager sequenceManager = new BaseSequenceManager(DbHelper, this.Identity);
         sequence = sequenceManager.GetSequence(this.CurrentTableName);
         workFlowActivityEntity.SortCode = int.Parse(sequence);
     }
     SQLBuilder sqlBuilder = new SQLBuilder(DbHelper, this.Identity, this.ReturnId);
     sqlBuilder.BeginInsert(this.CurrentTableName, BaseWorkFlowActivityEntity.FieldId);
     if (!this.Identity)
     {
         sqlBuilder.SetValue(BaseWorkFlowActivityEntity.FieldId, workFlowActivityEntity.Id);
     }
     else
     {
         if (!this.ReturnId && (DbHelper.CurrentDbType == DbTypes.Oracle || DbHelper.CurrentDbType == DbTypes.DB2))
         {
             if (DbHelper.CurrentDbType == DbTypes.Oracle)
             {
                 sqlBuilder.SetFormula(BaseWorkFlowActivityEntity.FieldId, "SEQ_" + this.CurrentTableName.ToUpper() + ".NEXTVAL ");
             }
             if (DbHelper.CurrentDbType == DbTypes.DB2)
             {
                 sqlBuilder.SetFormula(BaseWorkFlowActivityEntity.FieldId, "NEXT VALUE FOR SEQ_" + this.CurrentTableName.ToUpper());
             }
         }
         else
         {
             if (this.Identity && (DbHelper.CurrentDbType == DbTypes.Oracle || DbHelper.CurrentDbType == DbTypes.DB2))
             {
                 if (workFlowActivityEntity.Id == null)
                 {
                     if (string.IsNullOrEmpty(sequence))
                     {
                         BaseSequenceManager sequenceManager = new BaseSequenceManager(DbHelper, this.Identity);
                         sequence = sequenceManager.GetSequence(this.CurrentTableName);
                     }
                     workFlowActivityEntity.Id = int.Parse(sequence);
                 }
                 sqlBuilder.SetValue(BaseWorkFlowActivityEntity.FieldId, workFlowActivityEntity.Id);
             }
         }
     }
     this.SetEntity(sqlBuilder, workFlowActivityEntity);
     if (UserInfo != null)
     {
         sqlBuilder.SetValue(BaseWorkFlowActivityEntity.FieldCreateUserId, UserInfo.Id);
         sqlBuilder.SetValue(BaseWorkFlowActivityEntity.FieldCreateBy, UserInfo.RealName);
     }
     sqlBuilder.SetDBNow(BaseWorkFlowActivityEntity.FieldCreateOn);
     if (UserInfo != null)
     {
         sqlBuilder.SetValue(BaseWorkFlowActivityEntity.FieldModifiedUserId, UserInfo.Id);
         sqlBuilder.SetValue(BaseWorkFlowActivityEntity.FieldModifiedBy, UserInfo.RealName);
     }
     sqlBuilder.SetDBNow(BaseWorkFlowActivityEntity.FieldModifiedOn);
     if (DbHelper.CurrentDbType == DbTypes.SqlServer && this.Identity)
     {
         sequence = sqlBuilder.EndInsert().ToString();
     }
     else
     {
         sqlBuilder.EndInsert();
     }
     return sequence;
 }
 /// <summary>
 /// 添加
 /// </summary>
 /// <param name="baseWorkFlowActivityEntity">实体</param>
 /// <param name="identity">自增量方式</param>
 /// <param name="returnId">返回主鍵</param>
 /// <returns>主键</returns>
 public string Add(BaseWorkFlowActivityEntity baseWorkFlowActivityEntity, bool identity, bool returnId)
 {
     this.Identity = identity;
     this.ReturnId = returnId;
     return this.AddEntity(baseWorkFlowActivityEntity);
 }
 /// <summary>
 /// 添加
 /// </summary>
 /// <param name="baseWorkFlowActivityEntity">实体</param>
 /// <returns>主键</returns>
 public string Add(BaseWorkFlowActivityEntity baseWorkFlowActivityEntity)
 {
     return this.AddEntity(baseWorkFlowActivityEntity);
 }
 /// <summary>
 /// 审核通过(不需要再发给别人了)
 /// </summary>
 /// <param name="currentId">当前主键</param>
 /// <param name="auditIdea">批示</param>
 /// <returns>影响行数</returns>
 private int StepAuditPass(string currentId, string auditIdea, BaseWorkFlowActivityEntity workFlowActivityEntity)
 {
     BaseWorkFlowCurrentEntity workFlowCurrentEntity = this.GetEntity(currentId);
     // 1.记录当前的审核时间、审核人信息
     workFlowCurrentEntity.AuditDate = DateTime.Now;
     workFlowCurrentEntity.AuditIdea = auditIdea;
     workFlowCurrentEntity.AuditUserId = this.UserInfo.Id;
     workFlowCurrentEntity.AuditUserRealName = this.UserInfo.RealName;
     workFlowCurrentEntity.AuditStatus = AuditStatus.AuditPass.ToString();
     workFlowCurrentEntity.AuditStatusName = AuditStatus.AuditPass.ToDescription();
     // 2.记录审核日志
     this.AddHistory(workFlowCurrentEntity);
     // 3.上一个审核结束了,新的审核又开始了,更新待审核情况
     workFlowCurrentEntity.ActivityId = workFlowActivityEntity.Id;
     workFlowCurrentEntity.ToRoleId = workFlowActivityEntity.AuditRoleId;
     workFlowCurrentEntity.ToRoleRealName = workFlowActivityEntity.AuditRoleRealName;
     workFlowCurrentEntity.ToDepartmentId = workFlowActivityEntity.AuditDepartmentId;
     workFlowCurrentEntity.ToDepartmentName = workFlowActivityEntity.AuditDepartmentName;
     workFlowCurrentEntity.ToUserId = workFlowActivityEntity.AuditUserId;
     workFlowCurrentEntity.ToUserRealName = workFlowActivityEntity.AuditUserRealName;
     workFlowCurrentEntity.SortCode = workFlowActivityEntity.SortCode;
     return this.UpdateEntity(workFlowCurrentEntity);
 }