Dear telerik team,
Kindly check below problems i am facing due to events cycles you set for RadScheduleView.
1) I wanted to save newely created appointment, so i put my code in AppointmentSaving event. it works fine.
2) i wanted to edit appiontment , so i put my code in AppointmentEdited event. Now the problem comes into picture. Surprisingly, before firing AppointmentEdited event, AppointmentSaving is get fired everytime, so what is happening here, code in AppointmentSaving is also executing, then after AppiontmentEdited code executing. So one appointment is edited, and another appointment is created separately.
There were AppointmentAdded event in RadScheduler, so there were working everything fine, but now in RadScheduleView , due to new evens and event cycles, i am facing this problem.
kindly check below code, and respond.
thanks & regards
Kindly check below problems i am facing due to events cycles you set for RadScheduleView.
1) I wanted to save newely created appointment, so i put my code in AppointmentSaving event. it works fine.
2) i wanted to edit appiontment , so i put my code in AppointmentEdited event. Now the problem comes into picture. Surprisingly, before firing AppointmentEdited event, AppointmentSaving is get fired everytime, so what is happening here, code in AppointmentSaving is also executing, then after AppiontmentEdited code executing. So one appointment is edited, and another appointment is created separately.
There were AppointmentAdded event in RadScheduler, so there were working everything fine, but now in RadScheduleView , due to new evens and event cycles, i am facing this problem.
kindly check below code, and respond.
private void SchedulerView_AppointmentEdited(object sender, AppointmentEditedEventArgs e)
{
busyIndicator.IsBusy = true;
ResourceAppointment editedAppointment = e.Appointment as ResourceAppointment;
SP.ListItem listItem = _ResourceAppointment.GetItemById(editedAppointment.AppointmentId);
listItem["Title"] = editedAppointment.Subject.ToString();
listItem["EventDate"] = Convert.ToDateTime(editedAppointment.Start).ToLocalTime();
listItem["EndDate"] = Convert.ToDateTime(editedAppointment.End).ToLocalTime();
listItem["Description"] = editedAppointment.Body.ToString();
listItem.FieldValues["Rooms"] = editedAppointment.Resources[0].ResourceName.ToString();
listItem.FieldValues["Resources"] = editedAppointment.Resources[0].ResourceName.ToString();
listItem.Update();
_Context.Load(_ResourceAppointment, list => list.Title);
_Context.ExecuteQueryAsync(OnEditItemToListSucceeded, OnEditItemToListFailed);
}
private void SchedulerView_AppointmentSaving(object sender, AppointmentSavingEventArgs e)
{
busyIndicator.IsBusy = true;
ResourceAppointment newAppointment = e.Appointment as ResourceAppointment;
SP.ListItem listItem = _ResourceAppointment.AddItem(new ListItemCreationInformation());
listItem["Title"] = newAppointment.Subject.ToString();
listItem["EventDate"] = Convert.ToDateTime(newAppointment.Start).ToLocalTime();
listItem["EndDate"] = Convert.ToDateTime(newAppointment.End).ToLocalTime();
listItem["Description"] = newAppointment.Body.ToString();
listItem.FieldValues["Rooms"] = newAppointment.Resources[0].ResourceName.ToString();
listItem.FieldValues["Resources"] = newAppointment.Resources[0].ResourceName.ToString();
listItem.Update();
_Context.Load(_ResourceAppointment, list => list.Title);
_Context.ExecuteQueryAsync(OnSaveItemToListSucceeded, OnSaveItemToListFailed);
}
thanks & regards