public PromotionReward[] GetRewards()
        {
            var retVal = new CatalogItemAmountReward
            {
                Amount     = Amount,
                AmountType = RewardAmountType.Relative
            };

            return(new PromotionReward[] { retVal });
        }
        public PromotionReward[] GetRewards()
        {
            var retVal = new CatalogItemAmountReward
            {
                Amount     = Amount,
                AmountType = RewardAmountType.Absolute,
                ProductId  = ProductId
            };

            return(new PromotionReward[] { retVal });
        }
Example #3
0
        public PromotionReward[] GetRewards()
        {
            var retVal = new CatalogItemAmountReward
            {
                Amount     = 100,
                AmountType = RewardAmountType.Relative,
                Quantity   = NumItem,
                ProductId  = ProductId
            };

            return(new PromotionReward[] { retVal });
        }
Example #4
0
        public PromotionReward[] GetRewards()
        {
            var retVal = new CatalogItemAmountReward
            {
                Amount     = Amount,
                AmountType = RewardAmountType.Relative,
                ProductId  = ProductId,
                MaxLimit   = MaxLimit
            };

            return(new PromotionReward[] { retVal });
        }
        public virtual PromotionReward[] GetRewards()
        {
            var retVal = new CatalogItemAmountReward
            {
                Amount             = Amount,
                AmountType         = RewardAmountType.Relative,
                Quantity           = ItemLimit,
                ForNthQuantity     = ForNthQuantity,
                InEveryNthQuantity = InEveryNthQuantity,
                ProductId          = Product?.ProductId,
                MaxLimit           = MaxLimit,
            };

            return(new PromotionReward[] { retVal });
        }
Example #6
0
        public override PromotionReward[] EvaluatePromotion(IEvaluationContext context)
        {
            var retVal       = new List <PromotionReward>();
            var promoContext = context as PromotionEvaluationContext;

            if (promoContext != null)
            {
                foreach (var entry in promoContext.PromoEntries)
                {
                    var tag    = entry.Attributes != null ? entry.Attributes["tag"] : null;
                    var reward = new CatalogItemAmountReward
                    {
                        AmountType = RewardAmountType.Relative,
                        Amount     = _discountAmount,
                        IsValid    = !String.IsNullOrEmpty(tag) ? _tags.Contains(tag) : false,
                        ProductId  = entry.ProductId,
                        Promotion  = this
                    };
                }
            }
            return(retVal.ToArray());
        }
        public override Task <PromotionReward[]> EvaluatePromotionAsync(IEvaluationContext context)
        {
            var retVal = new List <PromotionReward>();

            if (context is PromotionEvaluationContext promoContext)
            {
                foreach (var entry in promoContext.PromoEntries)
                {
                    var tag    = entry.Attributes != null ? entry.Attributes["tag"] : null;
                    var reward = new CatalogItemAmountReward
                    {
                        AmountType = RewardAmountType.Relative,
                        Amount     = _discountAmount,
                        IsValid    = !string.IsNullOrEmpty(tag) && _tags.Contains(tag),
                        ProductId  = entry.ProductId,
                        Promotion  = this
                    };
                    retVal.Add(reward);
                }
            }
            return(Task.FromResult(retVal.ToArray()));
        }
Example #8
0
 //Copy constructor
 protected CatalogItemAmountReward(CatalogItemAmountReward other)
     : base(other)
 {
     ProductId            = other.ProductId;
     ConditionalProductId = other.ConditionalProductId;
 }