private void tBNombre_KeyPress(object sender, KeyPressEventArgs e) { if ((int)e.KeyChar == (int)Keys.Enter) { String nombre = tBNombre.Text; if (nombre.Length != 0) { TipoCuenta tipo = tipoCtaControlador.solicitudBuscar(nombre); if (tipo != null) { tBDescripcion.Text = tipo.getDescripcion(); aux = tipo.getId(); habilitarCampos(); btnGuardar.Enabled = false; btnEditar.Enabled = true; btnEliminar.Enabled = true; } else { MessageBox.Show("El tipo cuenta no existe, por favor adicionalo"); habilitarCampos(); btnGuardar.Enabled = true; btnEditar.Enabled = false; btnEliminar.Enabled = false; } } } }
public String guardarTipoCuenta(TipoCuenta entity) { String consulta = "exec guardarTipoCuenta " + entity.getId() + ",'" + entity.getNombre() + "','" + entity.getDescripcion() + "';"; ejecutarRetorno(consulta); String info = dataset.Tables[0].Rows[0]["respuesta"].ToString(); return(info); }