Esempio n. 1
0
        public async Task <IActionResult> AddInvoice([FromBody] AddInvoiceViewModel addInvoiceViewModel)
        {
            var command = new AddInvoiceCommand(InvoiceId.New, addInvoiceViewModel.Title);
            await _commandBus.PublishAsync(command, CancellationToken.None);

            return(Ok());
        }
        public async Task Handle(InvoiceReceivedEvent @event)
        {
            try
            {
                var invoice = await _invoiceQuery.GetInvoiceByReferenceId(@event.ReferenceId);

                CommandResult commandResult;
                if (invoice == null)
                {
                    _logger.LogInformation("invoice found.");
                    var invoiceCommand = new AddInvoiceCommand(@event.InvoiceNumber, @event.InvoiceDate, @event.CompanyCode, @event.ReferenceId, @event.InvoiceData);

                    commandResult = await _mediator.Send(invoiceCommand);

                    if (commandResult.IsSuccess)
                    {
                    }
                    else
                    {
                    }
                }
                else
                {
                }

                var invoiceAccepted = new InvoiceAcceptedEvent(@event.ReferenceId, @event.InvoiceData.Id);
                _eventBus.Publish(invoiceAccepted);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Esempio n. 3
0
 public AddInvoiceViewModel(Store store)
 {
     this.store        = store;
     AddInvoiceCommand = new AddInvoiceCommand(this);
     persons           = store.GetAllPersons();
     products          = store.GetAllProducts();
 }
Esempio n. 4
0
        private void CommitChargeCommandExecuted(EventChargeModel obj)
        {
            obj.IsCommited = true;

            if (_event.EventStatus.Name != "Confirmed")
            {
                // If event status is not Confirmed then we can change event status to Confirmed

                bool?dialogResult = null;

                RadWindow.Confirm(new DialogParameters()
                {
                    Owner   = Application.Current.MainWindow,
                    Content = "Would you like to change event status to confirmed?",
                    Closed  = (sender, args) => { dialogResult = args.DialogResult; }
                });

                if (dialogResult == true)
                {
                    _event.EventStatus = _eventStatuses.FirstOrDefault(x => x.Name == "Confirmed");
                }
            }
            AddInvoiceCommand.RaiseCanExecuteChanged();
        }
Esempio n. 5
0
 private void UndoCommitChargeCommandExecuted(EventChargeModel obj)
 {
     obj.IsCommited = false;
     AddInvoiceCommand.RaiseCanExecuteChanged();
 }
Esempio n. 6
0
 public async Task <IActionResult> AddInvoice(AddInvoiceCommand request)
 {
     return(Ok(await _mediator.Send(request)));
 }