Example #1
0
        public List <List <Slot> > FetchSlotWeeksByMonth(int?curMonth)
        {
            var evexweeks = Org.GetExtra(DbUtil.Db, "ExcludeWeeks") ?? "";
            var exweeks   = evexweeks.Split(',').Select(ww => ww.ToInt()).ToArray();

            if (SortByWeek)
            {
                var weekSorted = from slot in FetchSlots()
                                 where !exweeks.Contains(slot.Week) && slot.Week == WeekNumber
                                 group slot by slot.Sunday into g
                                 where g.Any(gg => gg.Time >= DateTime.Today)
                                 orderby g.Key.WeekOfMonth(), g.Key
                select g.OrderBy(gg => gg.Time).ToList();

                return(weekSorted.ToList());
            }
            var monthWeeks = from slot in FetchSlotsByMonth(CurMonth)
                             where !exweeks.Contains(slot.Week)
                             group slot by slot.Sunday into g
                             where g.Any(gg => gg.Time >= DateTime.Today)
                             orderby g.Key.WeekOfMonth(), g.Key
            select g.OrderBy(gg => gg.Time).ToList();

            return(monthWeeks.ToList());
        }
Example #2
0
        public IEnumerable <List <Slot> > FetchSlotWeeks()
        {
            var evexweeks = Org.GetExtra(DbUtil.Db, "ExcludeWeeks") ?? "";
            var exweeks   = evexweeks.Split(',').Select(ww => ww.ToInt()).ToArray();

            return(from slot in FetchSlots()
                   where !exweeks.Contains(slot.Week)
                   group slot by slot.Sunday
                   into g
                   where g.Any(gg => gg.Time > DateTime.Today)
                   orderby g.Key
                   select g.OrderBy(gg => gg.Time).ToList());
        }