Example #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;

            if (String.IsNullOrEmpty(this.txtNewPassword1.Text))
            {
                MessageBox.Show("密码不能为空");
                return;
            }
            if (!this.txtNewPassword1.Text.Equals(this.txtNewPassword2.Text))
            {
                MessageBox.Show("二次输入的密码不一致,请重新输入");
                return;
            }

            UserDao userDao = new UserDao();
            User user = new User();
            user.userId = this.txtUserName.Text;
            user.name = this.txtName.Text;
            user.password = this.txtNewPassword1.Text;
            userDao.Update(user);
            this.Cursor = Cursors.Default;
            MessageBox.Show("密码修改完成,下次请用新密码登录.");

        }
Example #2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(this.txtUserName.Text))
            {
                MessageBox.Show("请输入用户名");
                txtUserName.Focus();
                return;
            }
            if (String.IsNullOrEmpty(this.txtPassword.Text))
            {
                MessageBox.Show("请输入密码");
                txtPassword.Focus();
                return;
            }
            this.Cursor = Cursors.WaitCursor;
            UserDao userDao = new UserDao();
            this.loginUser = userDao.Get(this.txtUserName.Text);
            if (loginUser == null || (loginUser != null && !loginUser.password.Equals(this.txtPassword.Text)))
            {
                MessageBox.Show("用户名或者密码不正确,请重新输入.");
                txtUserName.Focus();
                this.Cursor = Cursors.Default;
                return;
            }
            this.DialogResult = DialogResult.OK;
            this.Hide();
            //异步执行开始
            worker.RunWorkerAsync();
            frmProgress frm = new frmProgress(this.worker);
          //  frm.Height = 100;
            frm.StartPosition = FormStartPosition.CenterScreen;
            frm.ShowDialog(this);
            frm.Close();
            this.Cursor = Cursors.Default;

            this.Close();
           
        }
Example #3
0
 private void btnModifyPassword_Click(object sender, EventArgs e)
 {
   
     if (String.IsNullOrEmpty(this.txtUserName.Text))
     {
         MessageBox.Show("请输入用户名");
         txtUserName.Focus();
         return;
     }
     if (String.IsNullOrEmpty(this.txtPassword.Text))
     {
         MessageBox.Show("请输入密码");
         txtPassword.Focus();
         return;
     }
     this.Cursor = Cursors.WaitCursor;
     UserDao userDao = new UserDao();
     this.loginUser = userDao.Get(this.txtUserName.Text);
     if (loginUser == null || (loginUser != null && !loginUser.password.Equals(this.txtPassword.Text)))
     {
         MessageBox.Show("用户名或者密码不正确,请重新输入.");
         txtUserName.Focus();
         return;
     }
     this.Cursor = Cursors.Default;
     frmUserModification frmUserModification = new frmUserModification();
     frmUserModification.ShowDialog();
 }