Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) Databinding Resources (Read 8791 times)
lahai
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 17
Joined: May 13th, 2009
Databinding Resources
Jul 28th, 2009 at 7:38am
Print Post  
Hello
I am having issues with getting my calendar to pull the itemcontacts information from a mysql db. I get the items in the single month view however when I switch to resource view and try to group by contacts and show item assigneed to contact I do not get that info. Im sure I am just missing something...

here is the code in my page load:
Private Overloads Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
       Calendar1.Schedule.Clear()
       DataSet1.Clear()

       ReminderTableAdapter1.Fill(DataSet1.reminder)
       StyleTableAdapter1.Fill(DataSet1.style)
       CustombrushesTableAdapter1.Fill(DataSet1.custombrushes)
       ContactTableAdapter1.Fill(DataSet1.contact)
       LocationTableAdapter1.Fill(DataSet1.location)
       ResourceTableAdapter1.Fill(DataSet1.resource)
       TaskTableAdapter1.Fill(DataSet1.task)
       ItemTableAdapter1.Fill(DataSet1.item)
       ItemcontactsTableAdapter1.Fill(DataSet1.itemcontacts)
       ItemresourcesTableAdapter1.Fill(DataSet1.itemresources)
       RecurrenceTableAdapter1.Fill(DataSet1.recurrence)
       RecurrenceexceptionTableAdapter1.Fill(DataSet1.recurrenceexception)
       RecurrenceexceptionsTableAdapter1.Fill(DataSet1.recurrenceexceptions)



       'Calendar1.LoadFromDataSource()

       'Calendar1.BeginInit()
       'Calendar1.Contacts.Clear()
       'Calendar1.Contacts.Add(Calendar1.Schedule.Contacts(0))
       'Calendar1.Contacts.Add(Calendar1.Schedule.Contacts(2))
       'Calendar1.Contacts.Add(Calendar1.Schedule.Contacts(3))
       'Calendar1.Contacts.Add(Calendar1.Schedule.Contacts(4))
       'Calendar1.Contacts.Add(Calendar1.Schedule.Contacts(5))
       'Calendar1.Contacts.Add(Calendar1.Schedule.Contacts(6))
       'Calendar1.Contacts.Add(Calendar1.Schedule.Contacts(7))
       'Calendar1.Contacts.Add(Calendar1.Schedule.Contacts(8))
       'Calendar1.Contacts.Add(Calendar1.Schedule.Contacts(9))
       'Calendar1.Contacts.Add(Calendar1.Schedule.Contacts(10))
       'Calendar1.Contacts.Add(Calendar1.Schedule.Contacts(11))
       'Calendar1.Contacts.Add(Calendar1.Schedule.Contacts(12))
       'Calendar1.Contacts.Add(Calendar1.Schedule.Contacts(13))
       'Calendar1.Contacts.Add(Calendar1.Schedule.Contacts(14))
       'Calendar1.Contacts.Add(Calendar1.Schedule.Contacts(15))
       'Calendar1.Contacts.Add(Calendar1.Schedule.Contacts(16))
       'Calendar1.Contacts.Add(Calendar1.Schedule.Contacts(18))
       'Calendar1.Contacts.Add(Calendar1.Schedule.Contacts(19))
       'Calendar1.Contacts.Add(Calendar1.Schedule.Contacts(17))

       'Calendar1.GroupType = MindFusion.Scheduling.WinForms.GroupType.GroupByContacts
       'Calendar1.EndInit()


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


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Databinding Resources
Reply #1 - Jul 28th, 2009 at 12:16pm
Print Post  
Is there any reason to comment the grouping code or it simply doesn't work as it is now?

Meppy
  
Back to top
 
IP Logged
 
lahai
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 17
Joined: May 13th, 2009
Re: Databinding Resources
Reply #2 - Jul 28th, 2009 at 2:25pm
Print Post  
I commented it out just to try something new. I can get the contacts in the calendar through that method but not the items.
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Databinding Resources
Reply #3 - Jul 28th, 2009 at 3:14pm
Print Post  
I will test this out and get back to you with any results I might come upon.

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


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Databinding Resources
Reply #4 - Jul 29th, 2009 at 5:58am
Print Post  
Well, a code similar to the one you commented out seems to be the key to this problem. That is, when you load appointments and contacts back from the data source, you have to instruct the calendar to group by the newly loaded contacts and discard the previous ones:

Code
Select All
Calendar1.BeginInit()
Calendar1.Contacts.Clear()
Dim c as Contact
For Each c In _calendar.Schedule.Contacts
      Calendar1.Contacts.Add(c)
Next
Calendar1.EndInit() 



Meppy
  
Back to top
 
IP Logged
 
lahai
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 17
Joined: May 13th, 2009
Re: Databinding Resources
Reply #5 - Jul 29th, 2009 at 11:50am
Print Post  
Hey meppy,
I added your code and did the same thing for the items however I still dont get the items loaded in the view.

[tr]
Calendar1.BeginInit()
Calendar1.Contacts.Clear()
Calendar1.Schedule.Items.Clear()
Dim c As MindFusion.Scheduling.Contact
For Each c In Calendar1.Schedule.Contacts
Calendar1.Contacts.Add(c)
Next
Calendar1.GroupType = MindFusion.Scheduling.WinForms.GroupType.GroupByContacts

Dim a As MindFusion.Scheduling.Item
For Each a In Calendar1.Schedule.Items
Calendar1.Schedule.Items.Add(a)
Next

Calendar1.EndInit()
[/tr]
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Databinding Resources
Reply #6 - Jul 29th, 2009 at 2:19pm
Print Post  
Below is the complete loading code that works well for me:

Code
Select All
Calendar1.Schedule.Clear()
DataSet1.Clear()

ReminderTableAdapter1.Fill(DataSet1.reminder)
StyleTableAdapter1.Fill(DataSet1.style)
CustomBrushesTableAdapter1.Fill(DataSet1.customBrushes)
ContactTableAdapter1.Fill(DataSet1.contact)
LocationTableAdapter1.Fill(DataSet1.location)
ResourceTableAdapter1.Fill(DataSet1.resource)
TaskTableAdapter1.Fill(DataSet1.task)
ItemTableAdapter1.Fill(DataSet1.item)
ItemContactsTableAdapter1.Fill(DataSet1.itemcontacts)
ItemResourcesTableAdapter1.Fill(DataSet1.itemresources)
RecurrenceTableAdapter1.Fill(DataSet1.recurrence)
RecurrenceExceptionTableAdapter1.Fill(DataSet1.recurrenceexception)
RecurrenceExceptionsTableAdapter1.Fill(DataSet1.recurrenceexceptions)

Calendar1.LoadFromDataSource()

Calendar1.BeginInit()
Calendar1.Contacts.Clear()
Dim c As Contact
For Each c In Calendar1.Schedule.Contacts
      Calendar1.Contacts.Add(c)
Next
Calendar1.EndInit() 


Try it at your place and let me know if its working.

Regards,
Meppy
  
Back to top
 
IP Logged
 
lahai
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 17
Joined: May 13th, 2009
Re: Databinding Resources
Reply #7 - Jul 29th, 2009 at 2:44pm
Print Post  
No it doesn't. I pull in the contacts fine. Its just the items assigned to those contacts that do not populate the calendar. I can see the items on the other calendar views but not when I go into resource view.  I am running it on a mysql db and have the item contacts table with values in it.
  
Back to top
 
IP Logged
 
lahai
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 17
Joined: May 13th, 2009
Re: Databinding Resources
Reply #8 - Jul 30th, 2009 at 9:56am
Print Post  
Is there any other ideas on this Im at a lose and I am long overdue on delivering this project to my company after it was purchased. Any help is greatly  appreciated...
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Databinding Resources
Reply #9 - Jul 30th, 2009 at 11:30am
Print Post  
Is it possible to send your database and a sample project, which loads the date into the Calendar control, to meppy@mindfusion.eu? I will check here what might be wrong.

Regards,
Meppy
  
Back to top
 
IP Logged
 
lahai
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 17
Joined: May 13th, 2009
Re: Databinding Resources
Reply #10 - Jul 30th, 2009 at 9:39pm
Print Post  
Thanks Meppy. I have sent the project to your address.
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Databinding Resources
Reply #11 - Jul 31st, 2009 at 8:21am
Print Post  
I have inspected the project you sent me and the following modifications to the ContactsDataPropertyMap seem to work for me:

(Id) -> Key (instead of (Id) -> Id)

Try this at your place and let me know if there is any improvement. Do not forget to uncomment the code after the LoadFromDataSource call:

Code
Select All
Calendar1.BeginInit()
Calendar1.Contacts.Clear()
Dim c As MindFusion.Scheduling.Contact
For Each c In Calendar1.Schedule.Contacts
      Calendar1.Contacts.Add(c)
Next

Calendar1.GroupType = MindFusion.Scheduling.WinForms.GroupType.GroupByContacts
Calendar1.EndInit() 


Regards,
Meppy
  
Back to top
 
IP Logged
 
lahai
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 17
Joined: May 13th, 2009
Re: Databinding Resources
Reply #12 - Aug 2nd, 2009 at 4:09pm
Print Post  
Meppy,
I am still not getting the items in the calendar? have you noticed anything else? Were you running the mysql insert or access?
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Databinding Resources
Reply #13 - Aug 3rd, 2009 at 5:59am
Print Post  
There is one vital thing I forgot to mention about. In your xsd schema (within Visual Studio), you have to establish one-to-many relationship between the following table fields:

[item.Key] <-> [itemcontacts.Item]
[contact.Key] <-> [itemcontacts.Contact]

You can create the relationship by dragging with the mouse from one field to another.

I hope this will help,
Meppy
  
Back to top
 
IP Logged
 
lahai
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 17
Joined: May 13th, 2009
Re: Databinding Resources
Reply #14 - Aug 3rd, 2009 at 8:31pm
Print Post  
Thanks meppy.
It works now.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint