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

WebService provider model design flawed?

5 Answers 126 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
MikeWiese
Top achievements
Rank 1
MikeWiese asked on 23 May 2009, 02:48 AM
I would love to be able to use the Web Service binding for my RadScheduler. But like many, I need to display user-specific information in the RadScheduler and the provider model appears to offer no "hooks" to allow this

Consider the GetAppointments method. The examples given mandate the following:
[WebMethod]  
public IEnumerable<AppointmentData> GetAppointments(SchedulerInfo schedulerInfo)  
{  
 return Controller.GetAppointments(schedulerInfo);  
where the Controller is a facade for my custom SchedulerProvider.

In my application, the appointments returned vary according to who is making the call. I'm using ASP.NET forms authentication and I can discover who is calling the webservice by specifying the EnableSession attribute, e.g.
[WebMethod(EnableSession = true)]  
public IEnumerable<AppointmentData> GetAppointments(SchedulerInfo schedulerInfo)  
{  
 string callerName = Context.User.Identity.Name;  // I can obtain the caller, but how can I make use of it?  
 return Controller.GetAppointments(schedulerInfo);  

But there appears to be no way I can pass the callerName identifier in the web service to the GetAppointments(RadScheduler radScheduler) method of my provider. But my custom provider needs this information in order to retrieve the correct appointments for the given caller.

Have I missed something simple (highly likely)? Or is the provider model broken here?

5 Answers, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 25 May 2009, 11:39 AM
Hello,

I can confirm that the current provider model doesn't support passing additional information to its methods. We're aware of this issue and we're planning to upgrade it to solve this issue and a number of others, such as the dependency to RadScheduler. For the moment there are two workarounds:
  • Use the Session object
  • Instantiate the provider class once per request and pass it additional information through properties or the constructor

They're by no means perfect, but I hope that they will do for the moment.
Kind regards,
Tsvetomir Tsonev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
MikeWiese
Top achievements
Rank 1
answered on 28 May 2009, 01:58 PM
Hi Tsvetomir, thanks for the reply.

I can't see how I would use the Session object (my custom SchedulerProvider class won't build because "the name 'Session' does not exist in the current context")

I also tried your suggestion of modifying the custom SchedulerProvider to take the username in the constructor, but some important things don't work. For example, the GetAppointments() method of the controller seems to be called instead of the Update() method when an appointment is resized. And the web service receives and end time 30 min (one timeslot) after the user's selected endtime.
0
T. Tsonev
Telerik team
answered on 29 May 2009, 11:27 AM
Hi,

You can access the current session by using HttpContext.Current.Session.

The GetAppointment call is actually expected in this case. As the appointments are not persisted on the server, RadScheduler needs to retrieve them first, so it can operate on them.

The 30 minute offset is really strange though, please let us know if the problem persists and how we can reproduce it.

Regards,
Tsvetomir Tsonev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
MikeWiese
Top achievements
Rank 1
answered on 02 Jun 2009, 01:41 PM

Thanks for the tip about HttpContext.Current - that gets me the User.Identity.Name that I need.

 

I upgraded today to the 2009 Q1 SP2 release (2009.1.527.35) which fixed the issue whereby the Update method was not being called.

 

After some further digging, the 30-min offset seems to have been caused by a missing DOCTYPE declaration in my aspx page,  Once I reinstated it, copying the DOCTYPE declaration from your examples, it all worked fine.

0
Khi
Top achievements
Rank 1
answered on 09 Feb 2011, 03:53 AM
I also use webservice scheduler and use HttpContext.Current.Session, but HttpContext.Current.Session is null in event update. please help me!
Tags
Scheduler
Asked by
MikeWiese
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
MikeWiese
Top achievements
Rank 1
Khi
Top achievements
Rank 1
Share this question
or