private void btnDoiMK_Click(object sender, EventArgs e) { TaiKhoan tk = TaiKhoanDAL.layTaiKhoan(this.Text); if (tk.MatKhau.Trim() != XuLyDAL.maHoaMK(txbMKhienTai.Text)) { MessageBox.Show("Mật khẩu hiện tại không đúng", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (!XuLyDAL.ktMatKhauHopLe(txbMKmoi1.Text)) { MessageBox.Show(" Mật khẩu không hợp lệ \n ( Mật khẩu phải có ít nhất 8 kí tự, phải bao gồm cả chữ và số)", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (txbMKmoi1.Text != txbMKmoi2.Text) { MessageBox.Show("Mật khẩu mới nhập lại không khớp", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } XuLyDAL.doiMatKhau(this.Text, txbMKmoi1.Text); MessageBox.Show("Đổi mật khẩu thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); }
private void btnDangNhap_Click(object sender, EventArgs e) { if (txbMatKhau.Text == "" || txbTenTK.Text == "") { MessageBox.Show("Tên đăng nhập hoặc mật khẩu không đúng", "Thống báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } string tentk = txbTenTK.Text; string matKhau = XuLyDAL.maHoaMK(txbMatKhau.Text); if (XuLuTK_BUS.dangNhap(tentk, matKhau)) { this.Dispose(false); if (tentk == "admin") { frmAdmin n = new frmAdmin(); n.Text = tentk; n.Show(); } else { frmKhachHang n = new frmKhachHang(); n.Text = tentk; n.Show(); } } else { txbTenTK.Text = ""; txbMatKhau.Text = ""; MessageBox.Show("Tên đăng nhập hoặc mật khẩu không đúng", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }