Exemple #1
0
        public static PromotionReward ToPromotionReward(this marketingDto.PromotionReward rewardDto, Currency currency)
        {
            var result = new PromotionReward
            {
                CategoryId           = rewardDto.CategoryId,
                Coupon               = rewardDto.Coupon,
                Description          = rewardDto.Description,
                IsValid              = rewardDto.IsValid ?? false,
                LineItemId           = rewardDto.LineItemId,
                MeasureUnit          = rewardDto.MeasureUnit,
                ProductId            = rewardDto.ProductId,
                PromotionId          = rewardDto.PromotionId,
                Quantity             = rewardDto.Quantity ?? 0,
                MaxLimit             = (decimal)(rewardDto.MaxLimit ?? 0),
                Amount               = (decimal)(rewardDto.Amount ?? 0),
                AmountType           = EnumUtility.SafeParse(rewardDto.AmountType, AmountType.Absolute),
                CouponAmount         = new Money(rewardDto.CouponAmount ?? 0, currency),
                CouponMinOrderAmount = new Money(rewardDto.CouponMinOrderAmount ?? 0, currency),
                Promotion            = rewardDto.Promotion.ToPromotion(),
                RewardType           = EnumUtility.SafeParse(rewardDto.RewardType, PromotionRewardType.CatalogItemAmountReward),
                ShippingMethodCode   = rewardDto.ShippingMethod,
                ConditionalProductId = rewardDto.ConditionalProductId,
                ForNthQuantity       = rewardDto.ForNthQuantity,
                InEveryNthQuantity   = rewardDto.InEveryNthQuantity,
            };

            return(result);
        }
        public virtual PromotionReward ToPromotionReward(marketingDto.PromotionReward serviceModel, Currency currency)
        {
            var result = ServiceLocator.Current.GetInstance <MarketingFactory>().CreatePromotionReward();

            result.InjectFrom <NullableAndEnumValueInjecter>(serviceModel);

            result.Amount               = (decimal)(serviceModel.Amount ?? 0);
            result.AmountType           = EnumUtility.SafeParse(serviceModel.AmountType, AmountType.Absolute);
            result.CouponAmount         = new Money(serviceModel.CouponAmount ?? 0, currency);
            result.CouponMinOrderAmount = new Money(serviceModel.CouponMinOrderAmount ?? 0, currency);
            result.Promotion            = serviceModel.Promotion.ToWebModel();
            result.RewardType           = EnumUtility.SafeParse(serviceModel.RewardType, PromotionRewardType.CatalogItemAmountReward);
            result.ShippingMethodCode   = serviceModel.ShippingMethod;

            return(result);
        }
Exemple #3
0
        public virtual PromotionReward ToPromotionReward(marketingDto.PromotionReward serviceModel, Currency currency)
        {
            var result = new PromotionReward();

            result.CategoryId  = serviceModel.CategoryId;
            result.Coupon      = serviceModel.Coupon;
            result.Description = serviceModel.Description;
            result.IsValid     = serviceModel.IsValid ?? false;
            result.LineItemId  = serviceModel.LineItemId;
            result.MeasureUnit = serviceModel.MeasureUnit;
            result.ProductId   = serviceModel.ProductId;
            result.PromotionId = serviceModel.PromotionId;
            result.Quantity    = serviceModel.Quantity ?? 0;

            result.Amount               = (decimal)(serviceModel.Amount ?? 0);
            result.AmountType           = EnumUtility.SafeParse(serviceModel.AmountType, AmountType.Absolute);
            result.CouponAmount         = new Money(serviceModel.CouponAmount ?? 0, currency);
            result.CouponMinOrderAmount = new Money(serviceModel.CouponMinOrderAmount ?? 0, currency);
            result.Promotion            = serviceModel.Promotion.ToWebModel();
            result.RewardType           = EnumUtility.SafeParse(serviceModel.RewardType, PromotionRewardType.CatalogItemAmountReward);
            result.ShippingMethodCode   = serviceModel.ShippingMethod;

            return(result);
        }
Exemple #4
0
 public static PromotionReward ToPromotionReward(this marketingDto.PromotionReward rewardDto, Currency currency)
 {
     return(MarketingConverterInstance.ToPromotionReward(rewardDto, currency));
 }