예제 #1
0
        private void Navigate(object sender, RoutedEventArgs e)
        {
            //Frame.Navigate(typeof(TasksView));
            User userInput = new User();

            userInput.UserId   = Convert.ToInt16(userIdBox.Text);
            userInput.HashPass = userPasswordBox.Password;
            LoginTool.LoginUser(userInput);
        }
예제 #2
0
        private void btbAceptarAgregarUsuario_Click(object sender, EventArgs e)
        {
            if (comboBox1.SelectedIndex > 0)
            {
                Usuario nu = new Usuario();

                int iEmpleadoUsuario = Convert.ToInt32(txtEmailAgregarUsuario.Text);
                nu.sPassword = LoginTool.GetMD5(txtContrasenaAgregarUsuario.Text);
                int fkRoles = Convert.ToInt32(comboBox1.SelectedIndex.ToString());


                MessageBox.Show("Exito al registrar");
                txtEmailAgregarUsuario.Clear();
                txtContrasenaAgregarUsuario.Clear();
                UsuarioManager.guardar(nu, fkRoles, iEmpleadoUsuario);
            }
            this.Close();
        }
예제 #3
0
        /// <summary>
        /// Funcion encargada de obtener autentificar un usuario segun su PIN
        /// </summary>
        /// <param name="sPin">variable de tipo string</param>
        /// <returns>retorna un registro segun su pin</returns>
        public static UsuarioHelper Autentificar(String sPin)
        {
            UsuarioHelper uHelper = new UsuarioHelper();
            Usuario       user    = BuscarPorPIN(LoginTool.GetMD5(sPin));

            if (user != null)
            {
                if (user.sPin == LoginTool.GetMD5(sPin))
                {
                    uHelper.usuario  = user;
                    uHelper.esValido = true;
                }
                else
                {
                    uHelper.sMensaje = "Datos Incorrectos";
                }
            }
            return(uHelper);
        }
예제 #4
0
        public static UsuarioHelper Autentificar(int empleado, String sPassword)
        {
            UsuarioHelper uHelper = new UsuarioHelper();
            Usuario       user    = BuscarPorEmail(empleado);

            if (user != null)
            {
                if (user.sPassword == LoginTool.GetMD5(sPassword))
                {
                    uHelper.usuario  = user;
                    uHelper.esValido = true;
                }
                else
                {
                    uHelper.sMensaje = "Datos Incorrectos";
                }
            }
            return(uHelper);
        }
예제 #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            usuario nUsuario = new usuario();

            if (txtContra.Text == "" || txtCuenta.Text == "" || txtContra2.Text == "" || textBox2.Text == "")
            {
                MessageBox.Show("Llene todo los Campos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtContra.Focus();
            }
            else
            {
                if (txtContra.Text == txtContra2.Text)
                {
                    if (pk > 0)
                    {
                        nUsuario.pkUsuario  = pk;
                        nUsuario.cNombreCom = textBox2.Text;
                        nUsuario.sEmail     = txtCuenta.Text;
                        nUsuario.sPassword  = LoginTool.GetMD5(txtContra.Text);
                        nUsuario.fkRol      = 1;
                        UsuarioManeger.GuardaUsuario(nUsuario);
                        mUsuario.CargarUsuarios();
                    }
                    else
                    {
                        nUsuario.cNombreCom = textBox2.Text;
                        nUsuario.sEmail     = txtCuenta.Text;
                        nUsuario.sPassword  = LoginTool.GetMD5(txtContra.Text);
                        nUsuario.fkRol      = 1;
                        UsuarioManeger.GuardaUsuario(nUsuario);
                    }
                    this.Close();
                }
                else
                {
                    label5.Text = "Contrasena no coinciden";
                    txtContra.Focus();
                }
            }
        }
예제 #6
0
        public static UsuarioHelper Autentificar(String sUsuario, String sPassword)
        {
            UsuarioHelper uHelper = new UsuarioHelper();
            Usuario       user    = BuscarPorEmail(sUsuario);

            if (user != null)
            {
                if (user.sPassword == LoginTool.GetMD5(sPassword))
                {
                    uHelper.usuario  = user;
                    uHelper.esValido = true;
                    Acceso nAcceso = new Acceso();
                    nAcceso.usuario = user;
                    AccesoManager.RegistrarAcceso(nAcceso);
                }
                else
                {
                    uHelper.sMensaje = "Datos Incorrectos";
                }
            }
            return(uHelper);
        }