Beispiel #1
0
        private void CreateParameters(ITransactionScope transactionScope, RunnedWorkflow runnedWorkflow, Event eventInformation)
        {
            var reader = JsonParser.GetJsonSerializer().Deserialize<Dictionary<string, string>>(eventInformation.Data);

            _parameterRepository.Save(transactionScope, _parameterRepository.Create(runnedWorkflow, "EventParameter", "Client", eventInformation.Client.Name));
            _parameterRepository.Save(transactionScope, _parameterRepository.Create(runnedWorkflow, "EventParameter", "EventGroupType", eventInformation.EventGroupType));
            _parameterRepository.Save(transactionScope, _parameterRepository.Create(runnedWorkflow, "EventParameter", "EventType", eventInformation.EventType));

            foreach (var row in reader)
            {
                var parameter = _parameterRepository.Create(runnedWorkflow, "EventParameter", row.Key, row.Value);

                _parameterRepository.Save(transactionScope, parameter);
            }
        }
Beispiel #2
0
        private List<RunnedWorkflowStep> CreateRunnedWorkflowSteps(ITransactionScope transactionScope, IList<DefinedWorkflowStep> workflowSteps, RunnedWorkflow runnedWorkflow)
        {
            var runnedWorkflowSteps = new List<RunnedWorkflowStep>();

            foreach (var definedWorkflowStep in workflowSteps)
            {
                var runnedWorkflowStep = _runnedWorkflowStepRepository.Create();
                runnedWorkflowStep.RunnedWorkflow = runnedWorkflow;
                runnedWorkflowStep.DefinedWorkflowStep = definedWorkflowStep;
                runnedWorkflowStep.RunnedTask = CreateRunnedTask(transactionScope, definedWorkflowStep.DefinedTask);

                _runnedWorkflowStepRepository.Save(transactionScope, runnedWorkflowStep);

                runnedWorkflowSteps.Add(runnedWorkflowStep);
            }

            return runnedWorkflowSteps;
        }
Beispiel #3
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;
 }
Beispiel #4
0
        private void CreateRunnedNextWorkflowSteps(ITransactionScope transactionScope,
                                                   IList<DefinedNextWorkflowStep> nextWorkflowSteps, 
                                                   RunnedWorkflow runnedWorkflow,
                                                   List<RunnedWorkflowStep> runnedWorkflowSteps)
        {
            foreach (var definedNextWorkflowStep in nextWorkflowSteps)
            {
                var runnedNextWorkflowStep = _runnedNextWorkflowStepRepository.Create();
                runnedNextWorkflowStep.RunnedWorkflow = runnedWorkflow;
                runnedNextWorkflowStep.DefinedNextWorkflowStep = definedNextWorkflowStep;

                if (definedNextWorkflowStep.NextStep == null)
                {
                    runnedNextWorkflowStep.NextStep = null;
                }
                else
                {
                    runnedNextWorkflowStep.NextStep =
                        runnedWorkflowSteps.Where(rws => rws.DefinedWorkflowStep == definedNextWorkflowStep.NextStep).Single();
                }

                if (definedNextWorkflowStep.PreviousStep == null)
                {
                    runnedNextWorkflowStep.PreviousStep = null;
                }
                else
                {
                    runnedNextWorkflowStep.PreviousStep =
                        runnedWorkflowSteps.Where(rws => rws.DefinedWorkflowStep == definedNextWorkflowStep.PreviousStep).Single();
                }

                _runnedNextWorkflowStepRepository.Save(transactionScope, runnedNextWorkflowStep);
            }
        }