private void BntApDung_Click(object sender, EventArgs e) { try { if (txtManv.Text == "" && txtMkcu.Text == "" && txtMkmoi.Text == "") { MessageBox.Show("Chưa Điền Thông Tin", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { dbNhanVien.DoiMatKhau(txtManv.Text, txtMkcu.Text, txtMkmoi.Text); DialogResult TL = MessageBox.Show("Đổi Thành Công! Bạn Muốn Thoát", "Thông Báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (TL == DialogResult.OK) { this.Close(); //frmDangNhap fdn = new frmDangNhap(); //this.ParentForm.Close(); //fdn.ShowDialog(); } } } catch { MessageBox.Show("Không thành công !Sai Thông Tin ?", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnDongY_Click(object sender, EventArgs e) { if (txtMatKhauCu.Text == "" || txtMatKhauMoi.Text == "" || txtXacNhanMatKhau.Text == "") { MessageBox.Show("Vui lòng điền đầy đủ các thông tin", "Thống báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { BLNV = new BLNhanVien(); passwword = BLNV.Laypassword(User).ToString(); if (passwword == txtMatKhauCu.Text) { BLNV = new BLNhanVien(); if (txtMatKhauMoi.Text == txtXacNhanMatKhau.Text) { if (BLNV.DoiMatKhau(ref err, User, txtMatKhauMoi.Text)) { MessageBox.Show("Đổi mật khẩu thành công", "Thông báo", MessageBoxButtons.OK); this.Close(); } else { MessageBox.Show(err, "Thông báo"); } } else { MessageBox.Show("Xác nhận lại mật khẩu", "Thông báo"); } } else { MessageBox.Show("Sai mật khẩu", "Thông báo"); } } }