public void SetAssociatedCohort() { foreach (StudentCohort cohortToCheckForAssociation in DataCatalogueService.CurrentStudentCohorts) { if (AssociatedCohort != null) { return; } if (cohortToCheckForAssociation == null) { UserIOController.OutputErrorMessage("Keine Cohorte für den Kurs gefunden, Abbruch!"); } foreach (Course RequiredCourseToCompare in cohortToCheckForAssociation._requiredCourses) { if (this.Name == RequiredCourseToCompare.Name) { AssociatedCohort = cohortToCheckForAssociation; return; } } } SetCompatibleCourseRooms(); }
static void CalculateCompleteSchedule() { int day = (int)WorkDays.Monday; int timeBlock = (int)TimeBlocks.First_Block; Course courseToPlaceInSchedule = new Course(); Schedule cSched = DataCatalogueService.CompleteSchedule; for (int i = 0; i < DataCatalogueService.CurrentlyTaughtCourses.Count; i++) { courseToPlaceInSchedule = DataCatalogueService.CurrentlyTaughtCourses[i]; if (courseToPlaceInSchedule.CheckIfSchedulesLineUp((WorkDays)day, (TimeBlocks)timeBlock)) { cSched.scheduleMatrix[day, timeBlock]._allScheduledCoursesCollection.Add(courseToPlaceInSchedule); courseToPlaceInSchedule.AddEntryToAllAssociatedSchedules((WorkDays)day, (TimeBlocks)timeBlock); day = 0; timeBlock = 0; } else { timeBlock++; if (timeBlock == Enum.GetNames(typeof(WorkDays)).Length - 1) { day++; timeBlock = 0; if (day == Enum.GetNames(typeof(TimeBlocks)).Length - 1) { UserIOController.OutputErrorMessage("Course konnte nicht platziert werden. Stundenplan generierung abgebrochen"); } } } } UserIOController.OutputMessage("Stundenplan erfolgreich erstellt."); }
private static void StartUserInterfacing() { bool userIsInterfaced = true; while (userIsInterfaced) { userIsInterfaced &= UserIOController.OutputCurrentUserOptions(); } }
public void PrintOut() { for (int i = 0; i < scheduleMatrix.GetLength(0); i++) { Console.WriteLine((WorkDays)i + ": "); for (int k = 0; k < scheduleMatrix.GetLength(1); k++) { foreach (Course toPrint in scheduleMatrix[i, k]._allScheduledCoursesCollection) { UserIOController.OutputCoursesForTheDay(toPrint, (WorkDays)i, (TimeBlocks)k); } } } }
// TODO Changed the entire loop, because it didn't actually loop through blocks/days // and only checked every course ONCE, so it obviously didn't work static void CalculateCompleteSchedule() { foreach (Course courseToPlace in DataCatalogueService.CurrentlyTaughtCourses) { // TODO made the looping it's own method, so I could break out of the "search for day and timeblock" part // without breaking out of the "loop through all courses" part bool couldPlace = LoopThroughScheduleAndPlaceIfPossible(courseToPlace); if (!couldPlace) { UserIOController.OutputErrorMessage("Der Kurs " + courseToPlace.Name + " konnte nicht eingetragen werden. Daten überprüfen"); } } UserIOController.OutputMessage("Stundenplan erfolgreich erstellt."); }