コード例 #1
0
        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;
            }

            int ver = Base_de_datos.validarNomMedidaMod(txtNombreRol.Text, txtCodigoRol.Text);

            if (ver != 1)
            {
                MessageBox.Show("Medida ya existente");
                return;
            }

            string estado;

            if (cmbestado.Text == "Activo")
            {
                estado = "ACT";
            }

            else
            {
                estado = "INC";
            }

            Base_de_datos.Actualizar_Medida(int.Parse(txtCodigoRol.Text), txtNombreRol.Text.ToUpper(), estado);

            MessageBox.Show("Medida modificada.");

            Base_de_datos busc = new Base_de_datos();

            busc.BuscarMedida();
            dataGridView1.DataSource = busc.Mostrar_Resultados();

            txtCodigoRol.Clear();
            txtNombreRol.Clear();

            btnModificar.Enabled = false;
            this.Hide();
        }