protected void btnActualizar_Click(object sender, EventArgs e) { TerminalNegocio negocio = new TerminalNegocio(); try { terminal = new Terminal(); terminal.IdTerminal = int.Parse(txtID.Text.Trim()); terminal.CodTerminal = txtCodTerminal.Text.Trim(); terminal.NombreTerminal = txtNomTerminal.Text.Trim(); terminal.Estado = "A"; //if (chofer.IdChofer == 0) negocio.modificarTerminal(terminal); Response.Redirect("Terminales.aspx"); //else // negocio.modificar(articulo); //Dispose(); } catch (Exception EX) { throw EX; } }
protected void Page_Load(object sender, EventArgs e) { try { TerminalNegocio negocio = new TerminalNegocio(); listaTerminales = negocio.listar2(); dgvTerminales.DataSource = listaTerminales; dgvTerminales.DataBind(); Session[Session.SessionID + "listaTerminales"] = listaTerminales; //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; } }
public void btnGuardar_Click(object sender, EventArgs e) { TerminalNegocio negocio = new TerminalNegocio(); try { if (terminal == null) { terminal = new Terminal(); } terminal.CodTerminal = txtCodTerminal.Text.Trim(); terminal.NombreTerminal = txtNomTermianl.Text.Trim(); //chofer.Estado = txtEstado.Text.Trim(); terminal.Estado = "A"; if (terminal.IdTerminal == 0) { negocio.agregar(terminal); } Response.Redirect("Terminales.aspx"); //else // negocio.modificar(articulo); //Dispose(); } catch (Exception EX) { throw EX; } }
protected void dgvTerminales_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Eliminar") { int index = Convert.ToInt32(e.CommandArgument); string idTerminal = dgvTerminales.Rows[index].Cells[1].Text; TerminalNegocio negocio = new TerminalNegocio(); negocio.bajaTerminal(idTerminal); Response.Redirect("Terminales.aspx"); } //if(e.CommandName == "Modificar") //{ // Response.Redirect("NuevoChofer.aspx"); // //int index = Convert.ToInt32(e.CommandArgument); // //Chofer chofer = new Chofer(); // //chofer = (Chofer)dgvChoferes.Rows.Cast; //} }