Пример #1
0
 private void limpiarErrores()
 {
     NombreUsuarioerrorProvider.Clear();
     PasserrorProvider.Clear();
     ConfPassTextBox.Clear();
     BuscarerrorProvider.Clear();
 }
Пример #2
0
        private bool Validar()
        {
            bool interruptor = true;

            if (string.IsNullOrEmpty(nombresTextBox.Text))
            {
                NombreserrorProvider.SetError(nombresTextBox, "Por favor llenar el campo vacio.");
                interruptor = false;
            }
            if (string.IsNullOrEmpty(nombreUsuarioTextBox.Text))
            {
                NombreUsuarioerrorProvider.SetError(nombreUsuarioTextBox, "Por favor llenar el campo vacio.");
                interruptor = false;
            }
            if (string.IsNullOrEmpty(claveTextBox.Text))
            {
                ClaveerrorProvider.SetError(claveTextBox, "Por favor llenar el campo vacio.");
                interruptor = false;
            }
            if (string.IsNullOrEmpty(confirmarClaveTextBox.Text))
            {
                ConfirmarClaveerrorProvider.SetError(confirmarClaveTextBox, "Por favor llenar el campo vacio.");
                interruptor = false;
            }
            if (string.IsNullOrEmpty(CargoscomboBox.Text))
            {
                CargoerrorProvider.SetError(CargoscomboBox, "Por favor llenar el campo vacio.");
                interruptor = false;
            }

            return(interruptor);
        }
Пример #3
0
        private void Limpiar()
        {
            usuarioIdMaskedTextBox.Clear();
            nombresTextBox.Clear();
            nombreUsuarioTextBox.Clear();
            claveTextBox.Clear();
            confirmarClaveTextBox.Clear();
            CargoscomboBox.Text = null;

            NombreserrorProvider.Clear();
            NombreUsuarioerrorProvider.Clear();
            ClaveerrorProvider.Clear();
            confirmarClaveTextBox.Clear();
            CargoerrorProvider.Clear();
        }
Пример #4
0
        private bool ValidarTextbox()
        {
            if (string.IsNullOrEmpty(UserNameTextBox.Text) && string.IsNullOrEmpty(PassTextBox.Text) && string.IsNullOrEmpty(ConfPassTextBox.Text))
            {
                NombreUsuarioerrorProvider.SetError(UserNameTextBox, "Favor ingresar el nombre de Usuario");
                PasserrorProvider.SetError(PassTextBox, "Favor ingresar la contraseña del usuario");
                ConfPasserrorProvider.SetError(ConfPassTextBox, "Favor confirmar comtraseña");
                MessageBox.Show("Favor llenar todos los campos obligatorios");
            }
            if (string.IsNullOrEmpty(UserNameTextBox.Text))
            {
                NombreUsuarioerrorProvider.SetError(UserNameTextBox, "Favor ingresar el nombre de Usuario");
                return(false);
            }

            if (string.IsNullOrEmpty(PassTextBox.Text))
            {
                NombreUsuarioerrorProvider.Clear();
                PasserrorProvider.SetError(PassTextBox, "Favor ingresar la contraseña del usuario");
                return(false);
            }

            if (string.IsNullOrEmpty(ConfPassTextBox.Text))
            {
                NombreUsuarioerrorProvider.Clear();
                PasserrorProvider.Clear();
                ConfPasserrorProvider.SetError(ConfPassTextBox, "Favor confirmar comtraseña");
                return(false);
            }

            if (ConfPassTextBox.Text != PassTextBox.Text)
            {
                NombreUsuarioerrorProvider.Clear();
                PasserrorProvider.Clear();
                ConfPassTextBox.Clear();
                ConfPasserrorProvider.SetError(ConfPassTextBox, "La contraseña no coincide");
                return(false);
            }



            return(true);
        }
        private bool Validar()
        {
            bool retorno = true;

            if (string.IsNullOrEmpty(NombreUsuariotextBox.Text))
            {
                NombreUsuarioerrorProvider.SetError(NombreUsuariotextBox, "Debe introducir el Nombre del usuario");
                if (string.IsNullOrEmpty(NombretextBox.Text))
                {
                    NombreerrorProvider.SetError(NombretextBox, "Debe introducir el nombre del Empleado");
                    if (string.IsNullOrEmpty(ClavetextBox.Text))
                    {
                        ClaveerrorProvider.SetError(ClavetextBox, "Debe introducir la Contraseña");
                        if (string.IsNullOrEmpty(ConfirmarClavetextBox.Text))
                        {
                            ConfirmarClaveerrorProvider.SetError(ConfirmarClavetextBox, "Debe introducir la Contraseña de confirmacion");
                        }
                    }
                }
                retorno = false;
            }
            return(retorno);
        }
Пример #6
0
        private void Guardarbutton_Click(object sender, EventArgs e)
        {
            Usuarios usuario = new Usuarios();

            if (Validar())
            {
                usuario = LlenarCampos();

                if (usuario.UsuarioId != 0 || UsuariosBLL.Buscar(p => p.NombreUsuario == nombreUsuarioTextBox.Text) == null)
                {
                    if (claveTextBox.Text == confirmarClaveTextBox.Text)
                    {
                        if (UsuariosBLL.Guardar(usuario))
                        {
                            usuarioIdMaskedTextBox.Text = usuario.UsuarioId.ToString();
                            MessageBox.Show("Guardado con exito.");
                        }
                        else
                        {
                            MessageBox.Show("Error! no se pudo guardar.");
                        }
                    }
                    else
                    {
                        MessageBox.Show("La clave de confirmacion es incorrecta.");
                        confirmarClaveTextBox.Clear();
                        confirmarClaveTextBox.Focus();
                    }
                }
                else
                {
                    NombreUsuarioerrorProvider.SetError(nombreUsuarioTextBox, "Ya existe un usuario con ese nombre.");
                    nombreUsuarioTextBox.Focus();
                }
            }
        }
Пример #7
0
 private void nombreUsuarioTextBox_TextChanged(object sender, EventArgs e)
 {
     NombreUsuarioerrorProvider.Clear();
 }