Exemplo n.º 1
0
        protected override void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                SitePreference sitePrefCache = CSFactory.GetCacheSitePref();

                if (Request.Headers["X-HTTPS"] != null)
                {
                    if (Request.Headers["X-HTTPS"].ToLower().Equals("no"))
                    {
                        if (Request.Url.ToString().Contains("www"))
                        {
                            Response.Redirect((Request.Url.ToString().Replace("http:/", "https:/").Replace("index.aspx", "")));
                        }
                        else
                        {
                            Response.Redirect((Request.Url.ToString().Replace("http:/", "https:/").Replace("https://", "https://www.").Replace("index.aspx", "")));
                        }
                    }
                }
                if (OrderHelper.IsMobileBrowser() && (Request.QueryString["mobile"] == null || (Request.QueryString["mobile"] != null && Request.QueryString["mobile"] != "false")))
                {
                    Response.Redirect("/mobile/?" + Request.QueryString.ToString().Replace("SID=DISPLAY", "SID=DISPLAY_MOB"));
                }

                if (CSBasePage.GetClientDeviceType() == CSBusiness.Enum.DeviceType.Tablet) // device mobile but version not mobile
                {
                    Response.Redirect("/tablet_big3/" + ((Request.QueryString.ToString().Length > 0) ? "?" : "") + Request.QueryString.ToString().Replace("SID=DISPLAY", "SID=DISPLAY_TAB"));
                }

                NavigationControl.RouteTo("big1");

                base.Page_Load(sender, e);
            }
        }
Exemplo n.º 2
0
        public static Dictionary <string, string> GetDynamicsid(string sid)
        {
            //string xmlData = "";
            Dictionary <string, string> dict = new Dictionary <string, string>();
            string connectionString          = ConfigHelper.GetDBConnection();
            List <CSBusiness.Version> list   = (CSFactory.GetCacheSitePref()).VersionItems;

            CSBusiness.Version item =
                list.Find(x => x.Title.ToLower() == CSBasePage.GetVersionName().ToLower());

            int versionName = 43;

            if (item != null)
            {
                versionName = item.VersionId;
            }
            String ProcName = "pr_site_get_dynamic_sid";

            SqlParameter[] ParamVal = new SqlParameter[6];
            ParamVal[0] = new SqlParameter("sid", sid ?? string.Empty);
            ParamVal[1] = new SqlParameter("@versionid", versionName);
            bool hasRecord = false;

            using (SqlDataReader reader = BaseSqlHelper.ExecuteReader(connectionString, ProcName, ParamVal))
            {
                while (reader.Read())
                {
                    dict.Add("sid", sid);
                    dict.Add("source", reader["source"].ToString());
                    dict.Add("media", reader["media"].ToString());
                    dict.Add("ProjectCode", reader["ProjectCode"].ToString());
                    dict.Add("PhoneNumber", reader["PhoneNumber"].ToString());
                    //xmlData = reader["DataXML"].ToString();
                    hasRecord = true;
                }
            }


            //if (!hasRecord)
            //{
            //    string sid1 = GetDynamicVersionData("sid");
            //    ProcName = "pr_site_get_dynamic_sid";
            //    SqlParameter[] ParamVal1 = new SqlParameter[6];
            //    ParamVal1[0] = new SqlParameter("sid", sid1 ?? string.Empty);
            //    ParamVal1[1] = new SqlParameter("@versionid", versionName);
            //    using (SqlDataReader reader = BaseSqlHelper.ExecuteReader(connectionString, ProcName, ParamVal1))
            //    {
            //        while (reader.Read())
            //        {
            //            dict.Add("sid", sid);
            //            dict.Add("source", reader["source"].ToString());
            //            dict.Add("media", reader["media"].ToString());
            //            dict.Add("ProjectCode", reader["ProjectCode"].ToString());
            //            dict.Add("PhoneNumber", reader["PhoneNumber"].ToString());
            //        }
            //    }


            //}
            return(dict);
        }
Exemplo n.º 3
0
 protected string GetVersionName()
 {
     return(GetJsString(CSBasePage.GetVersionName(false)));
 }
Exemplo n.º 4
0
        protected override void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);
            if (!IsPostBack)
            {
                if (CSBasePage.GetClientDeviceType() == CSBusiness.Enum.DeviceType.Mobile)
                {
                    OrderHelper.MobileRedirect();
                }

                string version    = OrderHelper.GetVersionName().ToLower();
                string strTermUrl = "";
                strTermUrl = Request.Url.ToString().ToLower().Replace(":81", "");
                OrderHelper.RedirectDesktop();

                OrderHelper.SetDynamicLandingPageVersion(OrderHelper.GetVersionName(), ClientOrderData);
                // versionName used in Header.ascx

                string versioName = OrderHelper.GetVersionName().ToLower();
                var    qs         = HttpUtility.ParseQueryString(Request.QueryString.ToString());
                if (Request["sid"] == null || Request["sid"].Equals(""))
                {
                    string sid = OrderHelper.GetDynamicVersionData("sid");
                    if (sid.Length > 0)
                    {
                        CommonHelper.SetCookie("sid", sid, new TimeSpan(1, 24, 1, 1));
                        qs.Set("sid", sid);
                        if (Request.RawUrl.Contains("?"))
                        {
                            Response.Redirect(Request.RawUrl.Substring(0, Request.RawUrl.IndexOf('?')) + "?" + qs);
                        }
                        else
                        {
                            Response.Redirect(Request.RawUrl + "?" + qs);
                        }
                    }
                }
                else if (Response.Cookies["sid"] != null && Response.Cookies["sid"].Value != null && Response.Cookies["sid"].Value.Equals("1"))
                {
                    string sid = OrderHelper.GetDynamicVersionData("sid");
                    if (sid.Length > 0)
                    {
                        CommonHelper.SetCookie("sid", sid, new TimeSpan(1, 24, 1, 1));
                        qs.Set("sid", sid);
                        if (Request.RawUrl.Contains("?"))
                        {
                            Response.Redirect(Request.RawUrl.Substring(0, Request.RawUrl.IndexOf('?')) + "?" + qs);
                        }
                        else
                        {
                            Response.Redirect(Request.RawUrl + "?" + qs);
                        }
                    }
                }
                else if (Request["sid"] != null && DynamicSidDAL.GetDynamicsid(Request["sid"].ToLower()).Count == 0)
                {
                    string sid = OrderHelper.GetDynamicVersionData("sid");
                    if (sid.Length > 0)
                    {
                        CommonHelper.SetCookie("sid", sid, new TimeSpan(1, 24, 1, 1));
                        qs.Set("sid", sid);
                        if (Request.RawUrl.Contains("?"))
                        {
                            Response.Redirect(Request.RawUrl.Substring(0, Request.RawUrl.IndexOf('?')) + "?" + qs);
                        }
                        else
                        {
                            Response.Redirect(Request.RawUrl + "?" + qs);
                        }
                    }
                }
                else if (Request["sid"] != null && DynamicSidDAL.GetDynamicsid(Request["sid"].ToLower()).Count == 0 && !Request["sid"].ToLower().Equals(OrderHelper.GetDynamicVersionData("sid").ToLower()))
                {
                    string sid = OrderHelper.GetDynamicVersionData("sid");
                    if (sid.Length > 0)
                    {
                        CommonHelper.SetCookie("sid", sid, new TimeSpan(1, 24, 1, 1));
                        qs.Remove("sid");
                        qs.Set("sid", sid);
                        if (Request.RawUrl.Contains("?"))
                        {
                            Response.Redirect(Request.RawUrl.Substring(0, Request.RawUrl.IndexOf('?')) + "?" + qs);
                        }
                        else
                        {
                            Response.Redirect(Request.RawUrl + "?" + qs);
                        }
                    }
                }
            }
        }