private void btnDoiMK_Click(object sender, EventArgs e) { if (txbMKhienTai.Text == "" || txbMKmoi.Text == "" || txbMKnhapLai.Text == "") { MessageBox.Show("Lỗi", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string str = XuLuTK_BUS.doiMK(this.Text, txbMKhienTai.Text, txbMKmoi.Text, txbMKnhapLai.Text); if (str == "kkmk") { MessageBox.Show("Mật khẩu hiện tại không đúng", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (str == "mkKhongHopLe") { MessageBox.Show("Mật khẩu mới không hợp lệ !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (str == "KhacMKnhapLai") { MessageBox.Show("Mật khẩu nhập lại không khớp !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { XuLyDAL.doiMatKhau(this.Text, txbMKmoi.Text); txbMKhienTai.Text = ""; txbMKmoi.Text = ""; txbMKnhapLai.Text = ""; MessageBox.Show("Đổi mật khẩu thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
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(); }