private void btnDangNhap_Click(object sender, EventArgs e) { string sql = string.Format("select TaiKhoan from Account where TaiKhoan='{0}' and MatKhau='{1}'", txtUseName.Text, txtPassWord.Text); DataTable dt = sqlHelper.Query(sql); if (dt.Rows.Count == 1) { SingletonData.Getlates().nguoidung = new Account() { TaiKhoan = txtUseName.Text }; MessageBox.Show("Đăng nhập thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); /////////////////////// if (ckLuu.Checked) { file.ghifileLG(padFile, txtUseName.Text.Trim(), txtPassWord.Text.Trim()); lblsuccess.Text = "✓ success"; ckLuu.Enabled = false; btnDangNhap.Enabled = true; } else { lblsuccess.Text = "X error"; } this.Close(); } else { SingletonData.Getlates().nguoidung = null; MessageBox.Show("Đăng nhập thất bại. Xem lại tài khoản hoặc mật khẩu!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnLogin_ItemClick(object sender, ItemClickEventArgs e) { nd = new TaiKhoan(); frmLogin login = new frmLogin(); login.ShowDialog(); nd = SingletonData.Getlates().nguoidung; if (nd != null) { btnLogin.Enabled = false; menuQuanLy.Visible = true; } }
private void mnHT_Login_Click(object sender, EventArgs e) { frmLogin login = new frmLogin(); login.ShowDialog(); nd = SingletonData.Getlates().nguoidung; if (nd != null) { mnHT_Login.Enabled = false; mnuKB.Enabled = true; lblNguoidung.Text = nd.TaiKhoan; } }
private void barButtonItem2_ItemClick(object sender, ItemClickEventArgs e) { nd = new Account(); frmLogin login = new frmLogin(); login.ShowDialog(); nd = SingletonData.Getlates().nguoidung; if (nd != null) { btnLogin.Enabled = false; lblNguoiDung.Caption = nd.TaiKhoan; btnQuanLyGiaoVien.Enabled = true; btnQuanLyHoc.Enabled = true; btnQuanLyHS.Enabled = true; btnQuanLyLopHoc.Enabled = true; btnQuanLyMonHoc.Enabled = true; } }
private void btnDangNhap_Click(object sender, EventArgs e) { string sql = string.Format("select TaiKhoan from Account where TaiKhoan='{0}' and MatKhau='{1}'", txtUseName.Text, txtPassWord.Text); DataTable dt = sqlHelper.Query(sql); if (dt.Rows.Count == 1) { SingletonData.Getlates().nguoidung = new Account() { TaiKhoan = txtUseName.Text }; MessageBox.Show("Đăng nhập thành công!"); this.Close(); } else { SingletonData.Getlates().nguoidung = null; MessageBox.Show("Đăng nhập thất bại. Xem lại tài khoản hoặc mật khẩu!"); } }
private void btnDangNhap_Click(object sender, EventArgs e) { lstTK = TaiKhoanController.getAllDataTaiKhoan(); try { foreach (TaiKhoan tk in lstTK) { if (tk.TenTaiKhoan == txtUserName.Text.Trim() && tk.MatKhau == txtPassWord.Text.Trim()) { SingletonData.Getlates().nguoidung = new TaiKhoan() { TenTaiKhoan = txtUserName.Text }; MessageBox.Show("Đăng nhập thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); if (ckLuu.Checked) { file.ghifileLG(pathFile, txtUserName.Text.Trim(), txtPassWord.Text.Trim()); lblLuu.Text = "✓ success"; ckLuu.Enabled = false; btnDangNhap.Enabled = true; } else { lblLuu.Text = "X error"; } this.Close(); return; } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } SingletonData.Getlates().nguoidung = null; MessageBox.Show("Đăng nhập thất bại. Xem lại tài khoản hoặc mật khẩu!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); }