Пример #1
0
        public GenerateDetailContext(BonusInfo model)
        {
            _bonus = model;
            BonusInfo.BonusPriceType?priceType      = _bonus.PriceType;
            BonusInfo.BonusPriceType valueOrDefault = priceType.GetValueOrDefault();
            if (priceType.HasValue)
            {
                switch (valueOrDefault)
                {
                case BonusInfo.BonusPriceType.Fixed:
                {
                    _generate = new FixedGeneration(model.FixedAmount.Value);
                    return;
                }

                case BonusInfo.BonusPriceType.Random:
                {
                    _generate = new RandomlyGeneration(model.RandomAmountStart.Value, model.RandomAmountEnd.Value);
                    break;
                }

                default:
                {
                    return;
                }
                }
            }
        }
Пример #2
0
        public GenerateDetailContext(BonusInfo model)
        {
            this._bonus = model;
            switch (this._bonus.PriceType)
            {
            case BonusInfo.BonusPriceType.Fixed:
                this._generate = new FixedGeneration((decimal)model.FixedAmount);
                break;

            case BonusInfo.BonusPriceType.Random:
                this._generate = new RandomlyGeneration((decimal)model.RandomAmountStart, (decimal)model.RandomAmountEnd);
                break;
            }
        }