private void button1_Click(object sender, EventArgs e) { try { if (txtDescripcion.Text == "Descripcion del Estado") { MessageBox.Show("Campo estado del Activo vacío \n Intentelo nuevamente", "Aviso"); } else { try { Backend.Entities.EstadoActivos estadoActivos = new Backend.Entities.EstadoActivos(); estadoActivos.NombreEstado = txtDescripcion.Text; estadoActivosDAL.addEstadoActivos(estadoActivos); MessageBox.Show("Estado agregado con exito", "Aviso"); this.Close(); } catch (Exception) { MessageBox.Show("Hubo un error \n Intentelo nuevamente", "Error"); return; } } } catch (Exception) { MessageBox.Show("Hubo un error ", "Error"); } }
private void cmbIdEstadoActivo_SelectedIndexChanged(object sender, EventArgs e) { string id = cmbIdEstadoActivo.Text; int id2 = Convert.ToInt32(id); estadoActivos = EstadoActivosDAL.obtenerEstadoActivosPorID(id2); txtNombreEstado.Text = estadoActivos.NombreEstado; }