private void bt_pwdOK_Click(object sender, EventArgs e) { MdPubFunc funcs = new MdPubFunc(); string pass = funcs.EnCrypt(tb_pwdOld.Text); string query = "select * from sUser where sUserCode = '" + tb_pwdId.Text + "' and sUserPass = '******'"; if (funcs.ExcScalar(query, MdDefine.strcon) == null) { lbl_mess.Text = "Mật khẩu không đúng !!!"; } else { if (tb_pwdNew.Text != tb_pwdNewR.Text) { lbl_mess.Text = "Mật khẩu mới ko giống nhau !!!"; } else { pass = funcs.EnCrypt(tb_pwdNew.Text.ToString()); query = "Update sUser Set sUserPass= '******' Where sUserCode='" + tb_pwdId.Text + "'"; if (funcs.ExecuteQuery(query, MdDefine.strcon) > 0) { MessageBox.Show("Bạn đã thay đổi thành công !!!"); } else { MessageBox.Show("Có lỗi trong quá trình thay đổi!!!"); } } } }
private void bt_login_Click(object sender, EventArgs e) { string name = txtb_name.Text.ToString(); string hasPass = ""; MdPubFunc funcs = new MdPubFunc(); hasPass = funcs.EnCrypt(txtb_pass.Text.ToString()); string qry = "select * from sUser where susercode='" + name + "' and suserpass='******'"; object result = funcs.ExcScalar(qry, MdDefine.strcon); if (result != null) { MainSys main = new MainSys(txtb_name.Text); main.ShowDialog(); this.Close(); } else { lbl_message.Text = "Username or Password incorrect"; txtb_name.Text = ""; txtb_pass.Text = ""; txtb_name.Focus(); } }