protected void btnLogin_Click(object sender, System.EventArgs e) { // 判断是登入日志信息 logdetail = EventLogs.GetLoginLogDetails(txtUserName.Text.Trim(), 3); // 没有日志数据 if (logdetail.ID == -1) { CurrLogin(); } else { // 在一个小时内登入错误次数大于5 int time = 0; TimeSpan a = DateTime.Now - logdetail.AddTime.Value; time = a.Hours; if (logdetail.ErrorCount >= 5 && time < 1) { this.ShowMessage("登入错误超过5次,一个小时后才能登入或通过忘记密码重新登入", false); currFlag.Value = "No"; } else { CurrLogin(); } } }