Example #1
0
 public void SetData(IEnumerable <ColumnViewModel> appointments, DateTime timePeriodStart, TimePeriodType timeView, AppointmentBookViewModelFilter columnFilter = AppointmentBookViewModelFilter.All)
 {
     base.Initialize(timePeriodStart, timeView);
     _blockLookup    = new Dictionary <Tuple <int, int>, AppointmentViewModel>();
     _allColumns     = appointments.ToArray();
     _visibleColumns = new ColumnViewModel[0];
     _columnFilter   = columnFilter;
     SetVisibleColumns();
 }
Example #2
0
 protected AppointmentBook(DataSourceToViewModelConverter viewModelGenerator)
 {
     _dataSource        = null;
     _timePeriodType    = TimePeriodType.DailyHourly;
     _timePeriodStart   = DateTime.Now.ToMidnight();
     _columnFilter      = AppointmentBookViewModelFilter.All;
     _lastDraggedOver   = Tuple.Create(int.MinValue, int.MinValue, false);
     ViewModelGenerator = viewModelGenerator;
     _resizing          = false;
     base.AllowDrop     = true;
     base.GiveFeedback += ResourceCalendar_DragGiveFeedback;
     base.DragEnter    += ResourceCalendar_DragEnter;
     base.DragLeave    += ResourceCalendar_DragLeave;
     base.DragOver     += ResourceCalendar_DragOver;
     base.DragDrop     += ResourceCalendar_DragDrop;
 }
Example #3
0
 public AppointmentBookViewModel(IEnumerable <ColumnViewModel> appointments, DateTime timePeriodStart, TimePeriodType timeView, AppointmentBookViewModelFilter columnFilter = AppointmentBookViewModelFilter.All)
     : base(timePeriodStart, timeView)
 {
     SetData(appointments, timePeriodStart, timeView, columnFilter);
 }
 public virtual AppointmentBookViewModel Convert(IAppointmentBookDataSource dataSource, DateTime timePeriodStart, TimePeriodType timeView, AppointmentBookViewModelFilter columnFilter)
 {
     return(new AppointmentBookViewModel(
                ConvertColumns(dataSource),
                timePeriodStart,
                timeView,
                columnFilter
                ));
 }
        public override AppointmentBookViewModel Convert(IAppointmentBookDataSource dataSource, DateTime timePeriodStart, TimePeriodType timeView, AppointmentBookViewModelFilter columnFilter)
        {
            DateTime startTime;
            DateTime endTime;

            switch (timeView)
            {
            case TimePeriodType.Monthly:
                startTime = timePeriodStart.ToBeginningOfMonth();
                endTime   = timePeriodStart.AddMonths(1).ToBeginningOfMonth();
                break;

            default:
                startTime = timePeriodStart.ToMidnight();
                endTime   = timePeriodStart.ToNextDay().ToMidnight();
                break;
            }

            return(new UnallocatedBookViewModel(
                       "Unallocated",
                       from appointment in dataSource.GetAppointments(new UnallocatedColumn())
                       select Convert(appointment),
                       startTime,
                       timeView
                       ));
        }