static void Main(string[] args) { Parser parser = new Parser(); DateTime aa = DateTime.Now; List<TimetableItem> list = parser.GetTimetableForGroup(StudyYear.MIS1, HalfYear.None, "1"); List<TimetableItem> list2 = parser.GetTimetableForYear(StudyYear.I1, HalfYear.B); List<TimetableItem> list3 = parser.GetTimetableForYear(StudyYear.MIS1); List<TimetableItem> list4 = parser.GetTimetableForYear(StudyYear.I2, HalfYear.B); List<TimetableItem> list5 = parser.GetTimetableForGroup(StudyYear.I3, HalfYear.B, "3"); DateTime bb = DateTime.Now; Console.WriteLine((bb-aa).TotalMilliseconds); list.AddRange(list2); list.AddRange(list3); list.AddRange(list4); list.AddRange(list5); if (list != null) { foreach (var item in list) { Console.WriteLine(item); } } Console.WriteLine(Exporter.ConvertToXML(list)); Console.Read(); }
public List<FiiTimetableItem> GetFullTimetable() { var parser = new Parser(); var list = new List<FiiTimetableItem>(); parser.GetTimetableForGroup(StudyYear.I1, HalfYear.A, "1"); list.AddRange(parser.GetTimetableForYear(StudyYear.I1, HalfYear.A)); list.AddRange(parser.GetTimetableForYear(StudyYear.I1, HalfYear.B)); list.AddRange(parser.GetTimetableForYear(StudyYear.I2, HalfYear.A)); list.AddRange(parser.GetTimetableForYear(StudyYear.I2, HalfYear.B)); list.AddRange(parser.GetTimetableForYear(StudyYear.I3, HalfYear.A)); list.AddRange(parser.GetTimetableForYear(StudyYear.I3, HalfYear.B)); list.AddRange(parser.GetTimetableForYear(StudyYear.MIS1)); list.AddRange(parser.GetTimetableForYear(StudyYear.MIS2)); list.AddRange(parser.GetTimetableForYear(StudyYear.MLC1)); list.AddRange(parser.GetTimetableForYear(StudyYear.MLC2)); list.AddRange(parser.GetTimetableForYear(StudyYear.MOC1)); list.AddRange(parser.GetTimetableForYear(StudyYear.MOC2)); list.AddRange(parser.GetTimetableForYear(StudyYear.MSD1)); list.AddRange(parser.GetTimetableForYear(StudyYear.MSD2)); list.AddRange(parser.GetTimetableForYear(StudyYear.MSI1)); list.AddRange(parser.GetTimetableForYear(StudyYear.MSI2)); return list; }
public void ShouldSetTimetableForFii() { var timetablesBL = new TimetablesBL(); var usersBL = new UsersBL(); List<string> list = usersBL.GetGroupsByFaculty("info.uaic.ro"); foreach (var group in list) { Timetable timetable = new Timetable(); timetable.Faculty = "info.uaic.ro"; timetable.GroupId = group; string name = usersBL.GetGroupName(group, "info.uaic.ro"); StudyYear year = StudyYear.None; HalfYear halfYear = HalfYear.None; string number = null; if(name.StartsWith("I")) // licenta { if(name.StartsWith("I1")) // lic 1 { year = StudyYear.I1; } else if(name.StartsWith("I2")) // lic 2 { year = StudyYear.I2; } else if(name.StartsWith("I3")) // lic 3 { year = StudyYear.I3; } if (name.Length > 2) { switch (name[2]) { case 'A': halfYear = HalfYear.A; break; case 'B': halfYear = HalfYear.B; break; } } number = name.Substring(3); } else if(name.StartsWith("M")) // master { halfYear = HalfYear.None; if(name.StartsWith("MIS")) { switch (name[3]) { case '1': year = StudyYear.MIS1; break; case '2': year = StudyYear.MIS2; break; } number = name[4].ToString(); } else if(name.StartsWith("MLC")) { switch (name[3]) { case '1': year = StudyYear.MLC1; break; case '2': year = StudyYear.MLC2; break; } } else if (name.StartsWith("MOC")) { switch (name[3]) { case '1': year = StudyYear.MOC1; break; case '2': year = StudyYear.MOC2; break; } } else if (name.StartsWith("MSD")) { switch (name[3]) { case '1': year = StudyYear.MSD1; break; case '2': year = StudyYear.MSD2; break; } } else if (name.StartsWith("MSI")) { switch (name[3]) { case '1': year = StudyYear.MSI1; break; case '2': year = StudyYear.MSI2; break; } } } var parser = new Parser(); var timetableForGroup = parser.GetTimetableForGroup(year, halfYear, number); timetable.TimetableItems = ConvertToRegularTimetable(timetableForGroup); timetablesBL.SaveTimetable(timetable); } }