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

Save Changes Automatically

6 Answers 134 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
Karl
Top achievements
Rank 1
Karl asked on 18 Jan 2012, 02:04 PM
Hi,
I was wondering if someone could help me, which event is best to call to save any changes made in the RadScheduler.At present I I use a button to save all changes using TableAdapters. I would like the changes saved automatically ie if resized, dragged or a appointment is opend edited and closed.

I've tried the .Appointments.CollectionChanged and when adding an event using CustomEditAppointmentDialog it adds the appointment twice.

Thanks

6 Answers, 1 is accepted

Sort by
0
Karl
Top achievements
Rank 1
answered on 19 Jan 2012, 11:38 AM
Think I sorted this, I added the

AppointmentsRowChanged

and the

AppointmentsRowDeleted

 on the dataset and it seems to work ok
0
Ivan Todorov
Telerik team
answered on 20 Jan 2012, 06:08 PM
Hi Karl,

I am glad that you have sorted this out.

Indeed, this is the correct approach since RadScheduler always keeps the source collection consistent by updating it when this is needed.

Should you have any future questions, do not hesitate to contact us.

Greetings,
Ivan Todorov
the Telerik team

SP1 of Q3’11 of RadControls for WinForms is available for download (see what's new).

0
Mark
Top achievements
Rank 1
answered on 01 May 2012, 03:27 AM
If this helps anyone, here is what i did to get the rad scheduler to save the data:

I followed the instructions in this video here (had to manually create an SQL CE database based on their sample access db):

http://tv.telerik.com/winforms/radscheduler/codeless-data-binding-with-radscheduler-winforms

But anytime i added or changed an appointment it wouldn't save it to the database.

So i added this to my form load:

radScheduler1.Appointments.CollectionChanged += new Telerik.WinControls.Data.NotifyCollectionChangedEventHandler(Appointments_CollectionChanged);

And the event handler code is:

        private void Appointments_CollectionChanged(object sender, Telerik.WinControls.Data.NotifyCollectionChangedEventArgs e)
        {
            appointmentsTableAdapter.Update(this.schedulerdataDataSet.Appointments);
            this.schedulerdataDataSet.AcceptChanges();

            Console.WriteLine("Updated scheduler at " + DateTime.Now.ToString());
        }

After doing that it actually saved the data to the database and seems to work now.

Hope this helps.
0
Ivan Todorov
Telerik team
answered on 03 May 2012, 01:17 PM
Hi Mark,

Thank you for sharing your solution with our community.

Your Telerik points have been updated.

Feel free to contact us whenever you need any help or you want to leave your feedback.

Regards,
Ivan Todorov
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
0
Gaston
Top achievements
Rank 1
answered on 01 Feb 2014, 09:57 AM
I tried to you use your code and it work as it should when it come to editing an appointment. But one slight problem... whenever i create a new appointment it always make duplicate?!? Do you have any idea why it might do that?
0
Ivan Todorov
Telerik team
answered on 05 Feb 2014, 07:54 AM
Hello Gaston,

Thank you fro your question.

Most probably this happens because calling Update method of the table adapter causes the scheduler to update its appointments and another CollectionChanged will be caused. To avoid this you can simply put a boolean flag to indicate if you are doing an update:
bool updating = false;
void Appointments_CollectionChanged(object sender, Telerik.WinControls.Data.NotifyCollectionChangedEventArgs e)
{
    if (updating)
    {
        return;
    }
 
    updating = true;
    appointmentsTableAdapter.Update(this.schedulerDataDataSet.Appointments);
    this.schedulerDataDataSet.AcceptChanges();
    updating = false;
}

Hope this will help. If you have any other questions, feel free to ask.

Regards,
Ivan Todorov
Telerik
TRY TELERIK'S NEWEST PRODUCT - APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
Scheduler and Reminder
Asked by
Karl
Top achievements
Rank 1
Answers by
Karl
Top achievements
Rank 1
Ivan Todorov
Telerik team
Mark
Top achievements
Rank 1
Gaston
Top achievements
Rank 1
Share this question
or