Exemplo n.º 1
0
        public void PrecedingPeriod()
        {
            var period1 = new BookingPeriod(new DateTime(1992, 2, 3), new DateTime(2006, 2, 2));
            var period2 = new BookingPeriod(new DateTime(1992, 1, 1), new DateTime(1992, 2, 2));

            Assert.IsFalse(period1.OverlapsWith(period2));
            Assert.IsTrue(period1.DoesNotoverlapWith(period2));
        }
Exemplo n.º 2
0
        private void ResetRoomDateSelectionElements()
        {
            ClearRoomDateSelectionElements();
            BookingPeriod viewPeriod = new BookingPeriod(StartDate, StartDate.AddDays(DatesToDisplay - 1));

            if (SelectedRange.IsValid() && SelectedRange.OverlapsWith(viewPeriod))
            {
                int startColumn, columnSpan;
                GetColumnAndSpanOfSelectedPeriod(out startColumn, out columnSpan);
                int rightMargin = SelectedRange.EndDate <= viewPeriod.EndDate ? MarginForRoomDateSelectionElement : 0;
                int leftMargin  = SelectedRange.StartDate >= viewPeriod.StartDate ? MarginForRoomDateSelectionElement : 0;
                foreach (Room room in SelectedRooms)
                {
                    int    row = Rooms.IndexOf(room);
                    Canvas SelectionElement = new Canvas();
                    SelectionElement.Background = Brushes.Orange;
                    SelectionElement.Margin     = new Thickness(leftMargin, 20, rightMargin, 10);
                    Grid.SetColumnSpan(SelectionElement, columnSpan);
                    AddToRoomDateGrid(startColumn, row, SelectionElement);
                    SelectionElements.Add(SelectionElement);
                }
            }
        }