Ejemplo n.º 1
0
        public UnionTE Create()
        {
            var union = new UnionTE();
            var daysOfWeek = EnumExtensions.GetFlags(_event.DaysOfWeekOptions);
            var firstDayOfWeek = EnumExtensions.GetDayOfWeek(_event.FirstDayOfWeek);
            var weeklyIntervals = _event.RepeatInterval;
            if (weeklyIntervals > 0 && _event.StartDateTime != null)
            {
                foreach (DayOfWeekEnum day in daysOfWeek.Cast<DayOfWeekEnum>().OrderBy(e => e, new DayOfWeekEnumComparer(_event.FirstDayOfWeek)))
                {
                    var dayOfWeek = new DayInWeekTE(day, firstDayOfWeek, (DateTime)_event.StartDateTime, weeklyIntervals);
                    union.Add(dayOfWeek);
                }
            }
            else
            {
                foreach (DayOfWeekEnum day in daysOfWeek.Cast<DayOfWeekEnum>().OrderBy(e => e, new DayOfWeekEnumComparer(_event.FirstDayOfWeek)))
                {
                    var dayOfWeek = new DayOfWeekTE(day);
                    union.Add(dayOfWeek);
                }
            }

            return union;
        }
        public UnionTE Create()
        {
            var union = new UnionTE();
            var daysOfWeek = EnumExtensions.GetFlags(_event.DaysOfWeekOptions);
            var weeklyIntervals = _event.WeeklyIntervalOptions;
            if (weeklyIntervals > 1 && _event.FirstDateTime != null)
            {
                foreach (DayOfWeekEnum day in daysOfWeek)
                {
                    var dayOfWeek = new DayInWeekTE(day, (DateTime)_event.FirstDateTime, weeklyIntervals);
                    union.Add(dayOfWeek);
                }
            }
            else
            {
                foreach (DayOfWeekEnum day in daysOfWeek)
                {
                    var dayOfWeek = new DayOfWeekTE(day);
                    union.Add(dayOfWeek);
                }
            }

            return union;
        }