Print Page | Close Window

Multiple Resources

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Calendar
Forum Description: Topics Related to Codejock Calendar
URL: http://forum.codejock.com/forum_posts.asp?TID=4099
Printed Date: 22 November 2024 at 3:53am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Multiple Resources
Posted By: Fabian
Subject: Multiple Resources
Date Posted: 30 April 2006 at 11:19am

Hi

I try to incorporate multiple resources in my (working) calendar app.

CalendarControl1.SetDataProvider(...)
CalendarControl1.DataProvider.Open

'----- New code
Set Resources=New CalendarResources
Set Resource=New CalendarResource
Resource.SetDataProvider(CalendarControl1.DataProvider,False )
Set Schedules=Resource.DataProvider.Schedules
Schedules.AddNewSchedule "Test"
Resource.Name="Test"
Resource.ScheduleIDs.Add 1
Resources.Add Resource
Resource.DataProvider.Save
'-----

'Now adding events to CalendarControl1.DataProvider as before.

If we run the app with the new code the resource was shown but the DataProvider is empty and inplace adding an event was no more possible... without the resource addition all work as expected but without resources...

What do I wrong?

Thanks a lot for any help!



-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.3

Platform: Windows 7 (32bit)

Language: Visual Basic 6.0 / SP6



Replies:
Posted By: sserge
Date Posted: 01 May 2006 at 6:02am
Hi Fabian,

Firstly please look at corresponding examples in calendar VB sample project:
mnuMultiSchedulesSimple_Click()
mnuMultiSchedulesExtended_Click()
 
1.
instead of
    Resource.ScheduleIDs.Add 1
use:
    Resource.ScheduleIDs.Add Schedules.Item(0).Id
 
2.
instead of
    Schedules.AddNewSchedule "Test"
use:
    If Schedules.Count < 1 Then
        Schedules.AddNewSchedule "Test"
    End If
because XML/file data provider saves/loads schedules when Save/Open methods are called.
 
3.  
Resource.SetDataProvider(CalendarControl1.DataProvider, False)
 
NOTE: if you set False to bCloseDataProviderWhenDestroy - please close (and save if necessary) a DataProvider manually when exit from app/form.
 
4. for events which you add you have to set ScheduleID.

5. Look also at CalendarResource.SetDataProvider2 method.

--
WBR,
Serge


Posted By: WaaZ
Date Posted: 03 May 2006 at 7:42am

Hi,

Based on the explanation above, I have implemented the following code:

Quote

CalendarResources Resources = new CalendarResourcesClass();

CalendarResource Resource=new CalendarResourceClass();

Resource.SetDataProvider(CalendarControl.DataProvider,false );

if (CalendarControl.DataProvider.Schedules.Count < 1)

{

CalendarControl.DataProvider.Schedules.AddNewSchedule("Test");

}

Resource.Name="Test";

Resource.ScheduleIDs.Add(CalendarControl.DataProvider.Schedu les[0].Id);

Resources.Add(Resource);

Resource.DataProvider.Save();

and when I create my event after the above has been executed and set the Schedule ID as follows:

Quote

ptrEvent.ScheduleID = CalendarControl.DataProvider.Schedules[0].Id;

I see no difference in the execution. I have done these changes in the sample code given while installing the controls



Posted By: sserge
Date Posted: 03 May 2006 at 11:07am
Ensure you've called:

CalendarControl.SetMultipleResources(Resources);
CalendarControl.Populate();

 
Compare your code with code in calendar VB sample project:
mnuMultiSchedulesSimple_Click();

--
WBR,
Serge



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net