2 using System.Collections.Generic;
3 using System.ComponentModel;
8 using System.Windows.Forms;
9 using MySql.Data.MySqlClient;
11 namespace HospitalManageSys
13 public partial class Form_PWD : Form
20 public Form_PWD(MySqlConnection connector)
22 InitializeComponent();
26 cmd = new MySqlCommand("select * from administrator where Admin_ID = " + HospitalManageSys.SqlCmd.admin_id, con);
27 ada = new MySqlDataAdapter(cmd);
32 private void button_cancel_Click(object sender, EventArgs e)
37 private void button_OK_Click(object sender, EventArgs e)
39 if (this.textBox_prePWD.Text.Trim() == string.Empty || this.textBox_newPWD.Text.Trim() == string.Empty || this.textBox_PWDagain.Text.Trim() == string.Empty)
41 MessageBox.Show("密码不能为空!", "提示", MessageBoxButtons.OK);
45 if (!this.textBox_prePWD.Text.GetHashCode().Equals(Convert.ToInt32(ds.Tables[0].Rows[0].ItemArray[9])))
47 textBox_prePWD.Clear();
48 textBox_newPWD.Clear();
49 textBox_PWDagain.Clear();
50 MessageBox.Show("原密码不正确!请再次输入!", "提示", MessageBoxButtons.OK);
55 if (!this.textBox_newPWD.Text.Equals(this.textBox_PWDagain.Text))
57 textBox_newPWD.Clear();
58 textBox_PWDagain.Clear();
59 MessageBox.Show("两次输入新密码不一样!请重新输入!", "提示", MessageBoxButtons.OK);
66 cmd.CommandText = "update administrator set Admin_password ='" + this.textBox_newPWD.Text.GetHashCode()
67 + "' where Admin_ID = " + HospitalManageSys.SqlCmd.admin_id;
68 cmd.ExecuteNonQuery();
71 MessageBox.Show("密码修改成功!请不要忘记修改后的密码!");
79 private void Form_PWD_Load(object sender, EventArgs e)