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

Appoiment Class in WCF Service

6 Answers 52 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ronak
Top achievements
Rank 1
Ronak asked on 21 Feb 2011, 04:30 PM
Hi Telerik team,
I am working on sharepoint 2010 and would like to Use Silverlight Telerik Control(radScheduler).
I am Creatiing a WCF servie to rollup calendar list which return generica list of Appoiment objects.can i use this class in WCF Service or i need to create a Custom class with DataContract.
Please find the code
[ServiceBehavior]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    public class PublicEventsRollupService : IPublicEventsRollupService
    {
          
        public List<Appointment> GetAllPublicCalEvents()  {
            SPWeb web = SPContext.Current.Web;
            DateTime startdate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
            string offset = startdate.Subtract(DateTime.Now).Days.ToString();
            SPSiteDataQuery Query = new SPSiteDataQuery();
            Query.Lists = "<Lists ServerTemplate=\"106\"/>";
            Query.Webs = "<Webs Scope='Recursive' />";
            Query.Query = "<OrderBy>" +
                              "<FieldRef Name='EventDate' />" +
                          "</OrderBy>" +
                          "<Where>" +
                               "<And>" +
                                   "<Geq><FieldRef Name='EndDate'/><Value Type='DateTime'><Today OffsetDays='" + offset + "' /></Value></Geq>" +
                                   "<Eq><FieldRef Name='Public'/><Value Type='Text'>1</Value></Eq>" +
                               "</And>" +
                          "</Where>";
            Query.ViewFields += "<FieldRef Name='ID' />";
            Query.ViewFields = "<FieldRef Name='Title' />";
            Query.ViewFields += "<FieldRef Name='EventDate' />";
            Query.ViewFields += "<FieldRef Name='EndDate' />";
            Query.ViewFields += "<FieldRef Name='Location' />";
            Query.ViewFields += "<FieldRef Name='Event_x0020_Description' />";
            Query.ViewFields += "<FieldRef Name='fRecurrence' />";
            Query.ViewFields += "<FieldRef Name='fAllDayEvent' />";
            //Query.ViewFields += "<ProjectProperty Name=\"Title\" />";
            Query.ViewFields += "<FieldRef Name='RecurrenceData' />";
            Query.ViewFields += "<FieldRef Name='XMLTZone' />";
            Query.ViewFields += "<FieldRef Name='EventType' />";
            Query.ViewFields += "<FieldRef Name='MasterSeriesItemID' />";
            Query.ViewFields += "<FieldRef Name='RecurrenceID' />";
  
            DataTable events = web.GetSiteData(Query);
            List<Appointment> publicCalEvents = null;
            if (events != null && events.Rows.Count > 0)
            {
                publicCalEvents = new List<Appointment>();
                // processRecurrenceEvents(events,publicCalEvents);
                processSingleEvents(events, publicCalEvents);
  
            }
            return publicCalEvents;
        }
  
        //Function to Process Each single event and Convert to RadScheduler Event
        private void processSingleEvents(DataTable allEvents, List<Appointment> singleEvents)
        {
            //Filter Datatable to get only Single events
            allEvents.DefaultView.RowFilter = "fRecurrence = '0'";
            DataView singleEventsView = allEvents.DefaultView;
            DataTable singleEventsDT = singleEventsView.ToTable();
            //Process Single Event and Create Telerik appoiment Object
            foreach (DataRow row in singleEventsDT.Rows) {
                  
                Appointment regAppoiment = new Appointment();
                regAppoiment.UniqueId = row["ID"].ToString();
                regAppoiment.Subject = row["Title"].ToString();
                regAppoiment.Start = Convert.ToDateTime(row["EventDate"]).ToLocalTime();
                regAppoiment.End = Convert.ToDateTime(row["EndDate"]).ToLocalTime();
                regAppoiment.IsAllDayEvent = Convert.ToBoolean(row["fAllDayEvent"].ToString());
                regAppoiment.Body = row["Event_x0020_Description"].ToString();
                regAppoiment.Location = row["Location"].ToString();
                singleEvents.Add(regAppoiment);
  
            }
  
        }
But i am getting following exception when try to browse service in browser after deploymnet.

An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
System.InvalidOperationException: An exception was thrown in a call to a WSDL export extension: System.ServiceModel.Description.DataContractSerializerOperationBehavior
 contract: http://tempuri.org/:IPublicEventsRollupService ----> System.TypeLoadException: Could not load type 'System.TimeZoneInfo' from assembly 'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
   at System.Signature._GetSignature(SignatureStruct& signature, Void* pCorSig, Int32 cCorSig, IntPtr fieldHandle, IntPtr methodHandle, IntPtr declaringTypeHandle)
   at System.Signature..ctor(RuntimeMethodHandle methodHandle, RuntimeTypeHandle declaringTypeHandle)
   at System.Reflection.RuntimeMethodInfo.get_Signature()
   at System.Reflection.RuntimeMethodInfo.FetchNonReturnParameters()
   at System.Reflection.RuntimeMethodInfo.GetParameters()
   at System.Runtime.Serialization.ClassDataContract.ClassDataContractCriticalHelper.ImportDataMembers()
   at System.Runtime.Serialization.ClassDataContract.ClassDataContractCriticalHelper..ctor(Type type)
   at System.Runtime.Serialization.ClassDataContract..ctor(Type type)
   at System.Runtime.Serialization.DataContract.DataContractCriticalHelper.CreateDataContract(Int32 id, RuntimeTypeHandle typeHandle, Type type)
   at System.Runtime.Serialization.DataContract.DataContractCriticalHelper.GetDataContractSkipValidation(Int32 id, RuntimeTypeHandle typeHandle, Type type)
   at System.Runtime.Serialization.ClassDataContract.ClassDataContractCriticalHelper..ctor(Type type)
   at System.Runtime.Serialization.ClassDataContract..ctor(Type type)
   at System.Runtime.Serialization.DataContract.DataContractCriticalHelper.CreateDataContract(Int32 id, RuntimeTypeHandle typeHandle, Type type)
   at System.Runtime.Serialization.DataContract.DataContractCriticalHelper.GetDataContractSkipValidation(Int32 id, RuntimeTypeHandle typeHandle, Type type)
   at System.Runtime.Serialization.DataContractSet.GetDataContract(Type clrType)
   at System.Runtime.Serialization.DataContractSet.AddCollectionDataContract(CollectionDataContract collectionDataContract)
   at System.Runtime.Serialization.DataContractSet.Add(XmlQualifiedName name, DataContract dataContract)
   at System.Runtime.Serialization.DataContractSet.Add(Type type)
   at System.Runtime.Serialization.XsdDataContractExporter.Export(Type type)
   at System.ServiceModel.Description.MessageContractExporter.ExportType(Type type, String partName, String operationName, XmlSchemaType& xsdType)
   at System.ServiceModel.Description.DataContractSerializerMessageContractExporter.ExportBody(Int32 messageIndex, Object state)
   at System.ServiceModel.Description.MessageContractExporter.ExportMessage(Int32 messageIndex, Object state)
   at System.ServiceModel.Description.MessageContractExporter.ExportMessageContract()
   at System.ServiceModel.Description.WsdlExporter.CallExtension(WsdlContractConversionContext contractContext, IWsdlExportExtension extension)
   --- End of inner ExceptionDetail stack trace ---
   at System.ServiceModel.Description.WsdlExporter.CallExtension(WsdlContractConversionContext contractContext, IWsdlExportExtension extension)
   at System.ServiceModel.Description.WsdlExporter.CallExportContract(WsdlContractConversionContext contractContext)
   at System.ServiceModel.Description.WsdlExporter.ExportContract(ContractDescription contract)
   at System.ServiceModel.Description.WsdlExporter.ExportEndpoint(ServiceEndpoint endpoint, XmlQualifiedName wsdlServiceQName)
   at System.ServiceModel.Description.WsdlExporter.ExportEndpoints(IEnumerable`1 endpoints, XmlQualifiedName wsdlServiceQName)
   at System.ServiceModel.Description.ServiceMetadataBehavior.MetadataExtensionInitializer.GenerateMetadata()
   at System.ServiceModel.Description.ServiceMetadataExtension.EnsureInitialized()
   at System.ServiceModel.Description.ServiceMetadataExtension.HttpGetImpl.InitializationData.InitializeFrom(ServiceMetadataExtension extension)
   at System.ServiceModel.Description.ServiceMetadataExtension.HttpGetImpl.GetInitData()
   at System.ServiceModel.Description.ServiceMetadataExtension.HttpGetImpl.TryHandleDocumentationRequest(Message httpGetRequest, String[] queries, Message& replyMessage)
   at System.ServiceModel.Description.ServiceMetadataExtension.HttpGetImpl.ProcessHttpRequest(Message httpGetRequest)
   at SyncInvokeGet(Object , Object[] , Object[] )
   at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
   at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)


Please advise.

Ronak

6 Answers, 1 is accepted

Sort by
0
George
Telerik team
answered on 24 Feb 2011, 03:12 PM
Hi Ronak,

 
Unfortunately, we are not aware of such problem. I would suggest you to refer to the following links:
I hope this helps!

Regards,
George
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Ronak
Top achievements
Rank 1
answered on 24 Feb 2011, 03:18 PM
HI Geroge thanks for your reply.
i am afraid to say this is not gonna help  i have been looking for web since a week nothing found.
By the way that Video about sharepoint and Telerik silverlight control is helpful but unfortunettly not for the project i am working on as i can not use client side object model.
you guys example but in that case datasource is Sql Server database not Sharepoint.

anyway thanks
0
George
Telerik team
answered on 07 Mar 2011, 10:33 AM
Hi Ronak,

 
In the project you sent us, we noticed that you didn't add all references for the RadScheduler control. In order to use the control, you need to add the following assemblies:

  1. Telerik.Windows.Controls
  2. Telerik.Windows.Controls.Input
  3. Telerik.Windows.Controls.Navigation
  4. Telerik.Windows.Controls.Scheduler
  5. Telerik.Windows.Data



All the best,
George
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Ronak
Top achievements
Rank 1
answered on 07 Mar 2011, 02:15 PM
Hi Geroge,
As i said this is web service so i dont need presentation control so i need is only one dll and its Telerik.Windows.Controls.Scheduler to use class appoimentBase.also i have added all these dll but its same result so i go ahead and remove all dlls from telerik and try sample without AppoimentBase class and it was working fine.

Please read my post in Telerik Ticket system.

Thanks
Ronak
0
Ari
Top achievements
Rank 1
answered on 28 Apr 2017, 01:23 PM
t have a WCF that returns the data from a remote MySQL database, the return is a simple XML, I believe that being a simple XML is not populating my kendo grid.

I would like an example to mount my return XML and meet the requirements of the kendo grid, as given in the kendo grid example:  https://demos.telerik.com/kendo-ui/service/Northwind.svc/Orders
0
Stefan
Telerik team
answered on 03 May 2017, 11:15 AM
Hello Ari,

As I understand from your post, you are using the Kendo UI Grid. If this is so, please, post your question in the relevant section, as this one is regarding the Silverlight RadScheduleView component.

Thanks in advance for your cooperation.

Best Regards,
Stefan X1
the Telerik team
 
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
 
Tags
General Discussions
Asked by
Ronak
Top achievements
Rank 1
Answers by
George
Telerik team
Ronak
Top achievements
Rank 1
Ari
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or