public override int GetWeight(Schedule s) { TeacherSchedule ts = s.TeacherSchedule; foreach (TeacherLessonCollection tlc in ts) { if (Global.GradeTeachers[tlc.TeacherID].SubjectName == SubjectName) { foreach (TeacherLesson tl in tlc) { if (Weeks.Contains(tl.DayOfWeek) && tl.Forenoon) { sum += Weight; } } } } return(sum); }