示例#1
0
        public Result<object> Process(Sale sale, IEnvelopeContext context)
        {
            var envelopeBuilder = new OrderEnvelopeBuilder(sale,
                new MainOrderEnvelopeBuilder(context,
                new ExternalDocRefEnvelopeBuilder(context,
                new PaymentNoteEnvelopeBuilder(context,
                new OutletVisitNoteEnvelopeBuilder(context)))));

            return new Transactor(database).Transact(() =>
            {
                envelopeBuilder.Build().ForEach(e => envelopeRouter.RouteCommandEnvelope(e));
                sale.OrderReference = context.OrderSaleReference();
                sale.ConfirmNewPayments();
                sale.ProcessingStatus = ProcessingStatus.Submitted;
                saleRepository.Save(sale);
            });
        }
示例#2
0
        public Result<object> Process(Sale sale, IEnvelopeContext context)
        {

            var envelopeBuilder = new SaleEnvelopeBuilder(sale,
                new MainOrderEnvelopeBuilder(context,
                new CloseOrderEnvelopeBuilder(context,
                new ExternalDocRefEnvelopeBuilder(context,
                new DispatchNoteEnvelopeBuilder(context,
                new InvoiceEnvelopeBuilder(context,
                new PaymentNoteEnvelopeBuilder(context,
                new ReceiptEnvelopeBuilder(context,
                new InventoryAdjustmentNoteEnvelopeBuilder(context, inventoryRepository,
                new OutletVisitNoteEnvelopeBuilder(context))))))))));

            return new Transactor(database).Transact(() =>
            {
                envelopeBuilder.Build().ForEach(e => envelopeRouter.RouteCommandEnvelope(e));
                inventoryRepository.AdjustInventoryForSale(sale);
                sale.OrderReference = context.OrderSaleReference();
                sale.ConfirmNewPayments();
                sale.ProcessingStatus = ProcessingStatus.Confirmed;
                saleRepository.Save(sale);
            });
        }