Sending Custom SchedulerInfo to the CreateRecurrenceException web service method

12 posts, 0 answers
  1. Andrew
    Andrew avatar
    4 posts
    Member since:
    Dec 2010

    Posted 14 Jun 2011 Link to this post

    I have a derived version of the SchedulerInfo class that is properly being populated in my GetAppointments Web Service Call...

    [WebMethod(EnableSession = true)]
    public IEnumerable<AppointmentData> GetAppointments(CustomSchedulerInfo schedulerInfo)
    {
            return Controller.GetAppointments(schedulerInfo);
    }


    However I noticed when the CreateRecurrenceException web service call is made it DOES send my custom scheduler info to the web service call but once it hits the Update method in my overridden SchedulerProvider it appears cast as type SchedulerInfo.


    Note that also when I update a schedule item which is not recurring the Update method is called with the CustomSChedulerInfo.

    An exert of my overriden SchedulerProvider

    public class SchedulerProvider : DbSchedulerProviderBase
        {
            public override IEnumerable<Appointment> GetAppointments(ISchedulerInfo schedulerInfo)
            {
                   var scheduleInfo = schedulerInfo as CustomSchedulerInfo;
            }
     
            public override void Update(ISchedulerInfo schedulerInfo, Appointment appointmentToUpdate)
            {
                   var scheduleInfo = schedulerInfo as CustomSchedulerInfo;

    //NOTE: When this is called from the CreateRecurrenceException web service call that
    scheduleInfo is cast as null.  When this is called from the UpdateAppointment web service call
    scheduleInfo is properly cast.

            }
    }


    An Exert of the web service

    [WebService(Namespace = "http://tempuri.org/")]
        [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
        [System.ComponentModel.ToolboxItem(false)]
        [System.Web.Script.Services.ScriptService]
        public class Scheduling : WebService, IRequiresSessionState
        {
            private WebServiceAppointmentController _controller;
            public const string ProviderSessionKey = "SchedulerWebServiceData";
     
            private WebServiceAppointmentController Controller
            {
                get
                {
                    SchedulerProvider provider;
                    if ((Session[ProviderSessionKey] == null))
                    {
                        provider = new SchedulerProvider();
                        Session[ProviderSessionKey] = provider;
                    }
                    else
                    {
                        provider = (SchedulerProvider)Session[ProviderSessionKey];
                    }
     
                    if (_controller == null)
                    {
                        _controller = new WebServiceAppointmentController(provider);
                    }
     
                    return _controller;
                }
            }
     
            [WebMethod(EnableSession = true)]
            public IEnumerable<AppointmentData> GetAppointments(CustomSchedulerInfo schedulerInfo)
            {
                return Controller.GetAppointments(schedulerInfo);
            }
     
            [WebMethod(EnableSession = true)]
            public IEnumerable<AppointmentData> InsertAppointment(CustomSchedulerInfo schedulerInfo, AppointmentData appointmentData)
            {
                return Controller.InsertAppointment(schedulerInfo, appointmentData);
            }
     
            [WebMethod(EnableSession = true)]
            public IEnumerable<AppointmentData> UpdateAppointment(CustomSchedulerInfo schedulerInfo, AppointmentData appointmentData)
            {
                return Controller.UpdateAppointment(schedulerInfo, appointmentData);
            }
     
            [WebMethod(EnableSession = true)]
            public IEnumerable<AppointmentData> CreateRecurrenceException(CustomSchedulerInfo schedulerInfo, AppointmentData recurrenceExceptionData)
            {
                return Controller.CreateRecurrenceException(schedulerInfo, recurrenceExceptionData);
            }
     
            [WebMethod(EnableSession = true)]
            public IEnumerable<AppointmentData> RemoveRecurrenceExceptions(CustomSchedulerInfo schedulerInfo, AppointmentData masterAppointmentData)
            {
                return Controller.RemoveRecurrenceExceptions(schedulerInfo, masterAppointmentData);
            }
     
            [WebMethod(EnableSession = true)]
            public IEnumerable<AppointmentData> DeleteAppointment(CustomSchedulerInfo schedulerInfo, AppointmentData appointmentData, bool deleteSeries)
            {
                return Controller.DeleteAppointment(schedulerInfo, appointmentData, deleteSeries);
            }
     
            [WebMethod(EnableSession = true)]
            public IEnumerable<ResourceData> GetResources(CustomSchedulerInfo schedulerInfo)
            {
                return Controller.GetResources(schedulerInfo);
            }
     
        }

  2. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 17 Jun 2011 Link to this post

    Hi Andrew,

    We have had this problem reported recently. We confirm that this is a glitch with RadScheduler, which we will fix for Q2 2011 at latest.

    Please, excuse us for this.

    Best wishes,
    Peter
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  3. David Bryant
    David  Bryant avatar
    19 posts
    Member since:
    Jan 2006

    Posted 19 Oct 2011 Link to this post

    I've checked the release notes but do not see where this item has been addressed as of yet.  I'm running into the same issue as discussed here and am looking for a resolution.  Thanks.
  4. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 21 Oct 2011 Link to this post

    Hi David,

    Unfortunately, we have postponed fixing this bug in favor of some more urgent issues. Please, accept our apologies for this.

    All the best,
    Peter
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  5. Daniel
    Daniel avatar
    1 posts
    Member since:
    Jun 2011

    Posted 21 Feb 2012 Link to this post

    I came across this bug too - it's quite annoying.
    However I found a work around. Part of the internals workings of "CreateRecurrenceException" are to first call "GetAppointments" on the controller before calling the insert/update/delete methods. And although the insert/update/delete methods are called with the default SchedulerInfo class as a parameter, the GetAppointments is called with the SubClassed custom one.

    So the work around is to have an instance variable on your controller class, e.g:
    private FilterSchedulerInfo _filterSchedulerInfo;


    And in the "GetAppointments" method, set this variable to the passed in one. e.g:
       
    public override IEnumerable<Appointment> GetAppointments(ISchedulerInfo schedulerInfo)
    {
        //Supposed to have been fixed in 2011 Q2 release but still not fixed.
        //Calls to Update from the web service only pass a default ISchedulerInfo when called from CreateRecurrenceException. But immediately befre, I found that GetAppointments
        //is called with the correct sub class. So we grab a copy here and store it. Then our methods can use this if they receive the default only class.
        _filterSchedulerInfo = (FilterSchedulerInfo)schedulerInfo;

    //etc
    }


    Then, in the insert/update/delete methods, test for the type and replace the variable accordingly.
    public override void Update(ISchedulerInfo schedulerInfo, Appointment appointmentToUpdate)
    {
        //See bug description in GetAppointments method above.
        if (schedulerInfo.GetType().Name != "FilterSchedulerInfo")
        {
            schedulerInfo = _filterSchedulerInfo;
        }

    //etc
    } 


    If the bug is ever fixed, then the if statements will be skipped so hopefully no need to remove the workaround.
    Hope this helps.
    Daniel Inston
  6. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 24 Feb 2012 Link to this post

    Hello Daniel,

    Thank you for sharing your findings in the forum. I have updated your Telerik points.

    Greetings,
    Peter
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  7. Marc-Antoine
    Marc-Antoine avatar
    6 posts
    Member since:
    Apr 2012

    Posted 16 May 2012 Link to this post

    Hello !

    I think I report the same bug, but i'm using a RadScheduler with WebService binding, and a custom ISchedulerInfo. All is fine fot Get, Insert or Update but not Delete ; in the overrided method of the provider, the cast (MySchedulerInfo) schedulerInfo doesn't work ..

    Have you ever seen this problem ?
    Do you know what happen ?

    Thank you for your help.

    Marc-Antoine.
  8. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 18 May 2012 Link to this post

    Hi Marc-Antoine,

    We believe we have fixed this issue. Please, try the latest internal build or the beta version of Q2 2012 that we will release next week and let me know if spot any problems.

    Regards,
    Peter
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  9. Marc-Antoine
    Marc-Antoine avatar
    6 posts
    Member since:
    Apr 2012

    Posted 21 May 2012 Link to this post

    Hello Peter,

    I've updated my version of Telerik by 2012.1.411.35, cleared my caches and updates my VS references but it still don't work ..

    public override void Delete(ISchedulerInfo schedulerInfo, Telerik.Web.UI.Appointment appointmentToDelete)
    in the provider delete method, the type of schedulerInfo after cast is Telerik.Web.UI.SchedulerInfo.

    According to my web method, the schedulerInfo should be ApplicationSchedulerInfo typed ..

    [WebMethod]
    public IEnumerable<AppointmentData> DeleteAppointment(ApplicationSchedulerInfo schedulerInfo, AppointmentData appointmentData, bool deleteSeries)
    {
        return Controller.DeleteAppointment(schedulerInfo, appointmentData, deleteSeries);
    }

    Thank you for your Help,

    Marc-Antoine.
  10. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 21 May 2012 Link to this post

    Hello Marc-Antoine,

    Version 2012.1.411 is the current official version and it does not have the fix included. Please, try the latest internal build or the beta version of Q2 2012 that we will release this week and let me know if spot any problems.


    All the best,
    Peter
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  11. Joe
    Joe avatar
    1 posts
    Member since:
    Jul 2012

    Posted 29 May 2012 Link to this post

    The issue does not appear to be fixed in build 2012.1.529, I am getting a invalid cast exception in the overiding GetAppointments for my Schedule Provider.
  12. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 04 Jun 2012 Link to this post

    Hello Joe,

    Thank you for letting us know of this, but we cannot replicate the problem at our side.

    Can you verify that you have successfully upgraded and that you are using the latest build by inspecting the rendered output of your page (please see the attached image).

    Kind regards,
    Peter
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top