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

Webservice, SQL DataBase and Recurrence

12 Answers 505 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Daniel Mettler
Top achievements
Rank 2
Iron
Daniel Mettler asked on 29 Apr 2009, 10:54 AM
Hi

Im trying to update my scheduler with a webservice an get the data from a sql database. I changed the GetAppointments Method in the Webservice:

Something like this:
[WebMethod]  
    public IEnumerable<AppointmentData> GetAppointments(chedulerInfo schedulerInfo)  
    {  
        List<AppointmentData> lstAppointments = new List<AppointmentData>();  
          
        foreach (object AppointmentInformations in ObjectCollection)  
        {  
            Appointment NewAppointment = new Appointment();  
            
            Appointment.Recurrence = "..........";
            Appointment.... 
            // Fill the NewAppointment with stuff from database  
 
            AppointmentData AppData = new AppointmentData();  
            AppData.CopyFrom(NewAppointment);  
            lstAppointments.Add(AppData);  
        }  
          
        return lstAppointments;  
    } 

In the database, there is a string field which contains the recurrence string, how can i handle this. The recurring appointments are not visible in the scheduler.

Do you have a code example or something?

Thx for help

12 Answers, 1 is accepted

Sort by
0
Accepted
Peter
Telerik team
answered on 30 Apr 2009, 04:12 PM
Hi Daniel,

You should not modify the GetAppointments method in the web service class. Instead, you should use a provider and set the WebServiceAppointmentController to use this provider.

I have prepared a demo project which uses Web Services with MyDbSchedulerProvider.cs. MyDbSchedulerProvider on its part uses Telerik.mdf -> [DbProvider_Classes] data table. The provider is configured in the web.config and the controller's constructor uses the provider name string:

* * *  
 
_controller = new WebServiceAppointmentController("MyDBSchedulerProvider");   
 
* * * 

The web.config settings related to the provider are as follows:
 <sectionGroup name="telerik.web.ui">  
      <section name="radScheduler" type="Telerik.Web.UI.RadSchedulerConfigurationSection, Telerik.Web.UI" allowDefinition="MachineToApplication" requirePermission="false"/>  
    </sectionGroup> 
 
* * *   
 
    <connectionStrings> 
  <add name="TelerikConnectionString1" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Telerik.mdf;Integrated Security=True;User Instance=True" 
   providerName="System.Data.SqlClient" /> 
 </connectionStrings> 
 
* * *  
 
 <telerik.web.ui> 
    <radScheduler defaultAppointmentProvider="Integrated">  
      <appointmentProviders> 
        <add name="MyDBSchedulerProvider" type="MyDbSchedulerProvider" connectionStringName="TelerikConnectionString1" persistChanges="true"/>  
      </appointmentProviders> 
    </radScheduler> 
  </telerik.web.ui> 

Let me know if you have further questions.


Best wishes,
Peter
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
Michael
Top achievements
Rank 1
answered on 07 May 2009, 01:30 AM
Peter,

When I attempt to run the same application attached, I get the following error when accessing the web service. 

Cannot serialize interface System.Collections.Generic.IEnumerable`1[[Telerik.Web.UI.AppointmentData, Telerik.Web.UI, Version=2009.1.402.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4]].

I copied all of the files to a new virtual directory and attempted to call both default.aspx and schedulerwebservice.asmx.  Both return the same error.  Any ideas what I am missing?  Thank you.

Michael
0
Jan
Top achievements
Rank 1
answered on 23 Jul 2009, 04:21 PM
Hello,

I have the same issue - Cannot serialize interface System.Collections.Generic.IEnumerable`1[[Telerik.Web.UI.AppointmentData, Telerik.Web.UI, Version=2009.2.701.20, Culture=neutral, PublicKeyToken=121fae78165ba3d4]].

Do You any idea how to solve it?

Thank You Jan
0
Sergio
Top achievements
Rank 1
answered on 28 Jul 2009, 03:25 AM
Same here.

Thanks
0
T. Tsonev
Telerik team
answered on 29 Jul 2009, 03:00 PM
Hi,

I guess that you're getting this error when you're trying to open the web service handler directly in the browser?

The automatically generated test page doesn't support script services and it tries to access the service using SOAP. Which in turn doesn't support IEnumerable and generates the error in question.

The service will work fine when invoked by RadScheduler with the correct transport type (JSON).

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
Yeroon
Top achievements
Rank 2
answered on 20 Aug 2009, 08:44 AM
Hi,

I got the sample to work. Now I was wondering if I can work with filtered datasets in the webmethods. I don't want to retrieve all appointments, but just limited sets. E.g. fltered by employee and date.

How can I achieve this?

I would like to be able to call something like this:

 [WebMethod]  
    public IEnumerable<AppointmentData> GetAppointments(SchedulerInfo schedulerInfo, DateTime day, long EmployeeID)  
    {  
        return Controller.GetAppointments(schedulerInfo, day, EmployeeID);  
    } 

Which would then be used in the underlying query in the provider:

cmd.CommandText = "SELECT [ClassID], [Subject], [Start], [End], [RecurrenceRule], [RecurrenceParentId] FROM [DbProvider_Classes] WHERE Start=" + day + " AND TeachID =" + EmployeeID ; 

Any way of achieving this? I will be getting thousands of entries in the appointments table and can't afford to retrieve them all everytime.

Thx for any help

Yeroon
0
Yeroon
Top achievements
Rank 2
answered on 20 Aug 2009, 09:03 AM
0
peter brandt
Top achievements
Rank 1
answered on 07 Oct 2009, 11:30 AM
Hi

If i want to set a Webreference to the Webservice with the SchedulerWebservice Webmethods it always says:

"Cannot serialize interface System.Collections.Generic.IEnumerable`1[[Telerik.Web.UI.AppointmentData, Telerik.Web.UI, Version=2009.1.402.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4]]."

like by the other people here.
Now i dont know what to do with your "correct transport type (JSON)"...

I have all my Webservices already done, but only the RadScheduler Webservice doesnt work...
What can i do now?
How to transfer by JSON?


Peter

0
T. Tsonev
Telerik team
answered on 09 Oct 2009, 03:22 PM
Hi,

Do you get this error when you try to access the Web Service handler in your browser? This is normal, as ASP.NET tries to generate an user-friendly test page, but fails as it can only do so for a SOAP-based services and not for JSON ones.

You can proceed and add the reference to RadScheduler and it'll work.

Best wishes,
Tsvetomir Tsonev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
PAUL HAY
Top achievements
Rank 1
answered on 17 Oct 2013, 08:25 AM
How do you add the reference when visual studio reports the Cannot serialize interface System.Collections.Generic.IEnumerable error in the add web reference dialogue and won't let you continue.
0
Piyushkumar
Top achievements
Rank 1
answered on 28 Jan 2014, 05:20 AM
Hi Admin (T. Tsonev),

With regard to your following comment: ===>
   "The automatically generated test page doesn't support script services and it tries to access the service using SOAP.
     Which in turn doesn't support IEnumerable and generates the error in question.

    The service will work fine when invoked by RadScheduler with the correct transport type (JSON)." <===

It should have been mentioned in the help document under "Implementing Provider".
It took me 3-4 days to figure out the issue and still struggling with it.

Frustrating.




0
Boyan Dimitrov
Telerik team
answered on 30 Jan 2014, 03:22 PM
Hello,

Thank you for the provided information.

I would like to assure you that we will investigate this question thoroughly and update the documentation if need.

Thank you for your cooperation.

Regards,
Boyan Dimitrov
Telerik
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 UI for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Scheduler
Asked by
Daniel Mettler
Top achievements
Rank 2
Iron
Answers by
Peter
Telerik team
Michael
Top achievements
Rank 1
Jan
Top achievements
Rank 1
Sergio
Top achievements
Rank 1
T. Tsonev
Telerik team
Yeroon
Top achievements
Rank 2
peter brandt
Top achievements
Rank 1
PAUL HAY
Top achievements
Rank 1
Piyushkumar
Top achievements
Rank 1
Boyan Dimitrov
Telerik team
Share this question
or