Пример #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");

            /********************************************************************
             * // 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...
            ParkDAL        parkDal        = new ParkDAL(connectionString);
            CampgroundDAL  campDal        = new CampgroundDAL(connectionString);
            SiteDAL        siteDal        = new SiteDAL(connectionString);
            ReservationDAL reservationDAL = new ReservationDAL(connectionString);



            MainMenu mainMenu = new MainMenu(parkDal, campDal, siteDal, reservationDAL);  // You'll probably be adding daos to the constructor

            //Run the menu.
            mainMenu.Run();
        }
Пример #2
0
        static void Main(string[] args)
        {
            VendingMachine vendMach = new VendingMachine();

            MainMenu mainMenu = new MainMenu(vendMach);

            mainMenu.Run();
        }
        static void Main(string[] args)
        {
            VendingMachine vMachine = new VendingMachine();


            MainMenu testing = new MainMenu(vMachine);

            testing.Run();
        }
Пример #4
0
        public static void Main(string[] args)
        {
            Stock vm = new Stock();
            Dictionary <string, VMItem> vmStock = vm.BuildStock();
            VendingMachine vM500 = new VendingMachine(vmStock);
            MainMenu       mm    = new MainMenu();

            mm.Run(vM500);
        }
Пример #5
0
        /// <summary>
        /// Vending machine program.
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            InventoryReader inventoryReader = new InventoryReader();
            Dictionary <string, VendingMachineItem> inventory = inventoryReader.ReadInventory();
            VendingMachineBrain vm = new VendingMachineBrain(inventory);
            Logger   log           = new Logger(vm);
            MainMenu menu          = new MainMenu(vm, log);

            menu.Run();
        }
Пример #6
0
        public static void Main(string[] args)
        {
            // instantiate fully stocked default vending machine
            VendingMachine vendingMachine = new VendingMachine();

            // instantiate a new instance of the main program menu to run from
            MainMenu mainMenu = new MainMenu();

            // pass staged vending machine to staged mainMenu
            mainMenu.Run(vendingMachine);
        }
        static void Main(string[] args)
        {
            // If you want to use the CLI menu, you can create an instance in Main, and
            // Run it.  You can customize the Main menu, and create other menus in the Views folder.
            // If you do not want to use the CLI menu, you can delete the files from the Views folder.
            VendingMachine vendingMachine = new VendingMachine();

            vendingMachine.Load();
            MainMenu menu = new MainMenu(vendingMachine);

            menu.Run();
        }
Пример #8
0
        public static void Main(string[] args)
        {
            //Starts the Main Menu Running

            VendingMachine Vendo_Matic_800 = new VendingMachine();

            Vendo_Matic_800.Load();

            MainMenu mainMenu = new MainMenu(Vendo_Matic_800);

            mainMenu.Run();
        }
        static void Main(string[] args)
        {
            // new vending machine
            VendingMachine ourVendingMachine = new VendingMachine();

            // load inventory with file name
            ourVendingMachine.LoadInventory("vendingmachine.csv");

            //main menu constructor pass in vending machine
            MainMenu main = new MainMenu(ourVendingMachine);

            main.Run();
        }
Пример #10
0
        static void Main(string[] args)
        {
            string transactionLogPath = @"..\..\..\..\Log.txt";
            string salesOutputPath    = @"..\..\..\..\SalesOutput.txt";
            string inventoryPath      = @"..\..\..\..\vendingmachine.csv";

            VendingMachine vendingMachine = new VendingMachine(transactionLogPath, salesOutputPath);

            vendingMachine.Restock(inventoryPath);

            MainMenu mainMenu = new MainMenu(vendingMachine);

            mainMenu.Run();
        }
Пример #11
0
        static void Main(string[] args)
        {
            VendingMachine vm = new VendingMachine(@"..\..\..\TextFiles\VendingMachineInputFile.txt", @"..\..\..\TextFiles\Log.txt");

            foreach (KeyValuePair <string, Product> kvp in vm.products)
            {
                Console.WriteLine($"{kvp.Value.Code} | {kvp.Value.Name} | {kvp.Value.Cost} | {kvp.Value.ProductType} | {kvp.Value.NumberItemsRemaining}");
            }

            MainMenu mm = new MainMenu(vm);

            mm.Run();
            Console.ReadLine();
        }
Пример #12
0
        static void Main(string[] args)
        {
            List <VendingItem> inventory = new List <VendingItem>();

// Product loader pulls the data from the loading file.
            inventory = ProductLoader.Loader();
            // Initializes "Vending Machine" and "Money Manager"
            VendingMachine vendingMachine = new VendingMachine(inventory);
            MoneyManager   moneyManager   = new MoneyManager();

            // Loads Main Menu to start user experience.
            MainMenu menu = new MainMenu(vendingMachine, moneyManager);

            menu.Run();
        }
Пример #13
0
        static void Main(string[] args)
        {
            //  Create a vending machine and load it
            VendingMachine VendOMatic = new VendingMachine();
            Stocker        stocker    = new Stocker();

            VendOMatic.Load(stocker.Restock());

            Customer customer = new Customer();
            //  Create a menu object and give it access to VendOMatic and customer
            MainMenu menu = new MainMenu();

            menu.Receive(VendOMatic, customer);
            menu.Run();//   Almost everything happens within the menu object
        }
        static void Main(string[] args)
        {
            //TODO Add ASCII Later
            Console.Write(@"
             \       /***** |\   |* *   * *  |\        /|    /|******* |    ||||| 
              \     / *     | \  |   * *   * | \      / |   / |   |    |  |||| 
               \   /  ***** |  \ |    *     *|  \    /  |  /--|   |    | |||  
                \ /   *     |   \|    *     *|   \  /   | /   |   |    |  |||
                 /    ***** |    \ * * ***** |    \/    |/    |   |    |   ||||||");

            MainMenu menu = new MainMenu();

            menu.Run();

            Console.WriteLine("Thank you for supporting Umbrella Corp!");
            Console.ReadKey();
        }
        static void Main(string[] args)
        {
            Console.BackgroundColor = ConsoleColor.DarkCyan;
            Console.Clear();
            Console.ForegroundColor = ConsoleColor.White;
            Console.Clear();

            LogTxt.LogPath = @"..\..\..\..\log.txt";
            Machine machine = new Machine();

            machine.Load((@"..\..\..\..\vendingmachine.csv"));
            MainMenu mm = new MainMenu(machine);

            mm.Run();

            Console.ReadKey();
        }
Пример #16
0
        static void Main(string[] args)
        {
            // If you want to use the CLI menu, you can create an instance in Main, and
            // Run it.  You can customize the Main menu, and create other menus in the Views folder.
            // If you do not want to use the CLI menu, you can delete the files from the Views folder.
            string path = @"..\..\..\..\etc\vendingmachine.csv";
            Loader load = new Loader(path);
            Dictionary <string, List <ProductIdentification> > inventory = new Dictionary <string, List <ProductIdentification> >();

            load.Load(inventory);


            VendingMachine machine = new VendingMachine(inventory);

            MainMenu menu = new MainMenu(machine);

            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");
            IParkDAO        parkDAO          = new ParkSqlDAO(connectionString);
            ICampgroundDAO  campgroundDAO    = new CampgroundSqlDAO(connectionString);
            ISiteDAO        siteDAO          = new SiteSqlDAO(connectionString);
            IReservationDAO reservationDAO   = new ReservationSqlDAO(connectionString);
            ParkService     ps = new ParkService(parkDAO, campgroundDAO, siteDAO, reservationDAO);

            MainMenu mainmenu = new MainMenu(ps);

            mainmenu.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();
        }
Пример #19
0
        static void Main(string[] args)
        {
            string path;

            do
            {
                Console.WriteLine("Please input a text file with the fully qualified file path to stock the vending machine with. \n(Press Enter to use the default)");
                path = Console.ReadLine();
                if (path == "")
                {
                    // If default selected, attempt to find the default inventory stocking file
                    path = @"..\..\..\..\vendingmachine.csv";
                    if (!File.Exists(path))
                    {
                        Console.WriteLine("Error: Could not find default file. Please provide a direct file or contact your system administrator.\n");
                    }
                }
            } while (!File.Exists(path)); // continue until valid path is given or user closes the program

            // create a new menu
            MainMenu myMenu = new MainMenu(path);

            myMenu.Run();
        }
Пример #20
0
        static void Main(string[] args)
        {
            // Find input file
            string inputFileName      = "vendingmachine.csv";
            string inputFileDirectory = Directory.GetCurrentDirectory();
            string inputFilePath      = "";

            try
            {
                bool fileExists = false;
                while (!fileExists)
                {
                    Directory.SetCurrentDirectory(inputFileDirectory);
                    inputFilePath = Path.Combine(inputFileDirectory, inputFileName);
                    fileExists    = File.Exists(inputFilePath);
                    if (!fileExists)
                    {
                        try
                        {
                            if (Directory.Exists(Directory.GetParent(Directory.GetCurrentDirectory()).ToString()))
                            {
                                inputFileDirectory = Directory.GetParent(inputFileDirectory).ToString();
                            }
                            else
                            {
                                Console.WriteLine("Input file not found. Please provide complete path to file:");
                                inputFilePath      = Console.ReadLine();
                                inputFileName      = Path.GetFileName(inputFilePath);
                                inputFileDirectory = Path.GetDirectoryName(inputFilePath);
                            }
                        }
                        catch (Exception)
                        {
                            while (!fileExists)
                            {
                                try
                                {
                                    Console.WriteLine("Input file not found. Please provide complete path to file:");
                                    inputFilePath      = Console.ReadLine();
                                    inputFileName      = Path.GetFileName(inputFilePath);
                                    inputFileDirectory = Path.GetDirectoryName(inputFilePath);
                                    Directory.SetCurrentDirectory(inputFileDirectory);
                                    fileExists = File.Exists(inputFilePath);
                                }
                                catch (DirectoryNotFoundException)
                                {
                                }
                                catch (ArgumentException)
                                {
                                }
                                catch (Exception)
                                {
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error finding input file: {ex.Message}");
                Console.ReadKey();
                return;
            }

            VendingMachine vendingMachine = new VendingMachine();

            bool isStocked = vendingMachine.StockFromFile(inputFilePath);

            if (!isStocked)
            {
                Console.WriteLine("Error: Machine not stocked properly.");
                Console.ReadKey();
                return;
            }

            MainMenu mainMenu = new MainMenu(vendingMachine);

            mainMenu.Run();
        }
Пример #21
0
        static void Main(string[] args)
        {
            MainMenu mainMenu = new MainMenu();

            mainMenu.Run();
        }