コード例 #1
0
 private void btndoimk_Click(object sender, EventArgs e)
 {
     if (txtmatkhaumoi.Text != txtnhaplaimatkhau.Text)
     {
         MessageBox.Show("Nhập lại mật khẩu sai !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else
     {
         TaiKhoan tk = new TaiKhoan();
         tk.TenDn   = TenDangNhap;
         tk.MatKhau = txtmatkhaucu.Text;
         if (taikhoan_bus.Dangnhap(tk).Rows.Count > 0)
         {
             tk.MatKhau = txtmatkhaumoi.Text;
             if (taikhoan_bus.Doimatkhau(tk) == true)
             {
                 MessageBox.Show("Đổi mật khẩu thành công !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 this.Hide();
             }
             else
             {
                 MessageBox.Show("Đổi mật khẩu không thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
         }
         else
         {
             MessageBox.Show("Mật khẩu cũ không đúng!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
 }