Пример #1
0
        private Dictionary <int, Week> PrepareWeeks(List <DayItem> items)
        {
            DateTime now = DateTime.Now;
            int      currentWeekNumber = Date.GetWeekNumber(now.Year, now.Month, now.Day);

            Dictionary <int, Week> weeks = new Dictionary <int, Week>();

            foreach (DayItem dayItem in items)
            {
                if (!weeks.ContainsKey(dayItem.Week))
                {
                    weeks.Add(dayItem.Week, new Week(dayItem.Week, dayItem.Week == currentWeekNumber));
                }

                Week week = weeks[dayItem.Week];
                week.AddDayItem(dayItem);
            }

            return(weeks);
        }