private void button1_Click(object sender, EventArgs e) { if (state == adminstate.asadmin) { AdminForm anext = new AdminForm(FacultyList, StudentList, Courses, admin, StudentList[dataGridView1.SelectedRows[0].Index]); anext.Show(); this.Close(); } if (state == adminstate.asstudent) { benutil.AddStudenttoCourse(asthisstudent, Courses[dataGridView1.SelectedRows[0].Index], admin); initdgv(); } }
private void logoutBtn_Click(object sender, EventArgs e) { if (state == adminstate.asadmin) this.Close(); if (state == adminstate.asstudent) { AdminForm nextform = new AdminForm(FacultyList, StudentList, Courses, admin); nextform.Show(); this.Close(); } }
private void button1_Click(object sender, EventArgs e) { bool success = false; foreach (UserAdmin a in Admins) { if (textBox1.Text == a.UserName) { if (a.isPassword(textBox2.Text)) { //launch admin form //but for now: Text = "Welcome " + a.UserName + ". "; AdminForm adm = new AdminForm(Faculty, Students, Courses, a); adm.Show(); textBox1.Text = textBox2.Text = ""; //end form. } else { textBox2.Text = ""; label3.Show(); success = true; } //tell user login failed. } } foreach (UserFaculty f in Faculty) { if (textBox1.Text == f.UserName) { if (f.isPassword(textBox2.Text)) { //launch faculty form Text = "Welcome " + f.UserName + ". "; Form3 formm = new Form3(Students, f, Courses, 0); formm.Show(); //this.Close(); textBox1.Text = textBox2.Text = ""; success = true; } else { textBox2.Text = ""; label3.Show(); } //tell user login failed. } } foreach (UserStudent s in Students) { if (textBox1.Text == s.UserName) { if (s.isPassword(textBox2.Text)) { //launch student form Text = "Welcome " + s.UserName + ". "; Form2 SF = new Form2(Courses, s, 0); SF.Show(); textBox1.Text = textBox2.Text = ""; //this.Close(); success = true; } else { textBox2.Text = ""; label3.Show(); } //tell user login failed. } } if (!success) { textBox2.Text = ""; label3.Show(); } }
private void button1_Click(object sender, EventArgs e) { bool success = false; foreach (UserAdmin a in Admins) if (textBox1.Text == a.UserName) { if (a.isPassword(textBox2.Text)) { //launch admin form //but for now: Text = "Welcome " + a.UserName + ". " ; AdminForm adm = new AdminForm(Faculty, Students, Courses, a); adm.Show(); textBox1.Text = textBox2.Text = ""; //end form. } else { textBox2.Text = ""; label3.Show(); success = true; } //tell user login failed. } foreach (UserFaculty f in Faculty) if (textBox1.Text == f.UserName) { if (f.isPassword(textBox2.Text)) { //launch faculty form Text = "Welcome " + f.UserName + ". "; Form3 formm = new Form3(Students,f,Courses,0); formm.Show(); //this.Close(); textBox1.Text = textBox2.Text = ""; success = true; } else { textBox2.Text = ""; label3.Show(); } //tell user login failed. } foreach (UserStudent s in Students) if (textBox1.Text == s.UserName) { if (s.isPassword(textBox2.Text)) { //launch student form Text = "Welcome " + s.UserName + ". "; Form2 SF = new Form2(Courses, s, 0); SF.Show(); textBox1.Text = textBox2.Text = ""; //this.Close(); success = true; } else { textBox2.Text = ""; label3.Show(); } //tell user login failed. } if (!success) { textBox2.Text = ""; label3.Show(); } }