Hi there,
i am looking for the best solution writing changed appointments to the datasbase after editing in the UtraDayView. My solution looks like this at the moment:
private void ultraCalendarInfo1_CalendarInfoChanged(object sender, Infragistics.Win.UltraWinSchedule.CalendarInfoChangedEventArgs e) { Infragistics.Shared.PropChangeInfo PropChange = e.PropChangeInfo.FindPropId(Infragistics.Win.UltraWinSchedule.PropertyIds.Appointment); bool aendern = false; if (PropChange != null) { if (PropChange.Trigger != null) { this.ultraCalendarInfo1.EventManager.SetEnabled(CalendarInfoEventIds.CalendarInfoChanged, false); Infragistics.Win.UltraWinSchedule.Appointment appChanged = (Infragistics.Win.UltraWinSchedule.Appointment)PropChange.Trigger.Source; if (PropChange.Trigger.ToString().StartsWith("Appointment.") && !PropChange.Trigger.ToString().StartsWith("Appointment.DataKey")) { if (this.terminColl.IsDirty) { this.terminColl.Save(); } } } this.ultraCalendarInfo1.EventManager.SetEnabled(CalendarInfoEventIds.CalendarInfoChanged, true); } }
The problem is, that changing the end date of an appointment is only possible in little steps.
Where is the best event to save appointment changes? I use v.8. 3 and the example "Data Binding".
Thanks
Stephan
The 'WinSchedule Database Demo' sample, which is also included with the SDK, demonstrates this concept using an OleDbDataAdapter. Regarding what to use as a trigger: in the sample I mentioned, a menu option provides a way for the user to synch the database proactively, and the FormClosing event is handled to prompt the user when the form is closed. You can also use the DataSet's HasCHanges method to determine whether there have been any changes, and push them out to the DB if that method returns true when the app closes.
I feel that it is best to leave this to the user to do manually.
You can remind them at certain points like trying to close the form/application or some other timer mechanism etc.
Just put a "SAVE" Button on a toolbar.
If you are using a Dataset then just do the following:
If dset.GetChanges() IsNot Nothing Then SaveBackToDatabaseRoutine()End If
CheersAaron