AppointmentOperationEventArgs Class
Provides data for the AllowAppointment events of the SchedulerControl.
Namespace: DevExpress.XtraScheduler
Assembly: DevExpress.XtraScheduler.v18.1.Core.dll
Declaration
Remarks
The AllowAppointment events occur when an end-user tries to perform a particular action, which is defined by this AllowAppointment event, and the corresponding AllowAppointment property of the SchedulerControl.OptionsCustomization object is set to Custom. The AppointmentOperationEventArgs class introduces the AppointmentOperationEventArgs.Allow property that specifies whether the particular action is allowed to be performed by an end-user or not. The processed appointment is identified by the AppointmentEventArgs.Appointment property.
An instance of the AppointmentOperationEventArgs class with appropriate settings is automatically created and passed to the corresponding event’s handler.
Example
This example demonstrates how to implement custom rules for editing and deleting appointments. The code below allows an appointment to be edited only by its owner (the end-user who created it). To do this it’s necessary to set the SchedulerOptionsCustomization.AllowAppointmentEdit and SchedulerOptionsCustomization.AllowAppointmentDelete properties to UsedAppointmentType.Custom, and handle the SchedulerControl.AllowAppointmentEdit and SchedulerControl.AllowAppointmentDelete events to implement custom logic for editing appointments.
using DevExpress.XtraScheduler;
// ...
private void schedulerControl1_AllowAppointmentDelete(object sender,
AppointmentOperationEventArgs e) {
// Allow only the user who created this appontment to delete it.
e.Allow = CanUserModifyThisAppointment(e.Appointment);
}
private void schedulerControl1_AllowAppointmentEdit(object sender,
AppointmentOperationEventArgs e) {
// Allow only the user who created this appontment to modify it.
e.Allow = CanUserModifyThisAppointment(e.Appointment);
}
// Determine if the current user is the same
// as the one who created the specified appointment
bool CanUserModifyThisAppointment(Appointment apt) {
object obj = apt.CustomFields["Owner"];
if (obj == null)
return true;
string appointmentOwner = obj.ToString();
if (appointmentOwner == String.Empty)
return true;
return (String.Compare(appointmentOwner, tbUserName.Text, true) == 0);
}
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the AppointmentOperationEventArgs class.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.