コード例 #1
0
        internal string getTransferInfoText(transferDiscount item, string currency)
        {
            string text = lang.checkoutTransferDiscount;

            if (item != null && item.isDiscountExist)
            {
                switch (item.discountType)
                {
                    case transfetDiscountType.percentage:
                        text = text.Replace("[amount]", "%" + item.amount.ToString("N0"));
                        break;
                    case transfetDiscountType.amount:
                        text = text.Replace("[amount]", "%" + item.amount.ToString("N0") + " " + currency);
                        break;
                }

                return text;
            }
            else
            {
                return null;
            }
        }
コード例 #2
0
        internal transferDiscount getTransferInfo(int langId)
        {
            transferDiscount helper = new transferDiscount();
            var settingItem = db.tbl_settings.Where(a => a.langId == langId).FirstOrDefault();
            if (settingItem != null)
            {
                if (settingItem.isTransferDiscount.HasValue && settingItem.transferDiscountType.HasValue && settingItem.transferDiscountAmount.HasValue && settingItem.isTransferDiscount.Value)
                {
                    helper.isDiscountExist = true;
                    helper.amount = settingItem.transferDiscountAmount.Value;

                    // Pertange Discount
                    if ((int)transfetDiscountType.percentage == settingItem.transferDiscountType.Value)
                    {
                        helper.discountType = transfetDiscountType.percentage;
                    }

                    // Amount Discount
                    if ((int)transfetDiscountType.amount == settingItem.transferDiscountType.Value)
                    {
                        helper.discountType = transfetDiscountType.amount;
                    }
                }

            }

            return helper;
        }