/// <summary> /// NewSemesters method populates the Semester database with the given variables. /// This is accomplished by creating the individual semesters, and giving them their /// neccessary data. The included data is a method call to Populate Weeks. Following the creation /// of the semesters, the weeks are modified to remove any breaks in the old semester, as well as add /// break weeks from the new semester to the old one. /// </summary> /// <param name="OldStart"></param> /// <param name="NewStart"></param> /// <param name="Length"></param> /// <param name="UseBreaks"></param> public void NewSemesters(DateTime OldStart, DateTime NewStart, int Length, bool UseBreaks) { memSemesters = new List <Semester>(); memSemesters.Add(Semester.CreateSemester(OldStart, Length, UseBreaks, PopulateWeeks(OldStart, Length, UseBreaks))); memSemesters.Add(Semester.CreateSemester(NewStart, Length, UseBreaks, PopulateWeeks(NewStart, Length, UseBreaks))); for (int i = 0; i < Length; i++) { if (memSemesters[0].Week(i).IsBreak) { memSemesters[0].Weeks.Remove(memSemesters[0].Week(i)); memSemesters[0].Weeks.Add(Week.CreateWeek(memSemesters[0].Weeks[memSemesters[0].Weeks.Count - 1].End.AddDays(1))); //Adds week to end to replace the missing week. } } for (int i = 0; i < Length; i++) { if (memSemesters[1].Week(i).IsBreak) { memSemesters[0].Weeks.Insert(i, memSemesters[1].Week(i)); memSemesters[0].Weeks.Remove(memSemesters[0].Weeks[memSemesters[0].Weeks.Count - 1]); //Removes week off the end to keep the count consistent } } }