コード例 #1
0
ファイル: DoiMatKhau.cs プロジェクト: ngoclam99/Quancaphe
        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 = "";
        }
コード例 #2
0
ファイル: FrmDangNhap.cs プロジェクト: ngoclam99/Quancaphe
        private void button1_Click(object sender, EventArgs e)
        {
            string user = txtDangNhap.Text;
            string pass = txtMatkhau.Text;

            if (user == "" && pass == "")
            {
                lbTK.Visible = true;
                lbMK.Visible = true;
                lbTB.Visible = false;
                return;
            }

            if (user == "")
            {
                lbTK.Visible = true;
                lbTB.Visible = false;
                return;
            }
            else
            {
                lbTK.Visible = false;
            }
            if (pass == "")
            {
                lbMK.Visible = true;
                lbTB.Visible = false;
                return;
            }
            else
            {
                lbMK.Visible = false;
            }

            account = new AccountBLL();
            string kiemtra = account.Account(user, pass);

            if (kiemtra == null)
            {
                lbTB.Visible = true;
            }
            else
            {
                string[] arr = kiemtra.Split('_');
                Properties.Settings.Default.username = arr[0];
                Properties.Settings.Default.manv     = arr[1];
                Properties.Settings.Default.bophan   = arr[2];
                Properties.Settings.Default.nameuser = arr[3];
                DialogResult = DialogResult.OK;
                lbTB.Visible = false;
            }
        }