Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Calendar
  New Posts New Posts RSS Feed - Possible ID bug when cloning event using mouse
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Possible ID bug when cloning event using mouse

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


Joined: 21 August 2006
Location: Norway
Status: Offline
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote zeko78 Quote  Post ReplyReply Direct Link To This Post Topic: Possible ID bug when cloning event using mouse
    Posted: 05 September 2006 at 4:21pm
Hi Serge,
 
I've discovered some weird behaviour/possible bug.
 
I'm using a custom dataprovider.
 
When I clone an event by holding down Ctrl and clicking/dragging an event so that it is "cloned", the new event passed to DoCreateEvent has the same ID as the "old" event. Also the parameter NewEventID contains the id of the old event.
 
However, if I again clone the newly created event by clicking/dragging it, a new ID is sent to DoCreateEvent (this ID is a totaly new ID, as expected).
 
So it seems that the first time you clone an event the ID of the original event is passed to DoCreateEvent...
 
This doesn't look right to me
 
Best regards,
Gøran
 
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: 06 September 2006 at 6:59am
Hi,

This is not a bug, but a feature
 
Custom data provider expects that DoCreateEvent() is responsible for assigning proper new event ID value.
 
The ID which is passed to DoCreateEvent is some ID (temporary id or existing event ID).
 
Inside DoCreateEvent you must set unique value to NewEventID. Generally this is AutoKey field from your database.

--
WBR,
Serge
Back to Top
zeko78 View Drop Down
Groupie
Groupie


Joined: 21 August 2006
Location: Norway
Status: Offline
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote zeko78 Quote  Post ReplyReply Direct Link To This Post Posted: 06 September 2006 at 4:58pm
Ok, no bug then
 
This gives me a nice little problem.
 
The thing is that we're collection data from various tables to be presented in the calendar. Some data is fetched from a table, added as "temporary" events, and should not be stored in the same table as the events the user creates in the calendar.
 
Since the "cloned" event sent to DoCreateEvent looks exactly the same as the original (including id, modified time, customproperties and such) I don't know wheter or not this event should be saved...
 
Is there a way to add an event without triggering DoCreateEvent?
 
Or, some way to uniquely identify the cloned event (at the time DoCreateEvent is triggered)?
 
Also, what is the correct place to fetch all my stored events when the Calendar is first opened? My dataprovider is "Provider=custom;Data Source=custom", and I don't find an event which would "ask" me to retreive all stored events to populate the calendar. Instead I do this using CreateEventEx after the dataprovider has been created/opened.
 
 
Best regards,
Gøran
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: 07 September 2006 at 11:36am
Ok, please take a look into http://codejock.com/support/articles/com/calendar/cp_3.asp

One of the main ideas is not to store all events in calendar,
but to ask them for visible days only: see DoRetrieveDayEvents.
See also our samples about how to implement it.
Do not call DoRetrieveDayEvents for one day many times (this is slow) custom data provider has a cache. DoRetrieveDayEvents called once for each day.

NOTE:
CreateEvent, CreateEventEx create a new event object related to this data provider.
They are not not add event to storage.
See also AddEvent. But it call DoCreateEvent, DoUpdateEvent inside

--
WBR,
Serge
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.188 seconds.