protected void GridViewResult_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        string y         = "";
        string m         = "";
        string md        = "";
        string rank      = "";
        string path_STT  = "";
        string classname = (Request.Params["class"] != null ? Request.Params["class"].ToString().Replace(".aspx", "") + "/" : "");

        if (e.Row.RowType == DataControlRowType.DataRow)
        {
//--------*** This sets up the table rows on the results page--------

            rank = e.Row.Cells[0].Text.Trim();
            y    = e.Row.Cells[1].Text.Trim();
            m    = e.Row.Cells[2].Text.Trim();
            md   = e.Row.Cells[3].Text.Trim();
            //class_ = e.Row.Cells[7].Text.Trim();
            path_STT            = "<a href='/Top-10-Fastest-Cars/" + classname + CarzHelpers.URLEncode(y) + "-" + CarzHelpers.URLEncode(m) + "-" + CarzHelpers.URLEncode(md, true) + "' title='" + rank + "'>" + rank + "</a>";
            e.Row.Cells[0].Text = path_STT;

            path_STT            = "<a href='/Top-10-Fastest-Cars/" + CarzHelpers.URLEncode(y) + "' title='" + e.Row.Cells[1].Text + "'>" + e.Row.Cells[1].Text + "</a>";
            e.Row.Cells[1].Text = path_STT;

            path_STT            = "<a href='/Top-10-Fastest-Cars/" + CarzHelpers.URLEncode(m) + "' title='" + e.Row.Cells[2].Text + "'>" + e.Row.Cells[2].Text + "</a>";
            e.Row.Cells[2].Text = path_STT;

            path_STT            = "<a href='/Top-10-Fastest-Cars/" + classname + CarzHelpers.URLEncode(y) + "-" + CarzHelpers.URLEncode(m) + "-" + CarzHelpers.URLEncode(md, true) + "' title='" + e.Row.Cells[3].Text + "'>" + e.Row.Cells[3].Text + "</a>";
            e.Row.Cells[3].Text = path_STT;


            //LiteralTitle.Text+= e.Row.Cells[0].Text;
        }
    }
    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 GridViewResult_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        string y        = "";
        string m        = "";
        string md       = "";
        string rank     = "";
        string path_STT = "";

        class_ = (Session["classname"] != null?Session["classname"].ToString().Replace(".aspx", ""):"");
        //DataRow row = ((DataRowView)e.Row.DataItem);
        object URLslug = (object)DataBinder.Eval(e.Row.DataItem, "URLslug");
        object ItemID  = (object)DataBinder.Eval(e.Row.DataItem, "ItemID");


        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            rank = e.Row.Cells[0].Text.Trim();
            y    = e.Row.Cells[1].Text.Trim();
            m    = e.Row.Cells[2].Text.Trim();
            md   = e.Row.Cells[3].Text.Trim();
            if (string.IsNullOrEmpty(ItemID.ToString()))
            {
                ItemID = "";
            }
            if (string.IsNullOrEmpty(URLslug.ToString()))
            {
                URLslug = CarzHelpers.URLEncode(m);
            }
            path_STT            = "<a href='/Popular-Lineups/" + class_ + "/" + CarzHelpers.URLEncode(y) + "-" + URLslug + "-" + CarzHelpers.URLEncode(md, true) + "-" + ItemID + "' title='" + rank + "'>" + rank + "</a>";
            e.Row.Cells[0].Text = path_STT;


            path_STT            = "<a href='/Popular-Lineups/" + class_ + "/" + CarzHelpers.URLEncode(y) + "' title='" + e.Row.Cells[1].Text + "'>" + e.Row.Cells[1].Text + "</a>";
            e.Row.Cells[1].Text = path_STT;

            //string URLslug="";
            //DataRow[] dr = dtb.Select("Make ='"+m+"'");

            path_STT            = "<a href='/Popular-Lineups/" + class_ + "/" + URLslug + "' title='" + e.Row.Cells[2].Text + "'>" + e.Row.Cells[2].Text + "</a>";
            e.Row.Cells[2].Text = path_STT;

            path_STT            = "<a href='/Popular-Lineups/" + class_ + "/" + CarzHelpers.URLEncode(y) + "-" + URLslug + "-" + CarzHelpers.URLEncode(md, true) + "-" + ItemID + "' title='" + e.Row.Cells[3].Text + "'>" + e.Row.Cells[3].Text + "</a>";
            e.Row.Cells[3].Text = path_STT;


            //LiteralTitle.Text+= e.Row.Cells[0].Text;
        }
    }
Пример #4
0
    protected void GridViewResult_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        string y         = "";
        string m         = "";
        string md        = "";
        string rank      = "";
        string path_STT  = "";
        string classname = (Request.Params["class"] != null ? Request.Params["class"].ToString().Replace(".aspx", "") + "/" : "");
        object URLslug   = (object)DataBinder.Eval(e.Row.DataItem, "URLslug");
        object ItemID    = (object)DataBinder.Eval(e.Row.DataItem, "ItemID");


        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            //--------*** This sets up the text links for table rows on the results page--------

            rank = e.Row.Cells[0].Text.Trim();
            y    = e.Row.Cells[1].Text.Trim();
            m    = e.Row.Cells[2].Text.Trim();
            md   = e.Row.Cells[3].Text.Trim();
            if (string.IsNullOrEmpty(ItemID.ToString()))
            {
                ItemID = "";
            }
            if (string.IsNullOrEmpty(URLslug.ToString()))
            {
                URLslug = CarzHelpers.URLEncode(m);
            }
            //class_ = e.Row.Cells[7].Text.Trim();
            path_STT            = "<a href='/Top-10-Fastest-Cars/" + classname + CarzHelpers.URLEncode(y) + "-" + URLslug + "-" + CarzHelpers.URLEncode(md, true) + "-" + ItemID + "' title='" + rank + "'>" + rank + "</a>";
            e.Row.Cells[0].Text = path_STT;

            path_STT            = "<a href='/Top-10-Fastest-Cars/" + CarzHelpers.URLEncode(y) + "' title='" + e.Row.Cells[1].Text + "'>" + e.Row.Cells[1].Text + "</a>";
            e.Row.Cells[1].Text = path_STT;

            path_STT            = "<a href='/Top-10-Fastest-Cars/" + URLslug + "' title='" + e.Row.Cells[2].Text + "'>" + e.Row.Cells[2].Text + "</a>";
            e.Row.Cells[2].Text = path_STT;

            path_STT            = "<a href='/Top-10-Fastest-Cars/" + classname + CarzHelpers.URLEncode(y) + "-" + URLslug + "-" + CarzHelpers.URLEncode(md, true) + "-" + ItemID + "' title='" + e.Row.Cells[3].Text + "'>" + e.Row.Cells[3].Text + "</a>";
            e.Row.Cells[3].Text = path_STT;


            //LiteralTitle.Text+= e.Row.Cells[0].Text;
        }
    }
    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("_", "-"))) : "");

        if (Request.Params["searchtext"] == null)
        {
            CMSContext.CurrentTitle = "Top 10 Fastest Cars from " + (name.Replace(".aspx", "") == "" ? "All" : name.Replace(".aspx", "").Replace(" All", ""));
        }
        else
        {
            CMSContext.CurrentTitle = "Search Results - " + CarzHelpers.URLDecode(Request.Params["searchtext"].ToString().Replace(".aspx", ""));
        }
    }
    private void getimage_class(string cls)
    {
        TreeProvider tree = new TreeProvider();

        ds = tree.SelectNodes(CMSContext.CurrentSiteName, "/Classes/%", CMSContext.CurrentDocumentCulture.CultureCode, true, "CMS.MenuItem", "DocumentMenuItemHideInNavigation='False' and ExpressClasses='false'", "NodeOrder ASC", -1, true);
        if (!DataHelper.DataSourceIsEmpty(ds))
        {
            foreach (DataRow ItemRow in ds.Tables[0].Rows)
            {
                if (ItemRow["MenuItemName"].ToString() == class_.Replace("-Cars", "").Replace("-", " "))
                {
                    //html result detail

                    if (searchtext != "")
                    {
                        LiteralTitle.Text = string.Format("<h1>{0}</h1>", "Search results for " + (classname != "" ? CarzHelpers.URLDecode(classname.Replace("-", " ")) + " " + title : CarzHelpers.URLDecode(cls.Replace("-", " "))));
                    }
                    else
                    {
                        LiteralTitle.Text = string.Format("<h1>{0}</h1>", "Top 10 Fastest " + (classname != "" ? CarzHelpers.URLDecode(classname.Replace("-", " ")) + " " + title : CarzHelpers.URLDecode(cls.Replace("-", " "))));
                    }
                    //classname = ItemRow["MenuItemName"].ToString();


                    previewimage = ItemRow["MenuItemTeaserImage"].ToString();
                    classname    = ItemRow["MenuItemName"].ToString();
                }
                // LiteralResultDetail.Text =dr["TimeClass"].ToString().Replace("-"," ");
            }
        }


        if (searchtext != "")
        {
            LiteralTitle.Text = string.Format("<h1>{0}</h1>", "Search results for " + searchtext + " " + title);
        }
        if (searchtext == "")
        {
            LiteralTitle.Text = string.Format("<h1>{0}</h1>", "Top 10 Fastest Cars from " + searchtext + " " + title);
        }
    }
    private void get_detail()
    {
        dtb = get_data();

        if (dtb != null)
        {
            DataRow dr = (DataRow)Session["list_result_detail"];
            Boolean b  = false;
            for (int i = 0; i < dtb.Rows.Count; i++)
            {
                if (dtb.Rows[i]["ItemID"].ToString() == dr["ItemID"].ToString())
                {
                    bSecond   = true;
                    dr["STT"] = dtb.Rows[i]["STT"];
                    try
                    {
                        if (i == 0)
                        {
                            //begin
                            if (dtb.Rows.Count > 1)
                            {
                                next  = dtb.Rows[1]["Year"].ToString() + "-" + CarzHelpers.URLEncode(dtb.Rows[1]["Make"].ToString()) + "-" + CarzHelpers.URLEncode(dtb.Rows[1]["Model"].ToString(), true);
                                cidn_ = dtb.Rows[1]["ItemID"].ToString();
                            }
                            preview = "";
                        }
                        else
                        if (i == (dtb.Rows.Count - 1))
                        {
                            //the end
                            if (dtb.Rows.Count > 1)
                            {
                                preview = dtb.Rows[dtb.Rows.Count - 2]["Year"].ToString() + "-" + CarzHelpers.URLEncode(dtb.Rows[dtb.Rows.Count - 2]["Make"].ToString()) + "-" + CarzHelpers.URLEncode(dtb.Rows[dtb.Rows.Count - 2]["Model"].ToString(), true);
                                cidp_   = dtb.Rows[dtb.Rows.Count - 2]["ItemID"].ToString();
                            }
                        }
                        else
                        {
                            preview = dtb.Rows[i - 1]["Year"].ToString() + "-" + CarzHelpers.URLEncode(dtb.Rows[i - 1]["Make"].ToString()) + "-" + CarzHelpers.URLEncode(dtb.Rows[i - 1]["Model"].ToString(), true);
                            cidp_   = dtb.Rows[i - 1]["ItemID"].ToString();
                            next    = dtb.Rows[i + 1]["Year"].ToString() + "-" + CarzHelpers.URLEncode(dtb.Rows[i + 1]["Make"].ToString()) + "-" + CarzHelpers.URLEncode(dtb.Rows[i + 1]["Model"].ToString(), true);
                            cidn_   = dtb.Rows[i + 1]["ItemID"].ToString();
                            //center
                        }
                    }
                    catch
                    {
                    }
                }



                try
                {
                    if (bSecond == true)
                    {
                        bSecond = false;
                        if (dtb.Rows.Count > 1)
                        {
                            if (i == (dtb.Rows.Count - 1))
                            {
                                if (dtb.Rows.Count == 2)
                                {
                                    y2     = dtb.Rows[i - 1]["Year"].ToString();
                                    m2     = dtb.Rows[i - 1]["Make"].ToString();
                                    md2    = dtb.Rows[i - 1]["Model"].ToString();
                                    r2     = dtb.Rows[i - 1]["STT"].ToString();
                                    time60 = Parse_double(dtb.Rows[i]["Best060Time"].ToString()) - Parse_double(dtb.Rows[i - 1]["Best060Time"].ToString());
                                }
                                else
                                {
                                    y2      = dtb.Rows[i - 2]["Year"].ToString();
                                    m2      = dtb.Rows[i - 2]["Make"].ToString();
                                    md2     = dtb.Rows[i - 2]["Model"].ToString();
                                    r2      = dtb.Rows[i - 2]["STT"].ToString();
                                    time60  = Parse_double(dtb.Rows[i]["Best060Time"].ToString()) - Parse_double(dtb.Rows[i - 2]["Best060Time"].ToString());
                                    y3      = dtb.Rows[i - 1]["Year"].ToString();
                                    m3      = dtb.Rows[i - 1]["Make"].ToString();
                                    md3     = dtb.Rows[i - 1]["Model"].ToString();
                                    r3      = dtb.Rows[i - 1]["STT"].ToString();
                                    time601 = Parse_double(dtb.Rows[i]["Best060Time"].ToString()) - Parse_double(dtb.Rows[i - 1]["Best060Time"].ToString());
                                }
                            }
                            else
                            {
                                if (dr["STT"].ToString() == "1")
                                {
                                    if (dtb.Rows.Count == 2)
                                    {
                                        y2     = dtb.Rows[i + 1]["Year"].ToString();
                                        m2     = dtb.Rows[i + 1]["Make"].ToString();
                                        md2    = dtb.Rows[i + 1]["Model"].ToString();
                                        r2     = dtb.Rows[i + 1]["STT"].ToString();
                                        time60 = Parse_double(dtb.Rows[i + 1]["Best060Time"].ToString()) - Parse_double(dtb.Rows[i]["Best060Time"].ToString());
                                    }
                                    else
                                    {
                                        y2      = dtb.Rows[i + 1]["Year"].ToString();
                                        m2      = dtb.Rows[i + 1]["Make"].ToString();
                                        md2     = dtb.Rows[i + 1]["Model"].ToString();
                                        bd2     = dtb.Rows[i + 1]["BodyText"].ToString();
                                        r2      = dtb.Rows[i + 1]["STT"].ToString();
                                        time60  = Parse_double(dtb.Rows[i + 1]["Best060Time"].ToString()) - Parse_double(dtb.Rows[i]["Best060Time"].ToString());
                                        y3      = dtb.Rows[i + 2]["Year"].ToString();
                                        m3      = dtb.Rows[i + 2]["Make"].ToString();
                                        md3     = dtb.Rows[i + 2]["Model"].ToString();
                                        bd3     = dtb.Rows[i + 2]["BodyText"].ToString();
                                        r3      = dtb.Rows[i + 2]["STT"].ToString();
                                        time601 = Parse_double(dtb.Rows[i + 2]["Best060Time"].ToString()) - Parse_double(dtb.Rows[i]["Best060Time"].ToString());
                                    }
                                }
                                else
                                {
                                    y2     = dtb.Rows[i - 1]["Year"].ToString();
                                    m2     = dtb.Rows[i - 1]["Make"].ToString();
                                    md2    = dtb.Rows[i - 1]["Model"].ToString();
                                    bd2    = dtb.Rows[i - 1]["BodyText"].ToString();
                                    r2     = dtb.Rows[i - 1]["STT"].ToString();
                                    time60 = Parse_double(dtb.Rows[i]["Best060Time"].ToString()) - Parse_double(dtb.Rows[i - 1]["Best060Time"].ToString());
                                    try
                                    {
                                        y3      = dtb.Rows[i + 1]["Year"].ToString();
                                        m3      = dtb.Rows[i + 1]["Make"].ToString();
                                        md3     = dtb.Rows[i + 1]["Model"].ToString();
                                        bd3     = dtb.Rows[i + 1]["BodyText"].ToString();
                                        r3      = dtb.Rows[i + 1]["STT"].ToString();
                                        time601 = Parse_double(dtb.Rows[i + 1]["Best060Time"].ToString()) - Parse_double(dtb.Rows[i]["Best060Time"].ToString());
                                    }
                                    catch
                                    {
                                    }
                                }
                            }
                        }
                    }
                }
                catch
                {
                }
            }
            Session["classname_search"] = (Request.Params["class"] != null ? Request.Params["class"].ToString() : "");
            if (n_row > 0 && nparam < 3)
            {
                string path = "";
                if (Request.Params["searchtext"] == null)
                {
                    path = (year != "" ? year : "") + (make != "" ? (year != "" ? "-" + CarzHelpers.URLEncode(make) : CarzHelpers.URLEncode(make)) : "") + (model != "" ? (year != "" ? "-" + CarzHelpers.URLEncode(model, true) : (make != "" ? "-" + CarzHelpers.URLEncode(model, true) : CarzHelpers.URLEncode(model, true))) : "");
                    if (Session["classname_search"].ToString() == "all")
                    {
                        path = "all";
                    }
                    Session["path_result"] = "/Top-10-Fastest-Cars/" + path;

                    Session["classname_search"] = path;
                }
                else
                {
                    Session["classname_search"] = (Request.Params["class"] != null ? Request.Params["class"].ToString() : "");
                    Session["path_result"]      = "/Search/Custom-Search/searchtext=" + Request.Params["searchtext"].ToString();
                    //Session["classname_search"] = CarzHelpers.URLDecode(Request.Params["searchtext"].ToString());
                }
            }


            getimage_class(Session["classname_search"].ToString());

//--------*** This sets up the winner's circle text on the detail page--------

            class_ = Session["classname_search"].ToString();
            string custompath = "/Top-10-Fastest-Cars/" + class_;
            if (CarzHelpers.URLDecode(class_, true) == "Custom-Search")
            {
                custompath = (Session["path_result"] != null ? Session["path_result"].ToString() : "");
            }
            cid         = dr["ItemID"].ToString();
            View        = (dr["Views"].ToString() == "" ? "0" : dr["Views"].ToString());
            link_detail = "/Top-10-Fastest-Cars" + (class_ != null ? "/" + class_ : "") + "/" + dr["Year"].ToString() + "-" + CarzHelpers.URLEncode(dr["Make"].ToString()) + "-" + CarzHelpers.URLEncode(dr["Model"].ToString(), true);
            string default_text = "The <a href='{7}' title='{0} {1} {2}{3}'>{0} {1} {2}{3}</a> ranks #{4} in the <a href='{9}' title='{5}'>{5}</a> class and races 0-60 mph in {8} seconds.";

            string path1 = "/Top-10-Fastest-Cars/" + class_ + "/" + dr["Year"].ToString() + "-" + CarzHelpers.URLEncode(dr["Make"].ToString()) + "-" + CarzHelpers.URLEncode(dr["Model"].ToString(), true);
            int    rank  = int.Parse(dr["STT"].ToString());
            default_text = string.Format(default_text, dr["Year"].ToString(), dr["Make"].ToString(), dr["Model"].ToString(), dr["BodyText"].ToString() == "" ? "" : " " + dr["BodyText"].ToString(), rank.ToString(), CarzHelpers.URLDecode(class_, true).Replace("-", " "), class_, path1, dr["Best060Time"].ToString(), custompath);
            string path2   = "/Top-10-Fastest-Cars/" + class_ + "/" + y2 + "-" + CarzHelpers.URLEncode(m2) + "-" + CarzHelpers.URLEncode(md2, true);
            string path3   = "/Top-10-Fastest-Cars/" + class_ + "/" + y3 + "-" + CarzHelpers.URLEncode(m3) + "-" + CarzHelpers.URLEncode(md3, true);
            string winner1 = "It pulls ahead of the #2 ranked <a href='{5}' title='{1} {2} {3}{4}'>{1} {2} {3}{4}</a> by {6}";
            if (y3 != "")
            {
                winner1 += " and the #3 ranked <a href='{11}' title='{7} {8} {9}{10}'>{7} {8} {9}{10}</a> by {12}.";
            }
            else
            {
                winner1 += ".";
            }
            if (y2 == "")
            {
                winner1 = "";
            }
            winner1 = string.Format(winner1, "", y2, m2, md2, bd2 == "" ? "" : " " + bd2, path2, (time60 <= 0.099999 ? "just hundredths of a second" : time60.ToString("0.0") + " seconds"), y3, m3, md3, bd3, path3, (compare(time601) ? " just hundredths of a second" : time601.ToString("0.0") + " seconds"));


            string winner2 = "It falls behind the #{6} ranked <a href='{5}' title='{1} {2} {3}{4}'>{1} {2} {3}{4}</a> by {7}";
            if (y3 != "")
            {
                winner2 += " and pulls ahead of the #{8} ranked <a href='{13}' title='{9} {10} {11}{12}'>{9} {10} {11}{12}</a> by {14}.";
            }
            else
            {
                winner2 += ".";
            }
            winner2 = string.Format(winner2, "", y2, m2, md2, bd2 == "" ? "" : " " + bd2, path2, r2, (time60 <= 0.099999 ? "just hundredths of a second" : time60.ToString("0.0") + " seconds"), r3, y3, m3, md3, bd3, path3, (compare(time601) ? " just hundredths of a second" : time601.ToString("0.0") + " seconds"));


            string winner3 = "It falls behind the #{6} ranked <a href='{5}' title='{1} {2} {3}{4}'>{1} {2} {3}{4}</a> by {7}";
            if (y3 != "")
            {
                winner3 += " and the #{8} ranked <a href='{13}' title='{9} {10} {11}{12}'>{9} {10} {11}{12}</a> by {14}.";
            }
            else
            {
                winner3 += ".";
            }

            winner3 = string.Format(winner3, "", y2, m2, md2, bd2 == "" ? "" : " " + bd2, path2, r2, (time60 <= 0.099999 ? "just hundredths of a second" : time60.ToString("0.0") + " seconds"), r3, y3, m3, md3, bd3, path3, (compare(time601) ? " just hundredths of a second" : time601.ToString("0.0") + " seconds"));
            string link_media = CarzHelpers.getMediaURL(dr["Image"].ToString());

            previewimage = (link_media != "" ? link_media : default_image);
            if (previewimage != "")
            {
                previewimage = string.Format("<div class='ResultImage'><img   border='0'  alt='' src='{0}'/></div>", previewimage);
            }
            string view_de = " {0}<div class='ResultTitle'><p>0482</p><p>Rank: #{1}</p><p>Class:  <a href='{2}' title='{3}'>{3}</a></p><p>0-60 Time: {4} seconds</p></div><div class='clear'></div>";

            view_de = string.Format(view_de, previewimage, rank, custompath, CarzHelpers.URLDecode(class_, true).Replace("-", " "), Parse_double(dr["Best060Time"].ToString()).ToString("0.0"));

            string html_content = "";

            //html_content = view_de + "<div class='ResultContent'><h2>Winner’s Circle</h2><p>" + default_text + "</p></div>";

            if (rank == 1)
            {
                html_content = view_de + "<div class='ResultContent'><h2 style='0122'>Winner’s Circle</h2><p>" + default_text + "</p><p>" + winner1 + "</p></div>";
            }
            else
            if (rank > 1 && rank < (dtb.Rows.Count))
            {
                html_content = view_de + "<div class='ResultContent'><h2 style='0122'>Winner’s Circle</h2><p>" + default_text + "</p><p>" + winner2 + "</p></div>";
            }
            else
            {
                html_content = view_de + "<div class='ResultContent'><h2 style='0122'>Winner’s Circle</h2><p>" + default_text + "</p><p>" + winner3 + "</p></div>";
            }


            LiteralResultDetail.Text = html_content;



            h1 = string.Format("{0} {1} {2}", dr["Year"].ToString(), dr["Make"].ToString(), dr["Model"].ToString());

            if (n_row == 1 && nparam > 2)
            {
                string html = "<div class='Car_Details list clearfix'><div class='Vehicle_information' > <h2>Vehicle information</h2><div class='conten'>{0}</div></div><div class='performance_statistics'><h2>Performance statistics</h2><div class='conten'>{1}</div></div></div><p style='clear:both;'>" + View + " people have viewed this car.</p> ";
                LiteralResultDetail2.Text = string.Format(html, "<p>Year: " + dr["Year"].ToString() +
                                                          "</p>" + "<p>Make: " + dr["Make"].ToString() + "</p>" +
                                                          "<p>Model: " + dr["Model"].ToString() + "</p>" +
                                                          "<p>Engine: " + dr["Engine"].ToString() + "</p>" +
                                                          "<p>Horsepower: " + Parse_double(dr["Horsepower"].ToString()).ToString("0") + "</p>" +
                                                          "<p>Torque: " + dr["Torque"].ToString() + "</p>" +
                                                          "<p>Transmission: " + dr["Transmission"].ToString() + "</p>" +
                                                          "<p>Curb Weight: " + dr["CurbWeight"].ToString() + "</p>" +
                                                          "<p>City MPG: " + dr["MPGCity"].ToString() + "</p>" +
                                                          "<p>Highway MPG: " + dr["MPG"].ToString() + "</p>" +
                                                          "<p>MSRP: $" + Parse_double(dr["MSRP"].ToString()).ToString("0,0") + "</p>",
                                                          "<p>Tags: " + dr["Tags"].ToString() + "</p>" +
                                                          "<p>Class: <a href='/Popular-Lineups/" + dr["TimeClass"].ToString() + "' title='" + dr["TimeClass"].ToString() + "' >" + dr["TimeClass"].ToString().Replace("-", " ") + "</a></p>" + "<p>Rank: #" + dr["TimeClassRank"].ToString() + "</p>" +
                                                          "<p>Best 0-60 Time: " + Parse_double(dr["Best060Time"].ToString()).ToString("0.0") + " seconds </p>" +
                                                          "<p>Best &#188;  Mile: " + Parse_double(dr["Best1of4MileTime"].ToString()).ToString("0.0") + " seconds </p>" +
                                                          "<p>Best  &#188;  Mile speed: " + Parse_double(dr["Best1of4MileSpeed"].ToString()).ToString("0.0") + " mph </p>" +
                                                          "<p>Best Top Speed: " + Parse_double(dr["BestTopSpeed"].ToString()).ToString("0.0") + " mph </p>"
                                                          );



                try
                {
                    /*
                     * CustomTableItemProvider tbProvide = new CustomTableItemProvider();
                     *
                     * CustomTableItem tbRecord = tbProvide.GetItem(int.Parse(cid), "customtable.carz");
                     * if (tbRecord != null)
                     * {
                     *  // Set new field values
                     *  tbRecord.SetValue("Views", int.Parse(View) + 1);
                     *
                     *  // Save updates in the database
                     *  tbRecord.Update();
                     *
                     *
                     * }
                     *
                     */

                    int k = cn.ExecuteNonQuery(string.Format("UPDATE [dbo].[customtable_carz] SET Views='{0}' WHERE ItemID='{1}' ", int.Parse(View) + 1, cid), null, QueryTypeEnum.SQLQuery, false);
                }
                catch
                {
                }

                GridViewResult.Visible       = false;
                LiteralNone.Text             = " style='display:none;' ";
                LiteralResultDetail2.Visible = true;
                LiteralTitle.Text            = "<h1>" + h1 + "</h1>";

//--------*** This sets up the individual car profile text on the detail page--------


                string back = "<a title='Back to Results' href='" + (Session["path_result"] != null ? Session["path_result"].ToString() : "javascript:history.back();") + "'>Back to Results</a> | ";
                LiteralResultDetail.Text = LiteralResultDetail.Text.Replace("0122", "display:none;");
                LiteralResultDetail.Text = LiteralResultDetail.Text.Replace("0482", (preview == "" && next == "" ? "" : back) + (preview != "" ? "<  <a title='Prev' href='/Top-10-Fastest-Cars/" + class_ + "/" + preview + "'>Prev</a>&nbsp;&nbsp;&nbsp;" : "") + (next != "" ? " <a title='Next' href='/Top-10-Fastest-Cars/" + class_ + "/" + next + "'>Next > </a> " : ""));
            }
            else
            {
                LiteralResultDetail.Text = LiteralResultDetail.Text.Replace("0482", string.Format("<a href='{0}' title='{1}'>{1}</a>", path1, h1));
            }
            //Uri url = Request.Url;
            //LiteralResultDetail.Text = Session["123456"].ToString();
            //LiteralResultDetail.Text+="<br>"+Session["123456"].ToString()+"<br>"+debug + "<br>n_row =" + n_row + "<br>nparam=="+nparam;
        }
    }
    private void get_detail()
    {
        dtb = get_data();

        if (dtb != null)
        {
            DataRow dr = (DataRow)Session["list_result_detail"];
            Boolean b  = false;
            for (int i = 0; i < dtb.Rows.Count; i++)
            {
                if (dtb.Rows[i]["ItemID"].ToString() == dr["ItemID"].ToString())
                {
                    bSecond   = true;
                    dr["STT"] = dtb.Rows[i]["STT"];
                    try
                    {
                        if (i == 0)
                        {
                            //begin
                            if (dtb.Rows.Count > 1)
                            {
                                cidn_ = dtb.Rows[1]["ItemID"].ToString();
                                next  = dtb.Rows[1]["Year"].ToString() + "-" + CarzHelpers.URLEncode(dtb.Rows[1]["Make"].ToString()) + "-" + CarzHelpers.URLEncode(dtb.Rows[1]["Model"].ToString(), true) + "-" + cidn_;
                            }
                            preview = "";
                        }
                        else
                        if (i == (dtb.Rows.Count - 1))
                        {
                            //the end
                            if (dtb.Rows.Count > 1)
                            {
                                cidp_   = dtb.Rows[dtb.Rows.Count - 2]["ItemID"].ToString();
                                preview = dtb.Rows[dtb.Rows.Count - 2]["Year"].ToString() + "-" + CarzHelpers.URLEncode(dtb.Rows[dtb.Rows.Count - 2]["Make"].ToString()) + "-" + CarzHelpers.URLEncode(dtb.Rows[dtb.Rows.Count - 2]["Model"].ToString(), true) + "-" + cidp_;
                            }
                        }
                        else
                        {
                            cidp_   = dtb.Rows[i - 1]["ItemID"].ToString();
                            preview = dtb.Rows[i - 1]["Year"].ToString() + "-" + CarzHelpers.URLEncode(dtb.Rows[i - 1]["Make"].ToString()) + "-" + CarzHelpers.URLEncode(dtb.Rows[i - 1]["Model"].ToString(), true) + "-" + cidp_;
                            cidn_   = dtb.Rows[i + 1]["ItemID"].ToString();
                            next    = dtb.Rows[i + 1]["Year"].ToString() + "-" + CarzHelpers.URLEncode(dtb.Rows[i + 1]["Make"].ToString()) + "-" + CarzHelpers.URLEncode(dtb.Rows[i + 1]["Model"].ToString(), true) + "-" + cidn_;

                            //center
                        }
                    }
                    catch
                    {
                    }
                }



                try
                {
                    if (bSecond == true)
                    {
                        bSecond = false;
                        if (dtb.Rows.Count > 1)
                        {
                            if (i == (dtb.Rows.Count - 1))
                            {
                                if (dtb.Rows.Count == 2)
                                {
                                    id2    = dtb.Rows[i - 1]["ItemID"].ToString();
                                    y2     = dtb.Rows[i - 1]["Year"].ToString();
                                    m2     = (string.IsNullOrEmpty(dtb.Rows[i - 1]["URLslug"].ToString()) == true ? dtb.Rows[i - 1]["Make"].ToString() : dtb.Rows[i - 1]["URLslug"].ToString());
                                    md2    = dtb.Rows[i - 1]["Model"].ToString();
                                    r2     = dtb.Rows[i - 1]["STT"].ToString();
                                    time60 = Parse_double(dtb.Rows[i]["Best060Time"].ToString()) - Parse_double(dtb.Rows[i - 1]["Best060Time"].ToString());
                                }
                                else
                                {
                                    id2     = dtb.Rows[i - 2]["ItemID"].ToString();
                                    y2      = dtb.Rows[i - 2]["Year"].ToString();
                                    m2      = (string.IsNullOrEmpty(dtb.Rows[i - 2]["URLslug"].ToString()) == true ? dtb.Rows[i - 2]["Make"].ToString() : dtb.Rows[i - 2]["URLslug"].ToString());
                                    md2     = dtb.Rows[i - 2]["Model"].ToString();
                                    r2      = dtb.Rows[i - 2]["STT"].ToString();
                                    time60  = Parse_double(dtb.Rows[i]["Best060Time"].ToString()) - Parse_double(dtb.Rows[i - 2]["Best060Time"].ToString());
                                    id3     = dtb.Rows[i - 1]["ItemID"].ToString();
                                    y3      = dtb.Rows[i - 1]["Year"].ToString();
                                    m3      = (string.IsNullOrEmpty(dtb.Rows[i - 1]["URLslug"].ToString()) == true ? dtb.Rows[i - 1]["Make"].ToString() : dtb.Rows[i - 1]["URLslug"].ToString());
                                    md3     = dtb.Rows[i - 1]["Model"].ToString();
                                    r3      = dtb.Rows[i - 1]["STT"].ToString();
                                    time601 = Parse_double(dtb.Rows[i]["Best060Time"].ToString()) - Parse_double(dtb.Rows[i - 1]["Best060Time"].ToString());
                                }
                            }
                            else
                            {
                                if (dr["STT"].ToString() == "1")
                                {
                                    if (dtb.Rows.Count == 2)
                                    {
                                        id2    = dtb.Rows[i + 1]["ItemID"].ToString();
                                        y2     = dtb.Rows[i + 1]["Year"].ToString();
                                        m2     = (string.IsNullOrEmpty(dtb.Rows[i + 1]["URLslug"].ToString()) == true ? dtb.Rows[i + 1]["Make"].ToString() : dtb.Rows[i + 1]["URLslug"].ToString());
                                        md2    = dtb.Rows[i + 1]["Model"].ToString();
                                        r2     = dtb.Rows[i + 1]["STT"].ToString();
                                        time60 = Parse_double(dtb.Rows[i + 1]["Best060Time"].ToString()) - Parse_double(dtb.Rows[i]["Best060Time"].ToString());
                                    }
                                    else
                                    {
                                        id2     = dtb.Rows[i + 1]["ItemID"].ToString();
                                        y2      = dtb.Rows[i + 1]["Year"].ToString();
                                        m2      = (string.IsNullOrEmpty(dtb.Rows[i + 1]["URLslug"].ToString()) == true ? dtb.Rows[i + 1]["Make"].ToString() : dtb.Rows[i + 1]["URLslug"].ToString());
                                        md2     = dtb.Rows[i + 1]["Model"].ToString();
                                        bd2     = dtb.Rows[i + 1]["BodyText"].ToString();
                                        r2      = dtb.Rows[i + 1]["STT"].ToString();
                                        time60  = Parse_double(dtb.Rows[i + 1]["Best060Time"].ToString()) - Parse_double(dtb.Rows[i]["Best060Time"].ToString());
                                        id3     = dtb.Rows[i + 2]["ItemID"].ToString();
                                        y3      = dtb.Rows[i + 2]["Year"].ToString();
                                        m3      = (string.IsNullOrEmpty(dtb.Rows[i + 2]["URLslug"].ToString()) == true ? dtb.Rows[i + 2]["Make"].ToString() : dtb.Rows[i + 2]["URLslug"].ToString());
                                        md3     = dtb.Rows[i + 2]["Model"].ToString();
                                        bd3     = dtb.Rows[i + 2]["BodyText"].ToString();
                                        r3      = dtb.Rows[i + 2]["STT"].ToString();
                                        time601 = Parse_double(dtb.Rows[i + 2]["Best060Time"].ToString()) - Parse_double(dtb.Rows[i]["Best060Time"].ToString());
                                    }
                                }
                                else
                                {
                                    id2    = dtb.Rows[i - 1]["ItemID"].ToString();
                                    y2     = dtb.Rows[i - 1]["Year"].ToString();
                                    m2     = (string.IsNullOrEmpty(dtb.Rows[i - 1]["URLslug"].ToString()) == true ? dtb.Rows[i - 1]["Make"].ToString() : dtb.Rows[i - 1]["URLslug"].ToString());
                                    md2    = dtb.Rows[i - 1]["Model"].ToString();
                                    bd2    = dtb.Rows[i - 1]["BodyText"].ToString();
                                    r2     = dtb.Rows[i - 1]["STT"].ToString();
                                    time60 = Parse_double(dtb.Rows[i]["Best060Time"].ToString()) - Parse_double(dtb.Rows[i - 1]["Best060Time"].ToString());
                                    try
                                    {
                                        id3     = dtb.Rows[i + 1]["ItemID"].ToString();
                                        y3      = dtb.Rows[i + 1]["Year"].ToString();
                                        m3      = (string.IsNullOrEmpty(dtb.Rows[i + 1]["URLslug"].ToString()) == true ? dtb.Rows[i + 1]["Make"].ToString() : dtb.Rows[i + 1]["URLslug"].ToString());
                                        md3     = dtb.Rows[i + 1]["Model"].ToString();
                                        bd3     = dtb.Rows[i + 1]["BodyText"].ToString();
                                        r3      = dtb.Rows[i + 1]["STT"].ToString();
                                        time601 = Parse_double(dtb.Rows[i + 1]["Best060Time"].ToString()) - Parse_double(dtb.Rows[i]["Best060Time"].ToString());
                                    }
                                    catch
                                    {
                                    }
                                }
                            }
                        }
                    }
                }
                catch
                {
                }
            }



            cid  = dr["ItemID"].ToString();
            View = (dr["Views"].ToString() == "" ? "0" : dr["Views"].ToString());
            string make_encode = CarzHelpers.URLEncode(string.IsNullOrEmpty(dr["URLslug"].ToString()) == true ? dr["Make"].ToString() : dr["URLslug"].ToString());

            link_detail = "/Popular-Lineups" + (Request.Params["class"] != null ? "/" + Request.Params["class"].ToString() : "") + "/" + dr["Year"].ToString() + "-" + make_encode + "-" + CarzHelpers.URLEncode(dr["Model"].ToString(), true);



            string default_text = "The <a href='{7}' title='{0} {1} {2}{3}'>{0} {1} {2}{3}</a> ranks #{4} in the <a href='/Popular-Lineups/{6}' title='{5}'>{5}</a> class and races 0-60 mph in {8} seconds.";

            string path1 = "/Popular-Lineups/" + class_ + "/" + dr["Year"].ToString() + "-" + make_encode + "-" + CarzHelpers.URLEncode(dr["Model"].ToString(), true) + "-" + dr["ItemID"].ToString();
            int    rank  = int.Parse(dr["STT"].ToString());
            default_text = string.Format(default_text, dr["Year"].ToString(), dr["Make"].ToString(), dr["Model"].ToString(), dr["BodyText"].ToString() == "" ? "" : " " + dr["BodyText"].ToString(), rank.ToString(), class_.Replace("-", " "), class_, path1, dr["Best060Time"].ToString());
            string path2   = "/Popular-Lineups/" + class_ + "/" + y2 + "-" + CarzHelpers.URLEncode(m2) + "-" + CarzHelpers.URLEncode(md2, true) + "-" + id2;
            string path3   = "/Popular-Lineups/" + class_ + "/" + y3 + "-" + CarzHelpers.URLEncode(m3) + "-" + CarzHelpers.URLEncode(md3, true) + "-" + id3;
            string winner1 = "It pulls ahead of the #2 ranked <a href='{5}' title='{1} {2} {3}{4}'>{1} {2} {3}{4}</a> by {6}";
            if (y3 != "")
            {
                winner1 += " and the #3 ranked <a href='{11}' title='{7} {8} {9}{10}'>{7} {8} {9}{10}</a> by {12}.";
            }
            else
            {
                winner1 += ".";
            }
            if (y2 == "")
            {
                winner1 = "";
            }

            winner1 = string.Format(winner1, "", y2, m2, md2, bd2 == "" ? "" : " " + bd2, path2, (compare(time60) ? "just hundredths of a second" : time60.ToString("0.0") + " seconds"), y3, m3, md3, bd3, path3, (compare(time601) ? " just hundredths of a second" : time601.ToString("0.0") + " seconds"));


            string winner2 = "It falls behind the #{6} ranked <a href='{5}' title='{1} {2} {3}{4}'>{1} {2} {3}{4}</a> by {7}";
            if (y3 != "")
            {
                winner2 += " and pulls ahead of the #{8} ranked <a href='{13}' title='{9} {10} {11}{12}'>{9} {10} {11}{12}</a> by {14}.";
            }
            else
            {
                winner2 += ".";
            }
            winner2 = string.Format(winner2, "", y2, m2, md2, bd2 == "" ? "" : " " + bd2, path2, r2, (compare(time60) ? "just hundredths of a second" : time60.ToString("0.0") + " seconds"), r3, y3, m3, md3, bd3, path3, (compare(time601) ? " just hundredths of a second" : time601.ToString("0.0") + " seconds"));


            string winner3 = "It falls behind the #{6} ranked <a href='{5}' title='{1} {2} {3}{4}'>{1} {2} {3}{4}</a> by {7}";
            if (y3 != "")
            {
                winner3 += " and the #{8} ranked <a href='{13}' title='{9} {10} {11}{12}'>{9} {10} {11}{12}</a> by {14}.";
            }
            else
            {
                winner3 += ".";
            }
            winner3 = string.Format(winner3, "", y2, m2, md2, bd2 == "" ? "" : " " + bd2, path2, r2, (compare(time60) ? "just hundredths of a second" : time60.ToString("0.0") + " seconds"), r3, y3, m3, md3, bd3, path3, (compare(time601) ? " just hundredths of a second" : time601.ToString("0.0") + " seconds"));

            string link_media = CarzHelpers.getMediaURL(dr["Image"].ToString());

            previewimage = (link_media != "" ? link_media : default_image);

            if (previewimage != "")
            {
                previewimage = string.Format("<div class='ResultImage'><img   border='0'  alt='' src='{0}'/></div>", previewimage);
            }
            string view_de = " {0}<div class='ResultTitle'><p>0482</p><p>Rank: #{1}</p><p>Class:  <a href='{2}' title='{3}'>{3}</a></p><p>0-60 Time: {4} seconds</p></div><div class='clear'></div>";
            view_de = string.Format(view_de, previewimage, rank, "/Popular-Lineups/" + class_, class_.Replace("-", " "), Parse_double(dr["Best060Time"].ToString()).ToString("0.0"));

            string html_content = "";
            if (rank == 1)
            {
                html_content = view_de + "<div class='ResultContent'><h2 style='0122'>Winner’s Circle</h2><p>" + default_text + "</p><p>" + winner1 + "</p></div>";
            }
            else
            if (rank > 1 && rank < (dtb.Rows.Count))
            {
                html_content = view_de + "<div class='ResultContent'><h2 style='0122'>Winner’s Circle</h2><p>" + default_text + "</p><p>" + winner2 + "</p></div>";
            }
            else
            {
                html_content = view_de + "<div class='ResultContent'><h2 style='0122'>Winner’s Circle</h2><p>" + default_text + "</p><p>" + winner3 + "</p></div>";
            }



            h1 = string.Format("{0} {1} {2}", dr["Year"].ToString(), dr["Make"].ToString(), dr["Model"].ToString());
            LiteralResultDetail.Text = html_content;
            if (n_row == 1)
            {
                string html = "<div style='margin-bottom:10px;' class='addthis_toolbox addthis_default_style'><a class='addthis_button_preferred_1'></a><a class='addthis_button_preferred_2'></a><a class='addthis_button_preferred_3'></a><a class='addthis_button_preferred_4'></a><a class='addthis_button_compact'></a><a class='addthis_counter addthis_bubble_style'></a></div><div class='Car_Details list clearfix'><div class='Vehicle_information' > <h2>Vehicle information</h2><div class='conten'>{0}</div></div><div class='performance_statistics'><h2>Performance statistics</h2><div class='conten'>{1}</div></div></div><p style='clear:both;'>" + View + " people have viewed this car.</p> ";
                LiteralResultDetail2.Text = string.Format(html, "<p>Year: " + dr["Year"].ToString() +
                                                          "</p>" + "<p>Make: " + dr["Make"].ToString() + "</p>" +
                                                          "<p>Model: " + dr["Model"].ToString() + "</p>" +
                                                          "<p>Engine: " + dr["Engine"].ToString() + "</p>" +
                                                          "<p>Horsepower: " + Parse_double(dr["Horsepower"].ToString()).ToString("0") + "</p>" +
                                                          "<p>Torque: " + dr["Torque"].ToString() + "</p>" +
                                                          "<p>Transmission: " + dr["Transmission"].ToString() + "</p>" +
                                                          "<p>Curb Weight: " + dr["CurbWeight"].ToString() + "</p>" +
                                                          "<p>MPG: " + dr["MPG"].ToString() + "</p>" +
                                                          "<p>MSRP: $" + Parse_double(dr["MSRP"].ToString()).ToString("0,0") + "</p>",
                                                          "<p>Tags: " + dr["Tags"].ToString() + "</p>" +
                                                          "<p>Class: <a href='/Popular-Lineups/" + dr["TimeClass"].ToString() + "' title='" + dr["TimeClass"].ToString() + "' >" + dr["TimeClass"].ToString().Replace("-", " ") + "</a></p>" + "<p>Rank: #" + dr["TimeClassRank"].ToString() + "</p>" +
                                                          "<p>Best 0-60 Time: " + Parse_double(dr["Best060Time"].ToString()).ToString("0.0") + " seconds </p>" +
                                                          "<p>Best &#188;  Mile: " + Parse_double(dr["Best1of4MileTime"].ToString()).ToString("0.0") + " seconds </p>" +
                                                          "<p>Best  &#188;  Mile speed: " + Parse_double(dr["Best1of4MileSpeed"].ToString()).ToString("0.0") + " mph </p>" +
                                                          "<p>Best Top Speed: " + Parse_double(dr["BestTopSpeed"].ToString()).ToString("0.0") + " mph </p>"
                                                          );



                try
                {
                    /*
                     * CustomTableItemProvider tbProvide = new CustomTableItemProvider();
                     * CustomTableItem tbRecord = tbProvide.GetItem(int.Parse(cid), "customtable.carz");
                     * if (tbRecord != null)
                     * {
                     *  // Set new field values
                     *  tbRecord.SetValue("Views", int.Parse(View) + 1);
                     *
                     *  // Save updates in the database
                     *  tbRecord.Update();
                     *
                     *
                     * }*/
                    int k = cn.ExecuteNonQuery(string.Format("UPDATE [dbo].[customtable_carz] SET Views='{0}' WHERE ItemID='{1}' ", int.Parse(View) + 1, cid), null, QueryTypeEnum.SQLQuery, false);
                }
                catch
                {
                }

                GridViewResult.Visible       = false;
                LiteralNone.Text             = " style='display:none;' ";
                LiteralResultDetail2.Visible = true;
                LiteralTitle.Text            = "<h1>" + h1 + "</h1>";

                LiteralResultDetail.Text = LiteralResultDetail.Text.Replace("0122", "display:none;");
                string back = "<a title='Back to Results' href='" + "/Popular-Lineups" + (Request.Params["class"] != null ? "/" + Request.Params["class"].ToString() : "") + "/" + "'>Back to Results</a> | ";
                LiteralResultDetail.Text = LiteralResultDetail.Text.Replace("0482", (preview != "" || next != ""?back:"") + (preview != "" ? "<  <a title='Prev' href='/Popular-Lineups" + (Request.Params["class"] != null ? "/" + Request.Params["class"].ToString() : "") + "/" + preview + "'>Prev</a>&nbsp;&nbsp;&nbsp;" : "") + (next != "" ? " <a title='Next' href='/Popular-Lineups" + (Request.Params["class"] != null ? "/" + Request.Params["class"].ToString() : "") + "/" + next + "'>Next > </a> " : ""));
            }
            else
            {
                LiteralResultDetail.Text = LiteralResultDetail.Text.Replace("0482", string.Format("<a href='{0}' title='{1}'>{1}</a>", path1, h1));
            }
        }
    }
Пример #9
0
    public void init_value(object rY, object rM, object rMd, object rOther, object rClass, object rS)
    {
        int step   = 0;
        int nparam = 0;

        if (Session["step"] != null)
        {
            try
            {
                step = int.Parse(Session["step"].ToString());
                nparam++;
            }
            catch
            { }
        }

        if (step == 0)
        {
            string    make       = "";
            string    year       = "";
            string    model      = "";
            string    searchtext = "";
            string    other      = "";
            string    class_     = "";
            DataSet   ds         = null;
            DataRow[] dRows      = null;
            // tp = new CustomTableItemProvider(CMSContext.CurrentUser);
            GeneralConnection cn = null;
            if (Session["GeneralConnection"] != null)
            {
                cn = (GeneralConnection)Session["GeneralConnection"];
                ds = (DataSet)Session["customtable_carz"];
            }
            else
            {
                cn = ConnectionHelper.GetConnection();
                ds = cn.ExecuteQuery("select ItemID,Make,Model,Year from  dbo.customtable_carz ", null, QueryTypeEnum.SQLQuery, false);
            }
            Session["customtable_carz"]  = ds;
            Session["GeneralConnection"] = cn;
            if (rY != null)
            {
                year            = rY.ToString().Trim().Replace("?", "");
                Session["year"] = year;
                nparam++;
            }

            if (rM != null)
            {
                make = rM.ToString();
                make = make.Split('.')[0];
                make = CarzHelpers.URLDecode(make);
                make = make.Trim();
                nparam++;
                dRows = ds.Tables[0].Select("Make = '" + make + "'");
                //ds = cn.ExecuteQuery("select ItemID from  dbo.customtable_carz  where Make = '" + make + "'", null, QueryTypeEnum.SQLQuery, false);
                //ds = tp.GetItems("customtable.carz", string.Format("Make = '{0}'", make), "Make ASC");
                if (dRows.Length <= 0)
                {
                    model = make;
                    make  = "";
                }
                Session["year"]  = make;
                Session["model"] = model;
            }

            if (rMd != null && model == "")
            {
                model = rMd.ToString();
                model = CarzHelpers.URLDecode(model, true);
                model = model.Trim();
                nparam++;
                Session["model"] = model;
            }

            if (rS != null)
            {
                searchtext            = rS.ToString();
                searchtext            = HttpContext.Current.Server.UrlDecode(searchtext);
                Session["searchtext"] = searchtext;
            }

            if (rOther != null)
            {
                other = rOther.ToString();
                other = CarzHelpers.URLDecode(other.Replace("/", ""));
                other = other.Trim();
                dRows = ds.Tables[0].Select("Make = '" + other + "'");
                //ds = cn.ExecuteQuery("select ItemID from  dbo.customtable_carz  where Make = '" + other + "'", null, QueryTypeEnum.SQLQuery, false);
                //ds = tp.GetItems("customtable.carz", string.Format("Make = '{0}'", other), "Make ASC");
                if (dRows.Length <= 0)
                {
                    string[] arr = other.Split('-');
                    if (arr.Length == 2)
                    {
                        try
                        {
                            year  = int.Parse(arr[0]).ToString();
                            make  = arr[1];
                            dRows = ds.Tables[0].Select("Make = '" + make + "'");
                            //ds = cn.ExecuteQuery("select ItemID from  dbo.customtable_carz  where Make = '" + make + "'", null, QueryTypeEnum.SQLQuery, false);
                            //ds = tp.GetItems("customtable.carz", string.Format("Make = '{0}'", make), "Make ASC");
                            if (dRows.Length <= 0)
                            {
                                model = make;
                                make  = "";
                                nparam++;
                            }
                        }
                        catch
                        {
                            make    = arr[0];
                            model   = arr[1];
                            nparam += 2;
                        }
                    }
                    else
                    {
                        dRows = ds.Tables[0].Select("Make = '" + other + "'");
                        //ds = cn.ExecuteQuery("select ItemID from  dbo.customtable_carz  where Make = '" + other + "'", null, QueryTypeEnum.SQLQuery, false);
                        //ds = tp.GetItems("customtable.carz", string.Format("Make = '{0}'", other), "Make ASC");
                        if (dRows.Length > 0)
                        {
                            //is make
                            make = other;
                            nparam++;
                        }
                        dRows = ds.Tables[0].Select("Model = '" + other + "'");
                        // ds = cn.ExecuteQuery("select ItemID from  dbo.customtable_carz  where Model = '" + other + "'", null, QueryTypeEnum.SQLQuery, false);
                        //ds = tp.GetItems("customtable.carz", string.Format("Model = '{0}'", other), "Model ASC");
                        if (dRows.Length > 0)
                        {
                            //is make
                            model = other;
                            nparam++;
                        }
                    }
                }
                else
                {
                    make = other;
                    nparam++;
                }
            }
            class_ = (rClass != null ? rClass.ToString() : "");
            Session["searchtext"] = searchtext;



            Session["classname"] = class_.Replace(".aspx", "");
            Session["year"]      = year.Replace(".aspx", "");;
            Session["make"]      = make.Replace(".aspx", "");;
            Session["model"]     = model.Replace(".aspx", "");;
            nparam = 0;
            if (year != "")
            {
                nparam++;
            }
            if (make != "")
            {
                nparam++;
            }
            if (model != "")
            {
                nparam++;
            }
            Session["nparam"] = nparam;
            cn.Dispose();
        }
        else
        {
            Session["step"] = step++;
        }
    }
Пример #10
0
    private void get_detail()
    {
        dtb = get_data();

        if (dtb != null)
        {
            DataRow dr = (DataRow)Session["list_result_detail"];
            Boolean b  = false;
            for (int i = 0; i < dtb.Rows.Count; i++)
            {
                if (dtb.Rows[i]["ItemID"].ToString() == dr["ItemID"].ToString())
                {
                    bSecond   = true;
                    dr["STT"] = dtb.Rows[i]["STT"];
                    try
                    {
                        if (i == 0)
                        {
                            //begin
                            if (dtb.Rows.Count > 1)
                            {
                                next  = dtb.Rows[1]["Year"].ToString() + "-" + CarzHelpers.URLEncode(dtb.Rows[1]["Make"].ToString()) + "-" + CarzHelpers.URLEncode(dtb.Rows[1]["Model"].ToString(), true);
                                cidn_ = dtb.Rows[1]["ItemID"].ToString();
                            }
                            preview = "";
                        }
                        else
                        if (i == (dtb.Rows.Count - 1))
                        {
                            //the end
                            if (dtb.Rows.Count > 1)
                            {
                                preview = dtb.Rows[dtb.Rows.Count - 2]["Year"].ToString() + "-" + CarzHelpers.URLEncode(dtb.Rows[dtb.Rows.Count - 2]["Make"].ToString()) + "-" + CarzHelpers.URLEncode(dtb.Rows[dtb.Rows.Count - 2]["Model"].ToString(), true);
                                cidp_   = dtb.Rows[dtb.Rows.Count - 2]["ItemID"].ToString();
                            }
                        }
                        else
                        {
                            preview = dtb.Rows[i - 1]["Year"].ToString() + "-" + CarzHelpers.URLEncode(dtb.Rows[i - 1]["Make"].ToString()) + "-" + CarzHelpers.URLEncode(dtb.Rows[i - 1]["Model"].ToString(), true);
                            cidp_   = dtb.Rows[i - 1]["ItemID"].ToString();
                            next    = dtb.Rows[i + 1]["Year"].ToString() + "-" + CarzHelpers.URLEncode(dtb.Rows[i + 1]["Make"].ToString()) + "-" + CarzHelpers.URLEncode(dtb.Rows[i + 1]["Model"].ToString(), true);
                            cidn_   = dtb.Rows[i + 1]["ItemID"].ToString();
                            //center
                        }
                    }
                    catch
                    {
                    }
                }



                try
                {
                    if (bSecond == true)
                    {
                        bSecond = false;
                        if (dtb.Rows.Count > 1)
                        {
                            if (i == (dtb.Rows.Count - 1))
                            {
                                if (dtb.Rows.Count == 2)
                                {
                                    y2     = dtb.Rows[i - 1]["Year"].ToString();
                                    m2     = dtb.Rows[i - 1]["Make"].ToString();
                                    md2    = dtb.Rows[i - 1]["Model"].ToString();
                                    r2     = dtb.Rows[i - 1]["STT"].ToString();
                                    time60 = Parse_double(dtb.Rows[i]["Best060Time"].ToString()) - Parse_double(dtb.Rows[i - 1]["Best060Time"].ToString());
                                }
                                else
                                {
                                    y2      = dtb.Rows[i - 2]["Year"].ToString();
                                    m2      = dtb.Rows[i - 2]["Make"].ToString();
                                    md2     = dtb.Rows[i - 2]["Model"].ToString();
                                    r2      = dtb.Rows[i - 2]["STT"].ToString();
                                    time60  = Parse_double(dtb.Rows[i]["Best060Time"].ToString()) - Parse_double(dtb.Rows[i - 2]["Best060Time"].ToString());
                                    y3      = dtb.Rows[i - 1]["Year"].ToString();
                                    m3      = dtb.Rows[i - 1]["Make"].ToString();
                                    md3     = dtb.Rows[i - 1]["Model"].ToString();
                                    r3      = dtb.Rows[i - 1]["STT"].ToString();
                                    time601 = Parse_double(dtb.Rows[i]["Best060Time"].ToString()) - Parse_double(dtb.Rows[i - 1]["Best060Time"].ToString());
                                }
                            }
                            else
                            {
                                if (dr["STT"].ToString() == "1")
                                {
                                    if (dtb.Rows.Count == 2)
                                    {
                                        y2     = dtb.Rows[i + 1]["Year"].ToString();
                                        m2     = dtb.Rows[i + 1]["Make"].ToString();
                                        md2    = dtb.Rows[i + 1]["Model"].ToString();
                                        r2     = dtb.Rows[i + 1]["STT"].ToString();
                                        time60 = Parse_double(dtb.Rows[i + 1]["Best060Time"].ToString()) - Parse_double(dtb.Rows[i]["Best060Time"].ToString());
                                    }
                                    else
                                    {
                                        y2      = dtb.Rows[i + 1]["Year"].ToString();
                                        m2      = dtb.Rows[i + 1]["Make"].ToString();
                                        md2     = dtb.Rows[i + 1]["Model"].ToString();
                                        bd2     = dtb.Rows[i + 1]["BodyText"].ToString();
                                        r2      = dtb.Rows[i + 1]["STT"].ToString();
                                        time60  = Parse_double(dtb.Rows[i + 1]["Best060Time"].ToString()) - Parse_double(dtb.Rows[i]["Best060Time"].ToString());
                                        y3      = dtb.Rows[i + 2]["Year"].ToString();
                                        m3      = dtb.Rows[i + 2]["Make"].ToString();
                                        md3     = dtb.Rows[i + 2]["Model"].ToString();
                                        bd3     = dtb.Rows[i + 2]["BodyText"].ToString();
                                        r3      = dtb.Rows[i + 2]["STT"].ToString();
                                        time601 = Parse_double(dtb.Rows[i + 2]["Best060Time"].ToString()) - Parse_double(dtb.Rows[i]["Best060Time"].ToString());
                                    }
                                }
                                else
                                {
                                    y2     = dtb.Rows[i - 1]["Year"].ToString();
                                    m2     = dtb.Rows[i - 1]["Make"].ToString();
                                    md2    = dtb.Rows[i - 1]["Model"].ToString();
                                    bd2    = dtb.Rows[i - 1]["BodyText"].ToString();
                                    r2     = dtb.Rows[i - 1]["STT"].ToString();
                                    time60 = Parse_double(dtb.Rows[i]["Best060Time"].ToString()) - Parse_double(dtb.Rows[i - 1]["Best060Time"].ToString());
                                    try
                                    {
                                        y3      = dtb.Rows[i + 1]["Year"].ToString();
                                        m3      = dtb.Rows[i + 1]["Make"].ToString();
                                        md3     = dtb.Rows[i + 1]["Model"].ToString();
                                        bd3     = dtb.Rows[i + 1]["BodyText"].ToString();
                                        r3      = dtb.Rows[i + 1]["STT"].ToString();
                                        time601 = Parse_double(dtb.Rows[i + 1]["Best060Time"].ToString()) - Parse_double(dtb.Rows[i]["Best060Time"].ToString());
                                    }
                                    catch
                                    {
                                    }
                                }
                            }
                        }
                    }
                }
                catch
                {
                }
            }



//--------*** This sets up the winner's circle text on the detail page--------

            cid         = dr["ItemID"].ToString();
            View        = (dr["Views"].ToString() == "" ? "0" : dr["Views"].ToString());
            link_detail = "/Popular-Lineups" + (Request.Params["class"] != null ? "/" + Request.Params["class"].ToString() : "") + "/" + dr["Year"].ToString() + "-" + CarzHelpers.URLEncode(dr["Make"].ToString()) + "-" + CarzHelpers.URLEncode(dr["Model"].ToString(), true);

            //--------*** Section Intro --------
            string default_text = "The top 10 fastest cars are lined up from fastest to slowest by their 0 to 60 times. We bring you this list of <a href='/Popular-Lineups/{6}' title='{5}'>{5}</a> based on the best estimates from trusted sources, including Car & Driver, Motor Trend, Road & Track and more.</p><p>Ranked at <strong>#{4}</strong>, the <a href='{7}' title='{0} {1} {2}{3}'>{0} {1} {2}{3}</a> races 0-60 mph in {8} seconds. Sports cars that fall within this range of acceleration are categorized as <a href='/Popular-Lineups/" + dr["TimeClass"].ToString() + "' title='" + dr["TimeClass"].ToString() + "' >" + dr["TimeClass"].ToString().Replace("-", " ") + "</a>.</p><p> ";

            string path1 = "/Popular-Lineups/" + class_ + "/" + dr["Year"].ToString() + "-" + CarzHelpers.URLEncode(dr["Make"].ToString()) + "-" + CarzHelpers.URLEncode(dr["Model"].ToString(), true);
            int    rank  = int.Parse(dr["STT"].ToString());
            default_text = string.Format(default_text, dr["Year"].ToString(), dr["Make"].ToString(), dr["Model"].ToString(), dr["BodyText"].ToString() == "" ? "" : " " + dr["BodyText"].ToString(), rank.ToString(), class_.Replace("-", " "), class_, path1, dr["Best060Time"].ToString());

            //--------*** Section Winners --------
            //--------*** winner 1 --------
            string path2   = "/Popular-Lineups/" + class_ + "/" + y2 + "-" + CarzHelpers.URLEncode(m2) + "-" + CarzHelpers.URLEncode(md2, true);
            string path3   = "/Popular-Lineups/" + class_ + "/" + y3 + "-" + CarzHelpers.URLEncode(m3) + "-" + CarzHelpers.URLEncode(md3, true);
            string winner1 = "It pulls ahead of the #2 ranked <a href='{5}' title='{1} {2} {3}{4}'>{1} {2} {3}{4}</a> by {6}";
            if (y3 != "")
            {
                winner1 += " and the #3 ranked <a href='{11}' title='{7} {8} {9}{10}'>{7} {8} {9}{10}</a> by {12}.";
            }
            else
            {
                winner1 += ".";
            }
            if (y2 == "")
            {
                winner1 = "";
            }

            winner1 = string.Format(winner1, "", y2, m2, md2, bd2 == "" ? "" : " " + bd2, path2, (compare(time60) ? "just hundredths of a second" : time60.ToString("0.0") + " seconds"), y3, m3, md3, bd3, path3, (compare(time601) ? " just hundredths of a second" : time601.ToString("0.0") + " seconds"));
            string winner1B = "<a href='{5}' title='{1} {2} {3}{4}'>{1} {2} {3}{4}</a>, you would <strong>WIN</strong> by {6}!";
            winner1B = string.Format(winner1B, "", y2, m2, md2, bd2 == "" ? "" : " " + bd2, path2, (time60 <= 0.099999 ? "just hundredths of a second" : time60.ToString("0.0") + " seconds"), y3, m3, md3, bd3, path3, (compare(time601) ? " just hundredths of a second" : time601.ToString("0.0") + " seconds"));

            //--------*** winner2 --------
            string winner2 = "It falls behind the #{6} ranked <a href='{5}' title='{1} {2} {3}{4}'>{1} {2} {3}{4}</a> by {7}";
            if (y3 != "")
            {
                winner2 += " and pulls ahead of the #{8} ranked <a href='{13}' title='{9} {10} {11}{12}'>{9} {10} {11}{12}</a> by {14}.";
            }
            else
            {
                winner2 += ".";
            }
            winner2 = string.Format(winner2, "", y2, m2, md2, bd2 == "" ? "" : " " + bd2, path2, r2, (compare(time60) ? "just hundredths of a second" : time60.ToString("0.0") + " seconds"), r3, y3, m3, md3, bd3, path3, (compare(time601) ? " just hundredths of a second" : time601.ToString("0.0") + " seconds"));
            string winner2B = "<a href='{13}' title='{9} {10} {11}{12}'>{9} {10} {11}{12}</a>, you would <strong>WIN</strong> by {14}!";
            winner2B = string.Format(winner2B, "", y2, m2, md2, bd2 == "" ? "" : " " + bd2, path2, r2, (time60 <= 0.099999 ? "just hundredths of a second" : time60.ToString("0.0") + " seconds"), r3, y3, m3, md3, bd3, path3, (compare(time601) ? " just hundredths of a second" : time601.ToString("0.0") + " seconds"));

            //--------*** winner3 --------
            string winner3 = "It falls behind the #{6} ranked <a href='{5}' title='{1} {2} {3}{4}'>{1} {2} {3}{4}</a> by {7}";
            if (y3 != "")
            {
                winner3 += " and the #{8} ranked <a href='{13}' title='{9} {10} {11}{12}'>{9} {10} {11}{12}</a> by {14}.";
            }
            else
            {
                winner3 += ".";
            }
            winner3 = string.Format(winner3, "", y2, m2, md2, bd2 == "" ? "" : " " + bd2, path2, r2, (compare(time60) ? "just hundredths of a second" : time60.ToString("0.0") + " seconds"), r3, y3, m3, md3, bd3, path3, (compare(time601) ? " just hundredths of a second" : time601.ToString("0.0") + " seconds"));
            string winner3B = "<a href='{13}' title='{9} {10} {11}{12}'>{9} {10} {11}{12}</a>, you would <strong>LOSE</strong> by {14}!";
            winner3B = string.Format(winner3B, "", y2, m2, md2, bd2 == "" ? "" : " " + bd2, path2, r2, (time60 <= 0.099999 ? "just hundredths of a second" : time60.ToString("0.0") + " seconds"), r3, y3, m3, md3, bd3, path3, (compare(time601) ? " just hundredths of a second" : time601.ToString("0.0") + " seconds"));


            //--------*** Image --------
            string link_media = CarzHelpers.getMediaURL(dr["Image"].ToString());

            previewimage = (link_media != "" ? link_media : default_image);

            if (previewimage != "")
            {
                previewimage = string.Format("<div class='ResultImage'><img   border='0'  alt='' src='{0}'/></div>", previewimage);
            }
            string view_de = " {0}<div class='ResultTitle'><p>0482</p><p>Rank: #{1}</p><p>Class:  <a href='{2}' title='{3}'>{3}</a></p><p>0-60 Time: {4} seconds</p></div><div class='clear'></div>";
            view_de = string.Format(view_de, previewimage, rank, "/Popular-Lineups/" + class_, class_.Replace("-", " "), Parse_double(dr["Best060Time"].ToString()).ToString("0.0"));


            //--------*** Section 3 --------
            string default_textB = "Before getting in the driver's seat of one of these cars and punching the gas, you should know where you stand. In a race from 0-60 mph between <a href='{7}' title='{0} {1} {2}{3}'>{0} {1} {2}{3}</a> vs. ";
            string pathB         = "/Popular-Lineups/" + class_ + "/" + dr["Year"].ToString() + "-" + CarzHelpers.URLEncode(dr["Make"].ToString()) + "-" + CarzHelpers.URLEncode(dr["Model"].ToString(), true);
            int    rankB         = int.Parse(dr["STT"].ToString());
            default_textB = string.Format(default_textB, dr["Year"].ToString(), dr["Make"].ToString(), dr["Model"].ToString(), dr["BodyText"].ToString() == "" ? "" : " " + dr["BodyText"].ToString(), rank.ToString(), class_.Replace("-", " "), class_, pathB, dr["Best060Time"].ToString());


            //--------*** Section 4 --------
            string default_textC = "If you are thinking about going head to head with another <a href='{1}' title='{1}'>{1}</a>, make sure you know your competition. Find out where your car ranks against the <a href='{0}' title='{0}'>top 10 fastest cars from {0}</a>.";
            string pathC         = "/Popular-Lineups/" + class_ + "/" + dr["Year"].ToString() + "-" + CarzHelpers.URLEncode(dr["Make"].ToString()) + "-" + CarzHelpers.URLEncode(dr["Model"].ToString(), true);
            int    rankC         = int.Parse(dr["STT"].ToString());
            default_textC = string.Format(default_textC, dr["Year"].ToString(), dr["Make"].ToString(), dr["Model"].ToString(), dr["BodyText"].ToString() == "" ? "" : " " + dr["BodyText"].ToString(), rank.ToString(), class_.Replace("-", " "), class_, pathC, dr["Best060Time"].ToString());


            //--------*** Output HTML --------
            string html_content = "";
            if (rank == 1)
            {
                html_content = view_de + "<div class='ResultContent'><h2 style='0122'>Winner’s Circle</h2><p>" + default_text + winner1 + "</p><p>" + default_textB + winner1B + "<p>" + default_textC + "</p></div>";
            }
            else
            if (rank > 1 && rank < (dtb.Rows.Count))
            {
                html_content = view_de + "<div class='ResultContent'><h2 style='0122'>Winner’s Circle</h2><p>" + default_text + winner2 + "</p><p>" + default_textB + winner2B + "<p>" + default_textC + "</p></div>";
            }
            else
            {
                html_content = view_de + "<div class='ResultContent'><h2 style='0122'>Winner’s Circle</h2><p>" + default_text + winner3 + "</p><p>" + default_textB + winner3B + "<p>" + default_textC + "</p></div>";
            }



//--------*** This sets up the vehicle info/ perf stats on the detail page--------

            h1 = string.Format("{0} {1} {2}", dr["Year"].ToString(), dr["Make"].ToString(), dr["Model"].ToString());
            LiteralResultDetail.Text = html_content;
            if (n_row == 1)
            {
                string html = "<div class='Car_Details list clearfix'><div class='Vehicle_information' > <h2>Vehicle information</h2><div class='conten'>{0}</div></div><div class='performance_statistics'><h2>Performance statistics</h2><div class='conten'>{1}</div></div></div><p style='clear:both;'>" + View + " people have viewed this car.</p> ";
                LiteralResultDetail2.Text = string.Format(html, "<p><strong>Year:</strong> " + dr["Year"].ToString() + "</p>" +
                                                          "<p><strong>Make:</strong> " + dr["Make"].ToString() + "</p>" +
                                                          "<p><strong>Model:</strong> " + dr["Model"].ToString() + "</p>" +
                                                          "<p><strong>Engine:</strong> " + dr["Engine"].ToString() + "</p>" +
                                                          "<p><strong>Horsepower:</strong> " + Parse_double(dr["Horsepower"].ToString()).ToString("0") + "</p>" +
                                                          "<p><strong>Torque:</strong> " + dr["Torque"].ToString() + "</p>" +
                                                          "<p><strong>Transmission:</strong> " + dr["Transmission"].ToString() + "</p>" +
                                                          "<p><strong>Curb Weight:</strong> " + dr["CurbWeight"].ToString() + "</p>" +
                                                          "<p><strong>City MPG:</strong> " + dr["MPGCity"].ToString() + "</p>" +
                                                          "<p><strong>Highway MPG:</strong> " + dr["MPG"].ToString() + "</p>" +
                                                          "<p><strong>MSRP:</strong> $" + Parse_double(dr["MSRP"].ToString()).ToString("0,0") + "</p>",
                                                          "<p><strong>Tags:</strong> " + dr["Tags"].ToString() + "</p>" +
                                                          "<p><strong>Class:</strong> <a href='/Popular-Lineups/" + dr["TimeClass"].ToString() + "' title='" + dr["TimeClass"].ToString() + "' >" + dr["TimeClass"].ToString().Replace("-", " ") + "</a></p>" +
                                                          "<p><strong>Rank:</strong> #" + dr["TimeClassRank"].ToString() + "</p>" +
                                                          "<p><strong>Best 0-60 Time:</strong> " + Parse_double(dr["Best060Time"].ToString()).ToString("0.0") + " seconds </p>" +
                                                          "<p><strong>Best &#188;  Mile:</strong> " + Parse_double(dr["Best1of4MileTime"].ToString()).ToString("0.0") + " seconds </p>" +
                                                          "<p><strong>@ speed:</strong> " + Parse_double(dr["Best1of4MileSpeed"].ToString()).ToString("0.0") + " mph </p>" +
                                                          "<p><strong>Best Top Speed:</strong> " + Parse_double(dr["BestTopSpeed"].ToString()).ToString("0.0") + " mph </p>" +
                                                          "<p><strong>Best Skid Pad:</strong> " + Parse_double(dr["BestSkidPad"].ToString()).ToString("0.0") + " G </p>"
                                                          );



                try
                {
                    /*
                     * CustomTableItemProvider tbProvide = new CustomTableItemProvider();
                     * CustomTableItem tbRecord = tbProvide.GetItem(int.Parse(cid), "customtable.carz");
                     * if (tbRecord != null)
                     * {
                     *  // Set new field values
                     *  tbRecord.SetValue("Views", int.Parse(View) + 1);
                     *
                     *  // Save updates in the database
                     *  tbRecord.Update();
                     *
                     *
                     * }*/
                    int k = cn.ExecuteNonQuery(string.Format("UPDATE [dbo].[customtable_carz] SET Views='{0}' WHERE ItemID='{1}' ", int.Parse(View) + 1, cid), null, QueryTypeEnum.SQLQuery, false);
                }
                catch
                {
                }

                GridViewResult.Visible       = false;
                LiteralNone.Text             = " style='display:none;' ";
                LiteralResultDetail2.Visible = true;
                LiteralTitle.Text            = "<h1>" + h1 + "</h1>";

//--------*** This sets up the individual subnav on the detail page--------

                LiteralResultDetail.Text = LiteralResultDetail.Text.Replace("0122", "display:none;");
                string back = "<a title='Back to Results' href='" + "/Popular-Lineups" + (Request.Params["class"] != null ? "/" + Request.Params["class"].ToString() : "") + "/" + "'>Back to Results</a> | ";
                LiteralResultDetail.Text = LiteralResultDetail.Text.Replace("0482", (preview != "" || next != ""?back:"") + (preview != "" ? "<  <a title='Prev' href='/Popular-Lineups" + (Request.Params["class"] != null ? "/" + Request.Params["class"].ToString() : "") + "/" + preview + "'>Prev</a>&nbsp;&nbsp;&nbsp;" : "") + (next != "" ? " <a title='Next' href='/Popular-Lineups" + (Request.Params["class"] != null ? "/" + Request.Params["class"].ToString() : "") + "/" + next + "'>Next > </a> " : ""));
            }
            else
            {
                LiteralResultDetail.Text = LiteralResultDetail.Text.Replace("0482", string.Format("<a href='{0}' title='{1}'>{1}</a>", path1, h1));
            }
        }
    }
Пример #11
0
    private void FindMakeModel(string rOther, DataSet ds, out string year, out string make, out string URLslug, out string model, out int nparam, string y)
    {
        string other = rOther.ToString();

        other = CarzHelpers.URLDecode(other.Replace("/", ""));
        other = other.Trim();
        DataRow[] dRows = ds.Tables[0].Select("Make = '" + other + "' or URLslug = '" + other + "'");
        year    = y;
        model   = "";
        make    = "";
        URLslug = "";
        nparam  = 2;

        if (dRows.Length <= 0)
        {
            string[] arr = other.Split('-');
            if (arr.Length == 2)
            {
                try
                {
                    year = int.Parse(arr[0]).ToString();
                    make = arr[1];

                    if (dRows.Length <= 0)
                    {
                        model = make;
                        make  = "";
                        nparam++;
                    }
                }
                catch
                {
                    make    = arr[0];
                    model   = arr[1];
                    nparam += 2;
                }
            }
            else
            {
                dRows = ds.Tables[0].Select("Make = '" + other + "' or URLslug = '" + other + "'");
                if (dRows.Length > 0)
                {
                    //is make
                    make = other;
                    nparam++;
                }
                else
                {
                    dRows = ds.Tables[0].Select("Model = '" + other + "'");

                    if (dRows.Length > 0)
                    {
                        //is make
                        model = other;
                        nparam++;
                    }
                }
            }
        }
        else
        {
            Session["make_URLslug"] = dRows[0]["URLslug"].ToString();
            Session["make_main"]    = dRows[0]["Make"].ToString();
            make = other;
            nparam++;
        }
        // make = dRows.Length.ToString();
    }
Пример #12
0
//--------*** This sets up the results table page--------

    private void get_detail()
    {
        dtb = get_data();

        if (dtb != null)
        {
            DataRow dr = (DataRow)Session["list_result_detail"];
            Boolean b  = false;
            for (int i = 0; i < dtb.Rows.Count; i++)
            {
                if (dtb.Rows[i]["ItemID"].ToString() == dr["ItemID"].ToString())
                {
                    bSecond   = true;
                    dr["STT"] = dtb.Rows[i]["STT"];
                    try
                    {
                        if (i == 0)
                        {
                            //begin
                            if (dtb.Rows.Count > 1)
                            {
                                cidn_ = dtb.Rows[1]["ItemID"].ToString();
                                next  = dtb.Rows[1]["Year"].ToString() + "-" + CarzHelpers.URLEncode(dtb.Rows[1]["Make"].ToString()) + "-" + CarzHelpers.URLEncode(dtb.Rows[1]["Model"].ToString(), true) + "-" + cidn_;
                            }
                            preview = "";
                        }
                        else
                        if (i == (dtb.Rows.Count - 1))
                        {
                            //the end
                            if (dtb.Rows.Count > 1)
                            {
                                cidp_   = dtb.Rows[dtb.Rows.Count - 2]["ItemID"].ToString();
                                preview = dtb.Rows[dtb.Rows.Count - 2]["Year"].ToString() + "-" + CarzHelpers.URLEncode(dtb.Rows[dtb.Rows.Count - 2]["Make"].ToString()) + "-" + CarzHelpers.URLEncode(dtb.Rows[dtb.Rows.Count - 2]["Model"].ToString(), true) + "-" + cidp_;
                            }
                        }
                        else
                        {
                            cidp_   = dtb.Rows[i - 1]["ItemID"].ToString();
                            preview = dtb.Rows[i - 1]["Year"].ToString() + "-" + CarzHelpers.URLEncode(dtb.Rows[i - 1]["Make"].ToString()) + "-" + CarzHelpers.URLEncode(dtb.Rows[i - 1]["Model"].ToString(), true) + "-" + cidp_;
                            cidn_   = dtb.Rows[i + 1]["ItemID"].ToString();
                            next    = dtb.Rows[i + 1]["Year"].ToString() + "-" + CarzHelpers.URLEncode(dtb.Rows[i + 1]["Make"].ToString()) + "-" + CarzHelpers.URLEncode(dtb.Rows[i + 1]["Model"].ToString(), true) + "-" + cidn_;

                            //center
                        }
                    }
                    catch
                    {
                    }
                }



                try
                {
                    if (bSecond == true)
                    {
                        bSecond = false;
                        if (dtb.Rows.Count > 1)
                        {
                            if (i == (dtb.Rows.Count - 1))
                            {
                                if (dtb.Rows.Count == 2)
                                {
                                    id2    = dtb.Rows[i - 1]["ItemID"].ToString();
                                    y2     = dtb.Rows[i - 1]["Year"].ToString();
                                    m2     = (string.IsNullOrEmpty(dtb.Rows[i - 1]["URLslug"].ToString()) == true ? dtb.Rows[i - 1]["Make"].ToString() : dtb.Rows[i - 1]["URLslug"].ToString());
                                    md2    = dtb.Rows[i - 1]["Model"].ToString();
                                    r2     = dtb.Rows[i - 1]["STT"].ToString();
                                    time60 = Parse_double(dtb.Rows[i]["Best060Time"].ToString()) - Parse_double(dtb.Rows[i - 1]["Best060Time"].ToString());
                                }
                                else
                                {
                                    id2     = dtb.Rows[i - 2]["ItemID"].ToString();
                                    y2      = dtb.Rows[i - 2]["Year"].ToString();
                                    m2      = (string.IsNullOrEmpty(dtb.Rows[i - 2]["URLslug"].ToString()) == true ? dtb.Rows[i - 2]["Make"].ToString() : dtb.Rows[i - 2]["URLslug"].ToString());
                                    md2     = dtb.Rows[i - 2]["Model"].ToString();
                                    r2      = dtb.Rows[i - 2]["STT"].ToString();
                                    time60  = Parse_double(dtb.Rows[i]["Best060Time"].ToString()) - Parse_double(dtb.Rows[i - 2]["Best060Time"].ToString());
                                    id3     = dtb.Rows[i - 1]["ItemID"].ToString();
                                    y3      = dtb.Rows[i - 1]["Year"].ToString();
                                    m3      = (string.IsNullOrEmpty(dtb.Rows[i - 1]["URLslug"].ToString()) == true ? dtb.Rows[i - 1]["Make"].ToString() : dtb.Rows[i - 1]["URLslug"].ToString());
                                    md3     = dtb.Rows[i - 1]["Model"].ToString();
                                    r3      = dtb.Rows[i - 1]["STT"].ToString();
                                    time601 = Parse_double(dtb.Rows[i]["Best060Time"].ToString()) - Parse_double(dtb.Rows[i - 1]["Best060Time"].ToString());
                                }
                            }
                            else
                            {
                                if (dr["STT"].ToString() == "1")
                                {
                                    if (dtb.Rows.Count == 2)
                                    {
                                        id2    = dtb.Rows[i + 1]["ItemID"].ToString();
                                        y2     = dtb.Rows[i + 1]["Year"].ToString();
                                        m2     = (string.IsNullOrEmpty(dtb.Rows[i + 1]["URLslug"].ToString()) == true ? dtb.Rows[i + 1]["Make"].ToString() : dtb.Rows[i + 1]["URLslug"].ToString());
                                        md2    = dtb.Rows[i + 1]["Model"].ToString();
                                        r2     = dtb.Rows[i + 1]["STT"].ToString();
                                        time60 = Parse_double(dtb.Rows[i + 1]["Best060Time"].ToString()) - Parse_double(dtb.Rows[i]["Best060Time"].ToString());
                                    }
                                    else
                                    {
                                        id2     = dtb.Rows[i + 1]["ItemID"].ToString();
                                        y2      = dtb.Rows[i + 1]["Year"].ToString();
                                        m2      = (string.IsNullOrEmpty(dtb.Rows[i + 1]["URLslug"].ToString()) == true ? dtb.Rows[i + 1]["Make"].ToString() : dtb.Rows[i + 1]["URLslug"].ToString());
                                        md2     = dtb.Rows[i + 1]["Model"].ToString();
                                        bd2     = dtb.Rows[i + 1]["BodyText"].ToString();
                                        r2      = dtb.Rows[i + 1]["STT"].ToString();
                                        time60  = Parse_double(dtb.Rows[i + 1]["Best060Time"].ToString()) - Parse_double(dtb.Rows[i]["Best060Time"].ToString());
                                        id3     = dtb.Rows[i + 2]["ItemID"].ToString();
                                        y3      = dtb.Rows[i + 2]["Year"].ToString();
                                        m3      = (string.IsNullOrEmpty(dtb.Rows[i + 2]["URLslug"].ToString()) == true ? dtb.Rows[i + 2]["Make"].ToString() : dtb.Rows[i + 2]["URLslug"].ToString());
                                        md3     = dtb.Rows[i + 2]["Model"].ToString();
                                        bd3     = dtb.Rows[i + 2]["BodyText"].ToString();
                                        r3      = dtb.Rows[i + 2]["STT"].ToString();
                                        time601 = Parse_double(dtb.Rows[i + 2]["Best060Time"].ToString()) - Parse_double(dtb.Rows[i]["Best060Time"].ToString());
                                    }
                                }
                                else
                                {
                                    id2    = dtb.Rows[i - 1]["ItemID"].ToString();
                                    y2     = dtb.Rows[i - 1]["Year"].ToString();
                                    m2     = (string.IsNullOrEmpty(dtb.Rows[i - 1]["URLslug"].ToString()) == true ? dtb.Rows[i - 1]["Make"].ToString() : dtb.Rows[i - 1]["URLslug"].ToString());
                                    md2    = dtb.Rows[i - 1]["Model"].ToString();
                                    bd2    = dtb.Rows[i - 1]["BodyText"].ToString();
                                    r2     = dtb.Rows[i - 1]["STT"].ToString();
                                    time60 = Parse_double(dtb.Rows[i]["Best060Time"].ToString()) - Parse_double(dtb.Rows[i - 1]["Best060Time"].ToString());
                                    try
                                    {
                                        id2     = dtb.Rows[i + 1]["ItemID"].ToString();
                                        y3      = dtb.Rows[i + 1]["Year"].ToString();
                                        m3      = (string.IsNullOrEmpty(dtb.Rows[i + 1]["URLslug"].ToString()) == true ? dtb.Rows[i + 1]["Make"].ToString() : dtb.Rows[i + 1]["URLslug"].ToString());
                                        md3     = dtb.Rows[i + 1]["Model"].ToString();
                                        bd3     = dtb.Rows[i + 1]["BodyText"].ToString();
                                        r3      = dtb.Rows[i + 1]["STT"].ToString();
                                        time601 = Parse_double(dtb.Rows[i + 1]["Best060Time"].ToString()) - Parse_double(dtb.Rows[i]["Best060Time"].ToString());
                                    }
                                    catch
                                    {
                                    }
                                }
                            }
                        }
                    }
                }
                catch
                {
                }
            }

//--------*** This sets up the results for the keyword search on the top right--------

            Session["classname_search"] = (Request.Params["class"] != null ? Request.Params["class"].ToString() : "");


            if (n_row > 0 && nparam < 3)
            {
                string path = "";
                if (Request.Params["searchtext"] == null)
                {
                    path = (year != "" ? year : "") + (make != "" ? (year != "" ? "-" + CarzHelpers.URLEncode(make) : CarzHelpers.URLEncode(make)) : "") + (model != "" ? (year != "" ? "-" + CarzHelpers.URLEncode(model, true) : (make != "" ? "-" + CarzHelpers.URLEncode(model, true) : CarzHelpers.URLEncode(model, true))) : "");
                    if (Session["classname_search"].ToString() == "All")
                    {
                        path = "All";
                    }
                    Session["path_result"] = "/Top-10-Fastest-Cars/" + path;

                    Session["classname_search"] = path;
                }
                else
                {
                    Session["classname_search"] = (Request.Params["class"] != null ? Request.Params["class"].ToString() : "");
                    Session["path_result"]      = "/Search/Custom-Search/searchtext=" + Request.Params["searchtext"].ToString();
                    //Session["classname_search"] = CarzHelpers.URLDecode(Request.Params["searchtext"].ToString());
                }
            }


            getimage_class(Session["classname_search"].ToString());

//--------*** This sets up the winner's circle text on the detail page--------

            class_ = Session["classname_search"].ToString();
            //class_=(class_==""?"All":class_);
            string custompath = "/Top-10-Fastest-Cars/" + class_;
            if (CarzHelpers.URLDecode(class_, true) == "Custom-Search")
            {
                custompath = (Session["path_result"] != null ? Session["path_result"].ToString() : "");
            }
            cid  = dr["ItemID"].ToString();
            View = (dr["Views"].ToString() == "" ? "0" : dr["Views"].ToString());
            string make_encode = CarzHelpers.URLEncode(string.IsNullOrEmpty(dr["URLslug"].ToString()) == true ? dr["Make"].ToString() : dr["URLslug"].ToString());
            link_detail = "/Top-10-Fastest-Cars" + (class_ != null ? "/" + class_ : "") + "/" + dr["Year"].ToString() + "-" + make_encode + "-" + CarzHelpers.URLEncode(dr["Model"].ToString(), true);

            //--------*** Section Intro --------
            string default_text = "The top 10 fastest cars from <a href='/Top-10-Fastest-Cars/{6}' title='{5}'>{5}</a> are ranked from fastest to slowest based on their 0-60 times. We crunched the numbers from the best estimates of several premier resources, including Motor Trend, Road & Track, Car & Driver and more.</p><p>Pulling up at <strong>#{4}</strong> in this class is the <a href='{7}' title='{0} {1} {2}{3}'>{0} {1} {2}{3}</a>, which races 0-60 mph in {8} seconds. Sports cars with this rate of acceleration are generally classified as <a href='/Popular-Lineups/" + dr["TimeClass"].ToString() + "' title='" + dr["TimeClass"].ToString() + "' >" + dr["TimeClass"].ToString().Replace("-", " ") + "</a>.</p><p> ";

            string path1 = "/Top-10-Fastest-Cars/" + class_ + "/" + dr["Year"].ToString() + "-" + make_encode + "-" + CarzHelpers.URLEncode(dr["Model"].ToString(), true) + "-" + dr["ItemID"].ToString();
            int    rank  = int.Parse(dr["STT"].ToString());
            default_text = string.Format(default_text, dr["Year"].ToString(), dr["Make"].ToString(), dr["Model"].ToString(), dr["BodyText"].ToString() == "" ? "" : " " + dr["BodyText"].ToString(), rank.ToString(), CarzHelpers.URLDecode(class_, true).Replace("-", " "), class_, path1, dr["Best060Time"].ToString(), custompath);


            //--------*** Section Winners --------
            //--------*** winner 1 --------
            string path2 = "/Top-10-Fastest-Cars/" + class_ + "/" + y2 + "-" + CarzHelpers.URLEncode(m2) + "-" + CarzHelpers.URLEncode(md2, true) + "-" + id2;
            string path3 = "/Top-10-Fastest-Cars/" + class_ + "/" + y3 + "-" + CarzHelpers.URLEncode(m3) + "-" + CarzHelpers.URLEncode(md3, true) + "-" + id3;

            string winner1 = "It darts ahead of the #2 ranked <a href='{5}' title='{1} {2} {3}{4}'>{1} {2} {3}{4}</a> by {6}";
            if (y3 != "")
            {
                winner1 += " and the #3 ranked <a href='{11}' title='{7} {8} {9}{10}'>{7} {8} {9}{10}</a> by {12}.";
            }
            else
            {
                winner1 += ".";
            }
            if (y2 == "")
            {
                winner1 = "";
            }
            winner1 = string.Format(winner1, "", y2, m2, md2, bd2 == "" ? "" : " " + bd2, path2, (time60 <= 0.099999 ? "just hundredths of a second" : time60.ToString("0.0") + " seconds"), y3, m3, md3, bd3, path3, (compare(time601) ? " just hundredths of a second" : time601.ToString("0.0") + " seconds"));
            //string winner1B = "<a href='{5}' title='{1} {2} {3}{4}'>{1} {2} {3}{4}</a>, you would <strong>WIN</strong> by {6}!";
            //winner1B = string.Format(winner1B, "", y2, m2, md2, bd2 == "" ? "" : " " + bd2, path2, (time60 <= 0.099999 ? "just hundredths of a second" : time60.ToString("0.0") + " seconds"), y3, m3, md3, bd3, path3, (compare(time601) ? " just hundredths of a second" : time601.ToString("0.0") + " seconds"));


            //--------*** winner2 --------
            string winner2 = "It lags behind the #{6} ranked <a href='{5}' title='{1} {2} {3}{4}'>{1} {2} {3}{4}</a> by {7}";
            if (y3 != "")
            {
                winner2 += " and darts ahead of the #{8} ranked <a href='{13}' title='{9} {10} {11}{12}'>{9} {10} {11}{12}</a> by {14}.";
            }
            else
            {
                winner2 += ".";
            }
            winner2 = string.Format(winner2, "", y2, m2, md2, bd2 == "" ? "" : " " + bd2, path2, r2, (time60 <= 0.099999 ? "just hundredths of a second" : time60.ToString("0.0") + " seconds"), r3, y3, m3, md3, bd3, path3, (compare(time601) ? " just hundredths of a second" : time601.ToString("0.0") + " seconds"));
            //string winner2B = "<a href='{13}' title='{9} {10} {11}{12}'>{9} {10} {11}{12}</a>, you would <strong>WIN</strong> by {14}!";
            //winner2B = string.Format(winner2B, "", y2, m2, md2, bd2 == "" ? "" : " " + bd2, path2, r2, (time60 <= 0.099999 ? "just hundredths of a second" : time60.ToString("0.0") + " seconds"), r3, y3, m3, md3, bd3, path3, (compare(time601) ? " just hundredths of a second" : time601.ToString("0.0") + " seconds"));


            //--------*** winner3 --------
            string winner3 = "It lags behind the #{6} ranked <a href='{5}' title='{1} {2} {3}{4}'>{1} {2} {3}{4}</a> by {7}";
            if (y3 != "")
            {
                winner3 += " and the #{8} ranked <a href='{13}' title='{9} {10} {11}{12}'>{9} {10} {11}{12}</a> by {14}.";
            }
            else
            {
                winner3 += ".";
            }
            winner3 = string.Format(winner3, "", y2, m2, md2, bd2 == "" ? "" : " " + bd2, path2, r2, (time60 <= 0.099999 ? "just hundredths of a second" : time60.ToString("0.0") + " seconds"), r3, y3, m3, md3, bd3, path3, (compare(time601) ? " just hundredths of a second" : time601.ToString("0.0") + " seconds"));
            //string winner3B = "<a href='{13}' title='{9} {10} {11}{12}'>{9} {10} {11}{12}</a>, you would <strong>LOSE</strong> by {14}!";
            //winner3B = string.Format(winner3B, "", y2, m2, md2, bd2 == "" ? "" : " " + bd2, path2, r2, (time60 <= 0.099999 ? "just hundredths of a second" : time60.ToString("0.0") + " seconds"), r3, y3, m3, md3, bd3, path3, (compare(time601) ? " just hundredths of a second" : time601.ToString("0.0") + " seconds"));


            //--------*** Image --------
            string link_media = CarzHelpers.getMediaURL(dr["Image"].ToString());
            previewimage = (link_media != "" ? link_media : default_image);
            if (previewimage != "")
            {
                previewimage = string.Format("<div class='ResultImage'><img   border='0'  alt='' src='{0}'/></div>", previewimage);
            }
            string view_de = " {0}<div class='ResultTitle'><p>0482</p><p><strong>Rank:</strong> #{1}</p><p><strong>Class:</strong>  <a href='{2}' title='{3}'>{3}</a></p><p><strong>0-60 Time:</strong> {4} seconds</p></div><div class='clear'></div>";

            view_de = string.Format(view_de, previewimage, rank, custompath, CarzHelpers.URLDecode(class_, true).Replace("-", " "), Parse_double(dr["Best060Time"].ToString()).ToString("0.0"));


            //--------*** Section 3 --------
            //string default_textB = "Whether you are behind the wheel of one of these cars or happen to spot one in the next lane over, think twice before you step on the gas pedal. In a race from 0-60 mph between <strong><a href='{7}' title='{0} {1} {2}{3}'>{0} {1} {2}{3}</a></strong> vs. ";
            //string pathB = "/Top-10-Fastest-Cars/" + class_ + "/" + dr["Year"].ToString() + "-" + make_encode + "-" + CarzHelpers.URLEncode(dr["Model"].ToString(), true);
            //int rankB = int.Parse(dr["STT"].ToString());
            //default_textB = string.Format(default_textB, dr["Year"].ToString(), dr["Make"].ToString(), dr["Model"].ToString(), dr["BodyText"].ToString() == "" ? "" : " " + dr["BodyText"].ToString(), rankB.ToString(), CarzHelpers.URLDecode(class_, true).Replace("-", " "), class_, pathB, dr["Best060Time"].ToString(), custompath);


            //--------*** Section 4 --------
            string default_textC = "If you happen to roll up next to another <a href='{1}' title='{1}'>{1}</a>, be sure you know what you're up against. Find out where your car stands among the <a href='{0}' title='{0}'>top 10 fastest cars from {0}</a>.";
            string pathC         = "/Top-10-Fastest-Cars/" + class_ + "/" + dr["Year"].ToString() + "-" + make_encode + "-" + CarzHelpers.URLEncode(dr["Model"].ToString(), true);
            int    rankC         = int.Parse(dr["STT"].ToString());
            default_textC = string.Format(default_textC, dr["Year"].ToString(), dr["Make"].ToString(), dr["Model"].ToString(), dr["BodyText"].ToString() == "" ? "" : " " + dr["BodyText"].ToString(), rankC.ToString(), CarzHelpers.URLDecode(class_, true).Replace("-", " "), class_, pathC, dr["Best060Time"].ToString(), custompath);


            //--------*** Output HTML --------
            string html_content = "";

            //html_content = view_de + "<div class='ResultContent'><h2>Winner's Circle</h2><p>" + default_text + "</p></div>";

            if (rank == 1)
            {
                html_content = view_de + "<div class='ResultContent'><h2 style='0122'>Winner's Circle</h2><p>" + default_text + winner1 + "</p><p>" + default_textC + "</p></div>";
            }
            else
            if (rank > 1 && rank < (dtb.Rows.Count))
            {
                html_content = view_de + "<div class='ResultContent'><h2 style='0122'>Winner's Circle</h2><p>" + default_text + winner2 + "</p><p>" + default_textC + "</p></div>";
            }
            else
            {
                html_content = view_de + "<div class='ResultContent'><h2 style='0122'>Winner's Circle</h2><p>" + default_text + winner3 + "</p><p>" + default_textC + "</p></div>";
            }


            LiteralResultDetail.Text = html_content;



            h1 = string.Format("{0} {1} {2}", dr["Year"].ToString(), dr["Make"].ToString(), dr["Model"].ToString());

            if (n_row == 1 && nparam > 2)
            {
//--------*** This sets up the vehicle info/ perf stats on the detail page--------

                string html = "<div style='margin-bottom:10px;' class='addthis_toolbox addthis_default_style'><a class='addthis_button_preferred_1'></a><a class='addthis_button_preferred_2'></a><a class='addthis_button_preferred_3'></a><a class='addthis_button_preferred_4'></a><a class='addthis_button_compact'></a><a class='addthis_counter addthis_bubble_style'></a></div><div class='Car_Details list clearfix'><div class='Vehicle_information' > <h2>Vehicle information</h2><div class='conten'>{0}</div></div><div class='performance_statistics'><h2>Performance statistics</h2><div class='conten'>{1}</div></div></div><p style='clear:both;'>" + View + " people have viewed this car.</p> ";
                LiteralResultDetail2.Text = string.Format(html, "<p><strong>Year:</strong> " + dr["Year"].ToString() + "</p>" +
                                                          "<p><strong>Make:</strong> " + dr["Make"].ToString() + "</p>" +
                                                          "<p><strong>Model:</strong> " + dr["Model"].ToString() + "</p>" +
                                                          "<p><strong>Engine:</strong> " + dr["Engine"].ToString() + "</p>" +
                                                          "<p><strong>Horsepower:</strong> " + Parse_double(dr["Horsepower"].ToString()).ToString("0") + "</p>" +
                                                          "<p><strong>Torque:</strong> " + dr["Torque"].ToString() + "</p>" +
                                                          "<p><strong>Transmission:</strong> " + dr["Transmission"].ToString() + "</p>" +
                                                          "<p><strong>Curb Weight:</strong> " + dr["CurbWeight"].ToString() + "</p>" +
                                                          "<p><strong>City MPG:</strong> " + dr["MPGCity"].ToString() + "</p>" +
                                                          "<p><strong>Highway MPG:</strong> " + dr["MPG"].ToString() + "</p>" +
                                                          "<p><strong>MSRP:</strong> $" + Parse_double(dr["MSRP"].ToString()).ToString("0,0") + "</p>",
                                                          "<p><strong>Tags:</strong> " + dr["Tags"].ToString() + "</p>" +
                                                          "<p><strong>Class:</strong> <a href='/Popular-Lineups/" + dr["TimeClass"].ToString() + "' title='" + dr["TimeClass"].ToString() + "' >" + dr["TimeClass"].ToString().Replace("-", " ") + "</a></p>" +
                                                          "<p><strong>Rank:</strong> #" + dr["TimeClassRank"].ToString() + "</p>" +
                                                          "<p><strong>Best 0-60 Time:</strong> " + Parse_double(dr["Best060Time"].ToString()).ToString("0.0") + " seconds </p>" +
                                                          "<p><strong>Best &#188;  Mile:</strong> " + Parse_double(dr["Best1of4MileTime"].ToString()).ToString("0.0") + " seconds </p>" +
                                                          "<p><strong>@  speed:</strong> " + Parse_double(dr["Best1of4MileSpeed"].ToString()).ToString("0.0") + " mph </p>" +
                                                          "<p><strong>Best Top Speed:</strong> " + Parse_double(dr["BestTopSpeed"].ToString()).ToString("0.0") + " mph </p>" +
                                                          "<p><strong>Best Skid Pad:</strong> " + Parse_double(dr["BestSkidPad"].ToString()).ToString("0.0") + " G </p>"
                                                          );



                try
                {
                    /*
                     * CustomTableItemProvider tbProvide = new CustomTableItemProvider();
                     *
                     * CustomTableItem tbRecord = tbProvide.GetItem(int.Parse(cid), "customtable.carz");
                     * if (tbRecord != null)
                     * {
                     *  // Set new field values
                     *  tbRecord.SetValue("Views", int.Parse(View) + 1);
                     *
                     *  // Save updates in the database
                     *  tbRecord.Update();
                     *
                     *
                     * }
                     *
                     */

                    int k = cn.ExecuteNonQuery(string.Format("UPDATE [dbo].[customtable_carz] SET Views='{0}' WHERE ItemID='{1}' ", int.Parse(View) + 1, cid), null, QueryTypeEnum.SQLQuery, false);
                }
                catch
                {
                }

                GridViewResult.Visible       = false;
                LiteralNone.Text             = " style='display:none;' ";
                LiteralResultDetail2.Visible = true;
                LiteralTitle.Text            = "<h1>" + h1 + "</h1>";

//--------*** This sets up the individual subnav on the detail page--------


                string back = "<a title='Back to Results' href='" + (Session["path_result"] != null ? Session["path_result"].ToString() : "javascript:history.back();") + "'>Back to Results</a> | ";
                LiteralResultDetail.Text = LiteralResultDetail.Text.Replace("0122", "display:none;");
                LiteralResultDetail.Text = LiteralResultDetail.Text.Replace("0482", (preview == "" && next == "" ? "" : back) + (preview != "" ? "<  <a title='Prev' href='/Top-10-Fastest-Cars/" + class_ + "/" + preview + "'>Prev</a>&nbsp;&nbsp;&nbsp;" : "") + (next != "" ? " <a title='Next' href='/Top-10-Fastest-Cars/" + class_ + "/" + next + "'>Next > </a> " : ""));
            }
            else
            {
                LiteralResultDetail.Text = LiteralResultDetail.Text.Replace("0482", string.Format("<a href='{0}' title='{1}'>{1}</a>", path1, h1));
            }
            //Uri url = Request.Url;
            //LiteralResultDetail.Text = Session["123456"].ToString();
            //LiteralResultDetail.Text+="<br>"+Session["123456"].ToString()+"<br>"+debug + "<br>n_row =" + n_row + "<br>nparam=="+nparam;
        }
    }