'Declaration Public ReadOnly Property Appointment As Appointment
public Appointment Appointment {get;}
Private Sub UltraMonthViewSingle1_BeforeAppointmentEdit(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinSchedule.BeforeAppointmentEditEventArgs) Handles ultraMonthViewSingle.BeforeAppointmentEdit '---------------------------------------------------------------------------------------------------- ' Description ' BeforeAppointmentEdit ' ' Fires before an Appointment's subject is edited via the control's UI. ' If the event is canceled, the Appointment will not allow editing, and the AfterAppointmentEdit ' event does not fire. ' '---------------------------------------------------------------------------------------------------- ' Determine whether the appointment spans more than one day If e.Appointment.StartDateTime.Date <> e.Appointment.EndDateTime.Date Then ' This is a multi-day appointment, so we will inform the user that they do ' not have permission to edit the appointment, and cancel the event by ' setting the 'Cancel' property to true. MessageBox.Show("You do not have the appropriate permissions to edit this Appointment.", "Access Denied", MessageBoxButtons.OK, MessageBoxIcon.Error) e.Cancel = True Return End If ' Get the day of the week on which the appointment falls Dim dow As System.DayOfWeek = e.Appointment.StartDateTime.DayOfWeek ' If the appointment falls on any other day than Saturday or Sunday, ' don't allow the edit If dow <> System.DayOfWeek.Saturday And dow <> System.DayOfWeek.Sunday Then MessageBox.Show("You do not have the appropriate permissions to edit this Appointment.", "Access Denied", MessageBoxButtons.OK, MessageBoxIcon.Error) e.Cancel = True Return End If End Sub
private void ultraMonthViewSingle1_BeforeAppointmentEdit(object sender, Infragistics.Win.UltraWinSchedule.BeforeAppointmentEditEventArgs e) { //---------------------------------------------------------------------------------------------------- // Description // BeforeAppointmentEdit // // Fires before an Appointment's subject is edited via the control's UI. // If the event is canceled, the Appointment will not allow editing, and the AfterAppointmentEdit // event does not fire. // //---------------------------------------------------------------------------------------------------- // Determine whether the appointment spans more than one day if ( e.Appointment.StartDateTime.Date != e.Appointment.EndDateTime.Date ) { // This is a multi-day appointment, so we will inform the user that they do // not have permission to edit the appointment, and cancel the event by // setting the 'Cancel' property to true. MessageBox.Show( "You do not have the appropriate permissions to edit this Appointment.", "Access Denied", MessageBoxButtons.OK, MessageBoxIcon.Error ); e.Cancel = true; return; } // Get the day of the week on which the appointment falls System.DayOfWeek dow = e.Appointment.StartDateTime.DayOfWeek; // If the appointment falls on any other day than Saturday or Sunday, // don't allow the edit if ( dow != System.DayOfWeek.Saturday && dow != System.DayOfWeek.Sunday ) { MessageBox.Show( "You do not have the appropriate permissions to edit this Appointment.", "Access Denied", MessageBoxButtons.OK, MessageBoxIcon.Error ); e.Cancel = true; return; } }
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2