modify recurrence rule

Good day!

I'm currently working on an appointment calendar, I am able to add appointments with recurring dates (yearly) without any problems
What I want to do now is to modify the yearly recurrence rule.  Let's say I set an appointment date for every 10th day of November starting the year 2015.  Now, what I need is to modify that appointment date for the current year (e.g. 2017).  I would modify it that the appointment date will fall on the 12th day of November, but the succeeding appointment dates for the succeeding years will still fall on the 10th day of November.  I've read some of the documentation you had and I checked the "EXDATE" parameter but I'm not sure that that's what I'm looking for and I just can't seem to make it work.

Thank you very much and hope you can help me with this problem of mine as I really, really loved your controls.


- Mike


6 Replies

MG Mohanraj Gunasekaran Syncfusion Team November 14, 2017 01:01 PM UTC

Hi Mike, 

Thanks for using Syncfusion product. 

We can reproduce your scenario. And, we have confirmed this is a bug so we have logged the bug report for this issue and it will be available on our next release 2018 Vol 1 and you can expect this release on or before first week of February month. 

Please let us know if you have any concerns. 

Regards, 
Mohanraj G 



MI mike November 15, 2017 12:46 AM UTC

Is there any work around to this so I can achieve this result?

What I need is to edit only one (1) recurrence



MI mike November 15, 2017 10:04 AM UTC

What I want to achieve is this:

  • Create an appointment for "Appointment 1" that recurs YEARLY on November 5 starting year 2010 until 2020 EXCEPT for the year 2016 which will fall on November 2, and then continue recurring  on November 5 2017 until 2020


If that is not possible then I can maybe do this:

  • Create an appointment for "Appointment 1" that recurs YEARLY on November 5 starting year 2010 until year 2015
  • Add another appointment "Appointment 2" on November 6, 2016
  • Add another recurring appointment "Appointment 3" that recurs YEARLY on November 5 starting year 2017 onwards

But, I cannot achieve this.  Can you help me with my problem?  Thanks.




MG Mohanraj Gunasekaran Syncfusion Team November 15, 2017 12:08 PM UTC

Hi Mike,  
 
Thanks for your update. 
 
We could understand your scenario.  By default, schedule control does not have the support to create different recurrence rule for an appointment (First case). But, you can achieve your scenario by using Appointment Recurrence Form and also you can achieve your requirement programmatically by creating the recurrence rule separately for appointments (Second case). Please refer the below suggestions, 
 
Suggestion 1: 
You can make recurring appointment for schedule control using Appointment Recurrence Form. Please refer the below screenshot, 
 
Screenshot 
 
 
 
Suggestion2 
Also, you can achieve this scenario programmatically using below code, 
 
Code example 
IRecurringScheduleAppointment item1 = new ArrayListAppointment(); 
item1.StartTime = new DateTime(2015, 1, 1); 
item1.EndTime = new DateTime(2015, 1, 1); 
item1.RecurrenceRule = "01.01.2010;31.12.2015;Every YEAR on NOV 5"; 
item1.Subject = "Rule1"; 
item1.LabelValue = 1; 
item1.RecurringOnOverride = true; 
AddRecurrenceAppointment(item1); 
 
IRecurringScheduleAppointment item2 = new ArrayListAppointment(); 
item2.StartTime = new DateTime(2016, 1, 1); 
item2.EndTime = new DateTime(2016, 1, 1); ; 
item2.RecurrenceRule = "01.01.2016;31.12.2016;Every YEAR on NOV 6"; 
item2.Subject = "Rule2"; 
item2.LabelValue = 1; 
item2.RecurringOnOverride = true; 
AddRecurrenceAppointment(item2); 
 
IRecurringScheduleAppointment item3 = new ArrayListAppointment(); 
item3.StartTime = new DateTime(2017, 1, 1); 
item3.EndTime = new DateTime(2017, 1, 1); ; 
item3.RecurrenceRule = "01.01.2017;31.12.2020;Every YEAR on NOV 5"; 
item3.Subject = "Rule3"; 
item3.LabelValue = 1; 
item3.RecurringOnOverride = true; 
AddRecurrenceAppointment(item3); 
 
private void AddRecurrenceAppointment(IRecurringScheduleAppointment item) 
{ 
    DateTime date = this.scheduleControl1.Calendar.SelectedDates[this.scheduleControl1.Calendar.SelectedDates.Count - 1]; 
    scheduleProvider.AddNewRecurringAppointments(item, date); 
            
} 
 
 
Sample link: ScheduleControl 
 
Please let us know if you have any concerns. 
 
Regards, 
Mohanraj G 
 



MI mike November 16, 2017 04:14 AM UTC

Thank you for this snippet.
Another question, is it possible to edit/modify an existing recurring appointment?

Let's say "Rule 1" initially is set to recur from 2010 to 2017 every 5th day of November, then I will edit/modify it to recur only from 2010 to 2015.  Can this be done programatically?

Thank you so far for your kind help.


MG Mohanraj Gunasekaran Syncfusion Team November 17, 2017 12:30 PM UTC

Hi Mike,   
   
Thanks for your update.   
   
By default, ScheduleControl does not have the direct support to edit the recurring appointment based on the recurrence rule, but, you can achieve your scenario by using RemoveRecurringAppointments method to remove the old recurring appointment add the new recurrence appointment with recurrence rule. Please refer to the below code example,   
  
Code example   
IRecurringScheduleAppointment item1 = new ArrayListAppointment();   
item1.StartTime = new DateTime(2015, 1, 1);   
item1.EndTime = new DateTime(2015, 1, 1);   
item1.RecurrenceRule = "01.01.2010;31.12.2017;Every YEAR on NOV 5";   
item1.Subject = "Rule1";   
item1.LabelValue = 1;   
item1.RecurringOnOverride = true;   
item1.RecurrenceRuleID = this.scheduleProvider.GetUniqueID();   
AddRecurrenceAppointment(item1);   
   
IScheduleAppointmentList list = this.scheduleProvider.RecurringList;   
List<IRecurringScheduleAppointment> deleteItem = newList<IRecurringScheduleAppointment>();   
IRecurringScheduleDataProvider provider = this.scheduleControl1.DataSource asIRecurringScheduleDataProvider;   
foreach (IRecurringScheduleAppointment item in list)   
{   
     if (this.scheduleControl1.DataSource is IRecurringScheduleDataProvider)   
    {   
          //To identify that recurrence item using RecurrenceRuleID property.   
          if (item.RecurrenceRuleID == 1)   
          {   
                deleteItem.Add(item);   
            }   
     }   
}   
if (deleteItem.Count == 1)   
{   
     //To remove all the recurring appointment based on the specified recurring item   
     provider.RemoveRecurringAppointments(deleteItem[0]);   
     this.scheduleControl1.DataSource.IsDirty = true;   
      deleteItem[0] = null;   
      //To add new appointment with new recurrence rule.   
      this.AddNewAppointmnent();   
}   
//To update the changes in scheduleControl.   
this.scheduleControl1.GetScheduleHost().SetDataToDayPanels();   
 
   
Sample link: ScheduleControl   
   
Note:   
RecurrenceRuleId should be generated for every recurrence appointment to identify the specific appointment.   
  
Regards,   
Mohanraj G   
 


Loader.
Up arrow icon