Beispiel #1
0
        /// <summary>
        /// 流程审核
        /// </summary>
        /// <param name="conclusion">审核结论</param>
        /// <param name="participant">参与者,用于确定审核节点</param>
        /// <returns>true 审核成功 false 不允许审核</returns>
        public bool Audit(Conclusion conclusion, Participant participant)
        {
            Step aCurrent = this.GetCurrent();

            if (aCurrent == null)
            {
                return(false);
            }
            if (aCurrent.Audit(conclusion, participant))
            {
                aCurrent.Leave();
                if (this.GetCurrent() == null)
                {
                    this.FlowState = WorkFlowEngine.FlowState.Finished;
                }
                else
                {
                    this.FlowState = WorkFlowEngine.FlowState.Processing;
                }
                if (conclusion.AuditType != AuditType.Returned && this.GetCurrent() == null && this.FinishedHandler != null)
                {
                    this.FinishedHandler(this, null);
                }
                return(true);
            }
            return(false);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="Node"/> class.
 /// </summary>
 /// <param name="name">流程名称</param>ntnt
 /// <param name="participant">参与者</param>
 public Node(string name, Participant participant)
 {
     this.Name           = name;
     this.participant    = participant;
     this.TransferKind   = -1;
     this.conclusion     = new Conclusion(AuditType.UnAudit, -1, null);
     this.identification = Guid.NewGuid().ToString().Replace("-", "");
 }
 /// <summary>
 /// 执行审核
 /// </summary>
 /// <param name="conclusion">审核结论</param>
 /// <param name="participant">参与者</param>
 /// <returns>true 审核 false 未审</returns>
 public virtual bool Audit(Conclusion conclusion, Participant participant)
 {
     if (this.participant.CompareTo(participant) == 0)
     {
         this.conclusion = conclusion;
         return(true);
     }
     return(false);
 }
        /// <summary>
        /// 执行审核
        /// </summary>
        /// <param name="conclusion">审核结论</param>
        /// <param name="participant">参与者</param>
        /// <returns>true 审核 false 未审</returns>
        public virtual bool Audit(Conclusion conclusion, Participant participant)
        {
            bool         result = false;
            IList <Node> nodes  = this.GetCurrent();

            foreach (var node in nodes)
            {
                if (node.Audit(conclusion, participant))
                {
                    result = true;
                }
            }
            return(result);
        }
 /// <summary>
 /// 流程审核
 /// </summary>
 /// <param name="conclusion">审核结论</param>
 /// <param name="participant">参与者,用于确定审核节点</param>
 /// <returns>true 审核成功 false 不允许审核</returns>
 public bool Audit(Conclusion conclusion, Participant participant)
 {
     Step aCurrent = this.GetCurrent();
     if (aCurrent == null)
     {
         return false;
     }
     if (aCurrent.Audit(conclusion, participant))
     {
         aCurrent.Leave();
         if (this.GetCurrent() == null)
         {
             this.FlowState = WorkFlowEngine.FlowState.Finished;
         }
         else
         {
             this.FlowState = WorkFlowEngine.FlowState.Processing;
         }
         if (conclusion.AuditType != AuditType.Returned && this.GetCurrent() == null && this.FinishedHandler != null)
         {
             this.FinishedHandler(this, null);
         }
         return true;
     }            
     return false;
 }
        /// <summary>
        /// 流程审核
        /// </summary>
        /// <param name="flowEngine">流程</param>
        /// <param name="auditType">审核类型</param>
        /// <param name="auditDesc">审核描述</param>
        /// <param name="userId">Sys_User.Id</param>
        /// <returns>true 审核成功 false 不能审核</returns>
        public bool Audit(FlowEngine flowEngine, AuditType auditType, string auditDesc, int userId)
        {
            using (AppBLL bll = new AppBLL())
            {
                Participant participant = null;
                Conclusion conclusion = null;
                IList<FunctionEntity> userFuncs = bll.FillList<FunctionEntity>("Usp_Funcs_ByUser", new { UserId = userId });
                foreach (var userFunc in userFuncs)
                {
                    participant = new Participant() { Category = 1, Department = -1, Reference = (long)userFunc.Id };
                    conclusion = new Conclusion(auditType, (long)userId, DateTime.Now) { Description = auditDesc };
                    if (flowEngine.Audit(conclusion, participant))
                    {
                        return true;
                    }
                }

                participant = new Participant() { Category = 0, Department = userId, Reference = -1 };
                conclusion = new Conclusion(auditType, userId, DateTime.Now) { Description = auditDesc };
                if (flowEngine.Audit(conclusion, participant))
                {
                    return true;
                }
            }
            return false;
        }
 /// <summary>
 /// 执行审核
 /// </summary>
 /// <param name="conclusion">审核结论</param>
 /// <param name="participant">参与者</param>
 /// <returns>true 审核 false 未审</returns>
 public virtual bool Audit(Conclusion conclusion, Participant participant)
 {
     bool result = false;
     IList<Node> nodes = this.GetCurrent();
     foreach (var node in nodes)
     {
         if (node.Audit(conclusion, participant))
         {
             result = true;
         }
     }
     return result;
 }