コード例 #1
0
        /// <summary>
        /// 动态获取路线,根据决策节点设置条件表达式,自动去判断流转的路线
        /// </summary>
        /// <returns>路线</returns>
        public Transition GetTransition()
        {
            Command        command = GetExecuteCmd();
            WorkflowConfig config  = WorkflowConfig.GetInstance(command.ID);

            IDbConnection connection = DapperFactory.CreateConnection(config.ProviderName, config.ConnectionString);

            try
            {
                DataTable resultSet = new DataTable(Guid.NewGuid().ToString());
                using (IDataReader reader = connection.ExecuteReader(command.Text, new { InstanceID = InstanceID }))
                {
                    resultSet.Load(reader);
                    reader.Close();
                }
                Transition        instance    = null;
                List <Transition> transitions = QueryWorkflowNode(NID);
                if (resultSet.Rows.Count > 0)
                {
                    foreach (Transition transition in transitions)
                    {
                        if (resultSet.Select(transition.Expression).Length > 0)
                        {
                            instance = transition;
                            break;
                        }
                    }
                }
                return(instance);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #2
0
 /// <summary>
 /// 获取配置
 /// </summary>
 /// <returns></returns>
 public List <WorkflowConfig> GetSettings()
 {
     return(WorkflowConfig.GetSettings());
 }