C#, SQL and RecurrencePatterns |
Post Reply |
Author | |
njcurrie
Newbie Joined: 18 September 2005 Status: Offline Points: 2 |
Post Options
Thanks(0)
Posted: 21 September 2005 at 3:10pm |
Hi Using a previous post in this forum as a guide I have created the necessary functions to handle the communication between the Calendar Control and my SQL Database. For example to Load the events I loop through the database and create a new event for each record in the table. I add a recurrence Pattern if the ReccurenceState is set to RecurrenceMaster. Now my problem occurs when I create a RecurrenceException inside the calendar control; What I do is I save the event as a new record to the database with its ReccurenceState set to RecurrenceException. When I try to load the RecurrenceException back into the Calendar Control. I can add it as an event no problem at all, I detect during the load that it is a RecurrenceException and run the MakeAsRException() function on the event. How do I add a Recurrence Exception to a Recurrence Pattern from an external database? Thanks NJC |
|
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
Hi,
The calendar events objects model, like tree is similar to the following: <Normal event> <Recurrence master event> <Recurrence pattern> <Recurrence occurrences list> - virtual events. They are not stored but generated by request. <Recurrence exception> - instances stored inside pattern and used when generating occurrences. Recurrence Exception event has a few special fields to connect to its occurrence: RExceptionStartTimeOrig, RExceptionEndTimeOrig, and of cause RecurrencePatternID. These fields mean original occurrence Start/End times (and of cause RecurrencePatternID is used there too) The event object has such properties but they are not in the interface. You cannot set them directly. When MakeAsRException() is called - event StartTime/EndTime is copied to RExceptionStartTimeOrig / RExceptionEndTimeOrig. Other thing is that you have call AddEvent only for Normal and Master events. For Exceptions/Occurrences you have to call ChangeEvent method. The logic is that firstly you add master event with recurrence pattern. After that all occurrences virtually exist. Then you call ChangeEvent() to change some occurrences and make them as exceptions. EXAMPLE: // sort your records by RecurrenceState to be shure that master event // will be added before ocurrences. // Master event processing pMasterEvent.CreateRecurrenceEx(pEve ntRS("RecurrencePatternID")); // ..... // Exception event processing pEvent.StartTime = pEventRS("RExceptionStartTimeOrig"); pEvent.EndTime = pEventRS("RExceptionEndTimeOrig"); pEvent.MakeAsRExceptionEx(pEventRS(" RecurrencePatternID")); pEvent.StartTime = pEventRS("StartDateTime"); pEvent.EndTime = pEventRS("EndDateTime"); pData.ChangeEvent(pEvent); NOTE: Unfortunately, following methods members for ActiveX control will be available only with the next release. CalendarEvent.CreateRecurrenceEx(Pat ternID As Long) CalendarEvent.MakeAsRExceptionEx(Pat ternID As Long) CalendarRecurrencePattern.Id CalendarRecurrencePattern.MasterEven tId Let me know whether this is clear. -- WBR, Serge |
|
njcurrie
Newbie Joined: 18 September 2005 Status: Offline Points: 2 |
Post Options
Thanks(0)
|
Serge Sorry for the delay in the reply I got diverted onto another project. Thanks for the explanation, it now all makes perfect sense. I can proceed with the current version and incorporate Recurrence Exceptions at a later date when the new release is available. Thanks for the help NJC Edited by njcurrie |
|
gshawn
Senior Member Joined: 04 October 2004 Status: Offline Points: 227 |
Post Options
Thanks(0)
|
I already sent you a PM about 10 minutes ago, but in case your popup blocker prevents you from seeing it: Version 9.80 was released a few hours ago. Check the Downloads section. Edited by gshawn |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |