protected void HtmlAnchor_Click(object sender, EventArgs e)
        {
            if ((Session["UserSession"] == null || PublicCustomerInfos == null || string.IsNullOrEmpty(PublicCustomerInfos.EmailAddress)) &&
                string.IsNullOrEmpty(email.Text.Trim()) && !Helper.IsValidEmail(email.Text.Trim()))
            {
                email.CssClass = "form-control errorborder";
                return;
            }

            if (string.IsNullOrEmpty(FirstName.Text.Trim()))
            {
                FirstName.CssClass = "form-control errorborder";
                return;
            }
            if (string.IsNullOrEmpty(LastName.Text.Trim()))
            {
                LastName.CssClass = "form-control errorborder";
                return;
            }

            try
            {
                bool isSuccess;
                int  bookingId = PurchaseSubscription(out isSuccess);
                if (isSuccess)
                {
                    Session["BookingSuccess"] = true;
                    Response.Redirect(string.Format(Constant.SubscriptionConfirmPage,
                                                    PublicSubscription.StripePlanId,
                                                    bookingId,
                                                    ""), false);
                }
                else
                {
                    ScriptManager.RegisterClientScriptBlock(BookProductUpdatePanel, typeof(string), "openConfirmPopup", "window.showConfirmM = 'true';", true);
                }
            }
            catch (Exception ex)
            {
                ErrorMessageLit.Text = ex.Message;

                var logs = new Logs
                {
                    LogKey         = "Subscription-Booking-Error-On-Submit",
                    UpdatedDate    = DateTime.UtcNow,
                    UpdatedContent = string.Format("Booking Error - {0} - {1} - {2}", ex.Message, ex.StackTrace, ex.Source),
                    UpdatedBy      = PublicCustomerInfos != null ? PublicCustomerInfos.CustomerId : 0
                };
                _subscriptionBookingRepository.AddLog(logs);
            }
        }
        protected void Page_Init(object sender, EventArgs e)
        {
            try
            {
                if (Page.RouteData.Values["SubscriptionBookingId"] != null)
                {
                    int subBookingId;
                    if (int.TryParse(Page.RouteData.Values["SubscriptionBookingId"].ToString(), out subBookingId))
                    {
                        PublicSubscriptionBooking = _subscriptionBookingRepository.GetById(subBookingId);
                        PublicSubscriptionCycles  = _subscriptionBookingRepository.SubscriptionCyclesList
                                                    .Where(sc => sc.SubscriptionBookingId == subBookingId)
                                                    .OrderByDescending(sc => sc.CycleNumber)
                                                    .FirstOrDefault();
                        PublicSubscriptions = _subscriptionRepository.GetById(PublicSubscriptionBooking.SubscriptionId);
                        PublicDiscountUsed  = _subscriptionRepository.GetDiscountsBySubscriptionBookingId(subBookingId);
                        ReBindConfirmInfo();

                        if (PublicDiscountUsed != null)
                        {
                            PromoAppliedRow.Visible         = true;
                            PromoAppliedSeperateRow.Visible = true;
                            DiscountCodeLit.Text            = string.Format("{0} OFF",
                                                                            PublicDiscountUsed.PromoType == (int)Enums.PromoType.Fixed
                                    ? Helper.FormatPrice(PublicDiscountUsed.PercentOff)
                                    : PublicDiscountUsed.PercentOff + "%");
                        }

                        var promoPrice = PublicSubscriptionCycles.MerchantPrice * PublicSubscriptionBooking.Quantity - PublicSubscriptionCycles.TotalPrice - PublicSubscriptionCycles.PayByCredit;

                        if (promoPrice.Equals(0))
                        {
                            promoRow.Visible = false;
                        }
                        PromoPrice.Text = Helper.FormatPrice(promoPrice);

                        if (PublicSubscriptionCycles.PayByCredit.Equals(0))
                        {
                            creditRow.Visible = false;
                        }
                        CreditPrice.Text   = Helper.FormatPrice(PublicSubscriptionCycles.PayByCredit * -1);
                        TotalPriceLit.Text = Helper.FormatPrice(PublicSubscriptionCycles.TotalPrice);
                    }
                }

                int bookingId;
                if (Page.RouteData.Values["BookingId"] != null &&
                    int.TryParse(Page.RouteData.Values["BookingId"].ToString(), out bookingId))
                {
                    var productRepository = new ProductRepository();
                    PublicProducts = productRepository.GetProductsByBookingId(bookingId);
                }

                if (PublicCustomerInfos == null ||
                    PublicSubscriptionBooking != null &&
                    PublicCustomerInfos.CustomerId != PublicSubscriptionBooking.CustomerId)
                {
                    Response.Redirect(Constant.InvalidTicketPage, false);
                    //Response.Redirect(string.Format(Constant.SignIpPage, WebUtility.UrlEncode(Request.Url.PathAndQuery)));
                }

                if (PublicDiscounts == null)
                {
                    Response.Redirect(string.Format(Constant.SignIpPage, HttpUtility.UrlEncode(Request.Url.PathAndQuery)));
                }

                if (PublicSubscriptionBooking == null)
                {
                    if (PublicCustomerInfos != null && !string.IsNullOrEmpty(PublicCustomerInfos.BrowsePassUrl))
                    {
                        Response.Redirect(PublicCustomerInfos.BrowsePassUrl, true);
                    }
                    Response.Redirect(!string.IsNullOrEmpty((string)Session["SearchPage"])
                        ? Session["SearchPage"].ToString()
                        : Constant.SearchPageDefault, true);
                }

                if (PublicCustomerInfos == null || string.IsNullOrEmpty(PublicCustomerInfos.EmailAddress))
                {
                    PublicCustomerInfos = _customerInfoRepository.GetById(PublicSubscriptionBooking.CustomerId);
                }
                if (!PublicCustomerInfos.IsConfirmed)
                {
                    PasswordErrorMessage.Visible = false;
                    CustomerMV.ActiveViewIndex   = 0;
                }

                if (PublicProducts != null)
                {
                    FirstPassReserveLit.Text = "and your first day pass has been reserved";
                    ViewReservation.Visible  = true;
                    AnchorButton.Text        = "Reserve Pass";
                }
            }
            catch (Exception ex)
            {
                var logs = new Logs
                {
                    LogKey         = "Subscription-Confirmation-Error",
                    UpdatedDate    = DateTime.UtcNow,
                    UpdatedContent = string.Format("Subscription Confirmation Error - {0} - {1} - {2}", ex.Message, ex.StackTrace, ex.Source),
                    UpdatedBy      = PublicCustomerInfos != null ? PublicCustomerInfos.CustomerId : 0
                };
                _subscriptionBookingRepository.AddLog(logs);
            }
        }