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); } }