コード例 #1
0
        private void GetAllSites(int reqCampId, DateTime reqArrival, DateTime reqDeparture)
        {
            IList <Site> sites = siteDAO.TopFiveSites(reqCampId, reqArrival, reqDeparture);

            if (sites.Count > 0)
            {
                foreach (Site site in sites)
                {
                    int     totalDays  = (reqDeparture - reqArrival).Days;
                    decimal totalPrice = totalDays * site.DailyFee;
                    Console.WriteLine($"Site # {site.SiteId} in Camp # {site.CampgroundId} with a max occupancy of {site.MaxOccupancy} is Availible.\n\t{totalDays} day(s) at this site would cost {totalPrice:C}.\n\tAccessible: {site.Accessible}  RV's up to: {site.MaxRvLength} Length.  Utility Hook Up's: {site.Utilities}");
                }
            }
            else
            {
                Console.WriteLine("Not availible");
            }
        }