protected void Page_Load(object sender, EventArgs e)
    {
        this.UnobtrusiveValidationMode = System.Web.UI.UnobtrusiveValidationMode.None;
        if (!checkCookie())
            Response.Redirect("Login.aspx");
        String auctionId = Session["auctionId"].ToString();
        DatabaseHandler obj = new DatabaseHandler();
        DataSet ds = obj.GetAuctionCarInfo(auctionId);
        Label1.Text = ds.Tables[0].Rows[0]["CAR_BRAND"].ToString();
        Label2.Text = ds.Tables[0].Rows[0]["CAR_MODEL_NAME"].ToString();
        Label3.Text = ds.Tables[0].Rows[0]["CAR_MODEL_NUMBER"].ToString();
        Label4.Text = ds.Tables[0].Rows[0]["CAR_PRODUCTION_YEAR"].ToString();
        Label5.Text = ds.Tables[0].Rows[0]["CAR_BASE_PRICE"].ToString();
        Label7.Text = ds.Tables[0].Rows[0]["CAR_ENGINE"].ToString();
        Label8.Text = ds.Tables[0].Rows[0]["CAR_FUEL"].ToString();
        ImageButton1.ImageUrl = "~\\Car\\Front\\" + Path.GetFileName(ds.Tables[0].Rows[0]["CAR_FRONT_IMAGE"].ToString());
        ImageButton2.ImageUrl = "~\\Car\\Side\\" + Path.GetFileName(ds.Tables[0].Rows[0]["CAR_SIDE_IMAGE"].ToString());
        ImageButton3.ImageUrl = "~\\Car\\Rear\\" + Path.GetFileName(ds.Tables[0].Rows[0]["CAR_REAR_IMAGE"].ToString());

        DataSet ds1 = new DataSet();
        ds1 = obj.GetAuctionBids(auctionId);
        if (ds1 == null)
            Label9.Text = "No bids have been placed for this car yet";
        else
        {
            Label9.Text = ds1.Tables[0].Rows.Count + " bid(s) placed on this car";
            GridView1.DataSource = ds1;
            GridView1.DataBind();
        }
    }
 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 Button2_Click(object sender, EventArgs e)
 {
     String bidAmount = TextBox1.Text;
     DatabaseHandler obj = new DatabaseHandler();
     String auctionId = Session["auctionId"].ToString();
     DataSet ds = obj.GetAuctionCarInfo(auctionId);
     int basePrice = Convert.ToInt32(ds.Tables[0].Rows[0]["CAR_BASE_PRICE"].ToString());
     if (Convert.ToInt32(bidAmount) < basePrice)
     {
         Label9.Text = "Bid amount must be more than base price";
         Label9.ForeColor = System.Drawing.ColorTranslator.FromHtml("#FF0000");
     }
     else
     {
         obj.PlaceAuctionBid(Request.Cookies["Car-Trading"]["Username"].ToString(), bidAmount);
         DataSet ds1 = new DataSet();
         DatabaseHandler obj1 = new DatabaseHandler();
         ds1 = obj.GetAuctionBids(auctionId);
         GridView1.DataSource = ds1;
         GridView1.DataBind();
         Panel1.Visible = false;
         Label9.Text = "Bid placed !";
         Label9.ForeColor = System.Drawing.ColorTranslator.FromHtml("#00FF00");
     }
 }