Ejemplo n.º 1
0
 private RunnedWorkflowDto TranslateToDto(RunnedWorkflow runnedWorkflow)
 {
     var runnedWorkflowDto = new RunnedWorkflowDto
                                 {
                                     Id = runnedWorkflow.Id,
                                     WorkflowSteps = runnedWorkflow.WorkflowSteps.Select(TranslateToDto).ToList(),
                                     NextWorkflowSteps = runnedWorkflow.NextWorkflowSteps.Select(TranslateToDto).ToList(),
                                     Parameters = runnedWorkflow.Parameters.Select(TranslateToDto).ToList(),
                                 };
     return runnedWorkflowDto;
 }
Ejemplo n.º 2
0
 private void ExecuteWorkflow(RunnedWorkflowDto runnedWorkflowDto)
 {
     ExecuteStepsAfterStep(runnedWorkflowDto, null);
 }
Ejemplo n.º 3
0
 private IEnumerable<RunnedNextWorkflowStepDto> GetStepsAfterStep(RunnedWorkflowDto runnedWorkflowDto, int? currentStepId)
 {
     return runnedWorkflowDto.NextWorkflowSteps.Where(nws => nws.PreviousStepId == currentStepId);
 }
Ejemplo n.º 4
0
        private void ExecuteStepsAfterStep(RunnedWorkflowDto runnedWorkflowDto, int? currentStepId)
        {
            var nextSteps2Execute = GetStepsAfterStep(runnedWorkflowDto, currentStepId).ToList();

            foreach (var runnedNextWorkflowStepDto in nextSteps2Execute)
            {
                var step2Execute =
                    runnedWorkflowDto.WorkflowSteps.Where(ws => ws.Id == runnedNextWorkflowStepDto.NextStepId).SingleOrDefault();
                if (step2Execute == null)
                {
                    continue;
                }

                ExecuteStep(step2Execute, runnedWorkflowDto.Parameters);
            }

            foreach (var runnedNextWorkflowStepDto in nextSteps2Execute)
            {
                if (runnedNextWorkflowStepDto.NextStepId != null)
                {
                    ExecuteStepsAfterStep(runnedWorkflowDto, runnedNextWorkflowStepDto.NextStepId.Value);
                }
            }
        }