/// <summary> /// 学生登陆按钮功能实现 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnLogin_Click(object sender, EventArgs e) { try { sin = dbStudent.StudentInfo.FirstOrDefault(x => x.LoginName == txtUser.Text); if (sin == null && sin.DelFlag == true) { label4.Text = "用户名不存在或者在班信息被删除"; } else { label4.Text = ""; if (sin.NicKName == txtPassWord.Text) { label5.Text = ""; GLY xj = new GLY(sin.StuId); xj.ShowDialog(); } else { label5.Text = "密码不正确"; } } } catch { MessageBox.Show("你不是这个学校的学生或者你的用户名输错"); } }
/// <summary> /// 老师登陆按钮功能实现 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { try { TeacherInfo cin1 = new TeacherInfo(); cin1 = dbStudent.TeacherInfo.FirstOrDefault(x => x.TeacherName == txtUser.Text); if (cin1 == null && cin1.DelFlage == true) { label4.Text = "用户名不存在或者你被校长解雇了"; } else { label4.Text = ""; if (cin1.TeacherPW == txtPassWord.Text) { label5.Text = ""; GLY xj = new GLY(cin1.ClassID.ToString()); xj.ShowDialog(); } else { label5.Text = "密码不正确"; } } } catch { MessageBox.Show("你不是这个学校的老师或者你用户名输错"); } }
/// <summary> /// 校长登陆验证 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button2_Click(object sender, EventArgs e) { try { if (txtUser.Text != "" && txtPassWord.Text != "" && IsCheckCode()) { string pass; if (txtUser.TextLength == 18) { pass = txtUser.Text.Substring(12); } else { pass = txtUser.Text.Substring(9); } if (pass == txtPassWord.Text) { GLY xj = new GLY(); xj.ShowDialog(); } else { MessageBox.Show("校长你密码是不是记错了"); } } else { MessageBox.Show("校长你输入的这是啥东西啊"); } } catch { MessageBox.Show("输入身份证号登陆"); } }