private void ProcessRecurringCalendarItem(Appointment targetAppointment, CalendarItemType calendarItem, RadScheduler owner, ICollection <Appointment> instances) { targetAppointment.RecurrenceState = RecurrenceState.Master; RecurrencePattern pattern = calendarItem.Recurrence.Item.ConvertToRecurrencePattern(); RecurrenceRange range = calendarItem.Recurrence.Item1.ConvertToRecurrenceRange(); range.EventDuration = targetAppointment.Duration; range.Start = targetAppointment.Start; RecurrenceRule rrule = RecurrenceRule.FromPatternAndRange(pattern, range); if (calendarItem.ModifiedOccurrences != null) { foreach (CalendarItemType modifiedOccurrence in GetModifiedOccurrences(calendarItem)) { foreach (Appointment aptException in CreateAppointmentsFromCalendarItem(owner, modifiedOccurrence)) { aptException.RecurrenceState = RecurrenceState.Exception; aptException.RecurrenceParentID = calendarItem.ItemId.Id; instances.Add(aptException); } rrule.Exceptions.Add(modifiedOccurrence.OriginalStart); } } if (calendarItem.DeletedOccurrences != null) { foreach (DeletedOccurrenceInfoType occurenceInfo in calendarItem.DeletedOccurrences) { rrule.Exceptions.Add(occurenceInfo.Start); } } targetAppointment.RecurrenceRule = rrule.ToString(); }
/// <summary> /// Gets the recurrence rule for this control instance. /// </summary> /// <param name="startDate">The start date of the event in question.</param> /// <param name="endDate">The end date of the event in question.</param> /// <returns>The recurrence rule for the event in question</returns> internal RecurrenceRule GetRecurrenceRule(DateTime startDate, DateTime endDate) { return(RecurrenceRule.FromPatternAndRange(this.Pattern, this.GetRange(startDate, endDate))); }