private void _onClickAddAssignment(object sender, EventArgs e) { if (_lstFaculty.SelectedIndex >= 0) { Faculty faculty = new Faculty(); Course course = new Course(); faculty = _lstFaculty.SelectedItem as Faculty; addAssign courseAssign = new addAssign(faculty, course); DialogResult dr = courseAssign.ShowDialog(); if (dr == DialogResult.OK) { faculty.AddCourse(course); refreshCourses(); MessageBox.Show("Course for " + faculty.Name + " successfully added.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); } if (dr == DialogResult.Cancel) { Course.IdCount--; } } else { MessageBox.Show("Please, select/Input a Faculty to assign a course to.", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
public _mainForm() { InitializeComponent(); _faculty = new List <Faculty>(); _addAssignment = new addAssign(); _assignFalculty = new addFaculty(); }