Esempio n. 1
0
        /// <summary>
        /// Adds the columns and sets in the bookings
        /// </summary>
        private void UpdateBookingList( )
        {
            BookingCtr book = new BookingCtr();

            dt       = new DataTable();
            bs       = new BindingSource();
            bookings = book.GetAll();

            dt.Columns.Add("Escaperoom", typeof(string));
            dt.Columns.Add("Tidspunkt for booking", typeof(TimeSpan));
            dt.Columns.Add("Dato for booking", typeof(DateTime));
            dt.Columns.Add("Antal Personer", typeof(int));
            dt.Columns.Add("Brugernavn", typeof(string));
            dt.Columns.Add("Medarbejder", typeof(string));
            dt.Columns.Add("id", typeof(int));


            foreach (var Booking in bookings)
            {
                if (Booking.Date >= DateTime.Now.Date)
                {
                    dt.Rows.Add(Booking.Er.Name, Booking.BookingTime, Booking.Date.ToShortDateString(), Booking.AmountOfPeople, Booking.Cus.Username, Booking.Emp.FirstName + Booking.Emp.LastName, Booking.Id);
                }
            }

            bs.DataSource                        = dt;
            dgvAllBookings.DataSource            = bs;
            dgvAllBookings.Columns["id"].Visible = false;
        }
        public void ReadAllBookingTest( )
        {
            //Arrange
            BookingCtr     bc = new BookingCtr();
            List <Booking> bookings;

            //Act
            bookings = bc.GetAll();

            //Assert
            Assert.IsNotNull(bookings);
        }