protected void Page_Load(object sender, EventArgs e)
 {
     if (!checkCookie())
         Response.Redirect("Login.aspx");
     this.UnobtrusiveValidationMode = System.Web.UI.UnobtrusiveValidationMode.None;
     if (!IsPostBack)
         Wizard1.ActiveStepIndex = 0;
     Panel2.Visible = false;
     Panel3.Visible = false;
     String customerUsername = Request.Cookies["Car-Trading"]["Username"].ToString();
     DatabaseHandler obj = new DatabaseHandler();
     DataSet ds = obj.GetCustomerAddressPhone(customerUsername);
     String customerAddress = ds.Tables[0].Rows[0]["CUSTOMER_ADDRESS"].ToString();
     Label1.Text = customerAddress;
     String carId = Request.QueryString["carId"].ToString();
     String sellerId = Request.QueryString["sellerId"].ToString();
     EncryptDecrypt obj1 = new EncryptDecrypt();
     carId = obj1.Decrypt(HttpUtility.UrlDecode(carId));
     sellerId = obj1.Decrypt(HttpUtility.UrlDecode(sellerId));
     ds = obj.GetSellerName(sellerId);
     Label2.Text = ds.Tables[0].Rows[0]["SELLER_NAME"].ToString();
     ds = obj.GetCarInfo(carId);
     Label3.Text = ds.Tables[0].Rows[0]["CAR_BRAND"].ToString();
     Label4.Text = ds.Tables[0].Rows[0]["CAR_MODEL_NAME"].ToString();
     Label5.Text = ds.Tables[0].Rows[0]["CAR_MODEL_NUMBER"].ToString();
     Label6.Text = ds.Tables[0].Rows[0]["CAR_POSSESSION_TYPE"].ToString();
     Label7.Text = ds.Tables[0].Rows[0]["CAR_PRICE"].ToString();
     Label13.Text = Label2.Text;
     Label14.Text = Label7.Text;
     ImageButton1.ImageUrl = "~\\Car\\Front\\" + Path.GetFileName(ds.Tables[0].Rows[0]["CAR_FRONT_IMAGE"].ToString());
     ImageButton1.Width = 150;
     ImageButton1.Height = 150;
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!checkCookie())
         Response.Redirect("Login.aspx");
     String auctionId=Request.QueryString["auctionId"].ToString();
     DatabaseHandler obj = new DatabaseHandler();
     DataSet ds = obj.GetAuctionWinnerUsername(auctionId);
     if (ds == null)
         Label1.Text = "Auction not found or currently in progress";
     else
     {
         Panel1.Visible = true;
         Label1.Text = "Auction No. " + auctionId;
         Label2.Text = ds.Tables[0].Rows[0]["WINNER_USERNAME"].ToString();
         ds = obj.GetAuctionWinnerBid(Label2.Text);
         Label4.Text = ds.Tables[0].Rows[0]["CUSTOMER_BID_AMOUNT"].ToString();
         ds = obj.GetAuctionCarInfo(auctionId);
         Label3.Text = ds.Tables[0].Rows[0]["CAR_BASE_PRICE"].ToString();
         Label6.Text = ds.Tables[0].Rows[0]["CAR_BRAND"].ToString();
         Label7.Text = ds.Tables[0].Rows[0]["CAR_MODEL_NAME"].ToString();
         Label8.Text = ds.Tables[0].Rows[0]["CAR_MODEL_NUMBER"].ToString();
         String sellerId=ds.Tables[0].Rows[0]["SELLER_ID"].ToString();
         ds=obj.GetSellerName(sellerId);
         Label9.Text = ds.Tables[0].Rows[0]["SELLER_NAME"].ToString();
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!checkCookie())
         Response.Redirect("Login.aspx");
     EncryptDecrypt obj1 = new EncryptDecrypt();
     String carId = obj1.Decrypt(HttpUtility.UrlDecode(Request.QueryString["carId"].ToString()));
     String sellerId = obj1.Decrypt(HttpUtility.UrlDecode(Request.QueryString["sellerId"].ToString()));
     if (carId == null || sellerId == null)
         Response.Redirect("Error.aspx");
     else
     {
         DatabaseHandler obj = new DatabaseHandler();
         DataSet ds = obj.GetCarInfo(carId);
         Label1.Text = ds.Tables[0].Rows[0]["CAR_BRAND"].ToString() + " " + ds.Tables[0].Rows[0]["CAR_MODEL_NAME"].ToString();
         Label2.Text = ds.Tables[0].Rows[0]["CAR_BRAND"].ToString();
         Label3.Text = ds.Tables[0].Rows[0]["CAR_MODEL_NAME"].ToString();
         Label4.Text = ds.Tables[0].Rows[0]["CAR_MODEL_NUMBER"].ToString();
         Label5.Text = ds.Tables[0].Rows[0]["CAR_POSSESSION_TYPE"].ToString();
         Label6.Text = ds.Tables[0].Rows[0]["CAR_YEAR_OF_PURCHASE"].ToString();
         Label7.Text = ds.Tables[0].Rows[0]["CAR_PRICE"].ToString();
         Label8.Text = ds.Tables[0].Rows[0]["CAR_ENGINE"].ToString();
         Label9.Text = ds.Tables[0].Rows[0]["CAR_FUEL"].ToString();
         ImageButton1.ImageUrl = "~\\Car\\Front\\" + Path.GetFileName(ds.Tables[0].Rows[0]["CAR_FRONT_IMAGE"].ToString());
         ImageButton1.Width = 100;
         ImageButton1.Height = 100;
         ImageButton2.ImageUrl = "~\\Car\\Side\\" + Path.GetFileName(ds.Tables[0].Rows[0]["CAR_SIDE_IMAGE"].ToString());
         ImageButton2.Width = 100;
         ImageButton2.Height = 100;
         ImageButton3.ImageUrl = "~\\Car\\Rear\\" + Path.GetFileName(ds.Tables[0].Rows[0]["CAR_REAR_IMAGE"].ToString());
         ImageButton3.Width = 100;
         ImageButton3.Height = 100;
         ds = obj.GetSellerName(sellerId);
         Label10.Text = ds.Tables[0].Rows[0]["SELLER_NAME"].ToString();
     }
 }
    protected void Button2_Click(object sender, EventArgs e)
    {
        String brand = TextBox1.Text;
        String modelName = TextBox2.Text;
        String modelNum = TextBox3.Text;
        String possessionType = RadioButtonList1.Text;
        String yearOfPurchase = DropDownList2.Text;
        String carPrice = TextBox4.Text;
        String carEngine = TextBox5.Text;
        String carStock = TextBox8.Text;
        String fuelType = DropDownList1.Text;
        String frontImg = FileUpload1.PostedFile.FileName;
        String sideImg = FileUpload2.PostedFile.FileName;
        String rearImg = FileUpload3.PostedFile.FileName;

        String frontImgFolder = HttpContext.Current.Server.MapPath("~\\Car\\Front");
        String frontImgTarget = Path.Combine(frontImgFolder, frontImg);
        FileUpload1.SaveAs(frontImgTarget);

        String sideImgFolder = HttpContext.Current.Server.MapPath("~\\Car\\Side");
        String sideImgTarget = Path.Combine(sideImgFolder, sideImg);
        FileUpload2.SaveAs(sideImgTarget);

        String rearImgFolder = HttpContext.Current.Server.MapPath("~\\Car\\Rear");
        String rearImgTarget = Path.Combine(rearImgFolder, rearImg);
        FileUpload3.SaveAs(rearImgTarget);

        DatabaseHandler obj = new DatabaseHandler();
        String carId = "CAR_" + DateTime.Now.Ticks.ToString();
        obj.InsertCar(carId, brand, modelName, modelNum, possessionType, yearOfPurchase, carPrice,
            carEngine, fuelType, frontImgTarget, sideImgTarget, rearImgTarget);
        String sellerUsername = Request.Cookies["Car-Trading"]["Username"];
        DataSet ds = obj.GetSellerId(sellerUsername);
        String sellerId = ds.Tables[0].Rows[0]["SELLER_ID"].ToString();
        ds = obj.GetSellerName(sellerId);
        String sellerName = ds.Tables[0].Rows[0]["SELLER_NAME"].ToString();
        obj.InsertSellerCar(sellerId, carId, carStock);

        Response.Write("Car Added");
        TextBox1.Text = "";
        TextBox2.Text = "";
        TextBox3.Text = "";
        TextBox4.Text = "";
        TextBox5.Text = "";
        TextBox8.Text = "";
        RadioButtonList1.ClearSelection();
    }