// Show booking grid with booking list from SQL Table public void showBookings() { workingHours_Txt.Text = DatabaseControl.getHoursOfBookingDate(dateTimePicker1.Value.Date).ToString(); note_Txt.Text = DatabaseControl.getBookingNote(dateTimePicker1.Value.Date); double workingHours = DatabaseControl.getHoursOfBookingDate(dateTimePicker1.Value.Date); BindingSource bs = new BindingSource(); GData.bookings = DatabaseControl.getBookings(); GData.customers = DatabaseControl.getCustomers(); List <Booking> bookings = GData.bookings.Where(b => b.bookingDate.Date == dateTimePicker1.Value.Date).ToList(); foreach (Booking booking in bookings) { //booking.estimatedTime = booking.timeOut - booking.timeIn; booking.timeRemaining = workingHours - booking.estimatedTime; workingHours -= booking.estimatedTime; } bs.DataSource = bookings.Select(b => new FilteredBooking() { id = b.id, jobNO = b.jobNO, jobType = b.jobType, customerName = GData.customers.Where(c => c.id == b.customerID).ToList()[0].name, vehicleModel = b.vehicleModel, regNo = b.regNo, bookedBy = b.bookedBy, loanCar = b.loanCar, jobDescription = b.jobDescription, timeRemaining = b.timeRemaining, timeIn = b.timeIn, timeOut = b.timeOut, bookingDate = b.bookingDate }).ToList(); dataGridView1.DataSource = bs; }