public override async Task <IProcessFlowResponse> Advance(IProcessFlowArgument argument) { var userInfo = _userAppService.GetUserInfoByExecutionId(argument.Execution.Id); TraceFlow(argument); if (!argument.IsSubmitting) { var step = (StepDetail)GetCurrentStep(argument); return(new AdditionalInformationResponse { UserInfoDto = userInfo, Execution = argument.Execution, Action = step.Action, ActionMethod = step.ActionMethod, Controller = step.Controller, FriendlyUrl = (step.PageName + "/" + step.SectionName).Replace(" ", "-"), ResponseDetail = new ResponseDetailFlow { Status = ReponseStatus.Success } }); } Console.WriteLine("Submitting form...Guardando campos"); argument.IsSubmitting = false; return(await OnSuccess(argument).Result.Advance(argument)); }
public override async Task <IProcessFlowResponse> Advance(IProcessFlowArgument argument) { if (argument == null) { throw new ArgumentNullException(nameof(argument)); } var userInfo = _userAppService.GetUserInfoByExecutionId(argument.Execution.Id); var data = await Task.Factory.StartNew(() => JsonConvert.DeserializeObject <WsMotorServiceResponse>(userInfo.ResponseWsMotor)).ConfigureAwait(false); userInfo.ClassificationWsMotor = data.ScoresMotor.ScoreMotor.Classification == "A" ? Classification.Approved.GetStringValue() : Classification.Declined.GetStringValue(); TraceFlow(argument); var step = (StepDetail)GetCurrentStep(argument); return(new AdditionalInformationResponse { UserInfoDto = userInfo, Execution = argument.Execution, Action = step.Action, ActionMethod = step.ActionMethod, Controller = step.Controller, FriendlyUrl = (step.PageName + "/" + step.SectionName).Replace(" ", "-"), ResponseDetail = new ResponseDetailFlow { Status = ReponseStatus.Success } }); }
public override async Task <IProcessFlowResponse> Advance(IProcessFlowArgument argument) { if (argument == null) { throw new ArgumentNullException(nameof(argument)); } var userInfo = _userAppService.GetUserInfoByExecutionId(argument.Execution.Id); await Task.Factory.StartNew(() => TraceFlow(argument)).ConfigureAwait(false); var step = await Task.Factory.StartNew(() => (StepDetail)GetCurrentStep(argument)).ConfigureAwait(false); var response = new EvidenteResponse { UserInfoDto = userInfo, ErrorEvidenteResponse = new ErrorEvidenteResponse { Title = "Error", Message = "Lo sentimos", Code = 500 }, Execution = argument.Execution, Action = step.Action, ActionMethod = step.ActionMethod, Controller = step.Controller, FriendlyUrl = (step.PageName + "/" + step.SectionName).Replace(" ", "-"), ResponseDetail = new ResponseDetailFlow { Status = ReponseStatus.Success } }; return(Task.FromResult((IProcessFlowResponse)response).Result); }
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); } }
public override async Task <IProcessFlowResponse> Advance(IProcessFlowArgument argument) { //Obtener respuesta de WsMotor var userInfo = _userRepository.GetUserInfoByExecutionId(argument.Execution.Id); var data = JsonConvert.DeserializeObject <WsMotorServiceResponse>(userInfo.ResponseWsMotor); userInfo.ClassificationWsMotor = data.ScoresMotor.ScoreMotor.Classification == "A" ? Classification.Approved.GetStringValue() : Classification.Declined.GetStringValue(); TraceFlow(argument); var step = (StepDetail)GetCurrentStep(argument); if (!argument.IsSubmitting) { return(new RequestResponse { Name = userInfo.Names, UserInfoDto = userInfo, Execution = argument.Execution, Action = step.Action, ActionMethod = step.ActionMethod, Controller = step.Controller, FriendlyUrl = (step.PageName + "/" + step.SectionName).Replace(" ", "-"), ResponseDetail = new ResponseDetailFlow { Status = ReponseStatus.Success } }); } Console.WriteLine("Submitting form...Guardando campos"); argument.IsSubmitting = false; return(await OnSuccess(argument).Result.Advance(argument)); }
public StepFlow GetNextStep(IProcessFlowArgument argument, StepType stepType) { if (argument == null) { throw new ArgumentNullException(nameof(argument)); } if (!Enum.IsDefined(typeof(StepType), stepType)) { throw new InvalidEnumArgumentException(nameof(stepType), (int)stepType, typeof(StepType)); } productId = argument.Execution.ProductId; var currentstep = GetCurrentStep(argument); if (currentstep != null) { var stepsintorder = Steps .Select((r, i) => new { Row = r, Index = i + 1 }) .OrderBy(x => x.Row.Order); var firstOrDefault = stepsintorder.FirstOrDefault(s => { var orDefault = stepsintorder.FirstOrDefault(d => d.Row.Id == currentstep.Id); return(orDefault != null && s.Index == orDefault.Row.Order + 1); }); return(firstOrDefault != null ? firstOrDefault.Row : Steps.OrderBy(s => s.Order).FirstOrDefault(s => s.Order == currentstep.Order + 1)); } //first Step return(Steps.OrderBy(s => s.Order).FirstOrDefault(s => s.StepType == stepType)); }
public override async Task <IProcessFlowResponse> Advance(IProcessFlowArgument argument) { var userInfo = _userAppService.GetUserInfoByExecutionId(argument.Execution.Id); var wsMotorRequest = _wsMotorRequestSettingsBuilder.WithIdentificaction(userInfo.Identification) .WithExecutionId(argument.Execution.Id) .WithLastName(userInfo.LastName) .WithTypeIdentification("1") .WithParamsRequest(new List <Parameter> { new Parameter { Type = "T", Name = "Ingresos", Value = userInfo.Income } }).Build(); var response = _wsMotorAppService.Validate(wsMotorRequest); if (response.ScoresMotor.ScoreMotor.Classification == "A") { var saveFieldsAppService = argument as ProcessFlowArgument; saveFieldsAppService?.Form.Add(new FieldValueOrder { Key = "30", Value = "Aprobada" }); _saveFieldsAppService.SaveForm(saveFieldsAppService); return(await OnSuccess(argument).Result.Advance(argument)); } return(await OnError(argument).Result.Advance(argument)); }
public override async Task <IProcessFlowResponse> Advance(IProcessFlowArgument argument) { if (argument == null) { throw new ArgumentNullException(nameof(argument)); } var userInfo = _userAppService.GetUserInfoByExecutionId(argument.Execution.Id); var mock = bool.Parse(ConfigurationManager.AppSettings.Get("Mock")); if (!mock) { var arg = argument as IAnswerQuestionArgument; var settings = _answerSettingsBuilder.WithIdentification(userInfo.Identification) .WithAnswerRequest(arg.AnswerRequest) .WithIdentificationType("1") .WithExecutionId(argument.Execution.Id) .Build(); var response = _evidenteAppService.AnswerQuestions(settings); if (!response.Result) { return(await OnError(argument).Result.Advance(argument)); } if (response.Approval) { return(await OnSuccess(argument).Result.Advance(argument)); } return(await OnError(argument).Result.Advance(argument)); } return(await OnSuccess(argument).Result.Advance(argument)); }
public void TrackingStep(IProcessFlowArgument argument) { if (argument == null) { throw new ArgumentNullException(nameof(argument)); } Console.WriteLine($"Entra al Paso " + argument.Execution.CurrentStepId); }
public StepFlow StepDetail(IProcessFlowArgument argument) { if (argument == null) { throw new ArgumentNullException(nameof(argument)); } return(_processAppService.GetCurrentStepDetailByExecutionId(argument.Execution.Id)); }
public StepFlow GetCurrentStep(IProcessFlowArgument argument) { if (argument == null) { throw new ArgumentNullException(nameof(argument)); } productId = argument.Execution.ProductId; return(Steps.FirstOrDefault(s => s.Id == argument.Execution.CurrentStepId)); }
public override async Task <IProcessFlowResponse> StartFlow(IProcessFlowArgument arg) { if (arg == null) { throw new ArgumentNullException(nameof(arg)); } arg.Steps = Steps; InitializeArgument(arg); return(await base.StartFlow(arg).ConfigureAwait(false)); }
public async Task <StepFlow> GetNextStepAsync(IProcessFlowArgument argument, StepType stepType, CancellationToken cancellationToken = default(CancellationToken)) { if (argument == null) { throw new ArgumentNullException(nameof(argument)); } if (!Enum.IsDefined(typeof(StepType), stepType)) { throw new InvalidEnumArgumentException(nameof(stepType), (int)stepType, typeof(StepType)); } return(await Task.FromResult(Steps.First(s => s.Id == argument.Execution.CurrentStepId && s.StepType == stepType)).ConfigureAwait(false)); }
public BaseController(IProcessFlowArgument processFlowArgument, IProcessFlowManager processFlowManager) { if (processFlowArgument == null) { throw new ArgumentNullException(nameof(processFlowArgument)); } if (processFlowManager == null) { throw new ArgumentNullException(nameof(processFlowManager)); } ProcessFlowArgument = processFlowArgument; _processFlowManager = processFlowManager; }
public override async Task <IProcessFlowResponse> Advance(IProcessFlowArgument argument) { var user = _userAppService.GetUserInfoByExecutionId(argument.Execution.Id); _notificationSmsAppService.SendSms(user.Cellphone, $"Colpatria informa que usted realizo la solicitud #{user.SimpleId} a traves de oficina virtual", argument.Execution.Id); /*_inalambriaAppService.SendSms(user.Cellphone, * "Colpatria informa que usted realizo la solicitud #" + user.SimpleId + * " a traves de oficina virtual", "1", argument.Execution.Id); */ return(await OnSuccess(argument).Result.Advance(argument).ConfigureAwait(false)); }
public bool SaveForm(IProcessFlowArgument arg) { const bool response = true; var submitFormArgument = arg as ProcessFlowArgument; if (submitFormArgument != null) { _extendedFieldRepository.SetFields( submitFormArgument.Form.ToList(), submitFormArgument.Execution.Id); } else { throw new Exception(); } return(response); }
public void SetNextStep(IProcessFlowArgument argument, StepType stepType) { if (argument == null) { throw new ArgumentNullException(nameof(argument)); } if (!Enum.IsDefined(typeof(StepType), stepType)) { throw new InvalidEnumArgumentException(nameof(stepType), (int)stepType, typeof(StepType)); } var nextStepWithType = _processAppService.GetNextStepWithType(argument.Execution.CurrentStepId, argument.Execution.CurrentSectionId, argument.Execution.ProcessId, (int)stepType); argument.Execution.CurrentSectionId = nextStepWithType.SectionId; argument.Execution.CurrentStepId = nextStepWithType.Id; _processAppService.UpdateExecution((Execution)argument.Execution); }
public override async Task <IProcessFlowResponse> Advance(IProcessFlowArgument argument) { var userInfo = _userAppService.GetUserInfoByExecutionId(argument.Execution.Id); var data = JsonConvert.DeserializeObject <WsMotorServiceResponse>(userInfo.ResponseWsMotor); userInfo.ClassificationWsMotor = data.ScoresMotor.ScoreMotor.Classification == "A" ? Classification.Approved.GetStringValue() : Classification.Declined.GetStringValue(); TraceFlow(argument); var email = EmailMessage(userInfo); TraceFlow(argument); for (var i = 0; i < 2; i++) { if (_mailAppService.SendMail(email)) { break; } } return(await OnSuccess(argument).Result.Advance(argument)); }
public HomeController(IProcessFlowArgument processFlowArgument, IProcessFlowManager processFlowManager, ILoggingAppService loggingAppService) : base(processFlowArgument, processFlowManager) { _loggingAppService = loggingAppService; }
public MessagesController(IProcessFlowArgument processFlowArgument, IProcessFlowManager processFlowManager) : base(processFlowArgument, processFlowManager) { //Default CTOR }
public override async Task <IProcessFlowResponse> Advance(IProcessFlowArgument argument) { _saveFieldsAppService.SaveForm(argument); return(await OnSuccess(argument).Result.Advance(argument)); }
public override async Task <IProcessFlowResponse> Advance(IProcessFlowArgument argument) { TraceFlow(argument); if (!argument.IsSubmitting) { var userInfo = _userAppService.GetUserInfoByExecutionId(argument.Execution.Id); var validationSettings = _validateUserSettingsBuilder.WithIdentification(userInfo.Identification) .WithTypeOfDocument("1") .WithLastName(userInfo.LastName) .WithSecondLastName(userInfo.SecondLastName) .WithExpeditionDate(userInfo.DateOfExpedition) .WithNames(userInfo.Names) .WithExecutionId(argument.Execution.Id) .Build(); //validate User var validationResponse = _evidenteAppService.Validate(validationSettings); if (!validationResponse.Success) { return(await OnError(argument).Result.Advance(argument)); } //calll WS var questionsResponse = _evidenteAppService.GetQuestions(_questionsSettingsBuilder.WithDocumentNumber(userInfo.Identification) .WithTypeOfDocument("1") .WithValidationNumber(validationResponse.ValidationNumber) .WithExecutionId(argument.Execution.Id) .Build()); //validate response if (questionsResponse.MaximumAttemptsPerDay) { return(await OnError(argument).Result.Advance(argument)); } if (questionsResponse.MaximumAttemptsPerMonth) { return(await OnError(argument).Result.Advance(argument)); } if (questionsResponse.MaximumAttemptsPerYear) { return(await OnError(argument).Result.Advance(argument)); } var step = (StepDetail)GetCurrentStep(argument); return(new EvidenteResponse { UserInfoDto = userInfo, Execution = argument.Execution, QuestionsResponse = questionsResponse, Action = step.Action, ActionMethod = step.ActionMethod, Controller = step.Controller, FriendlyUrl = (step.PageName + "/" + step.SectionName).Replace(" ", "-"), ResponseDetail = new ResponseDetailFlow { Status = ReponseStatus.Success } }); } Console.WriteLine("Submitting form...Guardando campos"); argument.IsSubmitting = false; return(await OnSuccess(argument).Result.Advance(argument)); }
public void MakeCustomProcess(IProcessFlowArgument stepArgument) { _saveFieldsAppService.SaveForm(stepArgument); }
public RequestController(IProcessFlowArgument processFlowArgument, IProcessFlowManager processFlowManager, IUserAppService userAppService) : base(processFlowArgument, processFlowManager) { _userAppService = userAppService; }
public override Task <IProcessFlowResponse> AdvanceAsync(IProcessFlowArgument argument, CancellationToken cancellationToken = new CancellationToken()) { throw new NotImplementedException(); }
public override async Task <IProcessFlowResponse> Advance(IProcessFlowArgument argument) { MakeCustomProcess(argument); argument.IsSubmitting = false; return(await OnSuccess(argument).Result.Advance(argument)); }