Beispiel #1
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);

            Console.BackgroundColor = ConsoleColor.DarkGreen;
            Console.Clear();
            Console.ForegroundColor = ConsoleColor.White;

            Menu thisMenu = new Menu(parkDAO, campgroundDAO, siteDAO, reservationDAO);

            thisMenu.Header();
            thisMenu.MainMenu();

            Console.ReadKey();
        }
Beispiel #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("npcampground");

            /********************************************************************
             * // If you do not want to use CLIMenu, you can remove the following
             *********************************************************************/
            // Create any DAOs needed here, and then pass them into main menu...

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

            MainMenu mainMenu = new MainMenu(campgroundDAO, parkDAO, reservationDAO, siteDAO);  // You'll probably be adding daos to the constructor

            // Run the menu.
            mainMenu.Run();
        }
Beispiel #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");

            // Create DAO objects
            // These will be shared with all of our menu objects
            // Each menu will have access to all of them because they are sequential
            // Yeah it's messy, but that's how we have to do it
            IParkDAO        parkDAO        = new ParkSqlDAO(connectionString);
            ICampgroundDAO  campgroundDAO  = new CampgroundSqlDAO(connectionString);
            ISiteDAO        siteDAO        = new SiteSqlDAO(connectionString);
            IReservationDAO reservationDAO = new ReservationSqlDAO(connectionString);

            // Move to our first menu
            ViewParksMenu menu = new ViewParksMenu(parkDAO, campgroundDAO, siteDAO, reservationDAO);

            menu.Run();
        }
Beispiel #4
0
        public void DisplayMenuAskingUserForDate()
        {
            Console.WriteLine("Which Campground (enter 0 to cancel): ");
            int campGround = int.Parse(Console.ReadLine());

            if (campGround == 0)
            {
                DisplayParkCampgroundMenu();
            }
            else
            {
                DateTime    arrivalDate   = CampCLIHelper.GetUserDateTime("What is the arrival date? ");
                DateTime    departureDate = CampCLIHelper.GetUserDateTime("What is the departure date ?");
                SiteSqlDAO  site          = new SiteSqlDAO(ConnectionString);
                List <Site> listOfSites   = site.GetUserInputtedSite(campGround, arrivalDate, departureDate);
                Console.WriteLine("Site No.    Max Occup.    Accessible?    Max RV Length            Utility           Cost");

                foreach (Site item in listOfSites)
                {
                    Console.Write(item.SiteID + "           ");
                    Console.Write(item.MaxOccupancy + "             ");
                    Console.Write(CampCLIHelper.BoolToString(item.Accessible) + "                 ");
                    Console.Write(CampCLIHelper.NumberToString(item.MaxRvLength) + "                         ");
                    Console.Write(CampCLIHelper.BoolToString(item.Utilities) + "              ");
                    Console.Write(item.Cost.ToString("C2") + "                     ");
                    Console.WriteLine();
                }


                int sites = CampCLIHelper.GetUserInt("Which site should be reserved (enter 0 to cancel):");
                if (sites == 0)
                {
                    DisplayParkCampgroundMenu();
                }
                else
                {
                    string            name        = CampCLIHelper.GetUserString("What name should the reservation be made under ?");
                    ReservationSqlDAO reservation = new ReservationSqlDAO(ConnectionString);
                    int reservationId             = reservation.PlaceReservation(sites, name, arrivalDate, departureDate);

                    Console.WriteLine($"The reservation has been made and the Confirmation id is: {reservationId}");
                }
            }

            Console.ReadLine();
        }
        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);
        }
Beispiel #6
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();
        }
Beispiel #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");

            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();
        }
        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();
        }
        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();
        }
        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(@"                                                                                                                                                           ###");
        }
        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");
            ParkSqlDAO        parkDAO          = new ParkSqlDAO(connectionString);
            CampgroundSqlDAO  campgroundDAO    = new CampgroundSqlDAO(connectionString);
            ReservationSqlDAO reservationDAO   = new ReservationSqlDAO(connectionString);
            SiteSqlDAO        siteDAO          = new SiteSqlDAO(connectionString);



            // Create a menu and run it
            ParksMenu menu = new ParksMenu(parkDAO, campgroundDAO, reservationDAO, siteDAO);

            menu.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");

            // 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();
        }
Beispiel #13
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();

            // 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();
        }