示例#1
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;
        }
示例#2
0
        //================================================================================
        private ScrapDetail(
            double rob,
            double price,
            Currency currency,
            Good good,
            GoodUnit unit,
            Tank tank,
            Scrap scrap)
        {
            //This constructor added to be used for insert into DB.
            this.ROB = rob;
            this.Price = price;
            this.Currency = currency;
            this.Good = good;
            this.Unit = unit;
            this.Tank = tank;
            this.Scrap = scrap;

            this.isScrapSubmitRejected = new IsScrapSubmitRejected();

            //this.InventoryOperations = new List<InventoryOperation>();
        }
示例#3
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);
        }
示例#4
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);
        }
示例#5
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;
            }
        }