public AppointmentItem CreateAppointmentPattern(string subj, int categoryId) {
AppointmentItem apt = new AppointmentItem(AppointmentType.Pattern);
apt.Start = DateTime.Today.AddHours(9);
apt.End = apt.Start.AddMinutes(5);
apt.Subject = subj;
apt.LabelId = categoryId;
return apt;
}
// An appointment is set every 3 hours. Five occurrences.
AppointmentItem apt1 = CreateAppointmentPattern("Every 3 hours. Five occurrences.", 1);
apt1.SetRecurrenceInfo(RecurrenceBuilder.Hourly(apt1.Start, 5).Interval(3).Build());
scheduler.AppointmentItems.Add(apt1);
// An appointment is set every 5 hours. Infinite (no end date).
AppointmentItem apt2 = CreateAppointmentPattern("Every 5 hours. Infinite (no end date).", 1);
apt3.SetRecurrenceInfo(RecurrenceBuilder.Hourly(apt2.Start).Interval(5).Build());
scheduler.AppointmentItems.Add(apt2);
// An appointment is set every hour. Appointment series duration is 24 hours.
AppointmentItem apt3 = CreateAppointmentPattern("Every hour. Series duration is 24 hours.", 1);
apt3.SetRecurrenceInfo(RecurrenceBuilder.Hourly(apt3.Start, apt3.Start.AddHours(24)).Build());
scheduler.AppointmentItems.Add(apt3);
Public Function CreateAppointmentPattern(ByVal subj As String, ByVal categoryId As Integer) As AppointmentItem
Dim apt As New AppointmentItem(AppointmentType.Pattern)
apt.Start = Date.Today.AddHours(9)
apt.End = apt.Start.AddMinutes(5)
apt.Subject = subj
apt.LabelId = categoryId
Return apt
End Function
' An appointment is set every 3 hours. Five occurrences.
Private apt1 As AppointmentItem = CreateAppointmentPattern("Every 3 hours. Five occurrences.", 1)
apt1.SetRecurrenceInfo(RecurrenceBuilder.Hourly(apt1.Start, 5).Interval(3).Build())
scheduler.AppointmentItems.Add(apt1)
' An appointment is set every 5 hours. Infinite (no end date).
Dim apt2 As AppointmentItem = CreateAppointmentPattern("Every 5 hours. Infinite (no end date).", 1)
apt3.SetRecurrenceInfo(RecurrenceBuilder.Hourly(apt2.Start).Interval(5).Build())
scheduler.AppointmentItems.Add(apt2)
' An appointment is set every hour. Appointment series duration is 24 hours.
Dim apt3 As AppointmentItem = CreateAppointmentPattern("Every hour. Series duration is 24 hours.", 1)
apt3.SetRecurrenceInfo(RecurrenceBuilder.Hourly(apt3.Start, apt3.Start.AddHours(24)).Build())
scheduler.AppointmentItems.Add(apt3)