Beispiel #1
0
        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);
        }
Beispiel #2
0
 private void SetCustomerInfo(object currentSession)
 {
     if (currentSession != null && PublicCustomerInfos == null)
     {
         PublicCustomerInfos = _customerInfoRepository.GetCustomerInfoBySessionId(currentSession.ToString());
     }
     if (PublicCustomerInfos != null)
     {
         CustomerIdSearch = PublicCustomerInfos.CustomerId;
     }
 }
Beispiel #3
0
        protected void Page_Init(object sender, EventArgs e)
        {
            _customerInfo = _customerInfoRepository.GetCustomerInfoBySessionId(Session["UserSession"].ToString());
            if (!IsPostBack)
            {
                if (_customerInfo != null)
                {
                    FullNameHeader.InnerText = string.Format("{0} {1}", _customerInfo.FirstName, _customerInfo.LastName);

                    FirstNameText.Text    = _customerInfo.FirstName;
                    LastNameText.Text     = _customerInfo.LastName;
                    EmailAddressText.Text = _customerInfo.EmailAddress;
                }
            }
        }
        protected void Page_Init(object sender, EventArgs e)
        {
            var currentSession = Session["UserSession"];

            if (currentSession != null && _customerInfos == null)
            {
                _customerInfos = _helper.GetCustomerInfoBySessionId(currentSession.ToString());
                if (_customerInfos != null && !string.IsNullOrEmpty(_customerInfos.BrowsePassUrl))
                {
                    HomeLink.NavigateUrl = _customerInfos.BrowsePassUrl;
                }
                else if (!string.IsNullOrEmpty((string)Session["SearchPage"]))
                {
                    HomeLink.NavigateUrl = Session["SearchPage"].ToString();
                }
            }
            else
            {
                HomeLink.NavigateUrl = Constant.SearchPageDefault;
            }
        }
Beispiel #5
0
        protected void Page_Init(object sender, EventArgs e)
        {
            ScriptAnalyticsHeader.Visible = AppConfiguration.EnableTracking;
            if (Session["IsLogOut"] != null)
            {
                Session["IsLogOut"] = null;
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "resetMixpanel", "if (window.mixpanel) { window.mixpanel.reset(); }", true);
            }
            RequestUrl = Request.Url.AbsoluteUri.ToLower();
            if (RequestUrl.Contains("reviews"))
            {
                body.Attributes["class"] += " reviews-page";
            }
            if (RequestUrl.Contains("membership"))
            {
                body.Attributes["class"] += " membership-page";
            }

            if (RequestUrl.Contains("credits"))
            {
                body.Attributes["class"] += " credits-page";
            }

            var createSession = Request.Params["c"];

            if (Session["UserSession"] == null && createSession != null)
            {
                Session["UserSession"] = createSession;
            }

            partnerLink.HRef = AppConfiguration.ForPartnerLink;

            var currentSession = Session["UserSession"];

            if (currentSession != null)
            {
                using (var customerInfoRepository = new CustomerInfoRepository())
                {
                    _customerInfos = customerInfoRepository.GetCustomerInfoBySessionId(currentSession.ToString());
                    if (_customerInfos != null)
                    {
                        string firstName = string.IsNullOrEmpty(_customerInfos.FirstName)
                            ? _customerInfos.EmailAddress.Split('@')[0]
                            : _customerInfos.FirstName;
                        FirstnameLiteral.Text                 = firstName;
                        FirstnameMobileLiteral.Text           = firstName;
                        LoginLinkButton.Attributes["class"]  += " hidden-sm hidden-xs";
                        LoginLinkButton.Attributes["onclick"] = "";
                        if (Request.Browser["IsMobileDevice"] == "true")
                        {
                            LoginLinkButton.Visible = false;
                        }
                        hiw.Visible       = false;
                        mdp.Visible       = true;
                        MyAccount.Visible = true;
                        if (_customerInfos.IsAdmin)
                        {
                            partnerLink.InnerText = "Host";
                            partnerLink.HRef      = String.Format("{0}?e={1}",
                                                                  AppConfiguration.HostLink,
                                                                  HttpUtility.UrlEncode(Algoritma.Encrypt(_customerInfos.EmailAddress, Constant.EncryptPassword)));
                            partnerLink.Attributes["class"] = "is-host";
                        }
                    }
                }
            }
        }