private void m_btn_Submit_Click(object sender, EventArgs e) { TimeSlot timeSlot = (TimeSlot)m_cb_TimeSlots.SelectedItem; Person person = new Person().FromID(Context.Person); Candidate candidate = null; if (person.IsCandidate()) { candidate = person.GetCandidate(); } else { MessageBox.Show("You cannot sign up for interviews as you are not a registerd candidate."); Dispose(); return; } Interviewer interviewer = GetAvailableInterviewer(timeSlot); Table table = GetAvailableTable(timeSlot); Interview i = new Interview(); i.JobFairID = Context.JobFair; i.CandidateID = candidate.ID; i.TimeSlotID = timeSlot.ID; i.TableID = table.ID; i.Insert(); i.AddInterviewer(interviewer); MessageBox.Show("Your interview with " + m_lbl_CompanyName.Text + " at " + timeSlot.StartTime + " has been registered."); Dispose(); }