private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { this.Hide(); ForgetPassword frm = new ForgetPassword(); frm.Show(); }
private void Btnlogin_Click(object sender, EventArgs e) { if (securitycode.Check(SecCodeText.Text) == false)//验证码错误 { MessageBoxEx.Show("验证码错误,请重新输入!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Warning); securitycode.UpdateVerifyCode(); SecCodeText.Text = ""; SecCodePic.Image = securitycode.getImage(); return; } if (TextId.SkinTxt.Text.Length == 0 || TextPwd.SkinTxt.Text.Length == 0)//用户名或密码为空 { MessageBoxEx.Show("用户名或密码不能为空!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (user.Exists(TextId.SkinTxt.Text.ToString()) == false)//用户不存在 { MessageBoxEx.Show("用户不存在,请重新输入!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); securitycode.UpdateVerifyCode(); SecCodeText.Text = ""; TextId.Text = ""; TextPwd.Text = ""; SecCodePic.Image = securitycode.getImage(); return; } if (user.Check(TextId.Text, TextPwd.Text) == true)//密码正确 { Model.User u = user.GetModel(TextId.Text); this.Hide(); new MainForm(u).Show(); notifyIcon.ShowBalloonTip(500, "登录成功!", "欢迎你!\n来自" + u.School + "的用户!", ToolTipIcon.Info); return; } else//密码错误 { ForgetPassword.Visible = true; ForgetPassword.Show(); TextId.SkinTxt.Text = ""; TextPwd.SkinTxt.Text = ""; SecCodeText.Text = ""; securitycode.UpdateVerifyCode(); SecCodePic.Image = securitycode.getImage(); } }