// Used to insert values into tables that store data about pitch bookings public void AddNewPitchBooking(PitchBooking booking) { OpenConnection(); int numBookings = GetCount("[dbo].[BookingTable]"); int customerID = GetCount("[dbo].[CustomerTable]"); // Insert data about Customers into the CustomerTable sqlCommand = new SqlCommand("Insert Into CustomerTable VALUES (" + customerID + ", '" + booking.customerName + "', " + booking.groupSize + ");", sqlConnection); sqlCommand.ExecuteNonQuery(); // Insert data about BookingTable into the CustomerTable sqlCommand = new SqlCommand("Insert Into BookingTable VALUES (" + numBookings + ", '" + customerID + "', '" + string.Format("{0:MM-dd-yy}", booking.startDate.Date) + "', " + booking.nightsStayed + ", " + booking.GetPricePerNight() + ", " + booking.GetTotalPrice() + ");", sqlConnection); sqlCommand.ExecuteNonQuery(); // Insert data about CampingBookingsTable into the CustomerTable sqlCommand = new SqlCommand("Insert Into PitchBookingsTable VALUES (" + customerID + ", '" + booking.rentedSpace + "', " + (booking.water ? 1 : 0) + ", " + (booking.electricity ? 1 : 0) + ");", sqlConnection); sqlCommand.ExecuteNonQuery(); CloseConnection(); }