private ParsedCourseRow ParseExcelRow(DataRow row, ExcelCoursesFileColumnIndexes indexes, IReadOnlyDictionary <string, DayOfWeek?> dayOfWeekMap)
        {
            var dayOfWeekStr = GetRowValue(row, indexes.DayOfWeek);
            var dayOfWeek    = dayOfWeekMap[dayOfWeekStr];
            var startHourStr = GetRowTimeValue(row, indexes.StartHour);
            var startHour    = TimeFactory.FromString(startHourStr);
            var endHourStr   = GetRowTimeValue(row, indexes.EndHour);
            var endHour      = TimeFactory.FromString(endHourStr);

            // we ignore groups who can't be scheduled
            if (dayOfWeek == null || startHour == null || endHour == null)
            {
                return(null);
            }

            var parsedRow = new ParsedCourseRow();

            parsedRow.DayOfWeek = (DayOfWeek)dayOfWeek;
            parsedRow.StartHour = startHour;
            parsedRow.EndHour   = endHour;

            parsedRow.Group     = GetRowValue(row, indexes.Group);
            parsedRow.SubGroup  = GetRowValue(row, indexes.SubGroup);
            parsedRow.Id        = GetRowValue(row, indexes.Id);
            parsedRow.GroupName = GetRowValue(row, indexes.GroupName);

            parsedRow.ClassType = GetRowValue(row, indexes.ClassType);

            parsedRow.Lecturer = GetRowValue(row, indexes.Lecturer);



            parsedRow.Room = GetRowValue(row, indexes.Room);

            float academicPoints;

            float.TryParse(GetRowValue(row, indexes.AcademicPoints), out academicPoints);
            parsedRow.AcademicPoints = academicPoints;

            parsedRow.Faculty = GetRowValue(row, indexes.Faculty);

            return(parsedRow);
        }
Example #2
0
 public static string IndexHourToString(int i, bool getEndTime = false)
 {
     return(TimeFactory.FromIndex(i, getEndTime).ToString());
 }