private void btnLogin_Click(object sender, EventArgs e) { try { ClientMgrWSSoapClient TheClientMgr = new ClientMgrWSSoapClient(); string userCode = this.tbUserCode.Text; string password = Utility.Md5(this.tbPassword.Text); User user = TheClientMgr.LoadUser(userCode); if (user != null && user.Password.ToUpper() == password.ToUpper() && user.IsActive) { this.lblMessage.Text = "登录成功!"; this.lblMessage.Visible = true; this.LoginEvent(user, null); } else { this.lblMessage.Text = "登录失败!"; this.tbPassword.Text = string.Empty; this.lblMessage.Visible = true; } } catch (Exception ex) { MessageBox.Show(this, "未知错误!请与管理员联系!" + ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); InitialLogin(); } }