Beispiel #1
0
        public static RecurrenceRangeBaseType CreateFromSchedulerRecurrenceRule(RecurrenceRule schedulerRule, RadScheduler owner)
        {
            RecurrenceRange schedulerRange = schedulerRule.Range;

            DateTime start = schedulerRange.Start;

            //DateTime start = owner.UtcDayStart(schedulerRange.Start);
            if (schedulerRule.Pattern.Frequency == RecurrenceFrequency.Monthly ||
                schedulerRule.Pattern.Frequency == RecurrenceFrequency.Yearly)
            {
                DateTime monthStart = new DateTime(schedulerRange.Start.Year, schedulerRange.Start.Month, 1, 0, 0, 0, DateTimeKind.Utc);
                start = monthStart;
            }

            if (schedulerRange.RecursUntil < DateTime.MaxValue)
            {
                EndDateRecurrenceRangeType range = new EndDateRecurrenceRangeType();
                range.StartDate = start;
                range.EndDate   = schedulerRange.RecursUntil.AddDays(-1);
                return(range);
            }

            if (schedulerRange.MaxOccurrences < int.MaxValue)
            {
                NumberedRecurrenceRangeType range = new NumberedRecurrenceRangeType();
                range.StartDate           = start;
                range.NumberOfOccurrences = schedulerRange.MaxOccurrences;
                return(range);
            }

            NoEndRecurrenceRangeType noEndRange = new NoEndRecurrenceRangeType();

            noEndRange.StartDate = start;

            return(noEndRange);
        }
		public static RecurrenceRangeBaseType CreateFromSchedulerRecurrenceRule(RecurrenceRule schedulerRule, RadScheduler owner)
		{
			RecurrenceRange schedulerRange = schedulerRule.Range;

			DateTime start = schedulerRange.Start;

			//DateTime start = owner.UtcDayStart(schedulerRange.Start);
			if (schedulerRule.Pattern.Frequency == RecurrenceFrequency.Monthly ||
				schedulerRule.Pattern.Frequency == RecurrenceFrequency.Yearly)
			{
				DateTime monthStart = new DateTime(schedulerRange.Start.Year, schedulerRange.Start.Month, 1, 0, 0, 0, DateTimeKind.Utc);
				start = monthStart;
			}

			if (schedulerRange.RecursUntil < DateTime.MaxValue)
			{
				EndDateRecurrenceRangeType range = new EndDateRecurrenceRangeType();
				range.StartDate = start;
				range.EndDate = schedulerRange.RecursUntil.AddDays(-1);
				return range;
			}

			if (schedulerRange.MaxOccurrences < int.MaxValue)
			{
				NumberedRecurrenceRangeType range = new NumberedRecurrenceRangeType();
				range.StartDate = start;
				range.NumberOfOccurrences = schedulerRange.MaxOccurrences;
				return range;
			}

			NoEndRecurrenceRangeType noEndRange = new NoEndRecurrenceRangeType();
			noEndRange.StartDate = start;

			return noEndRange;
		}