public void binddetails() { TrainBLL tbll = new TrainBLL(); DataSet ds = new DataSet(); ds = tbll.display(); GridView1.DataSource = ds; GridView1.DataBind(); }
protected void GridView2_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandArgument != null) { if (e.CommandName.ToLower() == "cmddelete") { int p = Convert.ToInt32(e.CommandArgument); TrainBLL tbll = new TrainBLL(); tbll.deletebook(p); Label4.Text = "Deleted successfully of id " + p; } } }
public void binddetailsbyid() { tbo.TrainId = Convert.ToInt32(Request.QueryString["id"].ToString()); DataSet ds = new DataSet(); TrainBLL tbll = new TrainBLL(); ds = tbll.viewbyid(tbo); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { TextBox1.Text = ds.Tables[0].Rows[0]["TrainName"].ToString(); TextBox2.Text = ds.Tables[0].Rows[0]["Source"].ToString(); TextBox3.Text = ds.Tables[0].Rows[0]["Destination"].ToString(); TextBox4.Text = ds.Tables[0].Rows[0]["TicketFare"].ToString(); } }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandArgument != null) { if (e.CommandName.ToLower() == "cmdedit") { Response.Redirect("addtraindetails.aspx?id=" + e.CommandArgument); } else { TrainBO tbo = new TrainBO(); int d = Convert.ToInt32(e.CommandArgument); TrainBLL tbll = new TrainBLL(); tbll.delete(d); } } }
protected void Button1_Click(object sender, EventArgs e) { if (Request.QueryString["id"] != null) { tbo.TrainId = Convert.ToInt32(Request.QueryString["id"].ToString()); } else { tbo.TrainId = 0; } tbo.TrainName = TextBox1.Text; tbo.Source = TextBox2.Text; tbo.Destination = TextBox3.Text; tbo.TicketFare = Convert.ToDouble(TextBox4.Text); TrainBLL tbll = new TrainBLL(); int res = tbll.addTraindetails(tbo); if (res < 0) { label.Text = "your booking ID is " + res; } }