protected void Page_Load(object sender, EventArgs e) { try { ChoferNegocio negocio = new ChoferNegocio(); listaChoferes = negocio.listar2(); dgvChoferes.DataSource = listaChoferes; dgvChoferes.DataBind(); Session[Session.SessionID + "listaChoferes"] = listaChoferes; //cboti.DataSource = listaPokemons; //cboPokemons.DataBind(); //cboPokemons.Items.Add("Rojo"); //cboPokemons.Items.Add("Azul"); //cboPokemons.Items.Add("Verde"); if (!IsPostBack) { //pregunto si es la primera carga de la page //txtNumeroPokemon.Text = "150"; //cbotipoArt.DataSource = listaArticulos; //cbotipoArt.DataBind(); //esto es lo que necesitamos para el repeater. //repetidor.DataSource = listaPokemons; //repetidor.DataBind(); } } catch (Exception ex) { throw ex; } }
protected void btnActualizar_Click(object sender, EventArgs e) { ChoferNegocio negocio = new ChoferNegocio(); try { chofer = new Chofer(); chofer.IdChofer = int.Parse(txtID.Text.Trim()); chofer.Legajo = int.Parse(txtLegajo.Text.Trim()); chofer.Apellido = txtApellido.Text.Trim(); chofer.Nombre = txtNombre.Text.Trim(); chofer.Sexo = txtSexo.Text.Trim(); chofer.FechaNacimiento = DateTime.Parse(txtFechaNac.Text.ToString()); chofer.Estado = "A"; //if (chofer.IdChofer == 0) negocio.modificarChofer(chofer); Response.Redirect("Choferes.aspx"); //else // negocio.modificar(articulo); //Dispose(); } catch (Exception EX) { throw EX; } }
protected void dgvChoferes_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Eliminar") { int index = Convert.ToInt32(e.CommandArgument); string idChofer = dgvChoferes.Rows[index].Cells[1].Text; ChoferNegocio negocio = new ChoferNegocio(); negocio.bajaChofer(idChofer); Response.Redirect("Choferes.aspx"); } //if(e.CommandName == "Modificar") //{ // Response.Redirect("NuevoChofer.aspx"); // //int index = Convert.ToInt32(e.CommandArgument); // //Chofer chofer = new Chofer(); // //chofer = (Chofer)dgvChoferes.Rows.Cast; //} }