private void init_value() { string[] SetYear_ = SetYear.Split('|'); try { Session["step"] = 0; clsSearch clsC = new clsSearch(); clsC.init_value(Request.Params["year"], Request.Params["make"], Request.Params["model"], Request.Params["other"], Request.Params["class"], Request.Params["searchtext"]); year = (Session["year"] != null ? Session["year"].ToString() : ""); make = (Session["make"] != null ? Session["make"].ToString() : ""); model = (Session["model"] != null ? Session["model"].ToString() : ""); } catch { } //lVaribleDefault.Text = "alert('" + SetYear_ .Length.ToString()+ "')"; string obtion = "<option value='All'>All</option>"; for (int i = 0; i < SetYear_.Length; i++) { obtion += string.Format("<option value='{0}'>{0}</option>", SetYear_[i]); } DefaultYear.Text = obtion; }
protected override void OnInit(EventArgs e) { base.OnInit(e); clsC.init_value(Request.Params["year"], Request.Params["make"], Request.Params["model"], Request.Params["other"], Request.Params["class"], Request.Params["searchtext"]); year = Session["year"].ToString(); make = Session["make"].ToString(); model = Session["model"].ToString(); string name = (year != "" ? year : "") + (make != "" ? (year != "" ? " " + CarzHelpers.URLDecode(make) : CarzHelpers.URLDecode(make)) : "") + (model != "" ? (year != "" ? " " + CarzHelpers.URLDecode(model, true).Replace("_", "-") : (make != "" ? " " + CarzHelpers.URLDecode(model, true).Replace("_", "-") : CarzHelpers.URLDecode(model, true).Replace("_", "-"))) : ""); name = name.Trim(); if (Request.Params["class"] != null) { CMSContext.CurrentTitle = CarzHelpers.URLDecode(Request.Params["class"].ToString()).Replace("-", " ") + (name == "" ? "" : " - " + name.Replace(".aspx", "")); } }
protected void lodding() { clsC.init_value(Request.Params["year"], Request.Params["make"], Request.Params["model"], Request.Params["other"], Request.Params["class"], Request.Params["searchtext"]); year = Session["year"].ToString(); make = Session["make"].ToString(); model = Session["model"].ToString(); class_ = Session["classname"].ToString(); searchtext = Session["searchtext"].ToString(); nparam = Session["nparam"] != null?int.Parse(Session["nparam"].ToString()) : 0; clsC.get_sql(year, make, model, other, searchtext); sql = Session["sql"].ToString(); title = Session["title"].ToString(); get_query(); string[] aqn = qryname.Split('.'); //LiteralTitle.Text = qryname; string sql2 = "select QueryName,QueryText from dbo.CMS_Query where QueryName='{0}'"; ds_ = cn.ExecuteQuery(string.Format(sql2, aqn[2]), null, QueryTypeEnum.SQLQuery, false); if (ds_ != null) { foreach (DataRow ItemRow in ds_.Tables[0].Rows) { ds_ = cn.ExecuteQuery(ItemRow["QueryText"].ToString().Replace("##WHERE##", sql), null, QueryTypeEnum.SQLQuery, false); Session["123456"] = sql; if (ds_ != null) { if (ds_.Tables[0].Rows.Count <= 0) { LiteralResultDetail.Text = "<div class='ResultTitle'><p><h1>Sorry, no car found.</h1></p></div>"; Session["list_result"] = null; debug += "9"; //Uri url = Request.Url; //LiteralResultDetail.Text = url.AbsoluteUri; //LiteralResultDetail.Text = make; } else { debug = "1"; if (ds_.Tables[0].Rows.Count > 0) { if (ds_.Tables[0].Rows.Count > 0 && nparam < 3) { debug += "2"; Session["list_result"] = ds_.Tables[0]; } else if (Session["list_result"] == null && ds_.Tables[0].Rows.Count == 1) { Session["list_result"] = ds_.Tables[0]; debug += "3"; } n_row = ds_.Tables[0].Rows.Count; Session["list_result_detail"] = ds_.Tables[0].Rows[0]; class_ = ds_.Tables[0].Rows[0]["TimeClass"].ToString().Trim(); debug += "4"; } try { dtb = (DataTable)Session["list_result"]; debug += "-10"; } catch { debug += "-11"; } //for (int i = 0; i < ds_.Tables[0].Rows.Count; i++) //{ //ds_.Tables[0].Rows[i]["STT"] = ds_.Tables[0].Rows[i]["TimeClassRank"]; //} if (dtb.Rows.Count > 0) { if (dtb.Rows.Count > 1) { debug += "5"; Session["list_result"] = dtb.Select("", "STT ASC").CopyToDataTable(); } debug += "6"; n_row = ds_.Tables[0].Rows.Count; Session["list_result_detail"] = ds_.Tables[0].Rows[0]; } debug += "7"; } } } } }
private void init_value() { string[] SetYear_ = SetYear.Split('|'); try { Session["step"] = 0; clsSearch clsC = new clsSearch(); clsC.init_value(Request.Params["year"], Request.Params["make"], Request.Params["model"], Request.Params["other"], Request.Params["class"], Request.Params["searchtext"]); year = (Session["year"] != null ? Session["year"].ToString() : ""); make = (Session["make"] != null ? Session["make"].ToString() : ""); model = (Session["model"] != null ? Session["model"].ToString() : ""); } catch { } //lVaribleDefault.Text = "alert('" + SetYear_ .Length.ToString()+ "')"; string obtion = "<option value='All'>All</option>"; for (int i = 0; i < SetYear_.Length; i++) { obtion+=string.Format("<option value='{0}'>{0}</option>", SetYear_[i]); } DefaultYear.Text = obtion; }
protected void lodding() { clsC.init_value(Request.Params["year"], Request.Params["make"], Request.Params["model"], Request.Params["other"], Request.Params["class"], Request.Params["searchtext"]); year = Session["year"].ToString(); make = Session["make"].ToString(); model = Session["model"].ToString(); class_ = Session["classname"].ToString(); int nparam = Session["nparam"] != null?int.Parse(Session["nparam"].ToString()) : 0; clsC.get_sql(year, make, model, other, ""); sql = Session["sql"].ToString(); title = Session["title"].ToString(); get_query(); string[] aqn = qryname.Split('.'); //LiteralTitle.Text = qryname; string sql2 = "select QueryName,QueryText from dbo.CMS_Query where QueryName='{0}'"; ds_ = cn.ExecuteQuery(string.Format(sql2, aqn[2]), null, QueryTypeEnum.SQLQuery, false); if (ds_ != null) { foreach (DataRow ItemRow in ds_.Tables[0].Rows) { ds_ = cn.ExecuteQuery(ItemRow["QueryText"].ToString().Replace("##WHERE##", sql), null, QueryTypeEnum.SQLQuery, false); Session["123456"] = sql; if (ds_ != null) { if (ds_.Tables[0].Rows.Count <= 0) { LiteralResultDetail.Text = "<div class='ResultTitle'><p<h1>Crash and Burn</h1><p>Sorry, the car was not found. Please try another car.</p></div>"; Session["list_result"] = null; //LiteralResultDetail.Text = Session["123456"].ToString(); } else { if (ds_.Tables[0].Rows.Count > 0) { if (ds_.Tables[0].Rows.Count > 1) { Session["list_result"] = ds_.Tables[0]; } else if (Session["list_result"] == null && ds_.Tables[0].Rows.Count == 1) { Session["list_result"] = ds_.Tables[0]; } n_row = ds_.Tables[0].Rows.Count; Session["list_result_detail"] = ds_.Tables[0].Rows[0]; } try { dtb = (DataTable)Session["list_result"]; } catch { } if (!ExpressClasses) { if (nparam != 1) { for (int i = 0; i < ds_.Tables[0].Rows.Count; i++) { if (dtb != null) { if (dtb.Rows.Count > 1) { ds_.Tables[0].Rows[i]["STT"] = ds_.Tables[0].Rows[i]["TimeClassRank"]; } } } } } if (ds_.Tables[0].Rows.Count > 0) { if (ds_.Tables[0].Rows.Count > 1) { Session["list_result"] = ds_.Tables[0].Select("", "STT ASC").CopyToDataTable(); } n_row = ds_.Tables[0].Rows.Count; Session["list_result_detail"] = ds_.Tables[0].Rows[0]; } } } else { LiteralResultDetail.Text = "<div class='ResultTitle'><p><h1>Sorry, no car found.</h1></p></div>"; Session["list_result"] = null; } } } }