public void PrintParkCampGround(int parkSelection) { Console.Clear(); CampGroundSqlDAL campGroundsinPark = new CampGroundSqlDAL(databaseconnectionString); ParkSqlDAL park = new ParkSqlDAL(databaseconnectionString); List <Campground> printCampGrounds = new List <Campground>(); try { printCampGrounds = campGroundsinPark.GetParkCampGround(park.GetParkID(parkSelection)); } catch (SqlException ex) { Console.WriteLine("Invalid input. Please try again."); return; } Console.WriteLine("\tName".PadRight(35) + "Open".PadRight(13) + "Close".PadRight(13) + "Daily Fee"); int count = 0; foreach (Campground campground in printCampGrounds) { Console.WriteLine($"#{count + 1} \t{printCampGrounds[count].ToString()}"); count++; } CampGroundView(parkSelection); }
public void SearchAvailableSitesInPark(string arrival, string departure, int parkSelection) { Console.Clear(); SiteSqlDAL reservationAvailibility = new SiteSqlDAL(databaseconnectionString); List <Site> availableSites = new List <Site>(); try { availableSites = reservationAvailibility.ReservationAvailable(arrival, departure, parkSelection); } catch (SqlException ex) { Console.WriteLine(); Console.WriteLine("Invalid input. Please try again."); Console.WriteLine(); return; } CampGroundSqlDAL campGroundsinPark = new CampGroundSqlDAL(databaseconnectionString); ParkSqlDAL park = new ParkSqlDAL(databaseconnectionString); List <Campground> printCampGrounds = new List <Campground>(); try { printCampGrounds = campGroundsinPark.GetParkCampGround(park.GetParkID(parkSelection)); } catch (SqlException ex) { Console.WriteLine(); Console.WriteLine("Invalid input. Please try again."); Console.WriteLine(); return; } Console.WriteLine(); Console.WriteLine("Results Matching Your Search Criteria"); Console.WriteLine("CampGround".PadRight(32) + "Site No.".PadRight(15) + "Max Occup.".PadRight(15) + "Accessible?".PadRight(15) + "Max RV Length".PadRight(15) + "Utility".PadRight(15) + "Cost".PadRight(15)); int camp_id = 0; foreach (Site s in availableSites) { string campName = string.Empty; foreach (Campground camp in printCampGrounds) { if (camp.Campground_id == s.Campground_id) { campName = camp.Name; camp_id = camp.Campground_id; } } Console.WriteLine((campName + " ID:" + (camp_id).ToString()).PadRight(32) + s.ToString() + reservationAvailibility.PrintCost(s, arrival, departure)); } ReservationConfirmationForPark(arrival, departure, camp_id, parkSelection); Console.ReadLine(); }