public void SubmitInvoice( IInvoiceItemDomainService invoiceItemDomainService, IBalanceDomainService balanceDomainService, IInventoryOperationNotifier inventoryOperationNotifier) { // CheckInvoiceAnyInvoiceItem(); if (OrderRefrences == null) throw new BusinessRuleException("", "Reference not Set"); var c = new CalculateChangeInOrderBlance(invoiceItemDomainService, balanceDomainService); var orderItemsBalances = c.Process(this, this.InvoiceItems, this.OrderRefrences); foreach (var orderItemsBalance in orderItemsBalances) { var inventoryResult = inventoryOperationNotifier.NotifySubmittingOrderItemBalance(orderItemsBalance); if (inventoryResult == null) throw new InvalidOperation("SubmitInvoiceOrderItemBalance", "Submit the OrderItemBalance of Invoice to Inventory resulted to an error."); orderItemsBalance.InventoryOperation = inventoryResult; } State = States.Submitted; }