Beispiel #1
0
        public async Task <Result <Note> > Handle(CreateNoteRequest request, CancellationToken cancellationToken = default)
        {
            var invoice = await _invoicesRepository.Get(request.InvoiceId);

            var note = invoice.AddNote(request.Text, request.User.GetIdentity());

            await _notesRepository.Create(note);

            return(note);
        }
Beispiel #2
0
        public void ApproveInvoice(Guid invoiceId, string ownerId)
        {
            Invoices invoice       = invRepo.Get(invoiceId, ownerId);
            string   invoiceNumber = gen.GenerateInvoiceNumber(invoice.InvoiceDate, ownerId);

            if (invoice.Status != InvoiceStatus.DRAFT)
            {
                throw new Exception(String.Format("Status invoice '{0}' harus {1} sebelum dilakukan ganti status. Sedangkan status saat ini adalah {2}", invoice.InvoiceNo, InvoiceStatus.DRAFT, invoice.Status));
            }
            invoice.InvoiceNo = invoiceNumber;
            invoice.InvoiceStatusBelumBayar();
            invRepo.UpdateInvoices(invoice);

            if (bus != null)
            {
                bus.Publish(new InvoiceApproved {
                    InvoiceJson = invoice.ToJson <Invoices>()
                });
            }
        }
Beispiel #3
0
 public async Task <bool> ValidateExists(CreateNoteRequest request, CancellationToken cancellationToken) => await _invoicesRepository.Get(request.InvoiceId) != null;
Beispiel #4
0
 public Invoices Get(Int64 ixInvoice) => _invoicesRepository.Get(ixInvoice);