示例#1
0
 private void InitializeArgument(IProcessFlowArgument arg)
 {
     if (arg == null)
     {
         throw new ArgumentNullException(nameof(arg));
     }
     if (arg.Execution.ProductId == 0)
     {
         throw new Exception("Falta el Producto!!!");
     }
     if (arg.Execution.Id == 0)
     {
         var stepFlow = (Core.Entities.Process.Step)Store.GetNextStep(arg, StepType.Success);
         var request  = new Execution
         {
             CreateDate    = DateTime.UtcNow,
             IsActive      = true,
             ProcessId     = stepFlow.ProcessId,
             ProductId     = arg.Execution.ProductId,
             SimpleId      = ToolExtension.GenSemiUniqueId(),
             UserId        = arg.User.Id,
             CurrentStepId = stepFlow.Id,
             State         = (int)ExecutionState.Requesting,
             ProductData   = @"{}"
         };
         arg.Execution    = _executionRepository.CreateRequest(request);
         arg.IsSubmitting = true;
     }
     else
     {
         arg.Execution = _executionRepository.GetRequestById(arg.Execution.Id);
     }
 }