Ejemplo n.º 1
0
        public static int GetInteger(string message)
        {
            string userInput        = String.Empty;
            int    intValue         = 0;
            int    numberOfAttempts = 0;

            do
            {
                if (numberOfAttempts > 0)
                {
                    Console.WriteLine("Invalid input format. Please try again");
                }

                Console.Write(message + " ");
                userInput = Console.ReadLine();
                if (userInput == "0")
                {
                    CapstoneCLI cli = new CapstoneCLI();
                    cli.RunCLI();
                }
                numberOfAttempts++;
            }while (!int.TryParse(userInput, out intValue));

            return(intValue);
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            string      connectionString = ConfigurationManager.ConnectionStrings["CapstoneDatabase"].ConnectionString;
            CapstoneCLI program          = new CapstoneCLI();

            program.InitialMenu();
        }
Ejemplo n.º 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");

            CapstoneCLI capstoneCli = new CapstoneCLI(connectionString);


            capstoneCli.DisplayParks();

            Console.ReadLine();


            //string userDirtyInput = Console.ReadLine();
            //string userInput = CampCLIHelper.GetUserString(userDirtyInput);


            //CODE BELOW TESTS GETTING THE USER DICTATED PARK
            //ParkSqlDAO testPark = new ParkSqlDAO(connectionString);
            //IList<Park> test = new List<Park>(testPark.GetUserPark(userInput));
            //foreach (Park item in test)
            //{
            //    Console.WriteLine($"| {item.ParkId} | {item.Name} | {item.Location} | {item.EstablishDate} | {item.Area} | {item.Visitors}| \n {item.Description} \n");
            //}

            //CODE BELOW TO GRAB CAMPGROUNDS FROM USER INPUTTED PARK
            //CampgroundSqlDAO testCgx = new CampgroundSqlDAO(connectionString);
            //IList<Campground> testCg = new List<Campground>(testCgx.GetCampgroundsFromPark(userInput));

            //foreach  (Campground campground in testCg)
            //{
            //    Console.WriteLine($"| {campground.CampgroundId} | {campground.Name} | {campground.DailyFee} |\n");

            //}

            //The code below is to test getting the sites based on the user inputted Campground

            //the code below grabs the sites available under the camp the user selects (int userInput = (whatever))
            //int userInput = 1;
            //DateTime.TryParse("10/21/2019", out DateTime startDate);
            //DateTime.TryParse("10/26/2019", out DateTime endDate);
            //SiteSqlDAO testSite = new SiteSqlDAO(connectionString);
            //IList<Site> test = new List<Site>(testSite.GetUserInputtedSite(userInput, startDate, endDate));
            //foreach (Site item in test)
            //{
            //    Console.WriteLine($"| {item.CampgroundId} | {item.SiteNumber} | {item.MaxOccupancy} | {item.Accessible} | {item.MaxRvLength} | {item.Utilities}|\n");
            //}

            //ReservationSqlDAO newReservation = new ReservationSqlDAO(connectionString);
            //newReservation.PlaceReservation(1, "Campbells", Convert.ToDateTime("06/16/2020"), Convert.ToDateTime("06/20/2020"));
            //Console.WriteLine("Success!");
            //Console.ReadLine();
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            string connectionString = ConfigurationManager.ConnectionStrings["CapstoneDatabase"].ConnectionString;

            CapstoneCLI cli = new CapstoneCLI();

            cli.RunCLI();
        }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            // Sample Code to get a connection string from the
            // App.Config file
            // Use this so that you don't need to copy your connection string all over your code!
            string connectionString = ConfigurationManager.ConnectionStrings["CapstoneDatabase"].ConnectionString;
            // Main should only have a few lines of code
            CapstoneCLI cli = new CapstoneCLI();

            cli.RunCLI();
        }
Ejemplo n.º 6
0
        static void Main(string[] args)
        {
            IConfigurationBuilder builder = new ConfigurationBuilder()
                                            .SetBasePath(Directory.GetCurrentDirectory())
                                            .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);
            IConfigurationRoot configuration = builder.Build();

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

            CampgroundSqlDAL db = new CampgroundSqlDAL(connectionString);

            CapstoneCLI capstoneCli = new CapstoneCLI(db);

            capstoneCli.Start();
        }
Ejemplo n.º 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");

            CapstoneCLI CLI = new CapstoneCLI(connectionString);

            CLI.MainMenu();
        }
Ejemplo n.º 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");

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

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

            CLI.runCLI();
        }
Ejemplo n.º 9
0
        static void Main(string[] args)
        {
            CapstoneCLI cli = new CapstoneCLI();

            cli.RunCLI();
        }