private void btnAdd_Click(object sender, EventArgs e) { Classes group = EduManagement.Instance.Classes.ElementAt(0); Student newStudent = new Student(string.Empty, string.Empty, DateTime.Now, group); NewStudent NewStudentForm = new NewStudent(newStudent, newStudent, true); NewStudentForm.Show(); NewStudentForm.FormClosed += NewStudentForm_FormClosed; }
private void btnEdit_Click(object sender, EventArgs e) { if (dgvAllStudents.SelectedRows.Count > 0) { //grab selected object Student currentStudent = (Student)dgvAllStudents.SelectedRows[0].DataBoundItem; NewStudent NewStudentForm = new NewStudent(currentStudent, currentStudent, false); NewStudentForm.Show(); } }
private void addStudentMenu_Click(object sender, EventArgs e) { //add student form requires specil parameters to be called //NewStudent form constructor requires Student, User and boolean variable //As a student is a subclass of the User, it might be used instead of the user //student class requires a Classes class //thus Classes is also created here Classes group = EduManagement.Instance.Classes.ElementAt(0); Student newStudent = new Student(string.Empty, string.Empty, DateTime.Now, group); NewStudent form = new NewStudent(newStudent, newStudent, true); form.Show(); }