예제 #1
0
        private void Button1_Click(object sender, EventArgs e)
        {
            id       = txt_id.Text;
            nombre   = txt_nombre.Text;
            apellido = txt_apellido.Text;
            clave    = txt_clave.Text;

            int boton;

            if (boton_ingreso == true)
            {
                boton = 1;

                try
                {
                    DataTable dtusuario = logica1.usuarios(id, nombre, apellido, clave, boton);
                    MessageBox.Show("Usuario Creado");
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex);
                    return;
                }
            }

            else if (boton_modificar == true)
            {
                string estado = "";
                if (Rdb_activo.Checked)
                {
                    estado = "1";
                }

                if (Rdb_inactivo.Checked)
                {
                    estado = "0";
                }

                try
                {
                    DataTable dtUsuarioActualizar = logica1.ActualizarUsuario(id, nombre, apellido, clave, estado);
                    MessageBox.Show("Usuario Actualizado");
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex);
                    return;
                }
            }



            limpiar();
            txt_clave.Enabled    = true;
            txt_id.Enabled       = true;
            txt_apellido.Enabled = true;
            txt_nombre.Enabled   = true;
            Gpb_estado.Enabled   = true;
            txt_buscar.Enabled   = true;
            button1.Enabled      = true;
            button2.Enabled      = true;
            button3.Enabled      = true;
            button4.Enabled      = true;
        }
예제 #2
0
        private void Button1_Click(object sender, EventArgs e)
        {
            id       = txt_id.Text;
            nombre   = txt_nombre.Text;
            apellido = txt_apellido.Text;
            clave    = txt_clave.Text;

            int boton;

            if (txt_id.Text == " " || txt_nombre.Text == "" || txt_apellido.Text == "" || txt_clave.Text == "")
            {
                MessageBox.Show("Faltan Campos Por Llenar", "Verificación", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else if (clave.Length < 8)
            {
                MessageBox.Show("La contraseña debe de contener 8 caracteres como minimo", "Verificación", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                if (boton_ingreso == true)
                {
                    boton = 1;

                    try
                    {
                        DataTable dtusuario = logica1.usuarios(id, nombre, apellido, clave, boton);
                        MessageBox.Show("Usuario Creado");
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex);
                        return;
                    }
                }

                else if (boton_modificar == true)
                {
                    string estado = "";
                    if (Rdb_activo.Checked)
                    {
                        estado = "1";
                    }

                    if (Rdb_inactivo.Checked)
                    {
                        estado = "0";
                    }

                    try
                    {
                        DataTable dtUsuarioActualizar = logica1.ActualizarUsuario(id, nombre, apellido, clave, estado);
                        MessageBox.Show("Usuario Actualizado");
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex);
                        return;
                    }
                }



                limpiar();
                txt_clave.Enabled    = true;
                txt_id.Enabled       = true;
                txt_apellido.Enabled = true;
                txt_nombre.Enabled   = true;
                Gpb_estado.Enabled   = true;
                txt_buscar.Enabled   = true;
                button1.Enabled      = true;
                button2.Enabled      = true;
                button3.Enabled      = true;
                button4.Enabled      = true;
            }
        }