public void agregarNivel() { Database.constructor nivel = new Database.constructor(); nivel.nombreNivel = txtNombreNivel.Text; try { int retorno = Database.funcionesCRUD.agregarNivel(nivel); if (retorno < 1) { MessageBox.Show("El nivel no pudo ser agregado"); } } catch (Exception eAgregar) { MessageBox.Show("Error al ingresar nivel: " + eAgregar.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void actualizarNivel() { Database.constructor nivel = new Database.constructor(); nivel.nombreNivel = txtNombreNivel.Text; try { int retorno = Database.funcionesCRUD.actualizarNivel(nivel, id); if (retorno < 1) { MessageBox.Show("El nivel no pudo ser actualizado"); } } catch (Exception eActualizar) { if (MessageBox.Show("Error al actualizar nivel: " + eActualizar.Message, "Error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error) == DialogResult.Retry) { actualizarNivel(); } ; } }