private bool ValidarSesion()
        {
            if (UsuariotextBox.Text == "Admin" && Usuario == null)
            {
                Usuario = new Entidades.Usuarios(1, "Raidy Duran Garcia", "Admin", "1234", "1234", "Administrador");
                UsuariosBLL.Guardar(Usuario);
            }
            else
            {
                Usuario = BLL.UsuariosBLL.Buscar(p => p.NombreUsuario == UsuariotextBox.Text);
            }

            if (Usuario != null)
            {
                if (ClavetextBox.Text == Usuario.Clave)
                {
                    return(true);
                }
                else
                {
                    MessageBox.Show("La clave no coinside con el usuario.");
                    ClavetextBox.Clear();
                    ClavetextBox.Focus();
                }
            }
            else
            {
                MessageBox.Show("El usuario digitado no existe.");
                UsuariotextBox.Clear();
                UsuariotextBox.Focus();
            }

            return(false);
        }
 private void UsuariotextBox_KeyPress(object sender, KeyPressEventArgs e)
 {
     if ((Keys)e.KeyChar == Keys.Enter)
     {
         ClavetextBox.Focus();
     }
 }
Esempio n. 3
0
        private bool Validar()
        {
            bool paso = true;

            if (AliastextBox.Text == string.Empty)
            {
                ErrorProvider.SetError(AliastextBox, "Este Campo no puede estar vacio");
                AliastextBox.Focus();
                paso = false;
            }
            if (NombretextBox.Text == string.Empty)
            {
                ErrorProvider.SetError(NombretextBox, "Este Campo no puede estar vacio");
                NombretextBox.Focus();
                paso = false;
            }
            if (ClavetextBox.Text == string.Empty)
            {
                ErrorProvider.SetError(ClavetextBox, "Este Campo no puede estar vacio");
                ClavetextBox.Focus();
                paso = false;
            }
            if (ConfirmartextBox.Text == string.Empty)
            {
                ErrorProvider.SetError(ConfirmartextBox, "Este Campo no puede estar vacio");
                ConfirmartextBox.Focus();
                paso = false;
            }
            if (EmailtextBox.Text == string.Empty)
            {
                ErrorProvider.SetError(EmailtextBox, "Este Campo no puede estar vacio");
                EmailtextBox.Focus();
                paso = false;
            }
            if (UsuariosBLL.ExisteAlias(AliastextBox.Text, (int)IdnumericUpDown.Value))
            {
                ErrorProvider.SetError(AliastextBox, "Este Alias ya existe");
                AliastextBox.Focus();
                paso = false;
            }
            if (UsuariosBLL.ExisteRol(RolcomboBox.Text, (int)IdnumericUpDown.Value))
            {
                ErrorProvider.SetError(RolcomboBox, "Este Rol ya existe");
                RolcomboBox.Focus();
                paso = false;
            }
            if (string.Equals(ClavetextBox.Text, ConfirmartextBox.Text) != true)
            {
                ErrorProvider.SetError(ConfirmartextBox, "La clave es distinta");
                ConfirmartextBox.Focus();
                paso = false;
            }

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

            if (NombrestextBox.Text == string.Empty)
            {
                errorProvider1.SetError(NombrestextBox, "El campo nombre no puede estar vacio");
                NombrestextBox.Focus();
                paso = false;
            }

            if (string.IsNullOrWhiteSpace(EmailtextBox.Text))
            {
                errorProvider1.SetError(EmailtextBox, "El Email no puede estar vacio");
                EmailtextBox.Focus();
                paso = false;
            }
            if (string.IsNullOrWhiteSpace(AliastextBox.Text))
            {
                errorProvider1.SetError(AliastextBox, "El campo Alias no puede estar vacio");
                AliastextBox.Focus();
                paso = false;
            }
            if (string.IsNullOrWhiteSpace(RolcomboBox.Text))
            {
                errorProvider1.SetError(RolcomboBox, "Debe agregar un rol especifico");
                RolcomboBox.Focus();
                paso = false;
            }
            if (string.IsNullOrWhiteSpace(ClavetextBox.Text))
            {
                errorProvider1.SetError(ClavetextBox, "Debe asignar una clave a su usuario");
                ClavetextBox.Focus();
                paso = false;
            }
            if (string.IsNullOrWhiteSpace(ClaveConfirmtextBox.Text))
            {
                errorProvider1.SetError(ClaveConfirmtextBox, "Debe confirmar la clave");
                ClaveConfirmtextBox.Focus();
                paso = false;
            }
            if (string.IsNullOrWhiteSpace(FechadateTimePicker1.Text))
            {
                errorProvider1.SetError(FechadateTimePicker1, "Debe agregar una fecha de registro");
                FechadateTimePicker1.Focus();
                paso = false;
            }
            if (ClavetextBox.Text != ClaveConfirmtextBox.Text)
            {
                errorProvider1.SetError(ClaveConfirmtextBox, "La contraseña debe ser igual para ambos casos!");
                paso = false;
            }
            return(paso);
        }
Esempio n. 5
0
        private void Guardarbutton_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrWhiteSpace(ClavetextBox.Text) || String.IsNullOrWhiteSpace(ConfirmarClavetextBox.Text))
            {
                MessageBox.Show("No puede dejar las clave vacias", "Error de validación");
                errorProvider1.SetError(ClavetextBox, "No puede estar vacio");
                ClavetextBox.Focus();
            }

            else if (!ClavetextBox.Text.Equals(ConfirmarClavetextBox.Text))
            {
                MessageBox.Show("las claves no son iguales.", "Error de validación");
            }
        }
        private bool Validar()
        {
            bool interruptor = true;

            if (string.IsNullOrEmpty(UsuariotextBox.Text))
            {
                UsuarioerrorProvider.SetError(UsuariotextBox, "Por favor llenar el campo vacios.");
                UsuariotextBox.Focus();
                interruptor = false;
            }
            if (string.IsNullOrEmpty(ClavetextBox.Text))
            {
                ClaveerrorProvider.SetError(ClavetextBox, "Por favor llenar el campo vacios.");
                ClavetextBox.Focus();
                interruptor = false;
            }

            return(interruptor);
        }
Esempio n. 7
0
        private bool ValidarCampos()
        {
            bool paso = true;

            errorProvider.Clear();;


            if (string.IsNullOrWhiteSpace(UsuariotextBox.Text))
            {
                errorProvider.SetError(UsuariotextBox, "Este campo es obligatorio");
                UsuariotextBox.Focus();
                paso = false;
            }


            if (string.IsNullOrWhiteSpace(ClavetextBox.Text))
            {
                errorProvider.SetError(ClavetextBox, " Este campo es obligtorio!! ");
                ClavetextBox.Focus();
                paso = false;
            }

            return(paso);
        }
        private bool Validar()
        {
            RepositorioBase <Usuarios> db = new RepositorioBase <Usuarios>();

            bool paso = true;

            errorProvider.Clear();

            string Clave     = ClavetextBox.Text;
            string Confirmar = ConfirmarClavetextBox.Text;

            int Resultado = 0;

            Resultado = string.Compare(Clave, Confirmar);

            if (string.IsNullOrWhiteSpace(NombretextBox.Text))
            {
                errorProvider.SetError(NombretextBox, "La direccion no puede esta vacia");
                NombretextBox.Focus();
                paso = false;
            }

            if (Resultado != 0)
            {
                errorProvider.SetError(ConfirmarClavetextBox, "Clave no coincide!");
                ConfirmarClavetextBox.Focus();
                paso = false;
            }


            if (FechaIngresodateTimePicker.Value > DateTime.Now)
            {
                errorProvider.SetError(FechaIngresodateTimePicker, "La fecha Debe ser igual a hoy");
                EmailtextBox.Focus();
                paso = false;
            }

            if (NivelUsuariocomboBox.Text == string.Empty)
            {
                errorProvider.SetError(NivelUsuariocomboBox, "El campo Nivel de Usuario no puede estar vacio");
                NivelUsuariocomboBox.Focus();
                paso = false;
            }
            if (string.IsNullOrWhiteSpace(UsuariotextBox.Text))
            {
                errorProvider.SetError(UsuariotextBox, "La direccion no puede esta vacia");
                UsuariotextBox.Focus();
                paso = false;
            }



            if (ClavetextBox.Text == string.Empty)
            {
                errorProvider.SetError(ClavetextBox, "El campo Clave no puede estar vacio");
                ClavetextBox.Focus();
                paso = false;
            }

            if (ConfirmarClavetextBox.Text == string.Empty)
            {
                errorProvider.SetError(ConfirmarClavetextBox, "El campo Confirmar no puede estar vacio");
                ConfirmarClavetextBox.Focus();
                paso = false;
            }
            if (ValidarEmail(EmailtextBox.Text) == false)
            {
                errorProvider.SetError(EmailtextBox, "Correo invalido");
                EmailtextBox.Focus();
                paso = false;
            }
            if (NoDuplicadoCorreo(EmailtextBox.Text, (int)UsuarioIdnumericUpDown.Value) == true)
            {
                errorProvider.SetError(EmailtextBox, "Usuario Ya existe");
                EmailtextBox.Focus();
                paso = false;
            }

            if (NoDuplicadoUsuario(UsuariotextBox.Text, (int)UsuarioIdnumericUpDown.Value) == true)
            {
                errorProvider.SetError(UsuariotextBox, "Usuario Ya existe");
                UsuariotextBox.Focus();
                paso = false;
            }



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

            errorProvider.Clear();

            string Clave     = ClavetextBox.Text;
            string Confirmar = ConfirmarClavetextBox.Text;

            int Resultado = 0;

            Resultado = string.Compare(Clave, Confirmar);

            if (Resultado != 0)
            {
                errorProvider.SetError(ConfirmarClavetextBox, "Clave no coincide!");
                ConfirmarClavetextBox.Focus();
                paso = false;
            }


            if (NombretextBox.Text == string.Empty)
            {
                errorProvider.SetError(NombretextBox, "El campo Nombre no puede estar vacio");
                NombretextBox.Focus();
                paso = false;
            }

            if (EmailtextBox.Text == string.Empty)
            {
                errorProvider.SetError(EmailtextBox, "El campo Email no puede estar vacio");
                EmailtextBox.Focus();
                paso = false;
            }

            if (NivelUsuariocomboBox.Text == string.Empty)
            {
                errorProvider.SetError(NivelUsuariocomboBox, "El campo Nivel de Usuario no puede estar vacio");
                NivelUsuariocomboBox.Focus();
                paso = false;
            }

            if (UsuariotextBox.Text == string.Empty)
            {
                errorProvider.SetError(UsuariotextBox, "El campo Usuario no puede estar vacio");
                UsuariotextBox.Focus();
                paso = false;
            }

            if (ClavetextBox.Text == string.Empty)
            {
                errorProvider.SetError(ClavetextBox, "El campo Clave no puede estar vacio");
                ClavetextBox.Focus();
                paso = false;
            }

            if (ConfirmarClavetextBox.Text == string.Empty)
            {
                errorProvider.SetError(ConfirmarClavetextBox, "El campo Confirmar no puede estar vacio");
                ConfirmarClavetextBox.Focus();
                paso = false;
            }


            return(paso);
        }
Esempio n. 10
0
        private bool Validar()
        {
            bool paso = true;

            MyErrorProvider.Clear();

            string Clave     = ClavetextBox.Text;
            string Confirmar = ConfirmarClavetextBox.Text;

            int Resultado = 0;

            Resultado = string.Compare(Clave, Confirmar);

            if (Resultado != 0)
            {
                MyErrorProvider.SetError(ConfirmarClavetextBox, "Clave no coincide!");
                ConfirmarClavetextBox.Focus();
                paso = false;
            }
            if (NombretextBox.Text == string.Empty)
            {
                MyErrorProvider.SetError(NombretextBox, "Este campo no puede estar vacio");
                NombretextBox.Focus();
                paso = false;
            }
            if (EmailtextBox.Text == string.Empty)
            {
                MyErrorProvider.SetError(EmailtextBox, "Este campo no puede estar vacio");
                EmailtextBox.Focus();
                paso = false;
            }
            if (NivelUsuariocomboBox.Text == string.Empty)
            {
                MyErrorProvider.SetError(NivelUsuariocomboBox, "Este campo no puede estar vacio");
                NivelUsuariocomboBox.Focus();
                paso = false;
            }
            if (UsuariotextBox.Text == string.Empty)
            {
                MyErrorProvider.SetError(UsuariotextBox, "Este campo no puede estar vacio");
                UsuariotextBox.Focus();
                paso = false;
            }
            if (ClavetextBox.Text == string.Empty)
            {
                MyErrorProvider.SetError(ClavetextBox, "Este campo no puede estar vacio");
                ClavetextBox.Focus();
                paso = false;
            }
            if (ConfirmarClavetextBox.Text == string.Empty)
            {
                MyErrorProvider.SetError(ConfirmarClavetextBox, "Este campo no puede estar vacio");
                ConfirmarClavetextBox.Focus();
                paso = false;
            }
            if (NoRepetido(UsuariotextBox.Text))
            {
                MessageBox.Show("Los Usuarios no pueden ser iguales");
                UsuariotextBox.Focus();
                paso = false;
            }
            return(paso);
        }