private List <Course> ParseInternal(DataSet dataSet)
        {
            var indexes        = new ExcelCoursesFileColumnIndexes(dataSet.Tables[0].Columns);
            var dayOfWeekMap   = CreateDayOfWeekMap();
            var rows           = dataSet.Tables[0].Rows;
            var courseIdToRows = new Dictionary <string, List <ParsedCourseRow> >(rows.Count);

            foreach (DataRow row in rows)
            {
                var parsedRow = ParseExcelRow(row, indexes, dayOfWeekMap);

                if (parsedRow == null) // can be null if there is no Time info (Day/StartHour/EndHour)
                {
                    continue;
                }

                List <ParsedCourseRow> courseGroups;
                if (courseIdToRows.TryGetValue(parsedRow.Id, out courseGroups))
                {
                    courseGroups.Add(parsedRow);
                }
                else
                {
                    courseGroups = new List <ParsedCourseRow>();
                    courseGroups.Add(parsedRow);

                    courseIdToRows.Add(parsedRow.Id, courseGroups);
                }
            }

            var courses = CreateCourses(courseIdToRows);

            return(courses);
        }
        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);
        }