Example #1
0
 void ThucThi_DangNhap()
 {
     try
     {
         if (txtTenTaiKhoan.Text != string.Empty && txtMatKhau.Text != string.Empty)
         {
             string tendn   = txtTenTaiKhoan.Text;
             string matkhau = txtMatKhau.Text;
             if (nvBLL.KiemTraMaNVTonTai(tendn) != null)
             {
                 string matk = nvBLL.GetMkNV_BLL(tendn);
                 if (tendn == nvBLL.KiemTraMaNVTonTai(tendn) && matkhau == matk)
                 {
                     string luuTenDN = tendn;
                     MessageBox.Show("Đăng Nhập Thành Công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     frmMain main = new frmMain(luuTenDN);
                     main.Show();
                     this.Hide();
                     tendn_khidn = luuTenDN;
                     dn          = true;
                     //frm_PhieuNhap n = new frm_PhieuNhap(luuTenDN);
                     // n.Show();
                 }
                 else
                 {
                     dn = false;
                     MessageBox.Show("Sai tài khoản hoặc mật khẩu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
             else
             {
                 dn = false;
                 MessageBox.Show("Tên đăng nhập không tồn tại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         else
         {
             dn = false;
             MessageBox.Show("Có Thông Tin Còn Bỏ Trống", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     catch
     {
         dn = false;
         MessageBox.Show("Có Vấn Đề Trong Việc Đăng Nhập", "Thông Báo");
     }
 }