public void PrintCost() { SiteSqlDAL siteSqlDAL = new SiteSqlDAL(dbconnectionString); List <Site> testSiteList = siteSqlDAL.ListCampGroundSites(3); string siteCost = siteSqlDAL.PrintCost(testSiteList[0], "3/3/2018", "3/5/2018"); Assert.AreEqual("$60.00", siteCost); }
public virtual void SearchAvailableSitesInCampGround(int parkSelection, int camp_id, string arrival, string departure) { Console.Clear(); SiteSqlDAL reservationAvailibility = new SiteSqlDAL(databaseconnectionString); List <Site> availableSites = new List <Site>(); try { availableSites = reservationAvailibility.ReservationAvailable(camp_id, arrival, departure); } catch (SqlException ex) { Console.WriteLine(); Console.WriteLine("Invalid input. Please try again."); Console.WriteLine(); return; } Console.WriteLine(); if (reservationAvailibility.AnyAvailable(availableSites)) { Console.WriteLine("Results Matching Your Search Criteria"); Console.WriteLine("Site No.".PadRight(15) + "Max Occup.".PadRight(15) + "Accessible?".PadRight(15) + "Max RV Length".PadRight(15) + "Utility".PadRight(15) + "Cost".PadRight(15)); foreach (Site s in availableSites) { Console.WriteLine(s.ToString() + reservationAvailibility.PrintCost(s, arrival, departure)); } ReservationConfirmation(camp_id, arrival, departure, parkSelection); } else { Console.Write("No Available Sites. Would you like to enter alternate dates? (Y / N) "); string answer = Console.ReadLine(); if (answer.ToUpper() == "N") { menuInComplete = false; return; } else if (answer.ToUpper() == "Y") { return; } else { Console.WriteLine("Sorry I don't understand."); return; } } }
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(); }