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

Sending Custom SchedulerInfo to the CreateRecurrenceException web service method

11 Answers 103 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 14 Jun 2011, 04:48 PM
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);
        }
 
    }

11 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 17 Jun 2011, 01:57 PM
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.

0
David Bryant
Top achievements
Rank 1
answered on 19 Oct 2011, 08:48 PM
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.
0
Peter
Telerik team
answered on 21 Oct 2011, 09:50 AM
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
0
Daniel
Top achievements
Rank 1
answered on 22 Feb 2012, 02:59 AM
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
0
Peter
Telerik team
answered on 24 Feb 2012, 02:55 PM
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.
0
Marc-Antoine
Top achievements
Rank 1
answered on 16 May 2012, 05:26 PM
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.
0
Peter
Telerik team
answered on 18 May 2012, 05:39 PM
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.
0
Marc-Antoine
Top achievements
Rank 1
answered on 21 May 2012, 08:21 AM
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.
0
Peter
Telerik team
answered on 21 May 2012, 01:37 PM
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.
0
Joe
Top achievements
Rank 2
answered on 29 May 2012, 06:38 PM
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.
0
Peter
Telerik team
answered on 04 Jun 2012, 11:49 AM
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.
Tags
Scheduler
Asked by
Andrew
Top achievements
Rank 1
Answers by
Peter
Telerik team
David Bryant
Top achievements
Rank 1
Daniel
Top achievements
Rank 1
Marc-Antoine
Top achievements
Rank 1
Joe
Top achievements
Rank 2
Share this question
or