Exemplo n.º 1
0
        public void AddEvents(SupportEvent supportEvent)
        {
            Events.Add(supportEvent);
            if (supportEvent.OldWeekendDefinition)
            {
                OldWeekendDefinition = supportEvent.OldWeekendDefinition; // predpoklad je ze v celem mesici je definice stejna !!!
            }
            var supportType = supportEvent.SupportType;

            if (DaysByType.ContainsKey(supportType))
            {
                DaysByType[supportType]++;
            }
        }
Exemplo n.º 2
0
        private void Parse(ICSCalendar calendar)
        {
            Calendar.Clear();
            //2017.09.01 je prvni den pocitani supportu
            var validCalendar = calendar.Events.Where(e => e.StartDate > new DateTime(2017, 8, 31)).OrderBy(e => e.StartDate.Year).ThenBy(e => e.StartDate.Month);

            foreach (ICSEvent icsEvent in validCalendar)
            {
                var supportEvent = new SupportEvent(icsEvent, Holidays.IsHoliday(icsEvent.StartDate));
                var key          = $"{supportEvent.Date.Year}/{supportEvent.Date.Month}";
                if (!Calendar.ContainsKey(key))
                {
                    Calendar[key] = new List <SupportEvent>();
                }
                Calendar[key].Add(supportEvent);
            }

            CalendarDefinitions = calendar.Definition;
        }