I created a custom data provider as directed in http://www.telerik.com/help/winforms/using_a_data_provider.html to populate my appoitnment from the database.
Now How do I save the appointment details when the appointment is moved or resized.
thanks
santosh
24 Answers, 1 is accepted
I can suggest you take a look at the Data Binding example of RadScheduler in our Demo application. You will find there a Save Button which updates the database when it is clicked. I think the logic which updates the database in this example will be the solution in your case. Please contact me again if you have more questions.
Best wishes,
Boyko Markov
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
What you are suggesting me is that the user move/ resizes the appointment and then has to press a button (save) in order to save it. And say if they forget which is highly possible there changes will be lost.
Also I am using a custom data provider,so I have to iterate through all the appointment, check if the data has been updated by the user and then save it to the database.
What I am trying to achive is when the user rezises or moves the selected appointment, save the appointment details then and stop the user for going through the hassel to click the button.
Is there a way to achieve this.
santosh
Let me rephrase the question.
I have populated the scheduler using the logic defined in your demo application(2009) where the scheduler is bound using the business object.
The only difference is the appointment data is acquired from the database.
Now is there a way to automatically save the appointment after it has been moved or resized?
santosh
Automatic saving when you move/drag with the mouse is performed in the data set. You can also manually update your data set by using events in RadScheduler such as AppointmentMouseUp and AppointmentMouseDown you can use to check whether the appointment is moved or resized. For example in the AppointmentMouseDown handler you can save the appointment start and end times, after that in the AppointmentMouseUp handler you can test whether appointment start and end dates have changed and update your database. I have previously told you in my last post that you can see a code which updates the database when the Save button in our example is pressed and here is the exact code snippet:
AppointmentsTableAdapter appointmentsAdapter = new AppointmentsTableAdapter();
appointmentsAdapter.Update(this.schedulerDataSet.Appointments);
AppointmentsResourcesTableAdapter appointmentsResourcesAdapter = new AppointmentsResourcesTableAdapter();
appointmentsResourcesAdapter.Update(this.schedulerDataSet.AppointmentsResources);
This code updates the database. Before saving the changes on the disk you could manually update the appointments in the DataSet using code like this:
if (this.changedAppointment != null)
{
if (this.Scheduler != null && this.Scheduler.DataSource != null)
{
this.Scheduler.DataSource.GetEventProvider().Update(this.changedAppointment);
}
this.changedAppointment = null;
}
Where changedAppointment is IEvent instance. By default the changes in the DataSet are automatically updated by RadScheduler.
I suggest you take a look at the sample demonstrating databinding for RadScheduler that you can find in the Demo application.
Greetings,
Boyko Markov
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Thanks for you assistance so far.
I am still having trouble saving a particular appointment after its been moved or resized.
I have created an demo applcation and as I could not attach it to the following post have raised a support ticket which can be accessed in the following link.
http://www.telerik.com/account/support-tickets/view-ticket.aspx?threadid=212581
Please have a look at my application a suggest me a solution
thanks
santosh.
Thank you for attaching the application.
Please find the response to your question in the support ticket.
Best wishes,
Jordan
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Cheers.
Hi towps,
The 212581 support ticket is a private ticket and only santosh can access it. However, if you are interested in the answer, you can find it below:
"Unfortunately the AppointmentMouseUp event cannot be used to check if an appointment has been moved because it is currently fired a little too early (we will address this in the next release of RadControls for WinForms together with the original issue).
So it turns out that the only workaround is to save the appointment data from the scheduler to the data source using a method like bellow:
private
void
SaveAppointmentsToDataSource()
{
ISchedulerProvider<IEvent> eventProvider =
this
.radSchedulerDemo.DataSource.GetEventProvider();
foreach
(IEvent appointment
in
this
.radSchedulerDemo.Appointments)
{
eventProvider.Update(appointment);
}
}
If you do not want to make your users click a save button you can call this method just before the form is closed."
Best wishes,
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Are you sure that attached coded works in q3 2009, i tested it and it doesn't save appointements to database. I confused i could't save appointements to database.
Actually i use such code:
for (int i = 0; i < this.radScheduler1.Appointments.Count; i++) |
{ |
IEvent ie = this.radScheduler1.Appointments[i]; |
try{ |
eventProvider.Update(ie, null); |
} |
catch(Exception ex) |
{ |
} |
} |
Pavel.
Please take a look at the DataBinding example of RadScheduler in the QSF. It demonstrates the data binding feature of RadScheduler and especially how to bind the scheduler to a data source, make some changes and then save the changes back in the data base.
If you require more information, do nto hesitate to contact us.
Greetings,
Boyko Markov
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
By default the changes in the DataSet are automatically updated by RadScheduler. |
I track change and the AppointmentsTableAdapter() save all change that I do in my appointments
But AppointmentsResourcesTableAdapter(), does´t get the change in resource.. this always show the same values that are in database.. And if I add a new appointment, this error appears.
Unable to cast object of type 'System.Guid' to type 'System.IConvertible'.Couldn't store <797b4d38-63da-4421-b728-f875fd3c5f46> in ID Column. Expected type is Int32.
Follow this post I add that methow before save.. but After Execute that method.. next statements are not executed.
Note: I call btnSAve in formisclosing event.
Database is the same that is located in your examples projects.
private void btnSave_Dataset() |
{ |
ISchedulerProvider<IEvent> eventProvider = this.radSchedulerDemo.DataSource.GetEventProvider(); |
foreach (IEvent appointment in this.radSchedulerDemo.Appointments) |
{ |
try |
{ |
eventProvider.Update(appointment,null); |
} |
catch (Exception ex) |
{ |
} |
} |
////////////After Execute the previous method.. following lines never execute.. |
//see http://msdn.microsoft.com/en-us/library/ms171933.aspx |
AppointmentsTableAdapter appointmentsAdapter = new AppointmentsTableAdapter(); |
AppointmentsResourcesTableAdapter appointmentsResourcesAdapter = new AppointmentsResourcesTableAdapter(); |
appointmentsAdapter.Update(this.schedulerDataSet.Appointments); |
appointmentsResourcesAdapter.Update(this.schedulerDataSet.AppointmentsResources); |
SchedulerDataBDDataSet.AppointmentsResourcesDataTable deletedChildRecords = |
this.schedulerDataSet.AppointmentsResources.GetChanges(DataRowState.Deleted) |
as SchedulerDataBDDataSet.AppointmentsResourcesDataTable; |
There are a few problems that we are aware of with working with Access: when you create your dataset from an access database the Id of the appointment is not read only in the dataset but it should be read only. Also AutoincrementSeed and AutoincrementStep have values -1, but the value should be 1. Please take a look carefully the example that we provide for the scheduler binding (QSF->Scheduler->Binding example) with our installation.
If you have additional questions feel free to ask.
Kind regards,
Dobry Zranchev
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.
I resorted to the following approach, which I think is reasonably clear from the code snippet below. By the time the timer-elapsed eventhandler runs, the appointment is up to date. You just need to keep track of its unique identifier so that you can update it to the database when the timer goes off.
Private Sub RadScheduler1_AppointmentMouseUp(ByVal sender As System.Object, _
ByVal e As Telerik.WinControls.UI.SchedulerAppointmentMouseEventArgs) _
Handles RadScheduler1.AppointmentMouseUp
' The appointment does not have its ResourceID updated yet, so we must wait
' until this event handler has run to completion before updating the database.
Dim aTimer As System.Timers.Timer = New System.Timers.Timer(12)
AddHandler aTimer.Elapsed, AddressOf OnTimedEvent
aTimer.Enabled = True
aTimer.AutoReset = False
m_ApptId = CShort(e.Appointment.UniqueId().KeyValue())
End Sub
Thank you for writing.
Please use the CollectionChanged event in the Appointments collection of the scheduler and do your updates there. This event is call for each change of the collection insert, update or delete actions.
A bit off topic, please ask the person who has purchased our controls in your company to add you as a License Developer to the purchase. This will give you full access to the products your company has purchased, to our downloads section, and to our support ticketing system. Additionally, all your questions will be reviewed according to the license you have. More information on License Developers you can find here: www.telerik.com/account/faqs.aspx.
Kind regards,
Dobry Zranchev
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.
I am using the 2011 Q1 version and have the exact same issue. Can someone outline the steps? The solution mentioned by Jim Benson is unclear to me.
Thanks,
FB
You might find it useful to check this forum thread.
Hope this helps.
All the best,
Ivan Todorov
the Telerik team
THIS IS A BUG IN the scheduler I am usaingQ1 .315 Version till q2 11
comes out...?
Dr Jeff Link :)
I would just like to inform you that the Q2 release should be available for download later this week.
If you have any questions, do not hesitate to ask.
Kind regards,
Ivan Todorov
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!
Should I be looking somewhere else for the latest appointment data not the event argument object?
Thanks
Andrew
The issue that was discussed here was addressed in the Q2 2011 release, as you can see in the release notes. You might be experiencing a different issue, so please provide us with more details about your scenario.
A bit off topic, I would like to remind you that your Trial support package has already expired. If you would like to continue receiving support from us, you will have to consider a purchase of some of the licenses that we offer. At this link - http://www.telerik.com/purchase.aspx - you can find the available options. These licenses comes with Dev priority support where the tickets should be answered in a guaranteed period of time. Shortly said, we will provide you with quicker responses.
In case have already purchased the tools under another account, please send us the company name, account name and email under which the controls were purchased so that we can update your account and provide you with proper support services. Alternatively, please ask the purchase holder to add you as a License Developer to the purchase. This will give you full access to the products your company has purchased, to our downloads section, and to our support ticketing system. Additionally, all your questions will be reviewed according to the license you have. More information on License Developers you can find here: http://www.telerik.com/account/faqs.aspx.
Do not hesitate to contact us if you have any further questions.
Regards,
Ivan Todorov
the Telerik team
Q2’11 SP1 of RadControls for WinForms is available for download (see what's new); also available is the Q3'11 Roadmap for Telerik Windows Forms controls.
Thanks for your reply, please add the following code and subscribe to the associated events to your Scheduler Grouping example and you will see what I mean. I have update to version 2011.2.11.831.
1. The appointment mouse up event has exactly the same appointment details as the mouse down.
2. The move event is fired everytime you move past a given time interval, eg. in the demo it is set to hourly segments so every hour you move an appointment a move event is fired.
3. None of the events pick up the fact you have dragged an appointment from one resource to another.
Yes I have gone past my trial period but I have not had the time, now I am doing the evaluation and will be very happy to pay when I know it will do what I need. I figured this behaviour is not what is meant to happy and you would be happy to know.
Thanks
Andrew
private void radSchedulerDemo_AppointmentMouseDown(object sender, SchedulerAppointmentMouseEventArgs e)
{
Console.WriteLine("Down:" + e.Appointment.Start.ToString() + ":" + e.Appointment.End.ToString() + ":" + e.Appointment.ResourceId.KeyValue.ToString());
}
private void radSchedulerDemo_AppointmentMouseUp(object sender, SchedulerAppointmentMouseEventArgs e)
{
Console.WriteLine("Up:" + e.Appointment.Start.ToString() + ":" + e.Appointment.End.ToString() + ":" + e.Appointment.ResourceId.KeyValue.ToString());
}
private void radSchedulerDemo_AppointmentMoved(object sender, AppointmentMovedEventArgs e)
{
Console.WriteLine("Moved:" + e.Appointment.Start.ToString() + ":" + e.Appointment.End.ToString() + ":" + e.Appointment.ResourceId.KeyValue.ToString());
}
I forgot to mention that it works fine if you dray the appoinment edges to extend or shrink an appoinment, but not if you actually move the whole appoinment.
Thanks
Andrew
If I understand you correctly, you want to get the resource id of the view that an appointment is being dropped to. The AppointmentMouseUp event is the one that causes the drop of appointments so at this point the appointment have not yet changed its resource. You should subscribe to the AppointmentDropped event and you will see that the resource id is changed when the event fires.
As to the AppointmentMoved event, this is its behavior by design. If you think this behavior is incorrect, we will be glad to hear your feedback on how it should behave.
I hope you find this useful. Feel free to write back if you have any further questions.
Best wishes,
Ivan Todorov
the Telerik team
Q2’11 SP1 of RadControls for WinForms is available for download (see what's new); also available is the Q3'11 Roadmap for Telerik Windows Forms controls.
private void button1_Click_1(object sender, EventArgs e)
{
try
{
ISchedulerProvider<IEvent> eventProvider = this.radScheduler1.DataSource.GetEventProvider();
for (int i = 0; i < this.radScheduler1.Appointments.Count; i++)
{
IEvent ie = this.radScheduler1.Appointments[i];
MessageBox.Show(ie.ToString());
try
{
eventProvider.Update(ie,null);
}
catch (Exception ex)
{
}
}