static void Main(string[] args) { System.Console.WriteLine("Untis Export CLI test tool. Please insert path to GPN file:"); var file = System.Console.ReadLine(); var result = UntisExporter.ParseFile(file); foreach (var room in result.Rooms) { foreach (var period in room.Periods) { System.Console.WriteLine($"{string.Join('-', period.PeriodNumber)} - {period.Name} - {period.LongName}, {period.AlternativeRoom} - {period.Capacity} - {string.Join(", ", period.Floors)}"); } } foreach (var period in result.Periods) { System.Console.WriteLine($"{period.Name} - {period.LongName} - {period.Start.ToShortDateString()} - {period.End.ToShortDateString()}"); } foreach (var subject in result.Subjects) { System.Console.WriteLine($"{subject.Abbreviation}: {subject.Name}"); } foreach (var teacher in result.Teachers) { foreach(var period in teacher.Periods) { System.Console.WriteLine($"{period.PeriodNumber} - {period.Acronym} - {period.Lastname}, {period.Firstname} - {string.Join(", ", period.Subjects)}"); } } foreach(var tuition in result.Tuitions) { foreach(var period in tuition.Periods) { System.Console.WriteLine($"{period.PeriodNumber} - {period.TuitionNumber} - {string.Join(',', period.Grades)} - {period.Teacher} - {period.Subject}"); } } foreach(var @event in result.Events) { System.Console.WriteLine($"Event: {@event.Text}"); } var weeks = WeekResolver.SchoolWeekToCalendarWeek(result); foreach(var week in weeks) { System.Console.WriteLine($"{week.SchoolYearWeek} ({week.TuitionWeek}) - KW{week.CalendarWeek} - {week.WeekName} - {week.FirstDay.ToShortDateString()}"); } return; }
public async Task <ImportResult> ImportSupervisionsAsync(UntisExportResult result, Period period) { ConfigureImporter(); var supervisions = new List <TimetableSupervisionData>(); var weeks = WeekResolver.SchoolWeekToCalendarWeek(result); var periodWeeks = ComputePeriodWeeks(result, weeks, period); foreach (var floor in result.SupervisionFloors) { foreach (var supervision in floor.Supervisions) { var supervisionWeeks = weeks .Where(x => supervision.Weeks.Contains(x.SchoolYearWeek)) .Select(x => x.CalendarWeek) .Where(x => periodWeeks.Contains(x)) .ToList(); if (supervisionWeeks.Any()) { var data = new TimetableSupervisionData { Id = Guid.NewGuid().ToString(), Day = supervision.Day, Weeks = supervisionWeeks, IsBefore = true, Lesson = supervision.Lesson, Teacher = supervision.Teacher, Location = floor.Name }; supervisions.Add(data); } } } var response = await importer.ImportSupervisionsAsync(period.Name, supervisions); return(HandleResponse(response)); }