private void button1_Click(object sender, EventArgs e)
{
if (radioButton1.Checked == true)
{
if (textBox1.Text == "" || textBox2.Text == "")
{
MessageBox.Show("\n\n登录失败\n\n请填写好登录信息!!");
}
else if (PublicS.listS.Count == 0)
{
MessageBox.Show("\n\n登录失败\n\n请先注册!!");
}
else
{
IEnumerable<Student1> ie = PublicS.listS.Where((Student1 stu) => stu.Num == textBox1.Text);
if (ie.Count() > 0)
{
Student1 stu1 = ie.First();
if (textBox2.Text != stu1.Spw1)
{
MessageBox.Show("\n\n密码错误!");
textBox2.Text = "";
}
else
{
StudentBox To = new StudentBox();
To.Show();
this.Hide();
}
}
else
{
MessageBox.Show("\n\n学生号不存在!");
textBox1.Text = "";
textBox2.Text = "";
}
}
//else if (textBox1.Text != PublicS.listS[0].Num)
//{
//
MessageBox.Show("\n\n学生号不存在!");
//
textBox1.Text = "";
//
textBox2.Text = "";
//}
//else if (textBox2.Text != PublicS.listS[0].Spw1)
//{
//
MessageBox.Show("\n\n密码错误!");
//
textBox2.Text = "";
//}
//else if (textBox1.Text == PublicS.listS[0].Num && textBox2.Text == PublicS.listS[0].Spw1)
//{
//
StudentBox To = new StudentBox();
//
To.Show();
//
this.Hide();
//}
}
if (radioButton2.Checked == true)
{
if (textBox1.Text == "" || textBox2.Text == "")
{
MessageBox.Show("\n\n登录失败\n\n请填写好登录信息!!");
}
else if (PublicT.listT.Count == 0)
{
MessageBox.Show("\n\n登录失败\n\n请先注册!!");
}
else
{
IEnumerable<Teacher1> ie = PublicT.listT.Where((Teacher1 teach) => teach.Num == textBox1.Text);
if (ie.Count() > 0)
{
Teacher1 tech1 = ie.First();
if (textBox2.Text != tech1.Spw1)
{
MessageBox.Show("\n\n密码错误!");
textBox2.Text = "";
}
else
{
TeacherBox To = new TeacherBox();
To.Show();
this.Hide();
}
}
else
{
MessageBox.Show("\n\n教工号不存在!");
textBox1.Text = "";
textBox2.Text = "";
}
}
//else if ( textBox1.Text != PublicT.listT[0].Num)
//{
//
MessageBox.Show("\n\n教工号不存在!");
//
textBox1.Text = "";
//
textBox2.Text = "";
//}
//else if (textBox2.Text != PublicT.listT[0].Spw1)
//{
//
MessageBox.Show("\n\n密码错误!");
//
textBox2.Text = "";
//}
//else if (textBox1.Text == PublicT.listT[0].Num && textBox2.Text == PublicT.listT[0].Spw1)
//{
//
TeacherBox To = new TeacherBox();
//
To.Show();
//
this.Hide();
//}
}
}