Page Index Toggle Pages: [1] 2  Send TopicPrint
Hot Topic (More than 10 Replies) Recurrence Exceptions (Read 6951 times)
elpuerco
Junior Member
**
Offline


Time?  What's time matta
to a pig?

Posts: 94
Joined: Oct 2nd, 2007
Recurrence Exceptions
Jan 29th, 2008 at 1:21pm
Print Post  
Where or when does the exceptions get updated?

Here is my code that runs in response to a user selecting to delete a single occurrence or a series

In either event neither of them casue an error and the code runs on until the call to SaveToDataSource which then complains that an object is not set?


Code
Select All
Case DialogResult.Abort

    fd = New frmDeleteRecurrence

    If fd.ShowDialog(Me) = Windows.Forms.DialogResult.OK Then

	  If fd.DeleteOccurrenceSeries Then

		  e.Item.Recurrence = Nothing

	   Else

		  e.Item.Recurrence.MarkException(e.Item, True)

	   End If

End If
 



in order for this to work:

e.Item.Recurrence.MarkException(e.Item, True)

does a row need to exist already in the RecurrenceExceptions table or a do I have to create a RecurrenceException object and populate the fields manually?

Thanks




  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Recurrence Exceptions
Reply #1 - Jan 29th, 2008 at 1:38pm
Print Post  
The RecurrenceExceptions table should have been automatically populated after calling SaveToDataSource. What is the exact error you are getting when you are calling this method?

Meppy
  
Back to top
 
IP Logged
 
elpuerco
Junior Member
**
Offline


Time?  What's time matta
to a pig?

Posts: 94
Joined: Oct 2nd, 2007
Re: Recurrence Exceptions
Reply #2 - Jan 29th, 2008 at 1:49pm
Print Post  
The error happens on the SaveToDataSource call and reports:

'Object reference not set to an instance of an object'

If I leave all code in place but comment out the line

e.Item.Recurrence.MarkException(e.Item, True)

the SaveToDataSource works normally.

I am using a custom appointment form as well as a recurrence form.

But am following the same coding as in the Stock Form demo which detremines if a user want to delete a series or single occurence.

Is there something I need to do to create the RecurrenceExcpetion entry/object?

If I break just before the MarkException line the recurrence.exceptions count is zero but after the call it is 1 so that bit is working?


Is this similar to the post and the savetodatasource?

http://mindfusion.org/cgi/Forum/YaBB.pl?board=calnet_disc;action=display;num=119...
  
Back to top
 
IP Logged
 
elpuerco
Junior Member
**
Offline


Time?  What's time matta
to a pig?

Posts: 94
Joined: Oct 2nd, 2007
Re: Recurrence Exceptions
Reply #3 - Jan 29th, 2008 at 2:35pm
Print Post  
OK what I have found is this:

When I create a item and set it to a recurrence of a daily event to recur 3 times it is created corectly.

The item table has the single entry and the recurrence table has a single entry with its master set to 1405 which is the key of the related item.

Now I click on the second item displayed in the calendar and select to delete just that one occurrence.

The item table is updated with another row which relates to the exception and the new key values are 1406 and 1407 respectively.

However in the recurrence table the master value is still 1405.

so the updating is getting this far then falling over or am I not understanding this??

  
Back to top
 
IP Logged
 
elpuerco
Junior Member
**
Offline


Time?  What's time matta
to a pig?

Posts: 94
Joined: Oct 2nd, 2007
Re: Recurrence Exceptions
Reply #4 - Jan 29th, 2008 at 3:26pm
Print Post  
how do I send you a jpeg file so you can see the table data I have so I can pose some questions re the links please?

I do not know how to use the img tags?

Thanks
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Recurrence Exceptions
Reply #5 - Jan 30th, 2008 at 7:26am
Print Post  
I have modified the DataBinding sample so that you can now mark an item as deleted by right-clicking on it. The schedule then saves and loads correctly.

Each exception of a recurrence is saved as an individual item in the Items table so that the modified properties that caused the exception to occur are saved in the database as well. The recurrence record in the database still refers to the main item of the recurrence however.

As for the image, you might have to upload (host) the image on another site and refer to it using the following syntax:

Code
Select All
[img]http://site/image.format[/img] 


Meppy
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Recurrence Exceptions
Reply #6 - Jan 30th, 2008 at 7:27am
Print Post  
Here is the link to the modified DataBinding sample:

https://mindfusion.org/_samples/_sample_DataBinding2.zip

Meppy
  
Back to top
 
IP Logged
 
elpuerco
Junior Member
**
Offline


Time?  What's time matta
to a pig?

Posts: 94
Joined: Oct 2nd, 2007
Re: Recurrence Exceptions
Reply #7 - Jan 30th, 2008 at 8:33am
Print Post  
Thanks Meppy I really appreciate your time and input.

I spent a great deal of time last night stepping thru the databinding demo and my own app and got them both to stop at the same point.

I immediately found a difference between mine app and the demo.

The call to the MarkExcpeion method in the demo uses an Appointment object named app :

app.Recurrence.MarkException(app, True)

whereas I use this :

e.Item.Recurrence.MarkException(e.Item, True)

I don't fully understand the implications of my doing this, but to aid debugging I modified mine code to match the demo.

When comparing the parallel debugging I note the following differences:

The demo Appointment has a Attendee count of 1 and a Contact count of 1
My Appointment has both these set to zero as I do not have contacts or attendees.

The demo has the Appointment Location set to nothing
My Appointment has a location object set in this.

The demo Appointment has a StartDate without a time portion displayed
My Appointment StartDate displays both date and time.

Everything else looks OK.

However my Calendar is using Location as grouping.

Could this be the cause?

Thanks
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Recurrence Exceptions
Reply #8 - Jan 31st, 2008 at 6:03am
Print Post  
Is there a chance you can send me your project to support@mindfusion.eu with a detailed description on how to reproduce the problem you are facing so that I can inspect what is wrong and how it can be fixed?

Meppy
  
Back to top
 
IP Logged
 
elpuerco
Junior Member
**
Offline


Time?  What's time matta
to a pig?

Posts: 94
Joined: Oct 2nd, 2007
Re: Recurrence Exceptions
Reply #9 - Jan 31st, 2008 at 6:42am
Print Post  
Hi Meppy, I emailed the project to your meppy@ email address yesterday.

I was thinking over last night the reason behind why I was using a custom appointment and recurrence form rather than the inbuilt ones.

I think it was to allow myself more control over what I am doing and remove sections that do not need being available.  At the time we were not going to use recurrences.

I am going to try using the inbuilt forms today to see if they will do what we need.

However I found it labourious to cycle thr the controls to identify and disable the controls not required, contacts for example and not knowing what actual code runs when say for example the Recurrence buttons are fired as I am trying to update a monthview calandars highlights based on the changes made on a timetable view one.

The project I send has a lot of naff code in the item_click event which is in development only and will not stay that way!

Thansk
  
Back to top
 
IP Logged
 
elpuerco
Junior Member
**
Offline


Time?  What's time matta
to a pig?

Posts: 94
Joined: Oct 2nd, 2007
Re: Recurrence Exceptions
Reply #10 - Jan 31st, 2008 at 7:46am
Print Post  
Hi Meppy,

I am now using the inbuild appointment and recurrence forms in the same way as the demo databinding app and I get the same error?

The new item is created in the item table with an recurrence state of 2 and the original is there also set to 3.

In the recurrence table the master field still has the previous value of the original item key and there are not entries in the exceptions tables?

so to start:

item key = 1 recurrencestate = 3

recurrence master = 1

after change and attempted save

item key = 2 recurrencestate = 3
item key = 3 recurrencestate = 2

recurrence master = 1

nothing is writen to the exception tables probably due to the error?

Hope this helps....... ????





  
Back to top
 
IP Logged
 
elpuerco
Junior Member
**
Offline


Time?  What's time matta
to a pig?

Posts: 94
Joined: Oct 2nd, 2007
Re: Recurrence Exceptions
Reply #11 - Jan 31st, 2008 at 6:09pm
Print Post  
Well I have spent all day, and am still here now trying to figure out what is causing this?

I now have my app coded the same as the demo and it still errors when calling SaveToDataSource stating object not set to an instance of an object?

As I cannot see into the method I have absolutely no clue as to what object it is complaining about.

I really hope you have been able to see it first hand  with the files I sent and have some idea what the problem is.

I bet it will turn out to be some stupid setting or coding error on my part but I sure would love to know what it is!


Sad







  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Recurrence Exceptions
Reply #12 - Feb 1st, 2008 at 9:47am
Print Post  
We have just succeeded to start your application. It reads the database connection string from the registry instead of app.config, and there was some binding redirection setting applied that prevented us from loading the debug assemblies. These features weren't easy to discover 8)

To fix your problem, set RecurrenceExceptionsDataMember = "RecurrenceException" instead of "RecurrenceExceptions". All data member properties follow that pattern - the collection name (in plural) + DataMember property is set to a table named as the collection item class (in singular). The "RecurrenceExceptions" (in plural) table is used to keep track of the many-to-many relations between recurrent items and exceptions.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
elpuerco
Junior Member
**
Offline


Time?  What's time matta
to a pig?

Posts: 94
Joined: Oct 2nd, 2007
Re: Recurrence Exceptions
Reply #13 - Feb 1st, 2008 at 10:36am
Print Post  
YES!!!!!!!!!!!!!!!!!   Grin

That has resolved the problem, I knew it would end up being a typo or similar on my part, I just could not trace it!

The reason the connection string is in the registry is that it is possible the SQL Server address will change, as it has today in fact, so I have coded it to allow an admin user to redirect the app to the new SQL Server host.

Currently in design time it is pointing to a .mdf file on my hard disk but in release it will be across the network.

Thanks so much for this, hey tonight I will sleep like a babe Smiley

Cheers








  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Recurrence Exceptions
Reply #14 - Feb 1st, 2008 at 10:54am
Print Post  
That's great 8)

Just FYI, the .NET convention is to keep the connection string in the application's .config file. Visual Studio inserts the string there when you add a data source, and the admin user can edit the file instead of a registry key when moving the database.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint