private Boolean DetermineIfAllPreRequisiteCourseHaveBeenScheduled(int _CurriculumCourseID, int _EnrollmentID) { Boolean Rtn = true; IEnumerable <CurriculumCourse> PreRequisiteCoursesNotScheduled; using (var Dbconnection = new MCDEntities()) { PreRequisiteCoursesNotScheduled = (from a in Dbconnection.GetCurriculumCoursePreRequisiteCourseNotYetScheduled(_CurriculumCourseID, _EnrollmentID) select a) .ToList <CurriculumCourse>(); if (PreRequisiteCoursesNotScheduled.Count <CurriculumCourse>() > 0) { int iCounter = 1; Rtn = false; String ErrorMessage = "Before proceeding to schedule this course please schedule the following course first, as these are Pre-Requisite Courses for the currently selected course:\n\n"; foreach (CurriculumCourse CC in PreRequisiteCoursesNotScheduled) { Dbconnection.Entry(CC).Reference(a => a.Course).Load(); ErrorMessage += iCounter + " - " + CC.Course.CourseName + "\n"; iCounter++; } MessageBox.Show(ErrorMessage, "Pre-Requisite Course To Schedule", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }; return(Rtn); }