コード例 #1
0
        public void DisplayCamgrounds()
        {
            int number = 1;
            CampgroundSqlDAO  campgroundSqlDAO  = new CampgroundSqlDAO(ConnectionString);
            List <Campground> listOfCampgrounds = campgroundSqlDAO.GetCampgroundsFromPark(ChosenPark);

            Console.WriteLine("      Name                 Open              Close         Daily Fee");
            foreach (Campground campground in listOfCampgrounds)
            {
                Console.Write("#" + number + " " + campground.Name + "            ");
                Console.Write(DateTimeFormatInfo.CurrentInfo.GetMonthName(campground.OpenFromMonth) + "             ");
                Console.Write(DateTimeFormatInfo.CurrentInfo.GetMonthName(campground.OpenToMonth) + "             ");
                Console.Write(campground.DailyFee.ToString("C2") + "    ");
                Console.WriteLine();
                number = number + 1;
            }
        }
コード例 #2
0
        static void Main(string[] args)
        {
            // Get the connection string from the appsettings.json file
            IConfigurationBuilder builder = new ConfigurationBuilder()
                                            .SetBasePath(Directory.GetCurrentDirectory())
                                            .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);

            IConfigurationRoot configuration = builder.Build();

            string connectionString = configuration.GetConnectionString("campground-tiny");

            IParkDAO        parkDAO        = new ParkSqlDAO(connectionString);
            IReservationDAO reservationDAO = new ReservationSqlDAO(connectionString);
            ISiteDAO        siteDAO        = new SiteSqlDAO(connectionString);
            ICampgroundDAO  campgroundDAO  = new CampgroundSqlDAO(connectionString);


            MenuCLI newMenu = new MenuCLI(parkDAO, siteDAO, campgroundDAO, reservationDAO);
        }
コード例 #3
0
        static void Main(string[] args)
        {
            // Get the connection string from the appsettings.json file
            IConfigurationBuilder builder = new ConfigurationBuilder()
                                            .SetBasePath(Directory.GetCurrentDirectory())
                                            .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);

            IConfigurationRoot configuration = builder.Build();

            string          connectionString = configuration.GetConnectionString("Project");
            IParkDAO        parkDAO          = new ParkSqlDAO(@"Server =.\SQLEXPRESS; Database = npcampground; Trusted_Connection = True;");
            ICampgroundDAO  campgroundDAO    = new CampgroundSqlDAO(@"Server =.\SQLEXPRESS; Database = npcampground; Trusted_Connection = True;");
            ISiteDAO        siteDAO          = new SiteSqlDAO(@"Server =.\SQLEXPRESS; Database = npcampground; Trusted_Connection = True;");
            IReservationDAO reservationDAO   = new ReservationSqlDAO(@"Server =.\SQLEXPRESS; Database = npcampground; Trusted_Connection = True;");
            Menu            menus            = new Menu(parkDAO, campgroundDAO, siteDAO, reservationDAO);

            menus.Intro();
            menus.ViewParks();
        }
コード例 #4
0
        static void Main(string[] args)
        {
            //Get the connection string from the appsettings.json file
            IConfigurationBuilder builder = new ConfigurationBuilder()
                                            .SetBasePath(Directory.GetCurrentDirectory())
                                            .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);

            IConfigurationRoot configuration = builder.Build();

            string connectionString = configuration.GetConnectionString("Project");

            ICampground  campgroundDAO  = new CampgroundSqlDAO(connectionString);
            IPark        parkDAO        = new ParkSqlDAO(connectionString);
            IReservation reservationDAO = new ReservationSqlDAO(connectionString);
            ISite        siteDAO        = new SiteSqlDAO(connectionString);

            CapstoneCLI capstoneCLI = new CapstoneCLI(campgroundDAO, reservationDAO, parkDAO, siteDAO);

            capstoneCLI.RunMainMenu();
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: JohnSherck/Public
        static void Main(string[] args)
        {
            // Get the connection string from the appsettings.json file
            IConfigurationBuilder builder = new ConfigurationBuilder()
                                            .SetBasePath(Directory.GetCurrentDirectory())
                                            .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);

            IConfigurationRoot configuration = builder.Build();

            string          connectionString = configuration.GetConnectionString("Project");
            IParkDAO        parkDao          = new ParkSqlDAO(connectionString);
            ICampgroundDAO  campDao          = new CampgroundSqlDAO(connectionString);
            IReservationDAO resDao           = new ReservationSqlDAO(connectionString);


            // Create a menu and run it
            ViewParksMenu menu = new ViewParksMenu(campDao, parkDao, resDao);

            menu.Run();
        }
コード例 #6
0
        static void Main(string[] args)
        {
            //Console.WriteLine(DateTime.Today.ToString("yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture));
            // Get the connection string from the appsettings.json file
            IConfigurationBuilder builder = new ConfigurationBuilder()
                                            .SetBasePath(Directory.GetCurrentDirectory())
                                            .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);

            IConfigurationRoot configuration = builder.Build();

            string connectionString = configuration.GetConnectionString("npcampground");


            IParkDAO        parkDAO        = new ParkSqlDAO(connectionString);
            ICampgroundDAO  campgroundDAO  = new CampgroundSqlDAO(connectionString);
            ISiteDAO        siteDAO        = new SiteSqlDAO(connectionString);
            IReservationDAO reservationDAO = new ReservationSqlDAO(connectionString);

            NPCampsiteReservationCLI cli = new NPCampsiteReservationCLI(parkDAO, campgroundDAO, siteDAO, reservationDAO);

            cli.RunCLI();
        }
コード例 #7
0
        static void Main(string[] args)
        {
            // Get the connection string from the appsettings.json file
            IConfigurationBuilder builder = new ConfigurationBuilder()
                                            .SetBasePath(Directory.GetCurrentDirectory())
                                            .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);

            IConfigurationRoot configuration = builder.Build();

            string connectionString = configuration.GetConnectionString("Project");

            IParkSqlDAO        parkDAO        = new ParkSqlDAO(connectionString);
            ICampgroundSqlDAO  campgroundDAO  = new CampgroundSqlDAO(connectionString);
            ISiteSqlDAO        siteDAO        = new SiteSqlDAO(connectionString);
            IReservationSqlDAO reservationDAO = new ReservationSqlDAO(connectionString);

            MenuCLI projectCLI = new MenuCLI(parkDAO, campgroundDAO, siteDAO, reservationDAO); // objects that implement interfaces

            projectCLI.RunCLI();

            Console.ReadLine();
        }
コード例 #8
0
        static void Main(string[] args)
        {
            // Get the connection string from the appsettings.json file
            IConfigurationBuilder builder = new ConfigurationBuilder()
                                            .SetBasePath(Directory.GetCurrentDirectory())
                                            .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);

            IConfigurationRoot configuration = builder.Build();

            string connectionString = configuration.GetConnectionString("Project");

            IParkDAO        parkDAO        = new ParkSqlDAO(connectionString);
            ICampgroundDAO  campgroundDAO  = new CampgroundSqlDAO(connectionString);
            ISiteDAO        siteDAO        = new SiteSqlDAO(connectionString);
            IReservationDAO reservationDAO = new ReservationSqlDAO(connectionString);


            CLIMainMenu cliMainMenu = new CLIMainMenu(parkDAO, campgroundDAO, siteDAO, reservationDAO);

            cliMainMenu.Run();

            //TODO write tests

            //Console.WriteLine(@"                                                                                                                                                             A");
            //Console.WriteLine(@"                                                                                                                                                            d$b");
            //Console.WriteLine(@"                                                                                                                                                          .d\$$b.");
            //Console.WriteLine(@" ___                _         ___                                            _                        ___                 _                            .d$i$$\$$b.");
            //Console.WriteLine(@"(  _`\             ( )       |  _`\                                         ( )_  _                  (  _`\              ( )_                             d$$@b");
            //Console.WriteLine(@"| |_) )  _ _  _ __ | |/')    | (_) )   __    ___    __   _ __  _   _    _ _ | ,_)(_)   _     ___     | (_(_) _   _   ___ | ,_)   __    ___ ___           d\$$$ib");
            //Console.WriteLine(@"| ,__/'/'_` )( '__)| , <     | ,  /  /'__`\/',__) /'__`\( '__)( ) ( ) /'_` )| |  | | /'_`\ /' _ `\   `\__ \ ( ) ( )/',__)| |   /'__`\/' _ ` _ `\       .d$$$\$$$b");
            //Console.WriteLine(@"| |   ( (_| || |   | |\`\    | |\ \ (  ___/\__, \(  ___/| |   | \_/ |( (_| || |_ | |( (_) )| ( ) |   ( )_) || (_) |\__, \| |_ (  ___/| ( ) ( ) |     .d$$@$$$$\$$ib.");
            //Console.WriteLine(@"(_)   `\__,_)(_)   (_) (_)   (_) (_)`\____)(____/`\____)(_)   `\___/'`\__,_)`\__)(_)`\___/'(_) (_)   `\____)`\__, |(____/`\__)`\____)(_) (_) (_)          d$$i$$b");
            //Console.WriteLine(@"                                                                                                            ( )_| |                                     d\$$$$@$b");
            //Console.WriteLine(@"                                                                                                            `\___/'                                  .d$@$$\$$$$$@b.");
            //Console.WriteLine(@"                                                                                                                                                   .d$$$$i$$$\$$$$$$b.");
            //Console.WriteLine(@"                                                                                                                                                           ###");
            //Console.WriteLine(@"                                                                                                                                                           ###");
            //Console.WriteLine(@"                                                                                                                                                           ###");
        }
コード例 #9
0
        static void Main(string[] args)
        {
            Console.ForegroundColor = ConsoleColor.Green;

            // Get the connection string from the appsettings.json file
            IConfigurationBuilder builder = new ConfigurationBuilder()
                                            .SetBasePath(Directory.GetCurrentDirectory())
                                            .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);

            IConfigurationRoot configuration = builder.Build();

            string connectionString = configuration.GetConnectionString("Project");

            IReservationDAO reservationDAO = new ReservationSqlDAO(connectionString);
            IParkDAO        parkDAO        = new ParkSqlDAO(connectionString);
            ISiteDAO        siteDAO        = new SiteSqlDAO(connectionString);
            ICampgroundDAO  campgroundDAO  = new CampgroundSqlDAO(connectionString);

            ParkMenu menu = new ParkMenu(parkDAO, campgroundDAO, siteDAO, reservationDAO);

            menu.RunCLI();
            Console.ReadLine();
        }
コード例 #10
0
        static void Main(string[] args)
        {
            // Get the connection string from the appsettings.json file
            IConfigurationBuilder builder = new ConfigurationBuilder()
                                            .SetBasePath(Directory.GetCurrentDirectory())
                                            .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);

            IConfigurationRoot configuration = builder.Build();

            string connectionString = configuration.GetConnectionString("Project");

            // Instantiate a DAO of each type to pass to the menus
            IParkDAO        parkDAO        = new ParkSqlDAO(connectionString);
            ICampgroundDAO  campgroundDAO  = new CampgroundSqlDAO(connectionString);
            ISiteDAO        siteDAO        = new SiteSqlDAO(connectionString);
            IReservationDAO reservationDAO = new ReservationSqlDAO(connectionString);

            // Create a new main menu object and pass in all the DAOS
            MainMenu mainMenu = new MainMenu(parkDAO, campgroundDAO, siteDAO, reservationDAO);

            // Run the menu.
            mainMenu.Run();
        }
コード例 #11
0
ファイル: Program.cs プロジェクト: tiasmith8/npcampground
        static void Main(string[] args)
        {
            // Get the connection string from the appsettings.json file
            IConfigurationBuilder builder = new ConfigurationBuilder()
                                            .SetBasePath(Directory.GetCurrentDirectory())
                                            .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);

            IConfigurationRoot configuration = builder.Build();

            // Save the connection string pulled from key(Project), Value(db connection info) pair
            string connectionString = configuration.GetConnectionString("Project");

            // Instantiate objects communicating with DB here and pass to menu class
            IParkSqlDAO        parkDAO        = new ParkSqlDAO(connectionString);
            ICampgroundSqlDAO  campgroundDAO  = new CampgroundSqlDAO(connectionString);
            ISiteSqlDAO        siteDAO        = new SiteSqlDAO(connectionString);
            IReservationSqlDAO reservationDAO = new ReservationSqlDAO(connectionString);

            // Instantiate menu class for entire program and send it the data access objects
            NpCampgroundCLI cli = new NpCampgroundCLI(parkDAO, campgroundDAO, siteDAO, reservationDAO);

            //Console menu entry point
            cli.Run();
        }
        static void Main(string[] args)
        {
            // Get the connection string from the appsettings.json file
            IConfigurationBuilder builder = new ConfigurationBuilder()
                                            .SetBasePath(Directory.GetCurrentDirectory())
                                            .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);

            IConfigurationRoot configuration = builder.Build();

            string connectionString = configuration.GetConnectionString("Project");

            IParkDAO             parkDAO         = new ParksSqlDAO(connectionString);
            ICampgroundDAO       campgroundDAO   = new CampgroundSqlDAO(connectionString);
            ISiteDAO             siteDAO         = new SitesSqlDAO(connectionString);
            IReservationDAO      reservationDAO  = new ReservationsSqlDAO(connectionString);
            IMainMenu            mainMenu        = new MainMenuCLI();
            IParkInfoMenu        parkInfoMenu    = new ParkInfoMenuCLI();
            IParkCampgroundsMenu parkCampgrounds = new ParkCampgroundsMenuCLI();
            IReservationMenu     reservationMenu = new ReservationMenuCLI();

            NPSystemController nPSystemController = new NPSystemController(parkDAO, campgroundDAO, siteDAO, reservationDAO, mainMenu, parkInfoMenu, parkCampgrounds, reservationMenu);

            nPSystemController.Run();
        }