Пример #1
0
        public static IEnumerable<ScheduleRow> FromTable(ScheduleTable table, CQ tableElement)
        {
            var groupedItems = FromTable(tableElement).GroupBy(x => new { x.StartTime, x.EndTime }).ToList();

            foreach (var group in groupedItems)
            {
                var items = group.GroupBy(x => x.Title).Select(x => x.First()).ToList();

                string title = $"{group.Key.StartTime.ToString(@"hh\:mm")} - {group.Key.EndTime.ToString(@"hh\:mm")}";

                yield return new ScheduleRow(table, title, items);
            }
        }
Пример #2
0
        private static ScheduleTable FromScheduleDay(ScheduleTableDay scheduleTableDay)
        {
            string title = scheduleTableDay.TitleElement.Text();

            var headers = GetHeaders(scheduleTableDay.TableElement).ToList();

            var scheduleTable = new ScheduleTable(title, headers);

            var rows = ScheduleRow.FromTable(scheduleTable, scheduleTableDay.TableElement).ToList();
            foreach (var row in rows)
            {
                scheduleTable.Rows.Add(row);
            }

            return scheduleTable;
        }
Пример #3
0
        public ScheduleRow(ScheduleTable table, string title, IList<ScheduleItem> items)
        {
            if (table == null)
            {
                throw new ArgumentNullException(nameof(table));
            }
            if (title == null)
            {
                throw new ArgumentNullException(nameof(title));
            }
            if (items == null)
            {
                throw new ArgumentNullException(nameof(items));
            }

            this.Table = table;
            this.Title = title;
            this.Items = items;
        }