I've been trying to figure out how to hide a single column in the DayView control for an owner on a specified date.
The reason being an owner is added to our system before they actually commence work, this allows the receptionist to start booking appointments for this owner in advance for when they start work. However, the receptionist does not want to see their appointment column on the screen before their start date.I've looked at not adding this owner to the calendarInfo object for a single date, but this does not work for the scenario where the receptionist selects multiple days in the Calendar and the date range selectedoverlaps the owner start date.
Any help would be much appreciated.
Peter
The control does not support the behavior you describe here. You might want to consider handling UltraCalendarInfo.BeforeAppointmentAdded, and conditionally canceling the event based on the value of the e.Appointment.OwnerKey property. You can also do the same thing in BeforeDisplayAppointmentDialog to prevent the dialog from appearing for that owner. With this approach, you can prevent appointments from being added if they precede a certain date for a particular owner, and notifiy the receptionist as to the reason why.
Also note that NetAdvantage 2009.1 contains support for assigning specific days as workdays/non-workdays on a per-owner basis, and also assigning an Appearance that applies to a specific range of time. You could use this to make the days that precede the owner's start date an arbitrary appearance, so that these days appear to the user as inactive or disabled.
Example:
// Create the appearance that will be applied to the TimeSlots// that lie within the inactive rangeAppearance inactiveAppearance = new Appearance();inactiveAppearance.BackColor = Color.LightGray;inactiveAppearance.BorderColor = Color.Transparent;
// Create a DateRecurrence that runs every day, from day one to the// day before the owner starts workDateRecurrence recurrence = new DateRecurrence( System.Globalization.CultureInfo.CurrentCulture.Calendar.MinSupportedDateTime );recurrence.RangeEndDate = ownerStartDate.AddDays( -1 );recurrence.PatternFrequency = RecurrencePatternFrequency.Daily;recurrence.PatternDaysOfWeek = RecurrencePatternDaysOfWeek.All;
// Create an OwnerRecurringDateSettings object that is based on// the recurrence created above dateSettings = new OwnerRecurringDateSettings( recurrence );
// Create a TimeRange that spans the entire dayTimeRange timeRange = new TimeRange( TimeSpan.Zero, TimeSpan.FromDays(1) );
// Add the inactive appearance to the TimeRangeAppearances collectiondateSettings.TimeRangeAppearances.Add( timeRange, inactiveAppearance );
// Add the OwnerRecurringDateSettings object to the owner's// RecurringDateSettings collectionowner.RecurringDateSettings.Add( dateSettings );