示例#1
0
 public TimetableDayView(TimetableDay day, bool show_back, bool show_next)
 {
     this.timetableDay = day;
     this.show_back    = show_back;
     this.show_next    = show_next;
 }
示例#2
0
文件: Parser.cs 项目: matyjb/Parserv2
        public static Timetable MergeToTimetable(Timetable t, TimetableAcademicYear d)
        {
            //adding event to the timetable tree
            if (t.AcademicYears.Exists(e => e.AcademicYear == d.AcademicYear))
            {
                TimetableAcademicYear nextLayerTimetable = t[d.AcademicYear].First();
                TimetableDepartment   nextLayerK0        = d.Departments[0];
                if (nextLayerTimetable.Departments.Exists(e => e.Department == nextLayerK0.Department))
                {
                    TimetableDepartment nextLayerTimetable1 = nextLayerTimetable[nextLayerK0.Department].First();
                    TimetableMode       nextLayerK1         = nextLayerK0.Modes[0];
                    if (nextLayerTimetable1.Modes.Exists(e => e.Mode == nextLayerK1.Mode))
                    {
                        TimetableMode  nextLayerTimetable2 = nextLayerTimetable1[nextLayerK1.Mode].First();
                        TimetableField nextLayerK2         = nextLayerK1.Fields[0];
                        if (nextLayerTimetable2.Fields.Exists(e => e.FieldOfStudy == nextLayerK2.FieldOfStudy))
                        {
                            TimetableField    nextLayerTimetable3 = nextLayerTimetable2[nextLayerK2.FieldOfStudy].First();
                            TimetableSemester nextLayerK3         = nextLayerK2.Semesters[0];
                            if (nextLayerTimetable3.Semesters.Exists(e => e.Semester == nextLayerK3.Semester && e.Degree == nextLayerK3.Degree))
                            {
                                TimetableSemester nextLayerTimetable4 = nextLayerTimetable3[nextLayerK3.Semester, nextLayerK3.Degree, nextLayerK3.Year].First();
                                TimetableDay      nextLayerK4         = nextLayerK3.Days[0];
                                if (nextLayerTimetable4.Days.Exists(e => e.DayOfWeek == nextLayerK4.DayOfWeek))
                                {
                                    //TimetableDay nextLayerTimetable5 = nextLayerTimetable4[nextLayerK4.DayOfWeek].First();
                                    //nextLayerTimetable5.Events.AddRange(nextLayerK4.Events);
                                    TimetableDay   nextLayerTimetable5 = nextLayerTimetable4[nextLayerK4.DayOfWeek].First();
                                    TimetableEvent nextLayerK5         = nextLayerK4.Events[0];
                                    if (nextLayerTimetable5.Events.Any(e => e.EqualsExceptGroups(nextLayerK5)))
                                    {
                                        TimetableEvent nextLayerTimetable6 = nextLayerTimetable5.Events.Find(e => e.EqualsExceptGroups(nextLayerK5));
                                        nextLayerTimetable6.Groups        = nextLayerTimetable6.Groups.Union(nextLayerK5.Groups).ToList();
                                        nextLayerTimetable6.FacultyGroups = nextLayerTimetable6.FacultyGroups.Union(nextLayerK5.FacultyGroups).ToList();
                                    }
                                    else
                                    {
                                        nextLayerTimetable5.Events.Add(nextLayerK5);
                                    }
                                }
                                else
                                {
                                    nextLayerTimetable4.Days.Add(nextLayerK4);
                                }
                            }
                            else
                            {
                                nextLayerTimetable3.Semesters.Add(nextLayerK3);
                            }
                        }
                        else
                        {
                            nextLayerTimetable2.Fields.Add(nextLayerK2);
                        }
                    }
                    else
                    {
                        nextLayerTimetable1.Modes.Add(nextLayerK1);
                    }
                }
                else
                {
                    nextLayerTimetable.Departments.Add(nextLayerK0);
                }
            }
            else
            {
                t.AcademicYears.Add(d);
            }

            return(t);
        }