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); } }