Esempio n. 1
0
        public void AddItem(CharterItem charterItem)
        {
            #region bz

            if (this.CharterType == CharterType.Start)
            {
                //B5
                IsNotDuplicateItem(charterItem.TankId.Value, charterItem.GoodId);

                //B12
                HasTank(this.VesselInCompanyId.Value, charterItem.TankId.Value);

                //B60
                CompareOffhireValueItem(charterItem.GoodId, charterItem.OffhireFee);

                //B19
                IsNotFinalApprove();

                //B20
                HasCharterOutHeader(charterItem.CharterId);

                //B9 chrter out
                IsGoodAndUnitValidInCompany(charterItem.GoodId, charterItem.GoodUnitId);

            }
            else
            {
                //B5
                IsNotDuplicateItem(charterItem.TankId.Value, charterItem.GoodId);
                //B9 chrter out
                IsGoodAndUnitValidInCompany(charterItem.GoodId, charterItem.GoodUnitId);
                //B12
                HasTank(this.VesselInCompanyId.Value, charterItem.TankId.Value);
                //B20
                HasCharterOutHeader(charterItem.CharterId);
                //B33
                IsNotFinalApprove();
            }

            IsCharterItemValid isCharterItemValid = new IsCharterItemValid();
            //B6,7
            if (!(isCharterItemValid.IsSatisfiedBy(charterItem)))
                throw new BusinessRuleException("B6,7", "Invalid Charter Item ");
            #endregion

            this.CharterItems.Add(charterItem);
        }
Esempio n. 2
0
        public void AddItem(CharterItem charterItem)
        {
            #region bz

            if (this.CharterType == CharterType.Start)
            {
                //B1
                IsNotFinalApprove();

                //B5
                IsNotDuplicateItem(charterItem.TankId.Value, charterItem.GoodId);

                //12
                HasTank(this.VesselInCompanyId.Value, charterItem.TankId.Value);

                //B8,B47
                HasCharterInHeader(this.Id);

                //B9
                IsGoodAndUnitValidInCompany(charterItem.GoodId, charterItem.GoodUnitId);

                //B60
                CompareOffhireValueItem(charterItem.GoodId, charterItem.OffhireFee);

                //B74
                IsEqualValueOfFuelBetweenCharterInOut(charterItem.GoodId, charterItem.Rob);
            }
            else
            {
                //B5
                IsNotDuplicateItem(charterItem.TankId.Value, charterItem.GoodId);

                //12
                HasTank(this.VesselInCompanyId.Value, charterItem.TankId.Value);

                //B47
                HasCharterInHeader(this.Id);

                //B1
                IsNotFinalApprove();
            }
            IsCharterItemValid isCharterItemValid = new IsCharterItemValid();
            //B6,7
            if (!(isCharterItemValid.IsSatisfiedBy(charterItem)))
                throw new BusinessRuleException("B6,7", "Invalid Charter Item ");
            #endregion

            this.CharterItems.Add(charterItem);
        }