public bool CheckLogin(string TenDangNhap, string MatKhau, ref string userData, ref string MessageError) { bool isOk = false; try { NguoiDung nguoidung = new NguoiDung().LayThongTinNguoiDung(TenDangNhap); if (!string.IsNullOrEmpty(TenDangNhap) && !string.IsNullOrEmpty(MatKhau)) { if (nguoidung.Dang_Su_Dung == true) { if (nguoidung.Dang_Nhap_Domain == false) { string mk = LibEncrypt.Encrypt(MatKhau, true); //code xem ma hoa mat khau //string mk2 = LibEncrypt.Decrypt(nguoidung.Mat_Khau, true); //Response.Write("Mat khau da ma hoa : " + mk2); if (mk == nguoidung.Mat_Khau) { userData = LibEncrypt.Encrypt(nguoidung.ID_NguoiDung + "," + nguoidung.Ten_Dang_Nhap + "," + nguoidung.Email + "," + nguoidung.Ten_Hien_Thi, true); isOk = true; } } else { isOk = LDAP.AuthenticateUser("", TenDangNhap, MatKhau); if (isOk) { userData = LibEncrypt.Encrypt(nguoidung.ID_NguoiDung + "," + nguoidung.Ten_Dang_Nhap + "," + nguoidung.Email + "," + nguoidung.Ten_Hien_Thi, true); } } } } } catch (Exception ex) { lbError.Text = "<span class=\"error\">Hệ thống đang bảo trì</span>"; } return(isOk); }