Example #1
0
 private void btnLogin_Click(object sender, EventArgs e)
 {
     if (inputIsCorrect() == true)
     {
         dangnhap.TenDangNhap = txtUserName.Text;
         dangnhap.PassWord    = txtPassWord.Text;
         if (dangnhapBUS.TestAccount(dangnhap) == true)
         {
             MessageBox.Show("Đăng nhập thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             frmMain frm = new frmMain();
             this.Visible = false;
             frm.ShowDialog();
             this.Close();
         }
         else
         {
             if (dangnhapBUS.Error == null)
             {
                 MessageBox.Show("Tên đăng nhập hoặc mật khẩu không đúng", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
             else
             {
                 MessageBox.Show("Xảy ra lỗi", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
 }