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

Telerik Data Access + Winforms RadScheduler + sqlite

5 Answers 73 Views
Integration with other products
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Massimiliano
Top achievements
Rank 1
Massimiliano asked on 11 Jul 2014, 06:23 AM
Hi i'm trying to do an example project Telerik using Data Access + Winforms RadScheduler + sqlite
I red the tutorial at the page below

http://www.telerik.com/help/winforms/scheduler-data-binding-binding-to-entity-framework-and-telerik-data-access.html

But it didn't work for me.... may i find somewhere a c# tutorial or a c# example project explain how to create tables on sqlite to execute CRUD operation on appointments and recurrences by Telerik Data Access.

Thanks in advance

5 Answers, 1 is accepted

Sort by
0
Kristian Nikolov
Telerik team
answered on 15 Jul 2014, 08:19 AM
Hi Massimiliano,

While we do have samples where RadScheduler consumes data retrieved by Telerik Data Access, this is done through a WCF Service and not directly. Still if you think such sample can be useful, it is named "WCF Plain Services and Windows Forms" in the Windows Forms category of our Samples Kit.

That being said we would like to help you resolve the issues you are experiencing. In order to do so, we would need some additional details about the exact behavior you are experiencing. Could you please answer the following questions:
  1. Are you having trouble retrieving the data using Telerik Data Access or do you experience issues displaying it via the RadScheduler?
  2. Are you experiencing an exception? If so please tell us what is the exception, its message and send us the code which causes it.
  3. Any additional information you find relevant could be helpful.

We are looking forward to your feedback.

Regards,
Kristian Nikolov
Telerik
 
OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
 
0
Massimiliano
Top achievements
Rank 1
answered on 15 Jul 2014, 08:55 AM
Sorry i didn't explain very well my point of interest....  and sorry for my english...
I red the tutorial at the link 

http://www.telerik.com/help/winforms/scheduler-data-binding-binding-to-entity-framework-and-telerik-data-access.html

and i tried to reproduce the example adapting it for my sqlite database.
When program execute this piece of code

protected override void OnClosing(CancelEventArgs e)
{
this.dbContext.SaveChanges();
base.OnClosing(e);
}

the appointment is not saved....
No exception but the appointment is not saved.

probably the mapping i did with telerik data access designer and relative relationship between entities are wrong.....
I need a simple example described in the link above but adapted for sqlite database and telerik data access.


hope i explained better the problem.
Thks in advance



0
Kristian Nikolov
Telerik team
answered on 17 Jul 2014, 04:10 PM
Hello Massimiliano,

In order to add a new appointment to the scheduler you would need to handle the AppointmentAdded event of the RadScheduler user control. In it you will have to use the data from the Appointment object from the event argument to initialize a persistent Appointment object (the Appointment type from your model). The new persistent Appointment object should be added to the context object used in the form.

The following code is a simple example of how this can be done:
private void radScheduler1_AppointmentAdded(object sender, AppointmentAddedEventArgs e)
{
    Appointment newAppointment = new Appointment()
    {
        BackgroundID = e.Appointment.BackgroundId,
        Description = e.Appointment.Description,
        Location = e.Appointment.Location,
        Start = e.Appointment.Start,
        End = e.Appointment.End,
        Summary = e.Appointment.Summary,
        Visible = e.Appointment.Visible,
    };
 
    this.context.Add(newAppointment);   
}

Please note that since in the example the newAppointment is not associated with a resource you will have to disable the grouping of the scheduler in order to view the new event. This can be done by changing
this.radScheduler1.GroupType = GroupType.Resource;
to
this.radScheduler1.GroupType = GroupType.None;

I hope this helps. If you have additional questions feel free to post at our forums again.

Regards,
Kristian Nikolov
Telerik
 
OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
 
0
Massimiliano
Top achievements
Rank 1
answered on 17 Jul 2014, 04:53 PM
Thks a lot. Very useful..... and if i have add recurrence rule ? how to modify this piece of code to save recurrence in my data access Entity? I have to save recurrence always in my appointment Entitiy? I have to create a new Entity in my data access Model only for recurrence?

I hope i explained well the question.

Thks Max
0
George
Telerik team
answered on 22 Jul 2014, 11:10 AM
Hi Massimiliano,

Thank you for writing back.

In order to save the recurrence rule you must have a property in the Appointment type of your model named RecurrenceRule which is a string. Then, you can simply assign it in the AppointmentAdded event of RadScheduler by calling ToString of the RecurreceRule property of the scheduler's Appointment: 
private void radScheduler1_AppointmentAdded(object sender, AppointmentAddedEventArgs e)
{
    Appointment newAppointment = new Appointment()
    {
        BackgroundID = e.Appointment.BackgroundId,
        Description = e.Appointment.Description,
        Location = e.Appointment.Location,
        Start = e.Appointment.Start,
        End = e.Appointment.End,
        Summary = e.Appointment.Summary,
        Visible = e.Appointment.Visible,
        RecurrenceRule = e.Appointment.RecurrenceRule.ToString()
    };
  
    this.context.Add(newAppointment);  
}

I hope this helps.

Regards,
George
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
Integration with other products
Asked by
Massimiliano
Top achievements
Rank 1
Answers by
Kristian Nikolov
Telerik team
Massimiliano
Top achievements
Rank 1
George
Telerik team
Share this question
or