public List <Booking> Sp_ShowBooking(DateTime bookingDate) { List <Booking> bookings = new List <Booking>(); List <Package> packages = new List <Package>(); List <Package> packagesFromDB = new List <Package>(); Booking b = null; string customerName = ""; string startTime = ""; string packageName = ""; string bookingId = ""; pr.AddPackageFromDBToList(Sp_GetAllPackages()); using (SqlConnection con = new SqlConnection(connectionString)) { try { con.Open(); SqlCommand cmd1 = new SqlCommand("Sp_ShowDailyBookings", con); cmd1.CommandType = CommandType.StoredProcedure; cmd1.Parameters.Add(new SqlParameter("@BookingDate", bookingDate)); SqlDataReader reader = cmd1.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { customerName = (reader["CustomerName"].ToString()); startTime = reader["StartTime"].ToString(); bookingId = reader["BookingID"].ToString(); using (SqlConnection con2 = new SqlConnection(connectionString2)) { try { con2.Open(); SqlCommand cmd2 = new SqlCommand("Sp_FindAllPackagesForBooking", con2); cmd2.CommandType = CommandType.StoredProcedure; cmd2.Parameters.Add(new SqlParameter("@BookingID", bookingId)); using (SqlDataReader reader2 = cmd2.ExecuteReader()) { if (reader2.HasRows) { while (reader2.Read()) { packageName = reader2["packageName"].ToString(); packages.Add(pr.FindPackage(packageName)); } } } } catch (SqlException e) { Console.WriteLine("Ups" + e.Message); } } Customer customer = new Customer(customerName); b = new Booking(customer, startTime, bookingDate, packages); bookings.Add(b); } } } catch (SqlException e) { Console.WriteLine("Ups" + e.Message); } } return(bookings); }