This is a migrated thread and some comments may be shown as answers.

[Solved] Generic List datasource and Multiple Resources

6 Answers 271 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
antonio
Top achievements
Rank 1
antonio asked on 31 May 2008, 12:13 AM
Hello,

I wonder if it's possible to have a scheduler based on a generic list (for datasource) and allow using multiple resources.  The current example only shows one resource.

Any help would be appreciated.

Thanks,

Antonio

6 Answers, 1 is accepted

Sort by
0
Jonathan
Top achievements
Rank 1
answered on 01 Jun 2008, 05:54 PM
Hi Antonio

Yes it is possible to use a generic list, it's exactly what I use. It's in the sample code for the scheduler control, it's fair;y simple to use.

You can also have more than one resource just by adding additional resources to the scheduler

Dim

resType As New ResourceType("User")

resType.ForeignKeyField =

"ID"

Scheduler.ResourceTypes.Add(resType)

And then to add to this resource do this

Scheduler.Resources.Add(New Resource(fill this bit in))

Hope that helps
Jon

0
Ben
Top achievements
Rank 1
answered on 18 Jan 2009, 12:39 PM
Just an addition to this thread. I am having similar issues. I have a list of appointments where more than one resource can be assigned to the same appointment. I also want to group by resource. Same concept as Outlook appointment attendees.

I am using the generic list style implementation. I have a list of appointment objects and each appointment has an exposed list of Resource objects. I cannot figure out how to set the foreign key field for the grouping.

How do I set the ForeignKeyField in this case?

I have essentially the following in my Appointment class
public class Appointment
{
        private List<AppointmentResource> _resources;

        public List<AppointmentResource> Resources
        {
                get { return this._resources; }
                set { this._resources = value; }
        }
        // ... code removed for clarity (properties for appointment id, subject, location, etc)
}

And my AppointmentResource class:
public class AppointmentResource
{
        private object id;
        private int resourceId;
        private string resourceName;

        public string ResourceName
        {
            get { return resourceName; }
            set { resourceName = value; }
        }

        public int ResourceId
        {
            get { return resourceId; }
            set { resourceId = value; }
        }

        public object Id
        {
            get { return id; }
            set { id = value; }
        }
}

If my Appointment object had a ResourceId property (one appoinment to one resource), as per you example, the ForeignKeyField would be set to "ResourceId". However, in my case the ForeignKeyField is AppointmentResource.ResourceId, but I cannot set this as the ForeignKeyField, because the compiler throws an error.

I'm desperately trying to figure out what this should be set to.

Any suggestions?

Regards

Ben
0
Peter
Telerik team
answered on 19 Jan 2009, 09:36 AM
Hello Ben,

I have modified the Binding to Generic List example to use a second resource type (Room). Please, find it attached for reference.


All the best,
Peter
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Ben
Top achievements
Rank 1
answered on 19 Jan 2009, 12:13 PM
Hi Peter,

I think you might have misunderstood my question. Looking at the code example, you have added a RoomId to the appointment object, giving multiple types of resource types. However, I was looking for multiple resources assigned to the same appointment, of the same type, hence, the code you have in the AppointmentInfo class would change from this:

public int? UserID
{
get { return _userID; }
set { _userID = value; }
}

would change to this:

private List<int> _userIDs;
public List<int> UserIDs
{
    get { return _userIDs; }
    set { _userIDs = value; }
}

Any ideas how I implement this and create my mappings?

Regards

Ben

0
Peter
Telerik team
answered on 19 Jan 2009, 03:42 PM
Hello Ben,

Thanks for clarifying. Multiple resorce values of the same type can be implemented only via a provider. Please, following this help topic: Implementing A Provider That Supports Multi-valued Resources


Best wishes,
Peter
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
SKS
Top achievements
Rank 1
answered on 14 Sep 2009, 04:25 PM
i want to show list of attendees who are attending an appointment on the RADScheduler.
how can that be done?
Tags
Scheduler
Asked by
antonio
Top achievements
Rank 1
Answers by
Jonathan
Top achievements
Rank 1
Ben
Top achievements
Rank 1
Peter
Telerik team
SKS
Top achievements
Rank 1
Share this question
or