Telerik Data Access + Winforms RadScheduler + sqlite

6 posts, 0 answers
  1. Massimiliano
    Massimiliano avatar
    3 posts
    Member since:
    Jul 2014

    Posted 11 Jul 2014 Link to this post

    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
  2. Kristian Nikolov
    Admin
    Kristian Nikolov avatar
    206 posts

    Posted 15 Jul 2014 Link to this post

    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.
     
  3. DevCraft banner
  4. Massimiliano
    Massimiliano avatar
    3 posts
    Member since:
    Jul 2014

    Posted 15 Jul 2014 in reply to Kristian Nikolov Link to this post

    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



  5. Kristian Nikolov
    Admin
    Kristian Nikolov avatar
    206 posts

    Posted 17 Jul 2014 Link to this post

    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.
     
  6. Massimiliano
    Massimiliano avatar
    3 posts
    Member since:
    Jul 2014

    Posted 17 Jul 2014 in reply to Kristian Nikolov Link to this post

    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
  7. George
    Admin
    George avatar
    500 posts

    Posted 22 Jul 2014 Link to this post

    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.
     
Back to Top
DevCraft banner