1 Star 0 Fork 0

阿尔泰瑞斯/MyQQ-with-.net

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
AnQuanForm.cs 3.69 KB
一键复制 编辑 原始数据 按行查看 历史
nanhai 提交于 2020-04-13 09:28 . MyQQ
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace myqq
{
public partial class AnQuanForm : Form
{
int userId = QQuser.userId;
String pwdA = "";
int FriendshipPolicyId = 1;
public AnQuanForm()
{
InitializeComponent();
this.StartPosition = FormStartPosition.CenterScreen;
}
SqlConnection c;
private void Qian()
{
String s = "server=.;uid=sa;pwd=123;database=MyQQ";
c = new SqlConnection(s);
c.Open();
}
private void AnQuanForm_Load(object sender, EventArgs e)
{
textBox_A.Focus();
Qian();
String sql = String.Format("select NickName,FaceId,pwdQ,pwdA,FriendshipPolicyId from Users where Id={0}", userId);
SqlCommand cmd = new SqlCommand(sql, c);
SqlDataReader r = cmd.ExecuteReader();
if (r.Read()) {
label_nikeName.Text = r[0].ToString();
label_id.Text = userId.ToString();
String img = "QQ头像/" + r[1].ToString() + ".bmp";
pictureBox1.BackgroundImage = Image.FromFile(img);
Console.WriteLine(r[2].ToString());
textBox_Q.Text = r[2].ToString();
pwdA = r[3].ToString();
FriendshipPolicyId = int.Parse(r[4].ToString());
}
}
private void button_yanz_Click(object sender, EventArgs e)
{
if (!pwdA.Equals(textBox_A.Text))
{
MessageBox.Show("密保答案错误!");
}
else {
panel_quanx.Visible = true;
label_Ti.Text = "修改您的安全选项";
button_yanz.Visible = false;
if (FriendshipPolicyId == 1)
{
radioButton1.Checked = true;
}
else if (FriendshipPolicyId == 2)
{
radioButton2.Checked = true;
}
else
{
radioButton3.Checked = true;
}
}
}
//好友验证
private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
if (radioButton2.Checked)
{
panel_yanz.Visible = true;
}
else {
panel_yanz.Visible = false;
}
}
private void button_ok_Click(object sender, EventArgs e)
{
Qian();
String sql;
if (radioButton1.Checked)
{
sql = String.Format("update Users set pwdQ = '{0}', pwdA = '{1}', FriendshipPolicyId ={2} where Id = {3}",textBox_pwdQ.Text,textBox_A.Text,1,userId);
}
else if (radioButton2.Checked)
{
sql = String.Format("update Users set pwdQ='{0}',pwdA='{1}',FriendshipPolicyId={2},Q='{3}',A='{4}' where Id={5}", textBox_pwdQ.Text, textBox_A.Text, 2,textBox_Q.Text,textBox_A.Text,userId);
}
else {
sql = String.Format("update Users set pwdQ = '{0}', pwdA = '{1}', FriendshipPolicyId ={2} where Id = {3}", textBox_pwdQ.Text, textBox_A.Text, 1, userId);
}
SqlCommand cmd = new SqlCommand(sql,c);
int r = cmd.ExecuteNonQuery();
if (r > 0) {
MessageBox.Show("修改成功!");
this.Close();
}
}
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/aertairus/MyQQ-with-.net.git
git@gitee.com:aertairus/MyQQ-with-.net.git
aertairus
MyQQ-with-.net
MyQQ-with-.net
master

搜索帮助