protected void btnBuscar_Click(object sender, EventArgs e) { combustible = new Combustible(); btnModificar.Enabled = true; int id = 0; int.TryParse(tbId.Text, out id); if (tbId.Text == string.Empty) { Msg.Text = "Error, debe digitar un id"; } else { if (combustible.Buscar(id)) { id = combustible.IdCombustible; tbDescripcion.Text = combustible.Descripcion; } else if(!combustible.Buscar(id)) { Msg.Text = "El id no existe..."; limpiar(); } } btnEliminar.Enabled = true; }
protected void btnEliminar_Click(object sender, EventArgs e) { combustible = new Combustible(); int id = 0; int.TryParse(tbId.Text, out id); if (tbId.Text == string.Empty) { Msg.Text = "Error, debe digitar un id para eliminar el campo..."; } else { if (combustible.eliminar(id)) { Msg.Text = "El registro se ha eliminado exitosamente!"; } } limpiar(); }
protected void btnRegistrar_Click(object sender, EventArgs e) { combustible = new Combustible(); combustible.Descripcion = tbDescripcion.Text; if (tbId.Text != string.Empty) { Msg.Text = "El campo de id debe estar vacio para realizar esta accion..."; } else if (tbDescripcion.Text == string.Empty) { Msg.Text = "El campo de descripcion no puede estar vacio..."; } else { if (combustible.insertar()) { Msg.Text = "El registro se ha guardado exitosamente!"; } } }
protected void btnModificar_Click(object sender, EventArgs e) { combustible = new Combustible(); combustible.Descripcion = tbDescripcion.Text; int id = 0; int.TryParse(tbId.Text, out id); if (tbDescripcion.Text == string.Empty) { Msg.Text = "Error, el campo de descripcion no puede estar vacio!"; } else { if (combustible.modificar(id)) { Msg.Text = "El registro se ha modificado exitosamente!"; } } deshabilitar(); limpiar(); }