Hi all,
In December 2011 I wrote to support because of a problem with 'multiple schedules' (Issue # 27795.
Because I got no answer until yet, I hope someone in the forum can help me.
We have a custom database for saving calandar events. In our application
it is possible, that a couple of people share one event. I've modified the example for ''multiple ressources'' for Visual Basic.
- One schedule for every involved person - I clone the event - I change the schedule-Id of the cloned event.
The problem is, that lets say four people share one event, only the first and the last is shown up in the calendar. What am I doing wrong.
Thanks in advance
Manfred Richter
Code snippet
' Remove all resources
CalendarControl.MultipleResources.RemoveAll
fAnzMKzNameTab = Split(sMKzNamen, Chr(254))
fAnzMKzNrTab = Split(sMKzNr, Chr(254))
fAnzMKzTab = Split(sMkz, Chr(254))
Dim strConnectionString As String
strConnectionString = "Provider=Custom"
Dim arResources As New CalendarResources
Dim pRes0 As New CalendarResource
Dim pRes1 As CalendarResource
pRes0.SetDataProvider2 strConnectionString, True
If pRes0.DataProvider Is Nothing Then
Debug.Assert False
Exit Sub
End If
If Not pRes0.DataProvider.Open Then
If Not pRes0.DataProvider.create Then
Debug.Assert False
Exit Sub
End If
End If
'// ** schedules
Dim pSchedules As CalendarSchedules
Set pSchedules = pRes0.DataProvider.Schedules
If pSchedules Is Nothing Then
Exit Sub
End If
If pSchedules.Count < 1 Then
For li = 0 To UBound(fAnzMKzNrTab)
pSchedules.AddNewSchedule fAnzMKzTab(li)
Next li
pRes0.DataProvider.Save
End If
'// ** resources
pRes0.Name = pSchedules.Item(0).Name
pRes0.ScheduleIDs.Add pSchedules.Item(0).id
arResources.Add pRes0
For li = 1 To UBound(fAnzMKzNrTab)
Set pRes1 = New CalendarResource
pRes1.SetDataProvider pRes0.DataProvider, False
pRes1.Name = fAnzMKzTab(li)
pRes1.ScheduleIDs.Add pSchedules.Item(li).id
arResources.Add pRes1
Set pRes1 = Nothing
Next li
CalendarControl.SetMultipleResources arResources
'-------------------------------------------------------------------------------------
'* This routine is used to clone Events and point to the right schedule
'-------------------------------------------------------------------------------------
Private Sub fsBKZPruef(ByRef sEvents As XtremeCalendarControl.CalendarEvents, ByRef sEvent As CalendarEvent)
On Error Resume Next
Dim lBkzNrTab() As String
Dim li As Integer
Dim lID As Integer
Dim lEvent As CalendarEvent
Dim lInhalt As String
lInhalt = sEvent.CustomProperties("BKZ_ZUWEISUNG")
If lInhalt = "" Then
Exit Sub
End If
lBkzNrTab = Split(lInhalt, vbCrLf)
For li% = 0 To UBound(lBkzNrTab) - 1
lID = fForm.mtGetMkzId(Val(lBkzNrTab(li)))
If lID > 0 Then
Set lEvent = sEvent.CloneEvent
lEvent.ScheduleID = lID
sEvents.Add lEvent
Set lEvent = Nothing
End If
Next li
En
|