Пример #1
0
        //===================================================================================
        public void Submit(
            FuelReportState entityNewState,
            IVoyageDomainService voyageDomainService,
            IFuelReportDomainService fuelReportDomainService,
            IInventoryOperationDomainService inventoryOperationDomainService,
            IGoodDomainService goodDomainService,
            IOrderDomainService orderDomainService,
            ICurrencyDomainService currencyDomainService,
            IBalanceDomainService balanceDomainService,
            IInventoryManagementDomainService inventoryManagementDomainService,
            IInventoryOperationNotifier inventoryOperationNotifier)
        {
            this.CheckToBeOperational();

            validateSubmittingState(
                    voyageDomainService,
                    fuelReportDomainService,
                    inventoryOperationDomainService,
                    goodDomainService,
                    orderDomainService,
                    currencyDomainService,
                    inventoryManagementDomainService);

            sendDataToBalancingDomainService(balanceDomainService);

            if (this.FuelReportType == FuelReportTypes.EndOfVoyage ||
                this.FuelReportType == FuelReportTypes.EndOfYear ||
                this.FuelReportType == FuelReportTypes.EndOfMonth)
            {
                var inventoryResult = inventoryOperationNotifier.NotifySubmittingFuelReportConsumption(this);

                this.ConsumptionInventoryOperations.Add(inventoryResult);
            }
            else
            {
                foreach (var fuelReportDetail in this.FuelReportDetails)
                {
                    var inventoryResult = inventoryOperationNotifier.NotifySubmittingFuelReportDetail(fuelReportDetail, fuelReportDomainService);

                    if (inventoryResult != null)
                        fuelReportDetail.InventoryOperations.AddRange(inventoryResult);
                }

            }

            setEntityState(entityNewState);
        }