Print Page | Close Window

Possible ID bug when cloning event using mouse

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=4973
Printed Date: 29 May 2024 at 1:08am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Possible ID bug when cloning event using mouse
Posted By: zeko78
Subject: Possible ID bug when cloning event using mouse
Date 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
 



Replies:
Posted By: sserge
Date 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


Posted By: zeko78
Date 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


Posted By: sserge
Date 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



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