Beispiel #1
0
        private void btn_capnhat_Click(object sender, EventArgs e)
        {
            string     mk_cu      = txtMatkhaucu.Text;
            string     mk_moi     = txtMatkhaumoi.Text;
            string     nl_mk      = txtNhaplaimatkhau.Text;
            string     tendn      = Properties.Settings.Default.username;
            AccountBLL acc        = new AccountBLL();
            string     kiemtra_mk = acc.Account(tendn, mk_cu);

            if (kiemtra_mk == null)
            {
                lbTB.Text = "Mật khẩu cũ không chính xác!";
                return;
            }
            if (mk_moi != nl_mk)
            {
                lbTB.Text = "Mật khẩu mới phải trùng nhau!";
                return;
            }

            int ketqua = acc.DoiMatKhau(tendn, mk_moi);

            if (ketqua > 0)
            {
                lbTB.Text = "Đổi mật khẩu thành công!";
            }
            else
            {
                lbTB.Text = "Đổi mật khẩu thất bại!";
            }
            txtMatkhaucu.Text      = "";
            txtMatkhaumoi.Text     = "";
            txtNhaplaimatkhau.Text = "";
        }