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

[Solved] custom advanced form custom provider

1 Answer 90 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
jose luis
Top achievements
Rank 1
jose luis asked on 13 Sep 2011, 10:55 AM
hello,

i donwload the sample project 234043_customadvformandprovider.zip but when you try to set update this project to the new model of custom provider an error says that you must override GetReources when really i done, probably some javascript/or so much have to be changed. My method:

public override IDictionary<ResourceType, IEnumerable<Resource>> GetResources(ISchedulerInfo schedulerInfo)
{
    IDictionary<ResourceType, IEnumerable<Resource>> recursos =
            new Dictionary<ResourceType, IEnumerable<Resource>>();
 
    recursos.Add(new ResourceType("Teacher", true), Teachers.Values);
    recursos.Add(new ResourceType("Student", true), Students.Values);
 
 
    return recursos;
}

Also i comment GetrourcesByType and GetResourcesType and also the Insert update,etc to IschedulerInfo.

Thanks

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 13 Sep 2011, 03:24 PM
Hi Jose,

Please, make sure you override the following methods in your provider:
public override IDictionary<ResourceType, IEnumerable<Resource>> GetResources(ISchedulerInfo schedulerInfo)
    {
        Dictionary<ResourceType, IEnumerable<Resource>> resCollection = new Dictionary<ResourceType, IEnumerable<Resource>>();
 
        resCollection.Add(new ResourceType("Teacher", false), Teachers.Values);
        resCollection.Add(new ResourceType("Student", true), Students.Values);
 
        return resCollection;
    }
 
    public override IEnumerable<ResourceType> GetResourceTypes(RadScheduler owner)
    {
        ResourceType[] resourceTypes = new ResourceType[2];
        resourceTypes[0] = new ResourceType("Teacher", false);
        resourceTypes[1] = new ResourceType("Student", true);
 
        return resourceTypes;
    }
 
    public override IEnumerable<Resource> GetResourcesByType(RadScheduler owner, string resourceType)
    {
        switch (resourceType)
        {
            case "Teacher":
                return Teachers.Values;
 
            case "Student":
                return Students.Values;
 
            default:
                throw new InvalidOperationException("Unknown resource type: " + resourceType);
        }
    }


Greetings,
Peter
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Scheduler
Asked by
jose luis
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or