/// <summary>
        /// 增加会签
        /// </summary>
        /// <param name="flowEngine">流程</param>
        /// <param name="funcEntry"></param>        
        /// <param name="users"></param>
        private static void AddCountersign(FlowEngine flowEngine, FunctionEntity funcEntry, IList<UserEntity> users)
        {
            Step firstStep = flowEngine.FlowSteps.First();
            Step newStep = null;
            foreach (var user in users)
            {
                newStep = new StepGeneral();
                Participant participant = new Participant() { Department = -1, Category = 1, Reference = (long)funcEntry.Id };
                newStep.Add(new Node(funcEntry.C_Name, participant) { Description = funcEntry.C_Name });

                flowEngine.AddAfter(firstStep, newStep);
                firstStep = newStep;
            }
        }
 /// <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="NodeCondition"/> class.
 /// </summary>        
 /// <param name="name">节点名称</param>
 /// <param name="participant">参与者</param>
 /// <param name="key">关注的消息键值</param>
 public NodeCondition(string name, Participant participant)
     : base(name, participant)
 {            
 }
        /// <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;
 } 
 /// <summary>
 /// 是否允许审核
 /// </summary>
 /// <param name="participant">参与者</param>
 /// <returns>true 允许 false 不允许</returns>
 public virtual bool CanAudit(Participant participant)
 {
     var nodes = from node in this.nodes
                 where node.CanAudit(participant)
                 select node;
     return nodes.Any();
 }
 public Node FindByParticipant(Participant p)
 {
     var nodes = from node in this.nodes
                 where node.CanAudit(p)
                 select node;
     return nodes.Any() ? nodes.First() : null;
 }