The moment you were typing the reply.. i found out the difference.
if you do a ChangeEvent(masterEvent)... it overrides the exceptions.. This is causing problems whereby i want to change only details of the series.. like the title.. .and when i do a changeEvent.. i lose my exceptions.. There are work arounds.. but expensive in development time and execution time also.
In the previous version, it was alright
CalendarEvent masterEv = CalendarControl.DataProvider.CreateEvent();
//DateTime tempdate = DateTime.Now;
masterEv = CalendarControl.DataProvider.CreateEvent();
masterEv.Subject = "Master Ev";
masterEv.Location = "Master Loca";
masterEv.ScheduleID = 1;
CalendarRecurrencePattern RecurEv = masterEv.CreateRecurrence();
DateTime dtStart = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 13, 8, 0);
DateTime dtRecurencePattern_Start = new DateTime(DateTime.Now.Ticks);
// duration
// RecurEv.StartTime = DateTime.Now;
RecurEv.DurationMinutes = 60;
// period
dtRecurencePattern_Start = DateTime.Now.AddDays(-4);
RecurEv.StartDate = dtRecurencePattern_Start;
dtRecurencePattern_Start = DateTime.Now.AddDays(10);
RecurEv.StartTime = dtRecurencePattern_Start;
RecurEv.EndDate = dtRecurencePattern_Start;
RecurEv.Options.RecurrenceType = CalendarRecurrenceType.xtpCalendarRecurrenceDaily;
RecurEv.Options.DailyEveryWeekDayOnly = false;
RecurEv.Options.DailyIntervalDays = 1;
masterEv.UpdateRecurrence(RecurEv);
CalendarControl.DataProvider.AddEvent(masterEv);
// CalendarControl.DataProvider.ChangeEvent(masterEv);
/************/
/************/
// CalendarEvent excepEv = CalendarControl.DataProvider.CreateEventEx(masterEv.Id);
CalendarEvent excepEv = CalendarControl.DataProvider.CreateEvent();
excepEv.StartTime = dtRecurencePattern_Start.AddDays(-9);
excepEv.EndTime = dtRecurencePattern_Start.AddDays(-9).AddMinutes(60);
excepEv.Subject = "Excep Ev";
excepEv.ScheduleID = 2;
excepEv.MakeAsRExceptionEx(RecurEv.Id);
// excepEv.RExceptionEndTimeOrig = dtRecurencePattern_Start.AddDays(-10).AddMinutes(60);
//excepEv.RExceptionStartTimeOrig = dtRecurencePattern_Start.AddDays(-10);
excepEv.StartTime = dtRecurencePattern_Start.AddDays(-9).AddMinutes(180);
excepEv.EndTime = dtRecurencePattern_Start.AddDays(-9).AddMinutes(240);
//excepEv.RExceptionDeleted = true;
CalendarControl.DataProvider.ChangeEvent(excepEv);
// CalendarControl.DataProvider.ChangeEvent(masterEv);
excepEv = CalendarControl.DataProvider.CreateEvent();
excepEv.StartTime = dtRecurencePattern_Start.AddDays(-8);
excepEv.EndTime = dtRecurencePattern_Start.AddDays(-8).AddMinutes(60);
excepEv.Subject = "Excep Ev";
excepEv.MakeAsRExceptionEx(RecurEv.Id);
// excepEv.RExceptionEndTimeOrig = dtRecurencePattern_Start.AddDays(-10).AddMinutes(60);
//excepEv.RExceptionStartTimeOrig = dtRecurencePattern_Start.AddDays(-10);
excepEv.StartTime = dtRecurencePattern_Start.AddDays(-8).AddMinutes(-180);
excepEv.EndTime = dtRecurencePattern_Start.AddDays(-8).AddMinutes(-120);
//excepEv.RExceptionDeleted = true;
CalendarControl.DataProvider.ChangeEvent(excepEv);
CalendarControl.DataProvider.ChangeEvent(masterEv);
|
If you remove the last line, it will work...
Thanks
WaaZ
|