protected void Page_Init(object sender, EventArgs e) { Session["Active"] = "SearchBookingsList"; int customerId; int.TryParse(Request.Params["id"], out customerId); CurrentCustomerId = customerId; if (!IsPostBack) { Session["CurrentPage"] = 1; CustomerInfosDetails = _customerInfoRepository.GetById(CurrentCustomerId); string json = JsonConvert.SerializeObject(CustomerInfosDetails, CustomSettings.SerializerSettings()); Session["CustomerInfosDetails"] = json; _response = _helper.SearchDataByCustomerId(CurrentCustomerId); _currentData = _response.ListBookingsData.ToList(); string jsonData = JsonConvert.SerializeObject(_currentData, CustomSettings.SerializerSettings()); Session["SearchCustomerBookings"] = jsonData; BindRepeater(_currentData.Take(10)); } else { string session = Session["CustomerInfosDetails"] != null ? Session["CustomerInfosDetails"].ToString() : string.Empty; CustomerInfosDetails = JsonConvert.DeserializeObject <CustomerInfos>(session); string sessionData = Session["SearchCustomerBookings"] != null ? Session["SearchCustomerBookings"].ToString() : string.Empty; _currentData = JsonConvert.DeserializeObject <List <SearchDataObject> >(sessionData); } if (CustomerInfosDetails == null) { Response.Redirect(Constant.SearchBookingsAdminpage); } // Get Membership Info PublicDiscounts = _customerInfoRepository.GetSubscriptionDiscount(CustomerInfosDetails.CustomerId); if (PublicDiscounts != null) { _subscriptionBookings = _subscriptionBookingRepository.GetByCustomerId(CustomerInfosDetails.CustomerId, PublicDiscounts.Id); if (_subscriptionBookings != null && _subscriptionBookings.Status == (byte)Enums.SubscriptionBookingStatus.Active) { CancelMembershipLinkButton.Visible = true; } } BindCustomerData(); }
protected override void OnInit(EventArgs e) { if (!Request.IsLocal && !Request.IsSecureConnection) { string redirectUrl = Request.Url.ToString().Replace("http:", "https:"); Response.Redirect(redirectUrl, false); HttpContext.Current.ApplicationInstance.CompleteRequest(); } if (Session["UserSession"] != null) { PublicCustomerInfos = _customerInfoRepository.GetCustomerInfoBySessionId(Session["UserSession"].ToString()); } if (PublicCustomerInfos != null) { PublicCustomerSearch = _customerInfoRepository.CustomerInfoSearchCriteriaList.FirstOrDefault( x => x.CustomerId == PublicCustomerInfos.CustomerId); PublicDiscounts = _customerInfoRepository.GetSubscriptionDiscount(PublicCustomerInfos.CustomerId); if (PublicDiscounts != null) { var subscription = (from sb in _customerInfoRepository.SubscriptionBookingsList join sdu in _customerInfoRepository.SubscriptionDiscountUsedList on sb.Id equals sdu .SubscriptionBookingId join s in _customerInfoRepository.SubscriptionsList on sb.SubscriptionId equals s.Id where sdu.DiscountId == PublicDiscounts.Id select s).FirstOrDefault(); if (subscription != null) { PublicSubscriptionId = subscription.Id; } } } if ((PublicCustomerInfos != null && string.IsNullOrEmpty(PublicCustomerInfos.EmailAddress)) || (Session["UserSession"] != null && PublicCustomerInfos == null)) { PublicCustomerInfos = null; Session.Remove("UserSession"); Session.Remove("ReferralCode"); } // if (AppConfiguration.IsStageSite && (Page.RouteData.Values["urlSegment"] == null || (Page.RouteData.Values["urlSegment"] != null && !Page.RouteData.Values["urlSegment"].ToString().Contains("signup") && !Page.RouteData.Values["urlSegment"].ToString().Contains("signin"))) && (PublicCustomerInfos == null || !PublicCustomerInfos.IsActive)) { Response.Redirect(string.Format(Constant.SignIpPage, HttpUtility.UrlEncode(Request.Url.PathAndQuery))); } base.OnInit(e); }