public async Task <IActionResult> Post(Owner.Type ownerType, bool force, [FromBody] PaymentUseDto useDto) { var paymentUse = _mapper.Map <PaymentUseDto, PaymentUse>(useDto); _executor.GetCommand <CreatePaymentUseHandler>().Process(c => c.Execute(ownerType, paymentUse, force)); PaymentInvoice paymentInvoice = null; if (paymentUse.PaymentInvoiceId.HasValue) { paymentInvoice = await _executor.GetQuery <GetPaymentInvoiceByIdQuery>() .Process(q => q.ExecuteAsync(paymentUse.PaymentInvoiceId.Value)); } switch (ownerType) { case Owner.Type.Request: var requestId = paymentInvoice?.RequestId; NiisWorkflowAmbientContext.Current.RequestWorkflowService.Process(new RequestWorkFlowRequest { RequestId = requestId ?? 0, PaymentInvoiceId = paymentInvoice?.Id, IsAuto = true }); await Executor.GetHandler <UnsetRequestFormalExamNotPaidHandler>().Process(h => h.ExecuteAsync(requestId ?? 0, paymentInvoice)); //await Executor.GetHandler<GenerateAutoNotificationHandler>().Process(h => h.Execute(requestId ?? 0)); break; case Owner.Type.ProtectionDoc: if (DicTariff.Codes.GetProtectionDocSupportCodes().Contains(paymentInvoice?.Tariff?.Code) || paymentInvoice?.Tariff?.Code == DicTariff.Codes.ProtectionDocRestore) { var protectionDoc = await Executor.GetQuery <GetProtectionDocByIdQuery>().Process(q => q.ExecuteAsync(paymentInvoice?.ProtectionDocId ?? 0)); if (protectionDoc != null) { protectionDoc.MaintainDate = protectionDoc.MaintainDate?.AddYears(paymentInvoice?.TariffCount ?? 1) ?? DateTimeOffset.Now.AddYears(paymentInvoice?.TariffCount ?? 1); await Executor.GetCommand <UpdateProtectionDocCommand>().Process(c => c.ExecuteAsync(protectionDoc.Id, protectionDoc)); } } NiisWorkflowAmbientContext.Current.ProtectionDocumentWorkflowService.Process(new ProtectionDocumentWorkFlowRequest { ProtectionDocId = paymentInvoice?.ProtectionDocId ?? 0, IsAuto = true }); break; case Owner.Type.Contract: NiisWorkflowAmbientContext.Current.ContractWorkflowService.Process(new ContractWorkFlowRequest { ContractId = paymentInvoice?.ContractId ?? 0, IsAuto = true }); break; } return(Ok(_mapper.Map <PaymentUse, PaymentUseDto>(paymentUse))); }
protected override dynamic GetInternal(Dictionary <string, object> parameters) { PaymentUseDto paymentUseDto = parameters["PaymentUse"] as PaymentUseDto; if (paymentUseDto is null) { return(string.Empty); } return(paymentUseDto.ServiceName ?? string.Empty); }
protected override dynamic GetInternal(Dictionary <string, object> parameters) { PaymentUseDto paymentUse = parameters["PaymentUse"] as PaymentUseDto; if (paymentUse is null) { return(string.Empty); } return(paymentUse.EmployeeCheckoutPaymentName ?? string.Empty); }
protected override dynamic GetInternal(Dictionary <string, object> parameters) { PaymentUseDto paymentUse = parameters["PaymentUse"] as PaymentUseDto; if (paymentUse is null) { return(string.Empty); } return(paymentUse.PaymentId?.ToString() ?? string.Empty);; //TODO: Выяснить, что туда ставить. }
protected override dynamic GetInternal(Dictionary <string, object> parameters) { PaymentUseDto paymentUse = parameters["PaymentUse"] as PaymentUseDto; if (paymentUse is null) { return(string.Empty); } return(paymentUse.PaymentUseDate.ToTemplateDateFormat()); }
protected override dynamic GetInternal(Dictionary <string, object> parameters) { PaymentUseDto paymentUse = parameters["PaymentUse"] as PaymentUseDto; if (paymentUse is null) { return(string.Empty); } return(paymentUse.Amount.ToString()); }
protected override dynamic GetInternal(Dictionary <string, object> parameters) { PaymentUseDto paymentUse = parameters["PaymentUse"] as PaymentUseDto; if (paymentUse is null) { return(string.Empty); } return(paymentUse.RequestNumber ?? (paymentUse.ProtectionDocNumber ?? paymentUse.ContractNumber) ?? string.Empty); }
public async Task <IActionResult> Post(Owner.Type ownerType, [FromBody] PaymentUseDto useDto) { var result = await _mediator.Send(new Features.Payment.Uses.Create.Command(useDto, ownerType)); return(Ok(result)); }
protected override dynamic GetInternal(Dictionary <string, object> parameters) { PaymentUseDto paymentUse = parameters["PaymentUse"] as PaymentUseDto; return(paymentUse?.PaymentAmount is null ? string.Empty : paymentUse.PaymentAmount.ToString()); }