Beispiel #1
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 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);
        }
Beispiel #3
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 OffhireFacadeService(
            IOffhireApplicationService offhireApplicationService,
            IOffhireDomainService offhireDomainService,
            IEntityConfigurator<Offhire> offhireConfigurator,
            IOffhireToOffhireDtoMapper offhireDtoMapper,
            IOffhireDetailToOffhireDetailDtoMapper offhireDetailDtoMapper,
            IInventoryOperationToInventoryOperationDtoMapper inventoryOperationDtoMapper,
            IOffhireManagementSystemDomainService offhireManagementSystemDomainService,
            IOffhireManagementSystemEntityToOffhireManagementSystemDtoMapper offhireManagementSystemDtoMapper,
            IOffhirePreparedDataToOffhireDtoMapper offhirePreparedDataToOffhireDtoMapper,
            IPricingValueToPricingValueDtoMapper pricingValueDtoMapper)
        {
            this.offhireApplicationService = offhireApplicationService;
            this.offhireDomainService = offhireDomainService;
            this.offhireDtoMapper = offhireDtoMapper;
            this.offhireDetailDtoMapper = offhireDetailDtoMapper;
            this.inventoryOperationDtoMapper = inventoryOperationDtoMapper;
            this.offhireManagementSystemDomainService = offhireManagementSystemDomainService;
            this.offhireManagementSystemDtoMapper = offhireManagementSystemDtoMapper;
            this.offhirePreparedDataToOffhireDtoMapper = offhirePreparedDataToOffhireDtoMapper;
            this.pricingValueDtoMapper = pricingValueDtoMapper;

            this.offhireDomainService.SetConfigurator(offhireConfigurator);
        }
Beispiel #5
0
        //================================================================================
        //private void validateVesselCharteringTypeInCompany(Vessel vessel, CharteringPartyType partyType, IVesselDomainService vesselDomainService)
        //{
        //    VesselStates vesselState = vesselDomainService.GetVesselCurrentState(vessel.Id);
        //    if (partyType == CharteringPartyType.Charterer && vesselState != VesselStates.CharterIn)
        //        throw new BusinessRuleException("", "Vessel is not in Charter-In state for the company.");
        //    if (partyType == CharteringPartyType.ShipOwner && vesselState != VesselStates.CharterOut)
        //        throw new BusinessRuleException("", "Vessel is not in Charter-Out state for the company.");
        //}
        //================================================================================
        private void validateOffhireReference(long referenceNumber, Company introducer, IOffhireManagementSystemDomainService offhireManagementSystemDomainService)
        {
            var finalizedOffhire = offhireManagementSystemDomainService.GetFinalizedOffhire(referenceNumber, introducer.Id);

            if (finalizedOffhire == null)
                throw new BusinessRuleException("", "The selected Offhire is not registered.");

            if (finalizedOffhire.HasVoucher)
                throw new BusinessRuleException("", "Offhire is already registered with voucher.");
        }
Beispiel #6
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);
        }