private void Modificar_Nivel_Load(object sender, EventArgs e) { Base_de_datos busc = new Base_de_datos(); busc.BuscarNivel(); dataGridView1.DataSource = busc.Mostrar_Resultados(); }
private void btnModificar_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(txtCodigoRol.Text) == false) { MessageBox.Show("Llene todos los campos obligatorios"); return; } if (!string.IsNullOrEmpty(txtNombreRol.Text) == false) { MessageBox.Show("Llene el nombre de medida"); return; } if (!string.IsNullOrEmpty(textBox1.Text) == false) { MessageBox.Show("Llene el porcentaje"); return; } int ver = Base_de_datos.validarNomNivelMod(txtNombreRol.Text, txtCodigoRol.Text); if (ver != 1) { MessageBox.Show("Nivel ya existente"); return; } String estado; if (cmbestado.Text == "Activo") { estado = "ACT"; } else { estado = "INC"; } Base_de_datos.Actualizar_Nivel(int.Parse(txtCodigoRol.Text), txtNombreRol.Text.ToUpper(), float.Parse(textBox1.Text), estado); MessageBox.Show("Nivel modificada."); Base_de_datos busc = new Base_de_datos(); busc.BuscarNivel(); dataGridView1.DataSource = busc.Mostrar_Resultados(); txtCodigoRol.Clear(); txtNombreRol.Clear(); textBox1.Clear(); btnModificar.Enabled = false; this.Hide(); }