private void editButton_Click(object sender, EventArgs e) { if (personInfo.ID >= 0) { if (personInfo.TypeOfPerson == PersonType.Student) { StudentForm studentForm = new StudentForm(Tennis_Club.StudentList[personInfo.ID], Tennis_Club.GetStudentImage(personInfo.ID)); studentForm.SaveStudent += studentForm_SaveExistingStudent; studentForm.ShowDialog(); if (!studentForm.IsDisposed) { studentForm.Dispose(); } } else { CoachForm coachForm = new CoachForm(Tennis_Club.CoachList[personInfo.ID], Tennis_Club.GetCoachImage(personInfo.ID)); coachForm.SaveCoach += coachForm_SaveExistingCoach; coachForm.ShowDialog(); if (!coachForm.IsDisposed) { coachForm.Dispose(); } } } else { MessageBox.Show("No person selected.", "Tennis Management Software", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void coachToolStripMenuItem_Click(object sender, EventArgs e) { CoachForm coachForm = new CoachForm((uint)Tennis_Club.CoachList.Count()); coachForm.SaveCoach += coachForm_SaveNewCoach; coachForm.ShowDialog(); if (!coachForm.IsDisposed) { coachForm.Dispose(); } }