Skip to main content
A newer version of this page is available. .

AppointmentOperationEventArgs.Allow Property

Gets or sets a value indicating whether an end-user is allowed to perform a particular action.

Namespace: DevExpress.XtraScheduler

Assembly: DevExpress.XtraScheduler.v19.2.Core.dll

Declaration

public bool Allow { get; set; }

Property Value

Type Description
Boolean

true if an action is allowed; otherwise, false.

Remarks

If the Allow property value will not be set in the corresponding AllowAppointment event handler, then it is considered that the action is allowed (Allow will be set to true by default).

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);
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the Allow property.

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.

See Also