コード例 #1
0
        ICoupon GetCoupon(Commerce.Data.SqlRepository.Coupon coupon)
        {
            ICoupon result = null;

            switch (coupon.CouponTypeID)
            {
            //PercentOffOrder
            case 1:
                result = new PercentOffOrderCoupon(coupon.PercentOff);
                break;

            //PercentOffItem
            case 2:
                result = new PercentOffItemCoupon(coupon.PercentOff,
                                                  GetSplitArray(coupon.AppliesToProductCodes));
                break;

            //AmountOffOrder
            case 3:
                result = new AmountOffOrderCoupon(coupon.AmountOff);
                break;

            //AmountOffItem
            case 4:
                result = new AmountOffItemCoupon(coupon.AmountOff,
                                                 GetSplitArray(coupon.AppliesToProductCodes));
                break;
            }

            return(result);
        }
コード例 #2
0
        ICoupon GetCoupon(Commerce.Data.SqlRepository.Coupon coupon) {

            ICoupon result = null;
            switch (coupon.CouponTypeID) {

                //PercentOffOrder
                case 1:
                    result = new PercentOffOrderCoupon(coupon.PercentOff);
                    break;
                //PercentOffItem
                case 2:
                    result = new PercentOffItemCoupon(coupon.PercentOff, 
                        GetSplitArray(coupon.AppliesToProductCodes));
                    break;
                //AmountOffOrder
                case 3:
                    result = new AmountOffOrderCoupon(coupon.AmountOff);
                    break;
                //AmountOffItem
                case 4:
                    result = new AmountOffItemCoupon(coupon.AmountOff, 
                        GetSplitArray(coupon.AppliesToProductCodes));
                    break;

            }

            return result;
        }