private void back_Click(object sender, EventArgs e) { this.Close(); Student_home teach = new Student_home(); teach.Show(); }
private void button1_Click(object sender, EventArgs e) { if (id.Text != "" && pass.Text != "") { userid = int.Parse(id.Text); if (teacher.Checked) { /*var teach = (from Teacher in data.Teachers * where Teacher.teacher_Id == int.Parse(id.Text) * * select Teacher.Password).First();*/ int count = 0; foreach (var Line in data.Teachers) { if (Line.teacher_Id == int.Parse(id.Text) && Line.Password == pass.Text) { count = 1; name = Line.Name; this.Close(); Teacher_home techer = new Teacher_home(); techer.Show(); } } if (count == 0) { MessageBox.Show("Mismatch"); } /*if (teach !=null && pass.Text.Equals(teach.ToString() )) * { * this.Close(); * Teacher_home techer = new Teacher_home(); * techer.Show(); * * * } * else * MessageBox.Show("Mismatch");*/ } else if (student.Checked) { int count = 0; foreach (var Line in data.students) { if (Line.Student_Id == int.Parse(id.Text) && Line.Password == pass.Text) { count = 1; name = Line.Name; //MessageBox.Show(name); this.Close(); Student_home stu = new Student_home(); // stu stu.Show(); } } if (count == 0) { MessageBox.Show("Mismatch"); } } else if (admin.Checked) { int count = 0; foreach (var Line in data.Admins) { if (Line.Admin_Id == int.Parse(id.Text) && Line.Password.Equals(pass.Text)) { count = 1; name = Line.Name; this.Close(); Admin_home ad = new Admin_home(); ad.Show(); } } if (count == 0) { MessageBox.Show("Mismatch"); } } else { MessageBox.Show("Wrong selection"); } } else { MessageBox.Show("No input"); } }