custom advanced form custom provider

2 posts, 0 answers
  1. jose luis
    jose luis avatar
    20 posts
    Member since:
    Apr 2011

    Posted 13 Sep 2011 Link to this post

    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

  2. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 13 Sep 2011 Link to this post

    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.
Back to Top