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

MVVM, RIA, POCO

3 Answers 185 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Mark
Top achievements
Rank 1
Mark asked on 11 May 2011, 09:29 PM
Good day,

I am trying my darnedest to get this working without an entity model. My database structure is nothing even close or usuable for the scheduleview so I am attempting to manually create the objects.

In the .Web project I have manually created a DomainService:

[EnableClientAccess()]
public class MyDomainService : DomainService
{
    private Random random = new Random();
 
    public List<Appointment> GetVisits(DateTime aStartDate)
    {
        List<Appointment> result = new List<Appointment>();
 
        DateTime startDate = DateTime.Now.Date;
 
        for (int i = 0; i < 10; i++)
        {
            int length = 0;
            for (int currentTime = 0; currentTime < 24 * 60; currentTime += length)
            {
                length = this.random.Next(30, 180);
                if (length % 5 == 0)
                    continue;
 
                if ((24 * 60 - currentTime + length) < 60
                     || (24 * 60 - currentTime - length) < 0)
                         break;
 
                Appointment appointment = new Appointment();
                appointment.Subject = string.Format("App {0}.{1}", i + 1, length);
                appointment.Start = startDate.AddMinutes(currentTime);
                appointment.End = startDate.AddMinutes(currentTime + length);
                result.Add(appointment);
            }
 
            startDate = startDate.AddDays(1);
            System.Threading.Thread.Sleep(100);
        }
        return result;
    }
}

To get access to "Appointments" I need to add Telerik.Windows.Controls.ScheduleView. That assembly doesn't appear to be readily available in the .Net references (as it is for the non .web project) so I have to browse or use recent to reference the assembly. Then I get warnings for other assemblies saying that I am missing System.Windows and System.Windows.Data. Do I need to address these warning?

Then when I add "using Telerik.Windows.Controls.ScheduleView;" to my DomainService I get the folllowing error:

Error   2   The type 'Telerik.Windows.Controls.ViewModelBase' is defined in an assembly that is not referenced. You must add a reference to assembly 'Telerik.Windows.Controls, Version=2011.1.419.1040, Culture=neutral, PublicKeyToken=5803cfa389c90ce7'.  

So by brute force  I add a reference to Telerik.Windows.Controls.dll.

After all that, when I can finally build the .web project. When I build the silverlight project I get the following error:

Error   1   Entity 'Telerik.Windows.Controls.ScheduleView.Appointment' has a property 'TimeZone' with an unsupported type.  

How do I fix this error?

Was all the work necessary to access appointments in the DomainService or is there a better way?

Microsoft Visual Studio 2010
Version 10.0.30319.1 RTMRel
Microsoft .NET Framework
Version 4.0.30319 RTMRel

Installed Version: Professional

Microsoft Visual C# 2010   01018-587-3062631-70500
Microsoft Visual C# 2010

Hotfix for Microsoft Visual Studio 2010 Professional - ENU (KB982218)   KB982218
This hotfix is for Microsoft Visual Studio 2010 Professional - ENU.

Telerik Silverlight VSExtensions   2011.01.414.0
Telerik RadControls for Silverlight VSExtensions Package

-Markus

3 Answers, 1 is accepted

Sort by
0
Accepted
George
Telerik team
answered on 13 May 2011, 12:26 PM
Hi Mark,

 
Thank you for contacting us.

We are aware of this issue. The problem is that the TimeZoneInfo class cannot be deserialized in the Silverlight project. For example, if you try to implement a method that returns a TimeZoneInfo object, an error will be thrown when the call is completed in the Silverlight project. Unfortunately, we have a property IAppointment.TimeZone of type TimeZoneInfo and this causes the problem.
Also, the SerializableAttribute is not set for the AppointmentBase class. This could causes more troubles when you use it for return type of a method in the WCF Service. The reason for missing such attribute ii that the RadScheduleView assemblies are for Silverlight and their purpose is to be used only in Silverlight projects.

We don't support passing an appointments through the WCF Service. I would suggest you to pass another object that doesn't inherit the AppointmentBase in the WCF Service and to generate Appointments in the Silverlight project, according to this object

  • create a database appointment in the WCF Service (this appointment should not inherit the AppointmentBase or Appointment class)
  • pass this database appointment to the silverlight application
  • consume the service and create the Appointment according to the loaded database appointment
  • passing the appointment object to the ScheduleView control.

For more information how to achieve this scenario, please refer to the following link, where everything is explained in details - http://www.telerik.com/help/silverlight/radscheduler-populating-with-data-wcf-overview.html. This article is for the RadScheduler control, but it could point you to the right direction.


I hope this helps. Please do not hesitate to contact us if you require any further information.


Greetings,
George
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Leo
Top achievements
Rank 2
answered on 11 May 2012, 01:21 AM
Hi,

I don't seem to see the Categories/TimeMarkers class when creating a helper class. Am I missing something?
0
George
Telerik team
answered on 16 May 2012, 02:40 PM
Hello Leo,

Can you please specify which helper class is missing the Categories/TimeMarkers? 
 

Greetings,
George
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
ScheduleView
Asked by
Mark
Top achievements
Rank 1
Answers by
George
Telerik team
Leo
Top achievements
Rank 2
Share this question
or