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(); }
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(); }