Esempio n. 1
0
        private void BtnLogin_Click(object sender, EventArgs e)
        {
            FormLogin FrmLogin = new FormLogin(this, this);

            FrmLogin.Show();
        }
        private void BtnRePwd_Click(object sender, EventArgs e)
        {
            User user = new User();

            if (TxtID.Text.Trim().Equals(string.Empty) != true)
            {
                user.ID = TxtID.Text.Trim();
            }
            if (TxtNickName.Text.Trim().Equals(string.Empty) != true)
            {
                user.Nickname = TxtNickName.Text.Trim();
            }
            if (TxtPwd.Text.Trim().Equals(string.Empty) != true)
            {
                user.Password = TxtPwd.Text.Trim();
            }
            if (TxtMailAddress.Text.Trim().Equals(string.Empty) != true)
            {
                user.Mailaddress = TxtMailAddress.Text.Trim();
            }
            if (CmbPwdQuestion.Text.Trim().Equals(string.Empty) != true)
            {
                user.PwdQuestion = CmbPwdQuestion.Text.Trim();
            }
            if (TxtPwdAnswer.Text.Trim().Equals(string.Empty) != true)
            {
                user.PwdAnswer = TxtPwdAnswer.Text.Trim();
            }

            int          ret           = 0;
            string       strPwdConfirm = TxtPwdConfirm.Text.Trim();
            DialogResult DRret;

            if (user.Password.Equals(strPwdConfirm) != true)
            {
                MessageBox.Show("您输入的密码前后不一样!", "警告",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);

                TxtPwd.Text        = string.Empty;
                TxtPwdConfirm.Text = string.Empty;
                TxtPwd.Focus();

                return;
            }

            if (user.Password.Equals(string.Empty) || strPwdConfirm.Equals(string.Empty))
            {
                MessageBox.Show("密码和密码确认不可空缺!", "警告",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);

                return;
            }

            DRret = MessageBox.Show("确定重置?", "警告", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (DRret == DialogResult.Yes)
            {
                SQLExecute excute = new SQLExecute();

                ret = excute.UpdateUserInfo(user);

                if (ret == 1)
                {
                    MessageBox.Show("重置成功!\n请重新登录", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    FormLogin FrmLogin = new FormLogin();

                    FrmLogin.TxtID.Text = TxtID.Text.Trim();

                    FrmLogin.Show();

                    Close();
                }
                else
                {
                    MessageBox.Show("失败", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            else
            {
            }
        }