Print Page | Close Window

How to Modify m_pRPattern.RemoveAllExceptions

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Calendar
Forum Description: Topics Related to Codejock Calendar
URL: http://forum.codejock.com/forum_posts.asp?TID=6073
Printed Date: 21 December 2024 at 9:50pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: How to Modify m_pRPattern.RemoveAllExceptions
Posted By: dangier
Subject: How to Modify m_pRPattern.RemoveAllExceptions
Date Posted: 10 January 2007 at 6:08pm

I'm using the VB6 ActiveX Xtreme Calendar Control. The current code behind the btnOK button of frmEditRecurrence is:

Private Sub btnOK_Click()
    UpdatePatternFromControls
   
    If m_pRPattern.Exceptions.Count > 0 Then
        Dim nRes
        nRes = MsgBox("This series will be updated. Is this OK?", vbOKCancel)
        If nRes = vbCancel Then
            Exit Sub
        End If

        m_pRPattern.RemoveAllExceptions
    End If
   
    m_pMasterEvent.UpdateRecurrence m_pRPattern
    ''=====================================================
    Unload Me
I want to modify the frmEditRecurrence form so that if a user wants to edit a series, only the recurrence events from the current calendar date forward are changed (not any historical recurrences for that event).
 
I know this is not an Outlook behavior, but it's a very critical one for the project I'm working on.
 
Any idea how I could modify the btnOK code to store the old recurrence series and create a new recurrence series?
 
Your guidance is sincerely appreciated.
 



Replies:
Posted By: sserge
Date Posted: 11 January 2007 at 8:58am
Hi,

The solution would be similar to what I've described for you in IssueTrack could weeks earlier:

1. An easy solution.

To store previous recurrence events you have to divide existing series to 2 parts:
a) Old recurrence series - finished at a current date;
b) New recurrence series - started at current date.
So far there will be 2 operations:
a) modify the end date for existing MasterEvent->RecurrencePattern without calling RemoveAllExceptions;
b) create a copy of changed series (with Recurrence) starting from the current date;

2. Yet another solution.
Use an existing master event.
a. Get collection of all backward (historical) recurrence events (exception or occurrences).
b. Modify master event using new properties. (Commit it to data provider)
c. Get collection of all backward (historical) recurrence events for new series.
d. for each event from collection "c" add event from collection "a" as an exception.
  if "c" has more events than "a" rest events from "c" add as deleted exceptions.
  if "a" has more events than "c" rest events from "a" add as exceptions which are not related to any occurrence.
  (Commit it to data provider)

You see that the second way is complex. And if your 'historical' events collection will grows up to 100-200... events for each master event this may slow down performance.

I recommend you way 1, it is easier. But if you need to have only one master event for each series - use way 2.

--
WBR,
Serge


Posted By: dangier
Date Posted: 15 January 2007 at 1:23pm

Hi Serge,

Thank you for your response. I apologize for the redundancy. I missed your earlier message due to hosting email issues.
 
Your reply is greatly appreciated!


Posted By: dangier
Date Posted: 17 January 2007 at 9:48am

As you can probably guess, I'm fairly new to VB6, but working my way through it.

I'm using your first solution and successfully modified the begin and end dates for an existing MasterEvent -> RecurrencePattern.

I've been struggling with creating a copy of the changed series. Would you please give me a sample of code to get me started in the right direction? Do I use the CalendarControl.DataProvider.CreateEvent method?

The more I work through this Xtreme Calendar Control, the more impressed I am it. Thank you for all your help!



Posted By: sserge
Date Posted: 17 January 2007 at 5:30pm
Please look at our VB Sample, frmMain, Form_Load
 
There are 2 samples how to create a recurrence
 
1. A simple one after line
    If bAddRecurrenceEvent Then
 
2. An extended one is commented, after line
    ' extended recurrence example:
  Uncomment it and play :) 
 
These 2 peces of code are designed to help understand recurrence ideas.
 
3. And after that you can take a look at forms which edit events and recurrence for more details.

--
WBR,
Serge


Posted By: dangier
Date Posted: 17 January 2007 at 7:27pm
Thank you, Serge. I've been looking at forms that edit events and recurrence for bits of code. And your direction helps.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net