public OffhireApplicationService(
            IOffhireFactory offhireFactory,
            IOffhireRepository offhireRepository,
            IUnitOfWorkScope unitOfWorkScope,
            IOffhireDomainService offhireDomainService,
            IEntityConfigurator<Offhire> offhireConfigurator,
            IVesselInCompanyDomainService vesselDomianService,
            IVoyageDomainService voyageDomianService,
            ICompanyDomainService companyDomainService,
            ICurrencyDomainService currencyDomainService,
            IGoodDomainService goodDomainService,
            IGoodUnitDomainService goodUnitDomainService,
            ITankDomainService tankDomainService,
            IActivityLocationDomainService activityLocationDomainService,
            IOffhireManagementSystemDomainService offhireManagementSystemDomainService)
        {
            this.offhireFactory = offhireFactory;
            this.offhireRepository = offhireRepository;
            this.unitOfWorkScope = unitOfWorkScope;

            this.offhireDomainService = offhireDomainService;
            this.vesselDomianService = vesselDomianService;
            this.companyDomainService = companyDomainService;
            this.currencyDomainService = currencyDomainService;
            this.goodDomainService = goodDomainService;
            this.goodUnitDomainService = goodUnitDomainService;
            this.tankDomainService = tankDomainService;
            this.activityLocationDomainService = activityLocationDomainService;
            this.offhireManagementSystemDomainService = offhireManagementSystemDomainService;
            this.voyageDomianService = voyageDomianService;

            this.offhireDomainService.SetConfigurator(offhireConfigurator);
        }
Example #2
0
 public OffhireFactory(
     IEntityConfigurator<Offhire> offhireConfigurator,
     IWorkflowRepository workflowRepository,
     IOffhireDomainService offhireDomainService,
     IVesselInCompanyDomainService vesselDomainService,
     ICompanyDomainService companyDomainService,
     ITankDomainService tankDomainService,
     ICurrencyDomainService currencyDomainService,
     IGoodDomainService goodDomainService,
     IGoodUnitDomainService goodUnitDomainService,
     IOffhireManagementSystemDomainService offhireManagementSystemDomainService,
     IVoyageDomainService voyageDomainService,
     IActivityLocationDomainService activityLocationDomainService)
 {
     this.offhireConfigurator = offhireConfigurator;
     this.workflowRepository = workflowRepository;
     this.offhireDomainService = offhireDomainService;
     this.vesselDomainService = vesselDomainService;
     this.companyDomainService = companyDomainService;
     this.tankDomainService = tankDomainService;
     this.currencyDomainService = currencyDomainService;
     this.goodDomainService = goodDomainService;
     this.goodUnitDomainService = goodUnitDomainService;
     this.offhireManagementSystemDomainService = offhireManagementSystemDomainService;
     this.voyageDomainService = voyageDomainService;
     this.activityLocationDomainService = activityLocationDomainService;
 }
        public CurrencyFacadeService(
              ICurrencyDomainService currencyDomainService,
            ICurrencyToCurrencyDtoMapper currencyToCurrencyDtoMapper

                                                 )
        {
            this.currencyDomainService = currencyDomainService;
            this._mapper = currencyToCurrencyDtoMapper;
        }
Example #4
0
        internal Offhire(
            long referenceNumber,
            DateTime startDateTime,
            DateTime endDateTime,
            Company introducer,
            VesselInCompany vesselInCompany,
            Voyage voyage,
            ActivityLocation offhireLocation,
            DateTime voucherDate,
            Currency voucherCurrency,
            //string pricingReferenceNumber,
            //OffHirePricingType pricingReferenceType,
            IOffhireDomainService offhireDomainService,
            IOffhireManagementSystemDomainService offhireManagementSystemDomainService,
            IVesselInCompanyDomainService vesselDomainService,
            IVoyageDomainService voyageDomainService,
            ICompanyDomainService companyDomainService,
            IActivityLocationDomainService activityLocationDomainService,
            ICurrencyDomainService currencyDomainService)
            : this()
        {
            //var pricingReference = new OffhirePricingReference() { Type = pricingReferenceType, Number = pricingReferenceNumber };
            this.validateCreation(
                referenceNumber,
                startDateTime,
                endDateTime,
                introducer,
                vesselInCompany,
                voyage,
                offhireLocation,
                voucherDate,
                voucherCurrency,
                //pricingReference,
                offhireDomainService,
                offhireManagementSystemDomainService,
                vesselDomainService,
                voyageDomainService,
                companyDomainService,
                activityLocationDomainService,
                currencyDomainService);

            this.ReferenceNumber = referenceNumber;
            this.StartDateTime = startDateTime;
            this.EndDateTime = endDateTime;
            this.IntroducerType = offhireDomainService.GetCharteringPartyType(vesselInCompany);
            this.Introducer = introducer;
            this.VesselInCompany = vesselInCompany;
            this.Voyage = voyage;
            this.OffhireLocation = offhireLocation;
            this.VoucherDate = voucherDate;
            this.VoucherCurrencyId = voucherCurrency.Id;
            this.VoucherCurrency = voucherCurrency;

            this.PricingReference = this.createPricingReference(introducer, vesselInCompany, this.IntroducerType, voyage, startDateTime, offhireDomainService);
        }
 public ApprovableOffhireDomainService(
     IOffhireDomainService offhireDomainService, IFinanceNotifier eventNotifier,
     ITankDomainService tankDomainService, ICurrencyDomainService currencyDomainService,
     IGoodDomainService goodDomainService, IGoodUnitDomainService goodUnitDomainService)
 {
     this.offhireDomainService = offhireDomainService;
     this.eventNotifier = eventNotifier;
     this.tankDomainService = tankDomainService;
     this.currencyDomainService = currencyDomainService;
     this.goodDomainService = goodDomainService;
     this.goodUnitDomainService = goodUnitDomainService;
 }
 public ApprovableScrapDomainService(
     IVesselInCompanyDomainService vesselDomainService, IInventoryOperationNotifier inventoryOperationNotifier,
     ITankDomainService tankDomainService, ICurrencyDomainService currencyDomainService,
     IGoodDomainService goodDomainService, IGoodUnitDomainService goodUnitDomainService)
 {
     this.vesselDomainService = vesselDomainService;
     this.inventoryOperationNotifier = inventoryOperationNotifier;
     this.tankDomainService = tankDomainService;
     this.currencyDomainService = currencyDomainService;
     this.goodDomainService = goodDomainService;
     this.goodUnitDomainService = goodUnitDomainService;
 }
 public FuelReportApplicationService(
     IUnitOfWorkScope unitOfWorkScope,
     ICurrencyDomainService currencyDomainService,
     IVoyageDomainService voyageDomainService,
     IFuelReportDomainService fuelReportDomainService,
     IApproveFlowApplicationService approveFlowApplicationService)
 {
     this.unitOfWorkScope = unitOfWorkScope;
     this.currencyDomainService = currencyDomainService;
     this.voyageDomainService = voyageDomainService;
     this.fuelReportDomainService = fuelReportDomainService;
     this.approveFlowApplicationService = approveFlowApplicationService;
 }
Example #8
0
        internal ScrapDetail(double rob, double price, Currency currency, Good good, GoodUnit unit, Tank tank, Scrap scrap,
            IScrapDomainService scrapDomainService, ITankDomainService tankDomainService, ICurrencyDomainService currencyDomainService,
            IGoodDomainService goodDomainService, IGoodUnitDomainService goodUnitDomainService)
            : this()
        {
            this.validateScrap(scrap, scrapDomainService);

            this.validateValues(rob, price, currency, good, unit, tank, scrap,
                tankDomainService, currencyDomainService, goodDomainService, goodUnitDomainService);

            this.ROB = rob;
            this.Price = price;
            this.Currency = currency;
            this.Good = good;
            this.Unit = unit;
            this.Tank = tank;
            this.Scrap = scrap;
        }
Example #9
0
        internal OffhireDetail(decimal quantity, decimal feeInVoucherCurrency, decimal feeInMainCurrency, Good good, GoodUnit unit, Tank tank, Offhire offhire,
            IOffhireDomainService offhireDomainService, ITankDomainService tankDomainService, ICurrencyDomainService currencyDomainService,
            IGoodDomainService goodDomainService, IGoodUnitDomainService goodUnitDomainService)
            : this()
        {
            this.validateOffhire(offhire, offhireDomainService);

            this.validateValues(quantity, feeInVoucherCurrency, feeInMainCurrency, good, unit, tank, offhire, offhireDomainService,
                tankDomainService, currencyDomainService, goodDomainService, goodUnitDomainService);

            this.Quantity = quantity;
            this.FeeInVoucherCurrency = feeInVoucherCurrency;
            this.FeeInMainCurrency = feeInMainCurrency;
            this.Good = good;
            this.Unit = unit;
            this.Tank = tank;
            this.Offhire = offhire;
        }
 //================================================================================
 public FuelReportFacadeService(
     IFuelReportApplicationService appService,
     IFuelReportFuelReportDtoMapper fuelReportMapper,
     IFuelReportDetailToFuelReportDetailDtoMapper fuelReportDetailToFuelReportDetailDtoMapper,
     ICurrencyDomainService currencyDomainService,
     ICurrencyToCurrencyDtoMapper currencyToCurrencyDtoMapper,
     IFuelReportDomainService fuelReportDomainService,
     IInventoryOperationDomainService inventoryOperationDomainService,
     IInventoryOperationToInventoryOperationDtoMapper inventoryOperationMapper)
 {
     this.appService = appService;
     this.fuelReportMapper = fuelReportMapper;
     this.fuelReportDetailToFuelReportDetailDtoMapper = fuelReportDetailToFuelReportDetailDtoMapper;
     this.currencyToCurrencyDtoMapper = currencyToCurrencyDtoMapper;
     this.fuelReportDomainService = fuelReportDomainService;
     this.inventoryOperationDomainService = inventoryOperationDomainService;
     this.inventoryOperationMapper = inventoryOperationMapper;
     this.currencyDomainService = currencyDomainService;
 }
        public InvoiceApplicationService(IInvoiceRepository invoiceRepository,
                                         IUnitOfWorkScope unitOfWorkScope,
            //  IGoodPartyAssignmentDomainService goodPartyAssignmentDomainService,
                                         //IUserRepository userRepository,
                                         IVesselInCompanyDomainService vesselDomainService,
                                         IGoodDomainService goodDomainService,
                                         IInvoiceFactory invoiceFactory,
                                         ICompanyDomainService companyDomainService,
                                         IInvoiceDomainService invoiceDomainService,
                                         IInvoiceItemDomainService invoiceItemDomainService,
                                         IEffectiveFactorDomainService effectiveFactorDomainService,
                                         ICompanyRepository companyRepository
            //,IApprovableDomainService approvableDomainService
                                         ,
                                         IOrderRepository orderRepository,
                                         IGoodRepository goodRepository,
                                         ICurrencyDomainService currencyDomainService,
                                         IInvoiceAdditionalPriceDomainService invoiceAdditionalPriceDomainService,
                                         IGoodUnitConvertorDomainService goodUnitConvertorDomainService, IBalanceDomainService balanceDomainService, IEntityConfigurator<Invoice> invoiceConfigurator)
        {
            this.invoiceRepository = invoiceRepository;
            this.vesselDomainService = vesselDomainService;
            this.goodDomainService = goodDomainService;
            this.invoiceFactory = invoiceFactory;
            this.unitOfWorkScope = unitOfWorkScope;
            this.companyDomainService = companyDomainService;
            this.invoiceDomainService = invoiceDomainService;

            this.invoiceItemDomainService = invoiceItemDomainService;
            this.effectiveFactorDomainService = effectiveFactorDomainService;
            this.companyRepository = companyRepository;
            this.orderRepository = orderRepository;
            this.goodRepository = goodRepository;
            this.currencyDomainService = currencyDomainService;
            this.invoiceAdditionalPriceDomainService = invoiceAdditionalPriceDomainService;
            this.goodUnitConvertorDomainService = goodUnitConvertorDomainService;
            this.balanceDomainService = balanceDomainService;
            this.invoiceConfigurator = invoiceConfigurator;

            // _approvableDomainService = approvableDomainService;
            //  _goodPartyAssignmentDomainService = goodPartyAssignmentDomainService;
        }
Example #12
0
 public ScrapFactory(
     IEntityConfigurator<Scrap> scrapConfigurator,
     IWorkflowRepository workflowRepository,
     IScrapDomainService scrapDomainService,
     IVesselInCompanyDomainService vesselDomainService,
     ICompanyDomainService companyDomainService,
     ITankDomainService tankDomainService,
     ICurrencyDomainService currencyDomainService,
     IGoodDomainService goodDomainService,
     IGoodUnitDomainService goodUnitDomainService)
 {
     this.scrapConfigurator = scrapConfigurator;
     this.workflowRepository = workflowRepository;
     this.vesselDomainService = vesselDomainService;
     this.companyDomainService = companyDomainService;
     this.tankDomainService = tankDomainService;
     this.currencyDomainService = currencyDomainService;
     this.goodDomainService = goodDomainService;
     this.goodUnitDomainService = goodUnitDomainService;
     this.scrapDomainService = scrapDomainService;
 }
 public ApprovableFuelReportDomainService(
     IVoyageDomainService voyageDomainService,
     IFuelReportDomainService fuelReportDomainService,
     IInventoryOperationDomainService inventoryOperationDomainService,
     IGoodDomainService goodDomainService,
     IOrderDomainService orderDomainService,
     ICurrencyDomainService currencyDomainService,
     IBalanceDomainService balanceDomainService,
     IInventoryManagementDomainService inventoryManagementDomainService,
     IInventoryOperationNotifier inventoryOperationNotifier)
 {
     this.voyageDomainService = voyageDomainService;
     this.fuelReportDomainService = fuelReportDomainService;
     this.inventoryOperationDomainService = inventoryOperationDomainService;
     this.goodDomainService = goodDomainService;
     this.orderDomainService = orderDomainService;
     this.inventoryOperationNotifier = inventoryOperationNotifier;
     this.currencyDomainService = currencyDomainService;
     this.balanceDomainService = balanceDomainService;
     this.inventoryManagementDomainService = inventoryManagementDomainService;
 }
        public OffhireDomainService(
            IOffhireRepository offhireRepository,
            IRepository<OffhireDetail> offhireDetailRepository,
            ICharteringDomainService charteringDomainService,
            IInventoryManagementDomainService inventoryManagementDomainService,
            IFuelReportDomainService fuelReportDomainService,
            IVesselInCompanyDomainService vesselDomainService, IVoyageDomainService voyageDomainService,
            ICurrencyDomainService currencyDomainService)
        {
            this.offhireRepository = offhireRepository;
            this.offhireDetailRepository = offhireDetailRepository;
            this.charteringDomainService = charteringDomainService;
            this.inventoryManagementDomainService = inventoryManagementDomainService;
            this.fuelReportDomainService = fuelReportDomainService;
            this.vesselDomainService = vesselDomainService;
            this.voyageDomainService = voyageDomainService;
            this.currencyDomainService = currencyDomainService;

            this.isOffhireOpen = new IsOffhireOpen();
            this.isOffhireSubmitted = new IsOffhireSubmitted();
            this.isOffhireSubmitRejected = new IsOffhireSubmitRejected();
            this.isOffhireCancelled = new IsOffhireCancelled();
        }
        public ScrapApplicationService(
            IScrapFactory scrapFactory,
            IScrapRepository scrapRepository,
            IUnitOfWorkScope unitOfWorkScope,
            IScrapDomainService scrapDomainService,
            IVesselInCompanyDomainService vesselDomianService,
            ICompanyDomainService companyDomainService,
            ICurrencyDomainService currencyDomainService,
            IGoodDomainService goodDomainService,
            IGoodUnitDomainService goodUnitDomainService,
            ITankDomainService tankDomainService)
        {
            this.scrapFactory = scrapFactory;
            this.scrapRepository = scrapRepository;
            this.unitOfWorkScope = unitOfWorkScope;

            this.scrapDomainService = scrapDomainService;
            this.vesselDomianService = vesselDomianService;
            this.companyDomainService = companyDomainService;
            this.currencyDomainService = currencyDomainService;
            this.goodDomainService = goodDomainService;
            this.goodUnitDomainService = goodUnitDomainService;
            this.tankDomainService = tankDomainService;
        }
Example #16
0
        //================================================================================
        internal void Update(double rob, double price, Currency currency, Good good, GoodUnit unit, Tank tank,
            ITankDomainService tankDomainService, ICurrencyDomainService currencyDomainService,
            IGoodDomainService goodDomainService, IGoodUnitDomainService goodUnitDomainService)
        {
            this.validateValues(rob, price, currency, good, unit, tank, this.Scrap,
                 tankDomainService, currencyDomainService, goodDomainService, goodUnitDomainService);

            this.ROB = rob;
            this.Price = price;
            this.Currency = currency;
            this.Unit = unit;

            if (!this.isScrapSubmitRejected.IsSatisfiedBy(this.Scrap))
            {
                this.Good = good;
                this.Tank = tank;
            }
        }
Example #17
0
 //================================================================================
 public void Validate(ITankDomainService tankDomainService, ICurrencyDomainService currencyDomainService,
     IGoodDomainService goodDomainService, IGoodUnitDomainService goodUnitDomainService)
 {
     this.validateValues(this.ROB, this.Price, this.Currency, this.Good, this.Unit, this.Tank, this.Scrap,
          tankDomainService, currencyDomainService, goodDomainService, goodUnitDomainService);
 }
Example #18
0
 //================================================================================
 private void validateDetails(IOffhireDomainService offhireDomainService,
     ITankDomainService tankDomainService, ICurrencyDomainService currencyDomainService,
     IGoodDomainService goodDomainService, IGoodUnitDomainService goodUnitDomainService)
 {
     this.OffhireDetails.ForEach(sd => sd.Validate(offhireDomainService, tankDomainService, currencyDomainService, goodDomainService, goodUnitDomainService));
 }
Example #19
0
        //================================================================================
        private void validateUpdate(
            Currency voucherCurrency,
            ICurrencyDomainService currencyDomainService)
        {
            this.validateToBeOpenOrSubmitRejected();

            this.validateCurrency(voucherCurrency, currencyDomainService);
        }
Example #20
0
        //===================================================================================
        private void validateSubmittingState(IVoyageDomainService voyageDomainService,
            IFuelReportDomainService fuelReportDomainService, IInventoryOperationDomainService inventoryOperationDomainService, IGoodDomainService goodDomainService,
            IOrderDomainService orderDomainService, ICurrencyDomainService currencyDomainService,
            IInventoryManagementDomainService inventoryManagementDomainService)
        {
            validateToBeOpenOrSubmitRejected();

            validateVoyageId(this.VoyageId, voyageDomainService);

            //BR_FR37
            validatePreviousEndedVoyagesToBeIssued(
                voyageDomainService,
                fuelReportDomainService,
                inventoryOperationDomainService);

            //BR_FR38
            validatePreviousFuelReportsToBeFinalApproved(fuelReportDomainService);

            //BR_FR39
            validateFuelReportsOfPreviousDayForMandatoryType(
                fuelReportDomainService,
                goodDomainService);

            var isTheFirstReport = isCurrentFuelReportTheFirstOne(fuelReportDomainService);

            FuelReport previousFuelReport = getYesterdayLastFuelReport(fuelReportDomainService);

            validateFuelReportOfTheDayBefore(previousFuelReport, isTheFirstReport);

            foreach (var detailItem in this.FuelReportDetails)
            {
                FuelReportDetail fuelReportDetailOfYesterdayForRelevantGood =
                    getGoodRelevantFuelReportDetailOfYesterday(
                        detailItem.GoodId,
                        isTheFirstReport,
                        previousFuelReport);

                //All Edit Rules must be checked for details.
                detailItem.ValidateCurrentValues(
                    fuelReportDetailOfYesterdayForRelevantGood,
                    isTheFirstReport,
                    currencyDomainService);

                detailItem.ValidateTransferReferences(orderDomainService, inventoryManagementDomainService);
                detailItem.ValidateReceiveReferences(orderDomainService);
                detailItem.ValidateCorrectionReferences(isTheFirstReport, voyageDomainService, fuelReportDomainService);
            }
        }
Example #21
0
        //================================================================================
        private void validateValues(double rob, double price, Currency currency, Good good, GoodUnit unit, Tank tank, Scrap scrap, ITankDomainService tankDomainService, ICurrencyDomainService currencyDomainService, IGoodDomainService goodDomainService, IGoodUnitDomainService goodUnitDomainService)
        {
            this.validateTank(tank, scrap, tankDomainService);

            this.validateGood(good, goodDomainService);
            this.validateGoodInTank(tank, good, scrap);
            this.validateGoodToBeUniqueInDetails(good, scrap);

            this.validateROB(rob);
            this.validatePrice(price);
            this.validateCurrency(currency, currencyDomainService);

            this.validateUnit(unit, goodUnitDomainService);
            this.validateGoodUnitInCompany(scrap.VesselInCompany.Company, good, unit);
        }
Example #22
0
        //================================================================================
        public void ValidateMiddleApprove(IVesselInCompanyDomainService vesselDomainService,
            ITankDomainService tankDomainService, ICurrencyDomainService currencyDomainService,
            IGoodDomainService goodDomainService, IGoodUnitDomainService goodUnitDomainService)
        {
            this.validateToBeOpen();

            this.validateApproveAction(vesselDomainService, tankDomainService, currencyDomainService, goodDomainService, goodUnitDomainService);
        }
Example #23
0
        //================================================================================
        public ScrapDetail UpdateDetail(long scrapDetailId, double rob, double price, Currency currency, Good good, GoodUnit unit, Tank tank,
            ITankDomainService tankDomainService, ICurrencyDomainService currencyDomainService,
            IGoodDomainService goodDomainService, IGoodUnitDomainService goodUnitDomainService)
        {
            var scrapDetailToUpdate = this.findDetail(scrapDetailId);

            scrapDetailToUpdate.Update(rob, price, currency, good, unit, tank,
                 tankDomainService, currencyDomainService, goodDomainService, goodUnitDomainService);

            return scrapDetailToUpdate;
        }
Example #24
0
        //================================================================================
        public void Submit(SubmittedState submittedState,
            IVesselInCompanyDomainService vesselDomainService, IInventoryOperationNotifier eventNotifier,
            ITankDomainService tankDomainService, ICurrencyDomainService currencyDomainService,
            IGoodDomainService goodDomainService, IGoodUnitDomainService goodUnitDomainService)
        {
            this.validateToBeOpenOrSubmitRejected();

            this.validateApproveAction(vesselDomainService, tankDomainService, currencyDomainService, goodDomainService, goodUnitDomainService);

            //Perform Submit operations.
            //foreach (var scrapDetail in this.ScrapDetails)
            //{
            //    scrapDetail.InventoryOperations.AddRange(eventNotifier.NotifySubmittingScrapDetail(scrapDetail));
            //}

            if (this.isOpen.IsSatisfiedBy(this))
                vesselDomainService.ScrapVessel(this.VesselInCompanyId);

            var invResult = eventNotifier.NotifySubmittingScrap(this);

            this.InventoryOperations.AddRange(invResult);

            this.setState(submittedState);
        }
 public CurrencyApplicationService(ICurrencyDomainService domainService, IMapper mapper, IAuthorizationService authorizationService, IUserService userService)
     : base("flight-search.currencies.", mapper, authorizationService, userService)
 {
     DomainService = domainService;
 }
Example #26
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);
        }
Example #27
0
        //================================================================================
        private void validateCurrency(Currency currency, ICurrencyDomainService currencyDomainService)
        {
            if (currency == null)
                throw new BusinessRuleException("", "Currency must be selected.");

            if (currencyDomainService.Get(currency.Id) == null)
                throw new ObjectNotFound("Currency", currency.Id);
        }
Example #28
0
        //================================================================================
        private void validateCreation(
            long referenceNumber,
            DateTime startDateTime,
            DateTime endDateTime,
            Company introducer,
            VesselInCompany vesselInCompany,
            Voyage voyage,
            ActivityLocation offhireLocation,
            DateTime voucherDate,
            Currency voucherCurrency,
            //OffhirePricingReference pricingReference,
            IOffhireDomainService offhireDomainService,
            IOffhireManagementSystemDomainService offhireManagementSystemDomainService,
            IVesselInCompanyDomainService vesselDomainService,
            IVoyageDomainService voyageDomainService,
            ICompanyDomainService companyDomainService,
            IActivityLocationDomainService activityLocationDomainService,
            ICurrencyDomainService currencyDomainService)
        {
            this.validateCompanyExistance(introducer, companyDomainService);

            this.validateOffhireReference(referenceNumber, introducer, offhireManagementSystemDomainService);

            this.validateOffhireUniquenessInFuelManagementDomain(referenceNumber, introducer, offhireDomainService);

            this.validateCurrency(voucherCurrency, currencyDomainService);
            this.validateVoucherDate(voucherDate);

            this.validateVesselExistance(vesselInCompany, vesselDomainService);
            this.validateVesselInCompanyExistance(vesselInCompany, introducer, companyDomainService);

            this.validateVoyageExistance(voyage, voyageDomainService);
            this.validateVoyageInVesselOfCompanyExistance(voyage, vesselInCompany);
            this.validateOffhireDurationInVoyage(startDateTime, endDateTime, voyage);

            this.validateActivityLocation(offhireLocation, activityLocationDomainService);

            CharteringPartyType charteringPartyType = offhireDomainService.GetCharteringPartyType(vesselInCompany);

            var offhirePricingType = offhireDomainService.GetPricingType(introducer, vesselInCompany, startDateTime);

            this.validateOffhirePricingType(introducer, vesselInCompany, voyage, startDateTime, charteringPartyType, offhirePricingType,
                offhireDomainService);
        }
Example #29
0
        //================================================================================
        private void validateApproveAction(IVesselInCompanyDomainService vesselDomainService,
            ITankDomainService tankDomainService, ICurrencyDomainService currencyDomainService,
            IGoodDomainService goodDomainService, IGoodUnitDomainService goodUnitDomainService)
        {
            this.validateVesselOwnedState(this.VesselInCompany, vesselDomainService);

            this.validateBeingSubmitRejectedIfIsInScrappedState(this.VesselInCompany, vesselDomainService);

            this.validateDetailsExistance();

            this.validateDetails(tankDomainService, currencyDomainService, goodDomainService, goodUnitDomainService);
        }
Example #30
0
 //================================================================================
 private void validateDetails(ITankDomainService tankDomainService, ICurrencyDomainService currencyDomainService,
     IGoodDomainService goodDomainService, IGoodUnitDomainService goodUnitDomainService)
 {
     this.ScrapDetails.ForEach(sd => sd.Validate(tankDomainService, currencyDomainService, goodDomainService, goodUnitDomainService));
 }
Example #31
0
        //===================================================================================
        public FuelReportDetail UpdateFuelReportDetail(
            long fuelReportDetailId,
            double rob,
            double consumption,
            double? receive,
            ReceiveTypes? receiveType,
            double? transfer,
            TransferTypes? transferType,
            double? correction,
            CorrectionTypes? correctionType,
            decimal? correctionPrice,
            long? currencyId,
            Reference transferReference,
            Reference receiveReference,
            Reference correctionReference,
            IFuelReportDomainService fuelReportDomainService,
            ICurrencyDomainService currencyDomainService)
        {
            this.CheckToBeOperational();

            //BR_FR1
            validateToBeOpenOrSubmitRejected();

            FuelReportDetail updatingFuelReportDetail = FuelReportDetails.FirstOrDefault(c => c.Id == fuelReportDetailId);

            if (updatingFuelReportDetail == null) throw new ObjectNotFound("FuelReportDetail", fuelReportDetailId);

            validatePreviousFuelReportsToBeFinalApproved(fuelReportDomainService);

            //IOrderedEnumerable<FuelReport> fuelReportsOfYesterday =
            //    fuelReportDomainService
            //        .GetYesterdayFuelReports(this)
            //            .OrderBy(fr => fr.ReportDate);//The ordering is used to find the last report in previous day.

            //FuelReport previousFuelReport = null;

            //bool isTheFirstReport = false;

            //if (fuelReportsOfYesterday.Count() == 0)
            //{
            //    //If nothing found for previous day...

            //    isTheFirstReport = isCurrentFuelReportTheFirstOne(fuelReportDomainService);
            //}
            //else
            //{
            //    //Retrieve the last Fuel Report of yesterday.
            //    previousFuelReport = fuelReportsOfYesterday.LastOrDefault();
            //}

            //FuelReportDetail fuelReportDetailOfYesterdayForRelevantGood = null;

            //if (!isTheFirstReport)
            //{
            //    //TODO: The validation of fuel types against Yesterday valid fuel types must be revised.
            //    fuelReportDetailOfYesterdayForRelevantGood =
            //        previousFuelReport.FuelReportDetails.FirstOrDefault(c => c.GoodId == updatingFuelReportDetail.GoodId);

            //    if (fuelReportDetailOfYesterdayForRelevantGood == null)
            //        //Because current Fuel Report is not the first one,
            //        //its relevant Fuel Report Detail of yesterday must be found.
            //        throw new ObjectNotFound("FuelReportDetailOfYesterdayForRelevantGood");
            //}

            bool isTheFirstReport = isCurrentFuelReportTheFirstOne(fuelReportDomainService);

            FuelReport previousFuelReport = getYesterdayLastFuelReport(fuelReportDomainService);

            validateFuelReportOfTheDayBefore(previousFuelReport, isTheFirstReport);

            FuelReportDetail fuelReportDetailOfYesterdayForRelevantGood =
                getGoodRelevantFuelReportDetailOfYesterday(
                    updatingFuelReportDetail.GoodId,
                    isTheFirstReport,
                    previousFuelReport);

            if (this.State == States.Open)
            {
                updatingFuelReportDetail.Update(rob, consumption, receive, receiveType, transfer, transferType,
                                                correction, correctionType, correctionPrice, currencyId,
                                                transferReference,
                                                receiveReference,
                                                correctionReference,
                                                fuelReportDetailOfYesterdayForRelevantGood,
                                                isTheFirstReport,
                                                currencyDomainService);
            }
            else if (this.State == States.SubmitRejected)
            {
                updatingFuelReportDetail.Update(rob, consumption, fuelReportDetailOfYesterdayForRelevantGood, isTheFirstReport, currencyDomainService);
            }
            else
            {
                throw new InvalidOperation("UpdateFuelReportDetail", "The Fuel Report is in an invalid state.");
            }

            return updatingFuelReportDetail;
        }