private void myLoginFunc() { RegexInfo myLoginInfo = new RegexInfo(); ManageDB myManageDB = new ManageDB(); this.txtStatus.ForeColor = Color.Blue; this.txtStatus.Text = "重置信息:重置中..."; Application.DoEvents(); if (this.txtUserName.Text != "" && this.txtUserEmail.Text != "") { if (myManageDB.checkUserName(this.txtUserName.Text)) { if (myLoginInfo.isMailAddress(this.txtUserEmail.Text)) { if (myManageDB.userMailToResetPassword(this.txtUserName.Text, this.txtUserEmail.Text)) { TimeDelay myTimeDelay = new TimeDelay(); this.btnOK.Enabled = false; this.btnCancel.Enabled = false; myTimeDelay.closingCurrentWindowDelay(3, this.txtStatus, this, "重置信息:验证成功,即将开始重置...", ""); UserChangePSD myUserChangePSD = new UserChangePSD(); myUserChangePSD.Show(); } else { this.txtStatus.ForeColor = Color.Red; this.txtStatus.Text = "重置信息:重置失败,请确认邮箱是否填写正确!"; } } else { this.txtStatus.ForeColor = Color.Red; this.txtStatus.Text = "重置信息:重置失败!邮箱地址不合法!"; } } else { this.txtStatus.ForeColor = Color.Red; this.txtStatus.Text = "重置信息:重置失败,用户名不存在!"; } } else { this.txtStatus.ForeColor = Color.Red; this.txtStatus.Text = "重置信息:重置失败,用户名和邮箱均不能为空!"; } }
private void myLoginFunc() { if (Properties.Settings.Default.ConnectionString == null || Properties.Settings.Default.ConnectionString == "") { this.txtStatus.ForeColor = Color.Red; this.txtStatus.Text = "登录信息:登录失败,无法连接到服务器!"; } else { this.txtStatus.ForeColor = Color.Blue; this.txtStatus.Text = "登录信息:登录中..."; Application.DoEvents(); ManageDB myManageDB = new ManageDB(); if (this.txtUserName.Text != "" && this.txtPasswd.Text != "") { if (myManageDB.checkUserName(this.txtUserName.Text)) { if (myManageDB.queryUserFullName(this.txtUserName.Text, this.txtPasswd.Text) && myManageDB.queryEmailAddress(this.txtUserName.Text, this.txtPasswd.Text)) { pubUserName = this.txtUserName.Text; pubPasswd = this.txtPasswd.Text; this.txtStatus.ForeColor = Color.Green; this.txtStatus.Text = "登录信息:成功!"; Application.DoEvents(); this.Visible = false; d_ShowMainFrom(); } else { this.txtStatus.ForeColor = Color.Red; this.txtStatus.Text = "登录信息:登录失败,请确认密码是否填写正确!"; } } else { this.txtStatus.ForeColor = Color.Red; this.txtStatus.Text = "登录信息:登录失败,用户名不存在,请注册!"; } } else { this.txtStatus.ForeColor = Color.Red; this.txtStatus.Text = "登录信息:登录失败,用户名和密码不能为空!"; } } }