예제 #1
0
        public void GetCampgroundsTest()
        {
            CampgroundSQLDAL  campground  = new CampgroundSQLDAL(connectionString);
            List <Campground> campgrounds = CampgroundSQLDAL.GetAllCampgrounds(1);

            Assert.IsNotNull(campgrounds);
        }
예제 #2
0
        public void PrintCampgrounds(int parkID)
        {
            CampgroundSQLDAL  dal         = new CampgroundSQLDAL(DatabaseConnection);
            List <Campground> campgrounds = CampgroundSQLDAL.GetAllCampgrounds(parkID);

            if (campgrounds.Count > 0)
            {
                Console.WriteLine();
                Console.WriteLine("Name".PadLeft(11).PadRight(43) + "Open".PadRight(15) + "Close".PadRight(15) + "Fee");
                Console.WriteLine(new String('=', 79));
                foreach (Campground campground in campgrounds)
                {
                    Console.WriteLine($"#{campground.CampgroundID.ToString().PadRight(5)} {campground.CampgroundName.ToString().PadRight(35)} {CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(campground.OpenMonth).PadRight(14)} {CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(campground.CloseMonth).PadRight(14)} {campground.DailyFee.ToString("C2")}");
                }
                Console.WriteLine();
            }
            else
            {
                Console.WriteLine();
                Console.WriteLine("NO RESULTS");
                Console.WriteLine();
            }
        }