protected void ApplyPromoClick(object sender, EventArgs e)
        {
            rowMessage.Visible = false;
            MessageLabel.Text  = string.Empty;
            if (string.IsNullOrEmpty(PromoText.Text))
            {
                InitDefaultPromo(Message.InvalidOrExpiredPromo, false);
                return;
            }

            if (PublicCustomerCredits == null)
            {
                InitDefaultPromo(ErrorMessage.YouMustLogIn, false);
                return;
            }

            var giftCard = _customerCreditRepository.GetGiftCardByCode(PromoText.Text.Trim());

            if (giftCard != null)
            {
                if (PublicCustomerCredits == null)
                {
                    InitDefaultPromo(ErrorMessage.YouMustLogIn, false);
                    return;
                }

                if (giftCard.Status == (short)Enums.GiftCardType.Used)
                {
                    InitDefaultPromo(ErrorMessage.GiftCardHasBeenUsed, false);
                    return;
                }

                if (!string.IsNullOrEmpty(giftCard.EmailAddress) &&
                    !PublicCustomerInfos.EmailAddress.Equals(giftCard.EmailAddress, StringComparison.OrdinalIgnoreCase))
                {
                    InitDefaultPromo(ErrorMessage.PleaseCheckYourGiftCardWithCurrentAccount, false);
                    return;
                }

                _customerCreditRepository.AddGiftCard(PublicCustomerCredits, PromoText.Text.Trim());
                PublicCustomerCredits = _customerCreditRepository.Refresh(PublicCustomerCredits);
                CacheLayer.Clear(CacheKeys.GiftCardCacheKey);
                CacheLayer.Clear(CacheKeys.CustomerCreditsCacheKey);
                CacheLayer.Clear(CacheKeys.CustomerCreditLogsCacheKey);
                BindeGiftCardInfos();
                InitDefaultPromo(ErrorMessage.GiftCardHasBeenApplied);
                BookProductUpdatePanel.Update();
            }
        }
        protected void ApplyPromoClick(object sender, EventArgs e)
        {
            rowMessage.Visible      = false;
            msrp.Visible            = false;
            MessageLabel.Text       = string.Empty;
            LitDisclaimer.Text      = string.Format(Message.TermWithPromo, string.Empty);
            discountInfoRow.Visible = false;
            bool isLimit;

            if (string.IsNullOrEmpty(PromoText.Text))
            {
                InitDefaultPromo(Message.InvalidOrExpiredPromo, false);
                return;
            }

            var  giftCard   = _customerCreditRepository.GetGiftCardByCode(PromoText.Text.Trim());
            bool isGiftCard = giftCard != null;

            if (giftCard != null)
            {
                if (PublicCustomerCredits == null)
                {
                    InitDefaultPromo(ErrorMessage.YouMustLogIn, false);
                    return;
                }

                if (giftCard.Status == (short)Enums.GiftCardType.Used)
                {
                    InitDefaultPromo(ErrorMessage.GiftCardHasBeenUsed, false);
                    return;
                }

                if (!string.IsNullOrEmpty(giftCard.EmailAddress) &&
                    !PublicCustomerInfos.EmailAddress.Equals(giftCard.EmailAddress, StringComparison.OrdinalIgnoreCase))
                {
                    InitDefaultPromo(ErrorMessage.PleaseCheckYourGiftCardWithCurrentAccount, false);
                    return;
                }

                _customerCreditRepository.AddGiftCard(PublicCustomerCredits, PromoText.Text.Trim());
                PublicCustomerCredits = _customerCreditRepository.Refresh(PublicCustomerCredits);
                CacheLayer.Clear(CacheKeys.GiftCardCacheKey);
                CacheLayer.Clear(CacheKeys.CustomerCreditsCacheKey);
                CacheLayer.Clear(CacheKeys.CustomerCreditLogsCacheKey);
                BindSubscriptionInfos();
                InitDefaultPromo(ErrorMessage.GiftCardHasBeenApplied);
                BookProductUpdatePanel.Update();
            }

            if (!isGiftCard)
            {
                var param = new GetDiscountValidByCodeParams
                {
                    Code           = PromoText.Text.Trim(),
                    SubscriptionId = PublicSubscription.Id,
                    CustomerId     = PublicCustomerInfos != null ? PublicCustomerInfos.CustomerId : 0,
                    IsAdmin        = false,
                    BookingId      = 0
                };

                Discounts discounts = _discountRepository.GetDiscountValidByCode(param, out isLimit);
                if (discounts == null)
                {
                    InitDefaultPromo(isLimit ? Message.ExceedLimit : Message.InvalidOrExpiredPromo, false);
                    return;
                }

                if (discounts.MinAmount > PublicSubscription.Price * TotalTickets)
                {
                    InitDefaultPromo(ErrorMessage.MinAmountNotMatch, false);
                    return;
                }

                double actualPrice = NormalPrice;
                actualPrice = Helper.CalculateDiscount(discounts, actualPrice, TotalTickets);

                if (!actualPrice.Equals(NormalPrice))
                {
                    msrp.Visible       = true;
                    msrpPrice.Text     = Helper.FormatPrice(NormalPrice * TotalTickets);
                    LitDisclaimer.Text = string.Format(Message.TermWithPromo, Message.PeriodString);
                }

                moneyPrice.Text    = Helper.FormatPrice(actualPrice * TotalTickets);
                perMoneyPrice.Text = Helper.FormatPrice(actualPrice);

                string json = JsonConvert.SerializeObject(discounts, CustomSettings.SerializerSettings());
                Session[_discountKey] = json;
                BindSubscriptionInfos();
            }
        }