Print Page | Close Window

Exceptions

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=4167
Printed Date: 22 November 2024 at 3:41am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Exceptions
Posted By: WaaZ
Subject: Exceptions
Date Posted: 08 May 2006 at 7:12am

Has there been any change in the process of addind exceptions programatically?

The way it was being done in the previous version (9.8.2) is not working now on version 10.1.1

Thanks

WaaZ




Replies:
Posted By: sserge
Date Posted: 08 May 2006 at 11:20am
Hmm...
As I can see, neither Recurrence structure nor exceptions were not significantly changed, may be only some small fixes.

However, there were a lot of other data related changes like adding resources and schedules concepts.

Anyway, a couple simple tests I've tried right now works fine for me. So far, we need more details on your problems to say something.


ps: I can suppose only one problem related to recent changes -- now, if you use schedules, you have to set ScheduleID property both for master recurrence event and for exception event as well (the same value of course).

--
WBR,
Serge


Posted By: WaaZ
Date Posted: 08 May 2006 at 11:23am

The moment you were typing the reply.. i found out the difference.

if you do a ChangeEvent(masterEvent)... it overrides the exceptions.. This is causing problems whereby i want to change only details of the series.. like the title.. .and when i do a changeEvent.. i lose my exceptions.. There are work arounds.. but expensive in development time and execution time also.

In the previous version, it was alright

Quote

CalendarEvent masterEv = CalendarControl.DataProvider.CreateEvent();

//DateTime tempdate = DateTime.Now;

masterEv = CalendarControl.DataProvider.CreateEvent();

masterEv.Subject = "Master Ev";

masterEv.Location = "Master Loca";

masterEv.ScheduleID = 1;

CalendarRecurrencePattern RecurEv = masterEv.CreateRecurrence();

DateTime dtStart = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 13, 8, 0);

DateTime dtRecurencePattern_Start = new DateTime(DateTime.Now.Ticks);

// duration

// RecurEv.StartTime = DateTime.Now;

RecurEv.DurationMinutes = 60;

// period

dtRecurencePattern_Start = DateTime.Now.AddDays(-4);

RecurEv.StartDate = dtRecurencePattern_Start;

dtRecurencePattern_Start = DateTime.Now.AddDays(10);

RecurEv.StartTime = dtRecurencePattern_Start;

RecurEv.EndDate = dtRecurencePattern_Start;

RecurEv.Options.RecurrenceType = CalendarRecurrenceType.xtpCalendarRecurrenceDaily;

RecurEv.Options.DailyEveryWeekDayOnly = false;

RecurEv.Options.DailyIntervalDays = 1;

masterEv.UpdateRecurrence(RecurEv);

CalendarControl.DataProvider.AddEvent(masterEv);

// CalendarControl.DataProvider.ChangeEvent(masterEv);

/************/

/************/

// CalendarEvent excepEv = CalendarControl.DataProvider.CreateEventEx(masterEv.Id);

CalendarEvent excepEv = CalendarControl.DataProvider.CreateEvent();

excepEv.StartTime = dtRecurencePattern_Start.AddDays(-9);

excepEv.EndTime = dtRecurencePattern_Start.AddDays(-9).AddMinutes(60);

excepEv.Subject = "Excep Ev";

excepEv.ScheduleID = 2;

excepEv.MakeAsRExceptionEx(RecurEv.Id);

 

// excepEv.RExceptionEndTimeOrig = dtRecurencePattern_Start.AddDays(-10).AddMinutes(60);

//excepEv.RExceptionStartTimeOrig = dtRecurencePattern_Start.AddDays(-10);

excepEv.StartTime = dtRecurencePattern_Start.AddDays(-9).AddMinutes(180);

excepEv.EndTime = dtRecurencePattern_Start.AddDays(-9).AddMinutes(240);

//excepEv.RExceptionDeleted = true;

CalendarControl.DataProvider.ChangeEvent(excepEv);

// CalendarControl.DataProvider.ChangeEvent(masterEv);

excepEv = CalendarControl.DataProvider.CreateEvent();

excepEv.StartTime = dtRecurencePattern_Start.AddDays(-8);

excepEv.EndTime = dtRecurencePattern_Start.AddDays(-8).AddMinutes(60);

excepEv.Subject = "Excep Ev";

excepEv.MakeAsRExceptionEx(RecurEv.Id);

 

// excepEv.RExceptionEndTimeOrig = dtRecurencePattern_Start.AddDays(-10).AddMinutes(60);

//excepEv.RExceptionStartTimeOrig = dtRecurencePattern_Start.AddDays(-10);

excepEv.StartTime = dtRecurencePattern_Start.AddDays(-8).AddMinutes(-180);

excepEv.EndTime = dtRecurencePattern_Start.AddDays(-8).AddMinutes(-120);

//excepEv.RExceptionDeleted = true;

CalendarControl.DataProvider.ChangeEvent(excepEv);

CalendarControl.DataProvider.ChangeEvent(masterEv);

If you remove the last line, it will work...

Thanks

WaaZ



Posted By: sserge
Date Posted: 08 May 2006 at 2:36pm
Ok, let me note once more about master events...
Here is a hierarchy:

<master event> - contains a recurrence pattern inside itself.
    <recurrence pattern> - contains exceptions events inside itself
        <exception events collection>

CalendarControl.DataProvider.AddEvent(masterEv);  - add master event with empty exceptions collection
    ....  
CalendarControl.DataProvider.ChangeEvent(excepEv); - add exception to master event in the storage only.
                                                          masterEv object is not updated!
 
CalendarControl.DataProvider.ChangeEvent(masterEv); - this master event object has empty exceptions collection. This line kills exceptions in the storage.

This works in the same way in all calendar versions.

--
WBR,
Serge


Posted By: WaaZ
Date Posted: 14 May 2006 at 7:23am

But it was different from the previous version (9.8.1, 9.8.2)

ChangeEvent(masterEV) was not killing the exceptions in the storage. Now it is..

I manage to change the codes in my program to cater for that though.. it is alright now.




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