Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic two calendars two views (Read 2636 times)
elpuerco
Junior Member
**
Offline


Time?  What's time matta
to a pig?

Posts: 94
Joined: Oct 2nd, 2007
two calendars two views
Nov 27th, 2007 at 7:28am
Print Post  
Hi, I feel I am missing something here re the planner control and not understanding the connection and would appreciate any help on offer.

I have two calendar, one in month view and one in timetableview.

The monthview calendar is only used to select a date and display in highlight if an appoint exists on a given date.

The timetableview calendar moves to the date selected on the monthview calendar and allows the user to drag entries from a combobox onto it to create appointments.

When appointments are created or deleted the monthview calendar is updated accordingly.

The problem is that when I first open the application the timetableview calendar is correctly updated from the underlying database by way of the LoadFromDatasource() method.

But the monthview calendar does not get updated thus resulting in no higlights to show where appointments exist.

I then thought I needed of course to call the LoadFromDatasource() method of the monthview calendar but I get this error:

Item has already been added. Key in dictionary:
'MindFusion.Scheduling.Appointment'  Key being added:
'MindFusion.Scheduling.Appointment'

Here is the code for the refresh button I use to test it:

Code
Select All
If MessageBox.Show("Refreshing delivery schedule from database will overwrite displayed schedule, do you wish to continue.", "Confirm Refresh", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) = Windows.Forms.DialogResult.Yes Then

		Me.calTimeTableView.Schedule.Clear()

		Me.PlannerSQLDataSet.Reminder.Clear()
		Me.PlannerSQLDataSet.Style.Clear()
		Me.PlannerSQLDataSet.CustomBrushes.Clear()
		Me.PlannerSQLDataSet.Contact.Clear()
		Me.PlannerSQLDataSet.Location.Clear()
		Me.PlannerSQLDataSet.Resource.Clear()
		Me.PlannerSQLDataSet.Task.Clear()
		Me.PlannerSQLDataSet.Item.Clear()
		Me.PlannerSQLDataSet.ItemContacts.Clear()
		Me.PlannerSQLDataSet.ItemResources.Clear()
		Me.PlannerSQLDataSet.Recurrence.Clear()
		Me.PlannerSQLDataSet.RecurrenceException.Clear()
		Me.PlannerSQLDataSet.RecurrenceExceptions.Clear()

		Me.ReminderTableAdapter1.Fill(Me.PlannerSQLDataSet.Reminder)
		Me.StyleTableAdapter1.Fill(Me.PlannerSQLDataSet.Style)
		Me.CustomBrushesTableAdapter1.Fill(Me.PlannerSQLDataSet.CustomBrushes)
		Me.ContactTableAdapter1.Fill(Me.PlannerSQLDataSet.Contact)
		Me.LocationTableAdapter1.Fill(Me.PlannerSQLDataSet.Location)
		Me.ResourceTableAdapter1.Fill(Me.PlannerSQLDataSet.Resource)
		Me.TaskTableAdapter1.Fill(Me.PlannerSQLDataSet.Task)
		Me.ItemTableAdapter1.Fill(Me.PlannerSQLDataSet.Item)
		Me.ItemContactsTableAdapter1.Fill(Me.PlannerSQLDataSet.ItemContacts)
		Me.ItemResourcesTableAdapter1.Fill(Me.PlannerSQLDataSet.ItemResources)
		Me.RecurrenceTableAdapter1.Fill(Me.PlannerSQLDataSet.Recurrence)
		Me.RecurrenceExceptionTableAdapter1.Fill(Me.PlannerSQLDataSet.RecurrenceException)
		Me.RecurrenceExceptionsTableAdapter1.Fill(Me.PlannerSQLDataSet.RecurrenceExceptions)

		Me.calTimeTableView.LoadFromDataSource()

		Me.calMonthView.LoadFromDataSource()

		MessageBox.Show("The delivery schedule has been refreshed", "Successful Refresh", MessageBoxButtons.OK, MessageBoxIcon.Information)

	  End If

 




Have I totally misunderstood how these things work?

Thanks







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


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: two calendars two views
Reply #1 - Nov 27th, 2007 at 8:05am
Print Post  
If you are using the same schedule for both views, there is no need to load it twice. However, once the schedule is loaded, you have to update the Monthly view so that the appropriate dates are bold.

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: two calendars two views
Reply #2 - Nov 27th, 2007 at 8:33am
Print Post  
Fandabbydosey Smiley  thanks Meppy  Grin

Code
Select All
 For Each ni In Me.calTimeTableView.Schedule.Items

		    ProcessItemCreated(ni)

 Next
 

  
Back to top
 
IP Logged
 
Leo
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 4
Joined: Aug 30th, 2006
Re: two calendars two views
Reply #3 - Dec 7th, 2007 at 9:18am
Print Post  
Good afternoon,
I have the same error, by using a code like this:


       Dim appp As New MindFusion.Scheduling.Appointment

       Dim no As DateTime = Now
       appp.StartTime = no
       appp.EndTime = DateAdd(DateInterval.Hour, 1, no)
       appp.Subject = "Subject #1"
       appp.HeaderText = "Header #1"
       appp.DescriptionText = "Descr #1"
       Cal01.Schedule.Items.Add(appp)

       appp.StartTime = DateAdd(DateInterval.Day, 5, no)
       appp.EndTime = DateAdd(DateInterval.Hour, 5, appp.StartTime)
       appp.Subject = "Subject #2"
       appp.HeaderText = "Header #2"
       appp.DescriptionText = "Descr #2"
       Cal01.Schedule.Items.Add(appp)



If I comment the second part it works fine.
Problably something is not clear to me.

Thanks in advance for any help.

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


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: two calendars two views
Reply #4 - Dec 7th, 2007 at 9:50am
Print Post  
You have to create another Appointment object before the second block. Otherwise you will try to add the same appointment twice.

Code
Select All
Dim appp As New MindFusion.Scheduling.Appointment

Dim no As DateTime = Now
appp.StartTime = no
appp.EndTime = DateAdd(DateInterval.Hour, 1, no)
appp.Subject = "Subject #1"
appp.HeaderText = "Header #1"
appp.DescriptionText = "Descr #1"
Cal01.Schedule.Items.Add(appp)

appp = New MindFusion.Scheduling.Appointment

appp.StartTime = DateAdd(DateInterval.Day, 5, no)
appp.EndTime = DateAdd(DateInterval.Hour, 5, appp.StartTime)
appp.Subject = "Subject #2"
appp.HeaderText = "Header #2"
appp.DescriptionText = "Descr #2"
Cal01.Schedule.Items.Add(appp) 



Meppy
  
Back to top
 
IP Logged
 
Leo
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 4
Joined: Aug 30th, 2006
Re: two calendars two views
Reply #5 - Dec 7th, 2007 at 10:50am
Print Post  
Wonderfull! Now it's clear.


Thank you very much.
leo
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint