Sunday, June 14, 2015

Binding ScehduleView to Database part 3: Implement IAppointment

As we saw in the previous post, the best way is to implement the IAppointment interface without inheritance from Appointment class.

The whole code is available on GitHub, and below we will go over the code and explain every block.


1. Class:


public class AppointmentModel : BindableBase, IAppointment, IExtendedAppointment

Binding ScheduleView to Database part 2: The best way

In the previous post, we saw how to bind ScheduleView control to database, using class that derived from Telerik.Windows.Controls.ScheduleView.Appointment class. This is a good way, but let's examine if this is also the best way.

If you try to add a new appointment [Doublic-click on ScheduleView control, edit, click OK. don't forget click also on Save button before closing the application, you will see that these properties are bound well to database:

  • Subject
  • Description [mapped to Body column]
  • Start
  • End
  • Importance.


However, Some properties are not mapped to database and not saved. If you try set them, you will see the changes, until you restart the application, then the changes will be lost. It is because of  those properties are Objects and not simple properties.

These are the properties that not implemented yet:

  • Category
  • TimeMarker
  • Recurrence
  • Resources

Wednesday, June 10, 2015

Binding ScheduleView to Database part 1: QuickStart

In this article we will create simple solution of Telerik ScheduleView control, that his data source is Entity framework.

This article is part of a guide, which aims to explain how to use Telerik ScheduleView control with a database. See here the agenda.

The source code of this article, is available on GitHub.

OK, let's start.


Binding ScheduleView to Database - Overview

Telerik ScheduleView control is a scheduling component, for manage appointments or tasks, like Outlook.

Telerik documentation provides a useful guide and covers the most features and scenarios. But somehow, there is no documentation and training how to work with database. All the samples uses in-memory data sources, but no real-sample of save data in database.

Yes, I read this tutorial, and I tried this GitHub project. Unfortunately, those resources are not up-to-date, and they use very obsolete code and anti-pattern practices, and it is very difficult to read and customize.

Therefore, because it is so necessary, I think it would be good to write a comprehensive guide, step by step, how to use ScheduleView control with database.

I will use Sql server as database, Entity framework as ORM, and GitHub as repository.

You can explore and download the source code here:
https://github.com/YehudahA/ScheduleViewPractices/tree/master