Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
0
        //================================================================================
        private void validateActivityLocation(ActivityLocation offhireLocation, IActivityLocationDomainService activityLocationDomainService)
        {
            if (offhireLocation == null)
                throw new BusinessRuleException("", "Offhire Location is empty.");

            if (activityLocationDomainService.Get(offhireLocation.Id) == null)
                throw new ObjectNotFound("OffhireLocation");
        }