Example #1
0
        private void LoginButton_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(UsernameTextbox.Text) ||
                string.IsNullOrEmpty(PasswordTextbox.Text))
            {
                MessageBox.Show("Tên đăng nhập hoặc mật khẩu bị để trống. Xin hãy kiểm tra lại.");
                return;
            }

            string username        = UsernameTextbox.Text,
                   hashed_password = StringUtilities.MD5Hash(PasswordTextbox.Text);

            Employee emp = LessLazyWorker.GetEmployee(username, hashed_password);

            if (emp != null && emp.Id > 0)
            {
                Hide();
                form.SetCurrentEmployee(emp);
                form.Show(this);
            }
            else
            {
                MessageBox.Show("Sai tên đăng nhập hoặc mật khẩu. Xin hãy kiểm tra lại.");
            }
        }