Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Calendar
  New Posts New Posts RSS Feed - How to Modify m_pRPattern.RemoveAllExceptions
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to Modify m_pRPattern.RemoveAllExceptions

 Post Reply Post Reply
Author
Message
dangier View Drop Down
Groupie
Groupie


Joined: 10 January 2007
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote dangier Quote  Post ReplyReply Direct Link To This Post Topic: How to Modify m_pRPattern.RemoveAllExceptions
    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.
 
Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
dangier View Drop Down
Groupie
Groupie


Joined: 10 January 2007
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote dangier Quote  Post ReplyReply Direct Link To This Post 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!
Back to Top
dangier View Drop Down
Groupie
Groupie


Joined: 10 January 2007
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote dangier Quote  Post ReplyReply Direct Link To This Post 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!

Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
dangier View Drop Down
Groupie
Groupie


Joined: 10 January 2007
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote dangier Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.141 seconds.