private void Menu_commit_Click(object sender, EventArgs e)
        {
            var username = this.radGridView1.CurrentRow.Cells[1].Value;

            if (username == null)
            {
                MessageBox.Show("请选择要修改的用户!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            var       userID    = userHelper.GetUserID(username.ToString());
            ModifyPwd modifyPwd = new ModifyPwd(userID, username.ToString());

            if (modifyPwd.ShowDialog() == DialogResult.OK)
            {
                SelectAllUser();
            }
        }
Esempio n. 2
0
        private void GetBackPassword()
        {
            var username   = this.tb_username.Text.Trim();
            var password   = this.tb_pwd.Text.Trim();
            var confirmPwd = this.tb_repwd.Text.Trim();

            if (string.IsNullOrEmpty(username))
            {
                MessageBox.Show("用户名称不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (string.IsNullOrEmpty(password))
            {
                MessageBox.Show("密码不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (string.IsNullOrEmpty(confirmPwd))
            {
                MessageBox.Show("确认密码不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            var dt = userHelper.GetUserInfo(username).Tables[0];

            if (dt.Rows.Count < 1)
            {
                MessageBox.Show("用户名不存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (password != confirmPwd)
            {
                MessageBox.Show("两次密码不一致!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            var userID = userHelper.GetUserID(username);
            var res    = userHelper.ModifyUserPassword(username, username, confirmPwd);

            if (res == 1)
            {
                MessageBox.Show("修改成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                this.Close();
            }
            else
            {
                MessageBox.Show("修改失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }