private void simpleButtonOK_Click(object sender, EventArgs e) { ConnDB conn = new ConnDB(); string password; password = Common.MD5Encrypt(textEditPsw.Text.ToString().Trim()); string sql = "update cost_user set password ='******' where cid = " + textEditID.Text.ToString(); if (textEditLogName.Text.ToString().Trim() != "" && textEditPsw.Text.ToString().Trim() != "") { bool isok = conn.EditDatabase(sql); if (isok) { MessageBox.Show("修改成功!"); UserQuery.RefreshEX(); this.Close(); } else { MessageBox.Show("失败!"); } } else { MessageBox.Show("登录名和密码不能为空值!"); } conn.Close(); }
private void hyperlinkLabelControl1_Click(object sender, EventArgs e) { ConnDB conn = new ConnDB(); string strsql, password; password = Common.MD5Encrypt(textEditPsw.Text.ToString().Trim()); strsql = "select password from cost_user where cname = '" + textEditName.Text.ToString().Trim() + "'"; if (textEditName.Text.ToString().Trim() != "" && textEditPsw.Text.ToString().Trim() != "") { DataSet ds = conn.ReturnDataSet(strsql); if (ds.Tables[0].Rows[0][0].ToString() != "") { if (password == ds.Tables[0].Rows[0][0].ToString()) { ChangePass frm = new ChangePass(); frm.Show(); cname = textEditName.Text.ToString().Trim(); } else { MessageBox.Show("密码不正确!"); } } else { MessageBox.Show("用户名不存在!"); } } else { MessageBox.Show("用户名或密码不能为空!"); } conn.Close(); }
private void simpleButtonOK_Click(object sender, EventArgs e) { ConnDB conn = new ConnDB(); string strsql, strsql2, password, log_name, person_name, dept1, dept2, dept3, dept, remark; int rows; log_name = textEditLogName.Text.ToString().Trim(); password = Common.MD5Encrypt(textEditPsw.Text.ToString().Trim()); person_name = textEditName.Text.ToString().Trim(); dept1 = comboBoxDept1.Text.ToString(); dept2 = comboBoxDept2.Text.ToString(); dept3 = comboBoxDept3.Text.ToString(); dept = comboBoxDept.Text.ToString(); remark = textEditRemark.Text.ToString().Trim(); if (dept1 == "请选择") { dept1 = ""; } if (dept2 == "请选择") { dept2 = ""; } if (dept3 == "请选择") { dept3 = ""; } if (dept == "请选择") { dept = ""; } strsql = "insert into cost_user(CNAME,PASSWORD,PERSON_NAME,DEPT1,DEPT2,DEPT3,DEPT,remark) values('" + log_name + "','" + password + "','" + person_name + "','" + dept1 + "','" + dept2 + "','" + dept3 + "','" + dept + "','" + remark + "')"; strsql2 = "select cname from cost_user where cname = '" + textEditLogName.Text.ToString().Trim() + "'"; if (log_name != "" && textEditPsw.Text.ToString().Trim() != "") { rows = conn.ReturnRecordCount(strsql2); if (rows > 0) { MessageBox.Show("该用户已经存在!"); } else { bool isok = conn.EditDatabase(strsql); if (isok) { MessageBox.Show("添加成功!"); UserQuery.RefreshEX(); this.Close(); } else { MessageBox.Show("失败!"); } } } else { MessageBox.Show("不能为空!"); } conn.Close(); }
private void simpleButtonOK_Click(object sender, EventArgs e) { ConnDB conn = new ConnDB(); string password; password = Common.MD5Encrypt(textEditAgain.Text.ToString().Trim()); string sql = "update cost_user set password ='******' where cname = '" + Logon.GetCname() + "'"; string sql2 = "select cname from cost_user where cname = '" + Logon.GetCname() + "' and password ='******'"; if (textEditNew.Text.ToString().Trim() != "" && textEditAgain.Text.ToString().Trim() != "") { if (textEditNew.Text.ToString().Trim() == textEditAgain.Text.ToString().Trim()) { int rows = conn.ReturnRecordCount(sql2); if (rows > 0) { MessageBox.Show("不能和旧密码相同!"); } else { bool isok = conn.EditDatabase(sql); if (isok) { MessageBox.Show("修改成功!"); this.Close(); } else { MessageBox.Show("失败!"); } } } else { MessageBox.Show("两次输入的不一致!"); } } else { MessageBox.Show("不能为空值!"); } conn.Close(); }
private void simpleButton登录_Click(object sender, EventArgs e) { ConnDB conn = new ConnDB(); string strsql, password; password = Common.MD5Encrypt(textEditPsw.Text.ToString().Trim()); strsql = "select password,dept2 from cost_user where cname = '" + textEditName.Text.ToString().Trim() + "'"; if (textEditName.Text.ToString().Trim() != "" && textEditPsw.Text.ToString().Trim() != "") { DataSet ds = conn.ReturnDataSet(strsql); if (ds.Tables[0].Rows.Count>0) { if (password == ds.Tables[0].Rows[0][0].ToString()) { //MainForm2.ShowMe(); cname = textEditName.Text.ToString().Trim(); dept2 = ds.Tables[0].Rows[0][1].ToString().Trim(); MainForm2 frm = new MainForm2(); frm.Show(); // MainForm2.CheckRight(); this.Visible = false; } else { MessageBox.Show("密码不正确!"); } } else { MessageBox.Show("用户名不存在!"); } } else { MessageBox.Show("用户名或密码不能为空!"); } conn.Close(); }