Пример #1
0
        /// <summary>
        /// 撤消审批流程中的单据(撤销的没必要发送提醒信息)
        /// </summary>
        /// <param name="currentId">当前主键</param>
        /// <param name="auditIdea">批示</param>
        /// <returns>影响行数</returns>
        public int AuditQuash(IWorkFlowManager workFlowManager, string currentId, string auditIdea)
        {
            int returnValue = 0;

            if (!string.IsNullOrEmpty(currentId))
            {
                // using (TransactionScope transactionScope = new TransactionScope())
                // {
                try
                {
                    BaseWorkFlowCurrentEntity workFlowCurrentEntity = this.GetEntity(currentId);
                    // 只有待审核状态的,才可以撤销,被退回的也可以废弃
                    if (workFlowCurrentEntity.AuditStatus.Equals(AuditStatus.AuditComplete.ToString()) ||
                        workFlowCurrentEntity.AuditStatus.Equals(AuditStatus.AuditQuash.ToString()))
                    {
                        return(returnValue);
                    }
                    // 是超级管理员,或者创建者自己才可以撤销
                    if (!UserInfo.IsAdministrator && !workFlowCurrentEntity.CreateUserId.Equals(UserInfo.Id))
                    {
                        return(returnValue);
                    }
                    // 是自己的的单子需要被审核
                    // 最后修改人是自己,表明是自己发出的
                    // if ((baseWorkFlowCurrentEntity.ModifiedUserId == UserInfo.Id) || (baseWorkFlowCurrentEntity.CreateUserId == UserInfo.Id))
                    //{
                    // 进行更新操作
                    workFlowCurrentEntity = this.StepAuditQuash(currentId, auditIdea);
                    if (!string.IsNullOrEmpty(workFlowCurrentEntity.Id))
                    {
                        // 发送提醒信息
                        if (workFlowManager != null)
                        {
                            workFlowManager.OnAuditQuash(workFlowCurrentEntity);
                            returnValue = workFlowManager.SendRemindMessage(workFlowCurrentEntity, AuditStatus.AuditQuash, new string[] { workFlowCurrentEntity.CreateUserId }, null, null);
                        }
                    }
                    else
                    {
                        // 数据可能被删除
                        this.ReturnStatusCode = StatusCode.ErrorDeleted.ToString();
                    }
                    // }
                    this.ReturnStatusMessage = this.GetStateMessage(this.ReturnStatusCode);
                }
                catch (System.Exception ex)
                {
                    // 在本地记录异常
                    FileUtil.WriteException(UserInfo, ex);
                }
                finally
                {
                }
                // transactionScope.Complete();
                // }
            }
            return(returnValue);
        }
 /// <summary>
 /// 撤消审批流程中的单据(撤销的没必要发送提醒信息)
 /// </summary>
 /// <param name="currentId">当前主键</param>
 /// <param name="auditIdea">批示</param>
 /// <returns>影响行数</returns>
 public int AuditQuash(IWorkFlowManager workFlowManager, string currentId, string auditIdea)
 {
     int returnValue = 0;
     if (!string.IsNullOrEmpty(currentId))
     {
         // using (TransactionScope transactionScope = new TransactionScope())
         // {
         try
         {
             BaseWorkFlowCurrentEntity workFlowCurrentEntity = this.GetEntity(currentId);
             // 只有待审核状态的,才可以撤销,被退回的也可以废弃
             if (workFlowCurrentEntity.AuditStatus.Equals(AuditStatus.AuditComplete.ToString())
                 || workFlowCurrentEntity.AuditStatus.Equals(AuditStatus.AuditQuash.ToString()))
             {
                 return returnValue;
             }
             // 是超级管理员,或者创建者自己才可以撤销
             if (!UserInfo.IsAdministrator && !workFlowCurrentEntity.CreateUserId.Equals(UserInfo.Id))
             {
                 return returnValue;
             }
             // 是自己的的单子需要被审核
             // 最后修改人是自己,表明是自己发出的
             // if ((baseWorkFlowCurrentEntity.ModifiedUserId == UserInfo.Id) || (baseWorkFlowCurrentEntity.CreateUserId == UserInfo.Id))
             //{
             // 进行更新操作
             workFlowCurrentEntity = this.StepAuditQuash(currentId, auditIdea);
             if (!string.IsNullOrEmpty(workFlowCurrentEntity.Id))
             {
                 // 发送提醒信息
                 if (workFlowManager != null)
                 {
                     workFlowManager.OnAuditQuash(workFlowCurrentEntity);
                     returnValue = workFlowManager.SendRemindMessage(workFlowCurrentEntity, AuditStatus.AuditQuash, new string[] { workFlowCurrentEntity.CreateUserId }, null, null);
                 }
             }
             else
             {
                 // 数据可能被删除
                 this.ReturnStatusCode = StatusCode.ErrorDeleted.ToString();
             }
             // }
             this.ReturnStatusMessage = this.GetStateMessage(this.ReturnStatusCode);
         }
         catch (System.Exception ex)
         {
             // 在本地记录异常
             FileUtil.WriteException(UserInfo, ex);
         }
         finally
         {
         }
         // transactionScope.Complete();
         // }
     }
     return returnValue;
 }