Hello, thank you for looking at my question Telerik!
I Have a calendar, that when someone moves an appointment via the edit dialog using the startDate and endDate dropdown, when they click OK it fires a collectionchanged event like it should, however i get that event fired 2 times, one for the Start Date (PropertyName = "StartDate" and once for EndDate (property name "EndDate") and of course any other data they might have changed ...
My Question, how do i not get 2 events, how can i make it so when they change data ont he edit dialog and click OK i get ONE event, or somehow else know that a particular event was updated instead of getting field by field notification that tells me ok, this appointment was updated, then i can go and grab the properties of that Appointment object and save them to my datasource (Using WCF Web Services) with only 1 call, the issue is i make 1 call to save the start date then right behind that i make a second call to save the end date and its messing things up !
here is my collectionChanged event, thank you for the input !!
I Have a calendar, that when someone moves an appointment via the edit dialog using the startDate and endDate dropdown, when they click OK it fires a collectionchanged event like it should, however i get that event fired 2 times, one for the Start Date (PropertyName = "StartDate" and once for EndDate (property name "EndDate") and of course any other data they might have changed ...
My Question, how do i not get 2 events, how can i make it so when they change data ont he edit dialog and click OK i get ONE event, or somehow else know that a particular event was updated instead of getting field by field notification that tells me ok, this appointment was updated, then i can go and grab the properties of that Appointment object and save them to my datasource (Using WCF Web Services) with only 1 call, the issue is i make 1 call to save the start date then right behind that i make a second call to save the end date and its messing things up !
here is my collectionChanged event, thank you for the input !!
void
Appointments_CollectionChanged(
object
sender, Telerik.WinControls.Data.NotifyCollectionChangedEventArgs e)
{
if
(e.Action == Telerik.WinControls.Data.NotifyCollectionChangedAction.ItemChanged)
{
if
(e.NewItems.Count > 0 && e.OldItems.Count > 0)
{
DoctorAppointment newAppt = (DoctorAppointment) e.NewItems[0];
DoctorAppointment oldAppt = (DoctorAppointment) e.OldItems[0];
if
((e.PropertyName ==
"Start"
|| e.PropertyName ==
"End"
))
{
sc.RescheduleAppointmentAsync(
this
.LoggedInUserID, newAppt.id, newAppt.Start, newAppt.End);
}
if
(e.PropertyName ==
"status_id"
)
{
short
followupid = newAppt.status_id.GetValueOrDefault(-1);
if
(followupid > 0) {
sc.FollowupAppointmentAsync(
this
.LoggedInUserID, newAppt.id, followupid);
}
}
newAppt =
null
;
oldAppt =
null
;
}
}
}