protected void Page_Load(object sender, EventArgs e) { if (!checkCookie()) Response.Redirect("Login.aspx"); DatabaseHandler obj = new DatabaseHandler(); DataSet ds = obj.GetAuctions(); GridView1.DataSource = ds; GridView1.DataBind(); }
protected void GridView1_SelectedIndexChanging(object sender, GridViewSelectEventArgs e) { if (!checkCookie()) Response.Redirect("Login.aspx"); DateTime dt = Convert.ToDateTime(DateTime.Now.ToString("HH:mm")); DatabaseHandler obj = new DatabaseHandler(); DataSet ds = obj.GetAuctions(); String startTime = ds.Tables[0].Rows[0]["AUCTION_START_TIME"].ToString(); String endTime = ds.Tables[0].Rows[0]["AUCTION_END_TIME"].ToString(); String auctionId = ds.Tables[0].Rows[0]["AUCTION_ID"].ToString(); DateTime dt1 = Convert.ToDateTime(startTime); DateTime dt2 = Convert.ToDateTime(endTime); if (dt < dt1) Label1.Text = "Auction not started"; else { Session["auctionId"] = auctionId; Session["startTime"] = startTime; Session["endTime"] = endTime; Response.Redirect("CustomerPlaceBid.aspx"); } }