示例#1
0
        public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            DateTime intervalStart = System.Convert.ToDateTime(values[0]);
            DateTime intervalEnd   = System.Convert.ToDateTime(values[1]);
            string   resourceId    = System.Convert.ToString(values[2]);
            Brush    defaultBrush  = (Brush)values[3];

            if (intervalStart > intervalEnd)
            {
                DateTime temp = intervalStart;
                intervalStart = intervalEnd;
                intervalEnd   = temp;
            }

            bool available = ResourcesAvailabilities.IsIntervalAvailableForResource(
                resourceId, new TimeInterval(intervalStart, intervalEnd));

            if (available)
            {
                return(defaultBrush);
            }
            else
            {
                return(defaultBrush.SetBrightness(0.85));
            }
        }
示例#2
0
        private void schedulerControl1_AllowAppointmentCreate(object sender, AppointmentOperationEventArgs e)
        {
            bool available = ResourcesAvailabilities.IsIntervalAvailableForResource(
                schedulerControl1.SelectedResource.Id.ToString(),
                schedulerControl1.SelectedInterval);

            errorInfo.Content = (available ? null : ResourcesAvailabilities.WarningMessage);

            e.Allow = available;
        }
示例#3
0
        private void Storage_AppointmentChanging(object sender, PersistentObjectCancelEventArgs e)
        {
            Appointment apt = (Appointment)e.Object;

            bool available = ResourcesAvailabilities.IsIntervalAvailableForResource(
                apt.ResourceId.ToString(),
                new TimeInterval(apt.Start, apt.End));

            errorInfo.Content = (available ? null : ResourcesAvailabilities.WarningMessage);

            e.Cancel = !available;
        }