protected void ButtonS1_Click(object sender, EventArgs e) { iVeiculo = new Modelo.Veiculo(int.Parse(Session["id"].ToString()), TextBoxFAB.Text, TextBoxMOD.Text, Int32.Parse(TextBoxANO.Text), TextBoxPLACA.Text, TextBoxUF.Text); iVeiculoDAL = new DAL.VeiculoDAL(); iVeiculoDAL.Update(iVeiculo); Response.Redirect("~\\Veiculo.aspx"); }
protected void ButtonS1_Click(object sender, EventArgs e) { Modelo.Veiculo iVeiculo; DAL.VeiculoDAL iVeiculoDAL; iVeiculo = new Modelo.Veiculo(0, TextBoxFAB.Text, TextBoxMOD.Text, Int32.Parse(TextBoxANO.Text), TextBoxPLACA.Text, TextBoxUF.Text); iVeiculoDAL = new DAL.VeiculoDAL(); iVeiculoDAL.Insert(iVeiculo); Response.Redirect("~\\Veiculo.aspx"); }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { DAL.VeiculoDAL aVeiculoDal; Modelo.Veiculo aVeiculo; if (e.CommandName == "edit") { string sessao; int index = Convert.ToInt32(e.CommandArgument); sessao = GridView1.Rows[index].Cells[0].Text; Session["id"] = sessao; Response.Redirect("~\\VeiculoEdit.aspx"); } if (e.CommandName == "del") { aVeiculoDal = new DAL.VeiculoDAL(); int codigo; int index = Convert.ToInt32(e.CommandArgument); codigo = Convert.ToInt32(GridView1.Rows[index].Cells[0].Text); aVeiculoDal.Delete(codigo); Response.Redirect("~\\Veiculo.aspx"); } }