示例#1
0
        public ExecutionSummary Execute()
        {
            var executionSummary = new ExecutionSummary();

            if (Validators != null)
            {
                foreach (var validator in Validators)
                {
                    executionSummary.ValidationMessages.AddRange(validator.Validate(WorkflowBatch));
                }
            }

            foreach (var workflow in WorkflowBatch.Workflows)
            {
                if (StartProcessWorkflow != null)
                {
                    StartProcessWorkflow(this, new ProcessWorkflowEventArgs(workflow));
                }

                var result = new ExecutionResult
                {
                    WorkflowName = workflow.Name,
                    ExecutedTasks = new List<String>()
                };

                if (ProcessWorkflow != null)
                {
                    ProcessWorkflow(this, new ProcessWorkflowEventArgs(workflow));
                }

                foreach (var workflowTask in workflow.Tasks)
                {
                    result.ExecutedTasks.Add(workflowTask.Name);

                    foreach (var workflowParameter in workflowTask.Parameters)
                    {

                    }

                    System.Threading.Thread.Sleep(workflowTask.Delay);
                }

                if (EndProcessWorkflow != null)
                {
                    EndProcessWorkflow(this, new ProcessWorkflowEventArgs(workflow));
                }

                result.Succeeded = true;

                executionSummary.Results.Add(result);
            }

            return executionSummary;
        }
示例#2
0
        public IEnumerable<ExecutionResult> ExecuteWorkflows()
        {
            foreach (var workflow in WorkflowBatch.Workflows)
            {
                if (StartProcessWorkflow != null)
                {
                    StartProcessWorkflow(this, new ProcessWorkflowEventArgs(workflow));
                }

                var result = new ExecutionResult
                {
                    WorkflowName = workflow.Name,
                    ExecutedTasks = new List<String>()
                };

                if (ProcessWorkflow != null)
                {
                    ProcessWorkflow(this, new ProcessWorkflowEventArgs(workflow));
                }

                foreach (var workflowTask in workflow.Tasks)
                {
                    result.ExecutedTasks.Add(workflowTask.Name);

                    foreach (var workflowParameter in workflowTask.Parameters)
                    {

                    }

                    System.Threading.Thread.Sleep(workflowTask.Delay);
                }

                if (EndProcessWorkflow != null)
                {
                    EndProcessWorkflow(this, new ProcessWorkflowEventArgs(workflow));
                }

                result.Succeeded = true;

                yield return result;
            }
        }