コード例 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Session["CurrentPage"] = "Home";
            Session["PageName"] = "";
            Session["CurrentPageConfig"] = null;

            GeneralFunc.SaveSiteVisit();

            GeneralFunc.SetPageDefaults(Page);

            string Make = Request.QueryString[Request.QueryString.Count - 1];

            //string Name = Request.Cookies.Get("UserSettings").Values.Get("Name");
            //string Phone = Request.Cookies.Get("UserSettings").Values.Get("Phone");

            if (Make != null)
            {

                string[] strCarid = Make.Split('-');
                if(strCarid.Length >= 4)
                Hadd.Value = strCarid[3].ToString();

                CarsService obj = new CarsService();

                List<CarsInfo.UsedCarsInfo> objCarInfo = new List<CarsInfo.UsedCarsInfo>();

                ServiceReference objServiceReference = new ServiceReference();

                ScriptReference objScriptReference = new ScriptReference();

                //objServiceReference.Path = "http://cars.hugomirad.com/CarsService.asmx";

                //objScriptReference.Path = "http://cars.hugomirad.com/Static/JS/CarsJScriptNew.js";

                //objServiceReference.Path = "http://localhost:1460/Cars/CarsService.asmx";

                //objScriptReference.Path = "http://localhost:1460/Cars/Static/JS/CarsJScriptNew.js";

                objServiceReference.Path = "../CarsService.asmx";

                objScriptReference.Path = "../Static/Js/CarsJScriptNew.js";

                scrptmgr.Services.Add(objServiceReference);
                scrptmgr.Scripts.Add(objScriptReference);

                if (p == 0)
                {
                    if (strCarid.Length > 1)
                    {
                        string sCarid = strCarid[strCarid.Length - 1];

                        if (GeneralFunc.IsNumeric(sCarid))
                        {

                            if (Request.Cookies.Get("UserSettings") == null)
                            {
                                // ClientScript.RegisterStartupScript(typeof(Page), "KyAUIDFCS", "<script language='javascript' type='text/javascript'>Subscribe();</script>");

                            }

                            objCarInfo = obj.FindCarIDNew(sCarid);

                            FillCarDetails(objCarInfo, sCarid);

                        }
                    }
                }
            }
            else
            {
                Response.Redirect("errorpage.aspx");
            }
        }
    }