Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Contacts connected with the Appointement (Read 5199 times)
TwAwE
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 6
Joined: Jun 3rd, 2010
Contacts connected with the Appointement
Jun 3rd, 2010 at 12:18pm
Print Post  
Hi, I am a new entry, I come from Italy, sorry for my english.

I know how I can insert a contact on a Timetable control using vb.net but  I do not understand how can I connect it with a particular appointement.

I have tried to set the id of the appointement as id of the contact but do not exist the method to get it directly through the id, but only by index, and the problem is that when I want make some operation on the contact I must cicling all the contacts collection.

If you can help my also with the simple code i better.

Thanks in advance

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


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Contacts connected with the Appointement
Reply #1 - Jun 3rd, 2010 at 12:35pm
Print Post  
Hi,

To associate a contact with an item, add that contact to the Contacts collection of the item. The following code illustrates how:

Code
Select All
i.Contacts.Add(c) 


Let me know if this helps.

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


I love YaBB 1G - SP1!

Posts: 6
Joined: Jun 3rd, 2010
Re: Contacts connected with the Appointement
Reply #2 - Jun 3rd, 2010 at 3:32pm
Print Post  
I use an xml file as datasource for the timetable control and when I create an item (appointement) if I use the follow code, the contact do not be registrered on a file.

I post the code to create a new appointement with an associated contacts

Code
Select All
                'Reset the drag drop
                Me.Calendar.ResetDrag()

                'Oggetto / HeaderText
                e.item.HeaderText="MyTitle..."

                'Descrizione /DescriptionText
                 e.item.DescriptionText="MyDescription..."

                'Dichiaro un nuovo contatto / Declare a new contact
                Dim c As New Contact

                'Imposto i valori del contatto appena creato
                With c
                    .Id = e.item.Id
                    .Address = "MyAddress..."
                    .Email = "MyMail..."
                    .FirstName = "..."
                    .LastName = "..."
                    .Name = "..."
                    .Phone = "..."
                End With

                'Set the contact on the item
                e.item.Contacts.Add(c)

                'Start the process to create a file contains the appointement and the contacts

                Dim path As String = ....
                Dim a As New Xml.XmlDocument
                Schedulatore.Schedule.SaveTo(path.ToString, ContentType.Xml)

 




If at the code I add the follow row

Code
Select All
Me.Calendar.Contacts.Add(c)
 



The contact, when I create the file, is registrered, but I dont Know how can I filter the contact with the item click and eventually modified or deleted the record match

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


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Contacts connected with the Appointement
Reply #3 - Jun 4th, 2010 at 6:34am
Print Post  
I am not sure what you mean by "filter the contact with the item click".

You can access the contacts associated with the clicked item through the Item.Contacts collection. Then, when an item is clicked, you can inspect its associated contacts and perform the necessary operations.

Let me know if this helps.

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


I love YaBB 1G - SP1!

Posts: 6
Joined: Jun 3rd, 2010
Re: Contacts connected with the Appointement
Reply #4 - Jun 7th, 2010 at 1:19pm
Print Post  
Hi, I am come back,
I try to explain my problem with the code that I have writed(The follow code was been simplified):

On the event ItemCreated...
Code
Select All
Private Sub Calendario_ItemCreated(ByVal sender As Object, ByVal e As MindFusion.Scheduling.ItemEventArgs) Handles Calendario.ItemCreated

        Try

            'Oggetto / HeaderText
            e.Item.HeaderText = "MyItem.."

            'Dichiaro un nuovo contatto
            Dim c As New Contact

            'Imposto i valori del contatto appena creato
            With c
                .Id = e.Item.Id
                .Address = "Via chiusa..."
                .Email = "tavolonimarco@alice.it"
                .FirstName = "MyContacts.."
                .LastName = ""
                .Name = ""
                .Phone = "3285341..."
            End With
            Dim NTask As New Task


    'Add the contact at the item
            Me.Calendar.Contacts.Add(c)
            e.Item.Contacts.Add(c)

        Catch ex As Exception

            MsgBox(Err.Description, MsgBoxStyle.Critical, "Errore " & Err.Number)

        End Try

    End Sub
 



On the event ItemDeleting...
Code
Select All
Private Sub Calendario_ItemDeleting(ByVal sender As Object, ByVal e As MindFusion.Scheduling.WinForms.ItemConfirmEventArgs) Handles Calendario.ItemDeleting

        Try

            'Delete the contact from the scheduler
            Me.Calendar.Contacts.Remove(e.Item.Contacts(0))


        Catch ex As Exception

            MsgBox(Err.Description, MsgBoxStyle.Critical, "Errore " & Err.Number)

        End Try

    End Sub
 




After having used this routines i save the new data and then recharge my project from a file XML but
the contact created before and deleted exist still on a file.

The follow code is what I used to Save and Load the data

Code
Select All
Try


            Dim myXmlTextWriter As XmlTextWriter


            myXmlTextWriter = New XmlTextWriter(Percorso.ToString, System.Text.Encoding.UTF8)


            myXmlTextWriter.Formatting = System.Xml.Formatting.Indented
            myXmlTextWriter.WriteStartDocument(False)
            myXmlTextWriter.WriteComment("Appuntamenti utente " & CodiceUtente.ToString)


            myXmlTextWriter.WriteStartElement("Appointements")

            myXmlTextWriter.WriteEndElement()

            myXmlTextWriter.Flush()
            myXmlTextWriter.Close()

            Dim a As New Xml.XmlDocument
            Calendar.SaveTo(MyPath.ToString, ContentType.Xml)

        Catch ex As Exception

            MsgBox(Err.Description, MsgBoxStyle.Critical, "Errore " & Err.Number)

        End Try
 



Code
Select All
Try

            Calendar.LoadFrom(MyPath.ToString, ContentType.Xml)

        Catch ex As Exception

            MsgBox(Err.Description, MsgBoxStyle.Critical, "Errore " & Err.Number)

        End Try
 

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


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Contacts connected with the Appointement
Reply #5 - Jun 7th, 2010 at 2:23pm
Print Post  
Hi,

I will try to explain how the resource system in MindFusion.Scheduling works. To simplify the description I will focus on contacts, but the same rules apply to the other three types of resources.

All contacts should be present in the Schedule.Contacts object. The contacts that you want to group by should be added to the Calendar.Contacts collection. If you add a contact to Calendar.Contacts and this contact is not present in Schedule.Contacts, it is automatically added there. Therefore, when you call:

Code
Select All
Me.Calendar.Contacts.Add(c) 


this contact is also automatically added to Calendar.Schedule.Contacts. In other words, to completely delete a contact, you have to remove it from the Schedule.Contacts collection too.

Let me know if this helps.

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


I love YaBB 1G - SP1!

Posts: 6
Joined: Jun 3rd, 2010
Re: Contacts connected with the Appointement
Reply #6 - Jun 7th, 2010 at 7:27pm
Print Post  
Yes, I understand the structure of the scheduler but when I add an item as appointement that contains a Task or others resources, them are not insert automatically on the file.

To add some contact I Have to insert trought the Schedule.Contacts.Add method and I know how call group by an appointement but when I use Schedule.Contacts.Remove methods there is a problem beacouse it do not work.

If you want, you give my your e-mail address and I try to send you the project.
So you can check the problem

Thanks in advance.
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Contacts connected with the Appointement
Reply #7 - Jun 8th, 2010 at 5:52am
Print Post  
Feel free to send the project to meppy@mindfusion.eu.

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


I love YaBB 1G - SP1!

Posts: 6
Joined: Jun 3rd, 2010
Re: Contacts connected with the Appointement
Reply #8 - Jun 13th, 2010 at 12:48pm
Print Post  
Thanks for your help, you have been very friendly.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint