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

Kindly explain why events for create & edit appointment, seems illogical in my scenario

2 Answers 54 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
palak
Top achievements
Rank 1
palak asked on 11 Jun 2011, 02:58 PM
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.

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

2 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 14 Jun 2011, 08:40 AM
Hi Palak,

I'm pasting the reply from the support ticket regarding the same issue:

In RadScheduleView you can use AppointmentCreated event which is fired after AppointmentSaving in order to save the new appointment. More information about RadScheduleView events can be found here.
Also you can check this help article which explains the differences between RadScheduler and RadScheduleView.

Greetings,
Yana
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
0
palak
Top achievements
Rank 1
answered on 16 Jun 2011, 10:17 AM
Problem resolved.

 

AppointmentCreated event got a property lik e.createdappointment to reference new appointment which i missed it before.

thanks.

Tags
ScheduleView
Asked by
palak
Top achievements
Rank 1
Answers by
Yana
Telerik team
palak
Top achievements
Rank 1
Share this question
or