コード例 #1
0
        private void AddReturnItemCollectedFromDcf(WeeeCollectedAmount weeeCollectedAmount)
        {
            Guard.ArgumentNotNull(() => weeeCollectedAmount, weeeCollectedAmount);

            if (WeeeCollectedAmounts
                .Where(r => r.SourceType == WeeeCollectedAmountSourceType.Dcf)
                .Where(r => r.WeeeCategory == weeeCollectedAmount.WeeeCategory)
                .Where(r => (r.ObligationType & weeeCollectedAmount.ObligationType) != ObligationType.None)
                .Any())
            {
                string errorMessage = "A return item with this obligation type and category has already been added.";
                throw new InvalidOperationException(errorMessage);
            }

            WeeeCollectedAmounts.Add(weeeCollectedAmount);
        }
コード例 #2
0
        public void AddWeeeCollectedAmount(WeeeCollectedAmount weeeCollectedAmount)
        {
            Guard.ArgumentNotNull(() => weeeCollectedAmount, weeeCollectedAmount);
            switch (weeeCollectedAmount.SourceType)
            {
            case WeeeCollectedAmountSourceType.Dcf:
                AddReturnItemCollectedFromDcf(weeeCollectedAmount);
                break;

            case WeeeCollectedAmountSourceType.Distributor:
                AddB2cWeeeFromDistributor(weeeCollectedAmount);
                break;

            case WeeeCollectedAmountSourceType.FinalHolder:
                AddB2cWeeeFromFinalHolder(weeeCollectedAmount);
                break;
            }
        }
コード例 #3
0
        private void AddB2cWeeeFromFinalHolder(WeeeCollectedAmount weeeCollectedAmount)
        {
            Guard.ArgumentNotNull(() => weeeCollectedAmount, weeeCollectedAmount);

            if (weeeCollectedAmount.ObligationType != ObligationType.B2C)
            {
                string errorMessage = "Only return items with an obligation type of B2C can be added under \"B2C WEEE from final holders\".";
                throw new InvalidOperationException(errorMessage);
            }

            if (WeeeCollectedAmounts
                .Where(r => r.SourceType == WeeeCollectedAmountSourceType.FinalHolder)
                .Where(r => r.WeeeCategory == weeeCollectedAmount.WeeeCategory)
                .Where(r => (r.ObligationType & weeeCollectedAmount.ObligationType) != ObligationType.None)
                .Any())
            {
                string errorMessage = "A return item with this obligation type and category has already been added.";
                throw new InvalidOperationException(errorMessage);
            }

            WeeeCollectedAmounts.Add(weeeCollectedAmount);
        }