Beispiel #1
0
        private void ChangePassWordButton_Click(object sender, EventArgs e)
        {
            InputLegality check = new InputLegality();

            if (!(check.legality(textBox1.Text, 6) && check.legality(textBox1.Text, 6)))
            {
                MessageBox.Show("请确保密码长度正确且为纯数字。", "请重试");
                return;
            }

            if (textBox1.Text.CompareTo(textBox2.Text) != 0)
            {
                MessageBox.Show("请确保两次密码输入一致", "请重试");
                return;
            }
            dbsql  db    = new dbsql();
            string query = "UPDATE D_User SET Password ="******"WHERE U_ID=" + uid;
            int    right = 0;

            right = db.ExecuteUpdate(query);
            if (right == 1)
            {
                MessageBox.Show("新密码是" + textBox1.Text + "\n请牢记新密码", "修改成功");
            }

            this.Close();
        }
        private void StartButton_Click(object sender, EventArgs e)
        {
            dbsql         db = new dbsql();
            DataTable     userTable;
            InputLegality check = new InputLegality();

            if (!check.legality(IDtextBox.Text, -1))
            {
                MessageBox.Show("仅可输入纯数字。", "警告");
                IDtextBox.Text = "";
                return;
            }

            if (IDtextBox.Text == "")
            {
                string query = "select * from D_User ";
                userTable = db.ExecuteQuery(query);
                ListViewTool.ShowDataInListView(userTable, UserListView);
            }
            else
            {
                string query = "select * from D_User WHERE U_ID LIKE '%" + IDtextBox.Text + "%'";
                userTable = db.ExecuteQuery(query);
                ListViewTool.ShowDataInListView(userTable, UserListView);
            }
        }