Class RecurrenceHelper
Represents a helper for handling recurrence appointments.
Inheritance
Namespace: Syncfusion.UI.Xaml.Scheduler
Assembly: Syncfusion.SfScheduler.WPF.dll
Syntax
public static class RecurrenceHelper : Object
Methods
CreateRRule(RecurrenceProperties, DateTime, DateTime)
Method to generate RRule for recurrence appointment's.
Declaration
public static string CreateRRule(RecurrenceProperties recurrenceProperties, DateTime appStartTime, DateTime appEndTime)
Parameters
Type | Name | Description |
---|---|---|
RecurrenceProperties | recurrenceProperties | RecurrenceProperties for an appointment. |
System.DateTime | appStartTime | Start time of recurrence appointment. |
System.DateTime | appEndTime | End time of recurrence appointment. |
Returns
Type | Description |
---|---|
System.String | Recurrence rule string. |
GetOccurrenceAppointment(SfScheduler, Object, DateTime, DayOfWeek)
Get the occurrence appointment on specific date from the pattern appointment.
Declaration
public static ScheduleAppointment GetOccurrenceAppointment(SfScheduler scheduler, object patternAppointment, DateTime occurrenceDate, DayOfWeek firstDayOfWeek)
Parameters
Type | Name | Description |
---|---|---|
SfScheduler | scheduler | An instance of SfScheduler. |
System.Object | patternAppointment | Pattern appointment to get the occurrence appointment. |
System.DateTime | occurrenceDate | Date of occurrence appointment. |
System.DayOfWeek | firstDayOfWeek | An optional parameter that specifies the first day of the week for filtering the recurrence date-time collection. |
Returns
Type | Description |
---|---|
ScheduleAppointment | Returns specific occurrence ScheduleAppointment of the pattern appointment. For custom appointment, you can get the custom appointment detail from Data. |
Remarks
It returns null for non-recurrence appointments and when there is no occurrence appointment or exception date or exception appointment on given date.
Examples
The following example describes to get the occurrence appointment on specific date.
#[C#](#tab/tabid-1)DateTime appointmentDateTime = new DateTime(2020, 09, 1);
ScheduleAppointmentCollection appointments = new ScheduleAppointmentCollection();
appointments.Add(new ScheduleAppointment { Subject = "Meeting", StartTime = appointmentDateTime.Date.AddHours(9), EndTime = appointmentDateTime.Date.AddHours(11), RecurrenceRule = "FREQ=DAILY;INTERVAL=2", Id = 1 });
var occrrenceAppointment = RecurrenceHelper.GetOccurrenceAppointment(schedule, appointments[0], new DateTime(2020, 09, 24));
See Also
GetPatternAppointment(SfScheduler, Object)
Get the pattern appointment of specific occurrence appointment.
Declaration
public static ScheduleAppointment GetPatternAppointment(SfScheduler scheduler, object occurrenceAppointment)
Parameters
Type | Name | Description |
---|---|---|
SfScheduler | scheduler | An instance of SfScheduler. |
System.Object | occurrenceAppointment | Occurrence appointment to get pattern appointment. |
Returns
Type | Description |
---|---|
ScheduleAppointment | Returns the ScheduleAppointment pattern appointment of given occurrence appointment ,For custom appointment you can get the custom pattern appointment detail from Data. |
Examples
The following example describes to get the pattern appointment .
#[C#](#tab/tabid-2)DateTime appointmentDateTime = new DateTime(2020, 09, 1);
ScheduleAppointmentCollection appointments = new ScheduleAppointmentCollection();
appointments.Add(new ScheduleAppointment { Subject = "Meeting", StartTime = appointmentDateTime.Date.AddHours(9), EndTime = appointmentDateTime.Date.AddHours(11), RecurrenceRule = "FREQ=DAILY;INTERVAL=2", Id = 1 });
this.schedule.SchedulerContextMenuOpening += Schedule_SchedulerContextMenuOpening;
private void Schedule_SchedulerContextMenuOpening(object sender, SchedulerContextMenuOpeningEventArgs e)
{
if (e.MenuType == SchedulerContextMenuType.Appointment)
{
ScheduleAppointment patternAppointment = RecurrenceHelper.GetPatternAppointment(schedule, e.MenuInfo.Appointment);
}
}
See Also
GetRecurrenceDateTimeCollection(String, DateTime, Nullable<DateTime>, Nullable<DateTime>, Nullable<DateTime>, DayOfWeek)
Method to get recurrence appointment's date-time collection.
Declaration
public static IEnumerable<DateTime> GetRecurrenceDateTimeCollection(string rRule, DateTime recurrenceStartDate, Nullable<DateTime> specificStartDate = null, Nullable<DateTime> specificEndDate = null, Nullable<DateTime> recurrenceEndDate = null, DayOfWeek firstDayOfWeek)
Parameters
Type | Name | Description |
---|---|---|
System.String | rRule | RRule of Recurrence appointment's. |
System.DateTime | recurrenceStartDate | RangeStartDate of ScheduleAppointment's RecurrenceProperties. |
System.Nullable<System.DateTime> | specificStartDate | Optional parameter, can be passed to get the occurrences of recurrence appointment from specified start date of date ranges. |
System.Nullable<System.DateTime> | specificEndDate | Optional parameter, can be passed to get the occurrences of recurrence appointment up to the specified end date of date ranges. |
System.Nullable<System.DateTime> | recurrenceEndDate | An optional parameter can be passed to calculate the recurrence duration for get the occurrence start date time collection of a span recurrence appointment up to the specified start and end date ranges, when the occurrence start date time is not in between the specified visible start and end date ranges. |
System.DayOfWeek | firstDayOfWeek | An optional parameter that specifies the first day of the week for filtering the recurrence date-time collection. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.DateTime> | recurrence dates collection. |
RRuleParser(String, DateTime)
Method for Recurrence rule parser.
Declaration
public static RecurrenceProperties RRuleParser(string rRule, DateTime recStartDate)
Parameters
Type | Name | Description |
---|---|---|
System.String | rRule | Recurrence rule. |
System.DateTime | recStartDate | Recurrence start date. |
Returns
Type | Description |
---|---|
RecurrenceProperties | Recurrence properties. |