using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
//connect to database
using System.Data.SqlClient;
using System.Data;
using System.Configuration;
using System.Collections;
//to use string ehhehee
using System.Text;
using System.IO;
using System.Text.RegularExpressions;
//message box
public partial class Pre_Owned_customasp_vehicledetailcontrol : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
Get_CarDetail();
}
protected void Get_CarDetail()
{
string haha = HttpContext.Current.Request.QueryString[0].ToString();
SqlConnection myConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["CMSConnectionString"].ConnectionString);
try
{
DataSet dq = new DataSet();
DataTable dt = new DataTable();
dq.Tables.Add(dt);
SqlCommand cmd = new SqlCommand();
cmd.Connection = myConnection;
// cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "SELECT * FROM cardatabase WHERE car_plate =" + "'" + haha + "'";
myConnection.Open();
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = cmd;
da.Fill(dt);
model.Text = dt.Rows[0][1].ToString();
cc.Text = dt.Rows[0][2].ToString();
//trans.Text = dt.Rows[0][3].ToString();
plate.Text = dt.Rows[0][4].ToString();
colour.Text = dt.Rows[0][5].ToString();
year.Text = dt.Rows[0][6].ToString() + " / " + dt.Rows[0][15].ToString();
int whyohwhy2=Convert.ToInt32(dt.Rows[0][7]);
mileage.Text = string.Format("{0:#,###0}",whyohwhy2);
int whyohwhy=Convert.ToInt32(dt.Rows[0][8]);
//price.Text = dt.Rows[0][8].ToString();
price.Text = string.Format("{0:#,###0}",whyohwhy);
location.Text = Regex.Replace(dt.Rows[0][9].ToString(), "_", " ");
seat.Text = dt.Rows[0][10].ToString();
// available.Text = dt.Rows[0][13].ToString();
warranty.Text = dt.Rows[0][14].ToString();
DateTime startDate = Convert.ToDateTime(dt.Rows[0][17]);
int checkdays = (DateTime.Today - startDate).Days;
/* string imgspec = dt.Rows[0][1].ToString().Replace(" ", "_");
string sub = imgspec.Substring(0, 7);
string myspec = "
";
//string myspec = "";
// string myspec = "";
//