protected void Page_Init(object sender, EventArgs e) { if (PublicCustomerInfos == null) { var loginLinkButton = (HtmlAnchor)ControlExtensions.FindControlRecursive(Master, "LoginLinkButton"); loginLinkButton.Visible = false; Response.Redirect(string.Format(Constant.SignIpPage, HttpUtility.UrlEncode(Request.Url.PathAndQuery))); } _customerCredits = _crRepository.GetById(PublicCustomerInfos.CustomerId); if (!IsPostBack) { if (_customerCredits == null) { SendToFriendButton.Text = "Add"; } ReferralCodeLit.Text = _customerCredits != null ? _customerCredits.ReferralCode : "N/A"; TotalCreditLit.Text = Helper.FormatPrice(_customerCredits != null ? _customerCredits.Amount : 0); EnjoyFreeDayCationLit.Text = string.Format(ErrorMessage.EnjoyDayCations, Helper.FormatPrice(_customerCredits != null ? _customerCredits.FirstRewardForOwner : 0), Helper.FormatPrice(_customerCredits != null ? _customerCredits.FirstRewardForOwner : 0)); RebindLogs(); } }
private void BindImageLanding() { var imageDesktop = ControlExtensions.FindControlRecursive(ContentPlaceHolder, "ImageLandingDesktop") as Image; if (imageDesktop != null) { imageDesktop.Visible = true; imageDesktop.ImageUrl = new Uri(new Uri(AppConfiguration.CdnImageUrlDefault), _content.ImageLandingDesktop).AbsoluteUri; imageDesktop.CssClass += " img-background"; } var imageMobile = ControlExtensions.FindControlRecursive(ContentPlaceHolder, "ImageLandingMobile") as Image; if (imageMobile != null) { imageMobile.Visible = true; imageMobile.ImageUrl = new Uri(new Uri(AppConfiguration.CdnImageUrlDefault), _content.ImageLandingMobile).AbsoluteUri; imageMobile.CssClass += " img-background"; } }
private void BindMyDayPassInfo() { var daypassRepeater = ControlExtensions.FindControlRecursive(ContentPlaceHolder, "DayPassRepeater") as Repeater; if (daypassRepeater != null) { if (Session["UserSession"] == null) { throw new HttpException(401, "UnAuthorized"); } CustomerInfos customerInfos = _bookingRepository.GetCustomerInfoBySessionId((string)Session["UserSession"]); if (customerInfos == null) { throw new HttpException(401, "UnAuthorized"); } daypassRepeater.ItemDataBound += DaypassRepeaterOnItemDataBound; var daypasses = _bookingRepository.GetBookingsByCustomerId(customerInfos.CustomerId); daypassRepeater.DataSource = daypasses; daypassRepeater.DataBind(); } }
protected void Page_Init(object sender, EventArgs e) { if (PublicCustomerInfos == null) { var loginLinkButton = (HtmlAnchor)ControlExtensions.FindControlRecursive(Master, "LoginLinkButton"); loginLinkButton.Visible = false; Response.Redirect(string.Format(Constant.SignIpPage, HttpUtility.UrlEncode(Request.Url.PathAndQuery))); } MemberShipDetailView.ActiveViewIndex = 0; YourPlanLabel.Text = ErrorMessage.MembershipNotActive; reactiveMembershipLink.Visible = true; cancelMembershipLink.Visible = false; _subscriptionBookings = _subscriptionBookingRepository.GetSuspendedByCustomerId(PublicCustomerInfos.CustomerId); if (_subscriptionBookings != null) { PublicDiscounts = _customerInfoRepository.GetSubscriptionDiscountSuspended(PublicCustomerInfos.CustomerId); ErrorMessageLabel.Text = "Your subscription is suspended. Please contact our customer support at <a href=\"mailto:[email protected]\">[email protected]</a> to resolve this issue."; ErrorMessageLabel.Visible = true; ErrorMessageLabel.CssClass = "error-message"; } if (PublicDiscounts != null) { MemberShipDetailView.ActiveViewIndex = 1; _subscriptions = _customerInfoRepository.GetSubscriptionByCustomerId(PublicCustomerInfos.CustomerId, PublicDiscounts.Id); if (_subscriptions != null) { YourPlanLabel.Text = string.Format("{0} - {1} <br/> {2} / month", _subscriptions.Name.ToUpper(), _subscriptions.ProductHighlight, Helper.FormatPrice(_subscriptions.Price)); WhatYouGetLit.Text = _subscriptions.WhatYouGet; } // Avoid get again by Suspended case if (_subscriptionBookings == null) { _subscriptionBookings = _subscriptionBookingRepository.GetByCustomerId(PublicCustomerInfos.CustomerId, PublicDiscounts.Id); } if (_subscriptionBookings != null) { switch (_subscriptionBookings.Status) { case (int)Enums.SubscriptionBookingStatus.Active: NextCycleLit.Text = string.Format("Next cycle begins {0:MMMM dd}", PublicDiscounts.EndDate.HasValue ? PublicDiscounts.EndDate.Value.ToLosAngerlesTime().AddDays(1) : DateTime.UtcNow); reactiveMembershipLink.Visible = false; cancelMembershipLink.Visible = true; break; case (int)Enums.SubscriptionBookingStatus.End: NextCycleLit.Visible = false; break; case (int)Enums.SubscriptionBookingStatus.Suspended: reactiveMembershipLink.Visible = false; cancelMembershipLink.Visible = false; break; } } ValidLit.Text = string.Format("Valid through {0:MMMM dd, yyyy}", PublicDiscounts.EndDate.HasValue ? PublicDiscounts.EndDate.Value.ToLosAngerlesTime() : DateTime.UtcNow); MembershipIdLabel.Text = PublicDiscounts.Code; } }
protected void Page_Init(object sender, EventArgs e) { if (Master == null) { throw new HttpException(404, ErrorMessage.MasterNotFound); } HtmlGenericControl body = (HtmlGenericControl)Master.FindControl("body"); if (Page.RouteData.Values["urlSegment"] != null) { var urlSegment = (string)Page.RouteData.Values["urlSegment"]; bool isInvalidTicket = false; switch (urlSegment) { case "signup": case "signin": var signupControl = (AuthControlWithoutPopup)LoadControl("~/Controls/AuthControlWithoutPopup.ascx"); var multiView = (MultiView)ControlExtensions.FindControlRecursive(signupControl, "AuthMultiView"); if (multiView != null) { if (urlSegment == "signup") { multiView.ActiveViewIndex = 0; TitleLiteral.Text = "Sign Up"; } else { if (PublicCustomerInfos != null && Request.Params["ReturnUrl"] != null) { if (Request.RawUrl.Contains(Constant.ConfirmPageProduct)) { var ticketControl = (InvalidTicket)LoadControl("~/Controls/InvalidTicket.ascx"); ContentPlaceHolder.Controls.Add(ticketControl); isInvalidTicket = true; } else { Response.Redirect(HttpUtility.UrlDecode(Request.Params["ReturnUrl"])); } } TitleLiteral.Text = "Sign In"; multiView.ActiveViewIndex = 1; } if (Request.Params["sp"] != null && (Session["UserSession"] == null || (Session["UserSession"] != null && string.Equals(Request.Params["sp"], (string)Session["UserSession"], StringComparison.OrdinalIgnoreCase)))) { ShowAuth = true; multiView.ActiveViewIndex = 3; } } AuthControl.Visible = false; // Sign in but do not have permission if (!isInvalidTicket) { ContentPlaceHolder.Controls.Add(signupControl); } break; case "invalid-ticket": var invalidTicketControl = (InvalidTicket)LoadControl("~/Controls/InvalidTicket.ascx"); ContentPlaceHolder.Controls.Add(invalidTicketControl); AuthControl.Visible = false; break; case "my-account": body.Attributes["class"] += " my-account-page"; // Users Do not log in if (PublicCustomerInfos == null) { var loginLinkButton = (HtmlAnchor)ControlExtensions.FindControlRecursive(Master, "LoginLinkButton"); loginLinkButton.Visible = false; Response.Redirect(string.Format(Constant.SignIpPage, HttpUtility.UrlEncode(Request.Url.PathAndQuery))); } var myAccountControl = (MyAccount)LoadControl("~/Controls/MyAccount.ascx"); ContentPlaceHolder.Controls.Add(myAccountControl); AuthControl.Visible = false; footer.Visible = false; NewsletterControl.Visible = false; break; default: if (urlSegment == "my-day-passes") { if (PublicCustomerInfos == null) { Response.Redirect(string.Format(Constant.SignIpPage, HttpUtility.UrlEncode(Request.Url.PathAndQuery))); } } _content = _helper.GetHtmlContentsByUrlSegment(urlSegment); if (_content == null) { throw new HttpException(404, ErrorMessage.NotFound); } break; } } else { _content = _helper.GetDefaultHtmlContents(); //var homeControl = (HomePageContent)LoadControl("~/LandingTemplate/homepage.ascx"); //ContentPlaceHolder.Controls.Add(homeControl); //IsHome = true; body.Attributes["class"] += " home-page"; } if (_content != null) { body.Attributes["class"] += string.Format(" {0} {1}", Page.RouteData.Values["urlSegment"], _content.BodyClass); BindHeaderInfo(); BindContentInfo(); BindMyDayPassInfo(); BindImageLanding(); BindHomeProductFeatured(); } }
private void BindHomeProductFeatured() { var productFeaturedPlaceHolder = ControlExtensions.FindControlRecursive(ContentPlaceHolder, "FeaturedProductPlaceHolder") as PlaceHolder; var str = "<asp:Repeater ID=\"LvProductRepeater\" runat=\"server\" Visible=\"False\">" + " <HeaderTemplate>" + " <div id=\"owl-product-featured\" class=\"owl-carousel owl-theme\">" + " </HeaderTemplate>" + " <ItemTemplate>" + " <a id=\"ProductItem\" runat=\"server\">" + " <div class=\"product-item\">" + " <asp:Image ID=\"ProductImage\" CssClass=\"lazyOwl img-responsive\" AlternateText=\"\" runat=\"server\" />" + " <div class=\"product-info\">" + " <div class=\"type\">" + " <asp:Literal runat=\"server\" ID=\"ProductNameLit\"></asp:Literal>" + " </div>" + " <div class=\"hotel-name\">" + " <asp:Literal runat=\"server\" ID=\"HotelNameLit\"></asp:Literal>" + " </div>" + " <div class=\"max-guest\">" + " <asp:Label CssClass=\"price\" runat=\"server\" ID=\"PriceLit\"></asp:Label> per guest" + " </div>" + " <div class=\"rating\">" + " <asp:Literal runat=\"server\" ID=\"RatingLit\"></asp:Literal>" + " <span>" + " <asp:Literal runat=\"server\" ID=\"TotalReviewsLit\"></asp:Literal>" + " </span>" + " </div>" + " </div>" + " </div>" + " </a>" + " </ItemTemplate>" + " </asp:Repeater>"; if (productFeaturedPlaceHolder != null) { var strControl = Page.ParseControl(str); if (strControl != null) { productFeaturedPlaceHolder.Controls.Add(strControl); var productReater = ControlExtensions.FindControlRecursive(ContentPlaceHolder, "LvProductRepeater") as Repeater; if (productReater != null) { var products = _productRepository.GetFeaturedProducts(); if (products.Any()) { const string mixpanelscript = "MixpanelScript"; string strScript = string.Empty; products.ForEach(item => { strScript += Helper.GetMixpanelScriptRedirect(item.ProductId, string.Format("/{0}/{1}/{2}/{3}/{4}", Page.RouteData.Values["market"] ?? "socal", Helper.ReplaceSpecialCharacter(item.Hotels.City), Helper.ReplaceSpecialCharacter(item.Hotels.HotelName), Helper.ReplaceSpecialCharacter(item.ProductName), item.ProductId)); }); if (!string.IsNullOrEmpty(strScript)) { ClientScript.RegisterClientScriptBlock(GetType(), mixpanelscript, strScript, true); } productReater.ItemDataBound += ProductReaterOnItemDataBound; productReater.DataSource = products; productReater.Visible = true; productReater.DataBind(); } } } } }