示例#1
0
文件: LogIn.cs 项目: joeLloyd/OOP_v3
        private void LoginValidate()
        {
            // Local Variables //
            string pass;
            string user;
            string passHash;
            bool isValid;

            pass = txtPassword.Text;
            user = txtUser.Text;

            // Calling Encryption method from the BLL, this takes a password and returns the encrypted string
            BLLMngr bllMngr = new BLLMngr();
            passHash = bllMngr.PassEncrypt(pass);

            //Instanciating a user
            UserModel userDetails = new UserModel(user, passHash);

            //Sending details (UserName and password) through BLL and DAL for validation at the database
            isValid = bllMngr.IsValidLogin(userDetails);

            //If it comes back as a valid user allow access and go to main DataGrid
            if (isValid)
            {
                MessageBox.Show("Welcome To DBS Credit Union");
                using (DGMain dgm = new DGMain())
                {
                    this.Hide();
                    dgm.ShowDialog();
                }
                this.Show();
                txtPassword.Clear();
                txtUser.Clear();
            }
            else
            {
                MessageBox.Show("Invalid Login");
            }
        }