示例#1
0
 /// <summary>
 /// 获取开始节点
 /// </summary>
 /// <returns></returns>
 public WfNodeInfo GetStartNode()
 {
     try
     {
         WfNodeInfo startnode = null;
         foreach (var node in wfSchemeModel.nodes)
         {
             if (node.type == "startround")
             {
                 startnode = node;
             }
         }
         return(startnode);
     }
     catch (Exception ex)
     {
         if (ex is ExceptionEx)
         {
             throw;
         }
         else
         {
             throw ExceptionEx.ThrowBusinessException(ex);
         }
     }
 }
示例#2
0
        /// <summary>
        /// 寻找到下一个节点
        /// </summary>
        /// <param name="nodeId">当前Id</param>
        /// <param name="transportType">流转类型1.同意2.不同意3.超时</param>
        /// <returns></returns>
        public List <WfNodeInfo> GetNextNodes(string nodeId, WfTransportType transportType)
        {
            try
            {
                List <WfNodeInfo> nextNodes = new List <WfNodeInfo>();
                // 找到与当前节点相连的线条
                foreach (var line in wfSchemeModel.lines)
                {
                    if (line.from == nodeId)
                    {
                        bool isOk = false;
                        switch (transportType)
                        {
                        case WfTransportType.Agree:
                            if (line.wftype == 1 || line.wftype == 4 || line.wftype == 6)
                            {
                                isOk = true;
                            }
                            break;

                        case WfTransportType.Disagree:
                            if (line.wftype == 2 || line.wftype == 5 || line.wftype == 6)
                            {
                                isOk = true;
                            }
                            break;

                        case WfTransportType.Overtime:
                            if (line.wftype == 3 || line.wftype == 4 || line.wftype == 5)
                            {
                                isOk = true;
                            }
                            break;
                        }
                        if (isOk)
                        {
                            WfNodeInfo nextNode = nodesMap[line.to];
                            if (nextNode != null)
                            {
                                nextNodes.Add(nextNode);
                            }
                        }
                    }
                }
                return(nextNodes);
            }
            catch (Exception ex)
            {
                if (ex is ExceptionEx)
                {
                    throw;
                }
                else
                {
                    throw ExceptionEx.ThrowBusinessException(ex);
                }
            }
        }