static void Main(string[] args)
        {
            // Instantiate the dependencies
            IInventorySource   inventorySource   = new InventoryFileDAL("vendingmachine.csv");
            ITransactionLogger transactionLogger = new TransactionFileLog("transactions.txt");

            // IInventorySource inventorySource = new InventorySqlDAL("connectionstring");

            VendingMachine vm;

            try
            {
                // Inject the dependency into the class using the constructor
                vm = new VendingMachine(inventorySource, transactionLogger);
            }
            catch
            {
                Console.WriteLine();
                Console.WriteLine("An error occurred starting the vending machine. The program is going to exit.");
                return;
            }

            // Start the CLI and run the menu
            VendingMachineCLI cli = new VendingMachineCLI(vm);

            cli.Run();
        }
示例#2
0
        static void Main(string[] args)
        {
            VendingMachine    vm       = new VendingMachine();
            VendingMachineCLI mainmenu = new VendingMachineCLI(vm);

            mainmenu.Display();
        }
示例#3
0
        static void Main(string[] args)
        {
            //Instantiate new vending machine command line interface

            VendingMachineCLI cLI = new VendingMachineCLI();

            cLI.StartVendingMachine();

            cLI.OpenMainMenu();

            cLI.UsingMainMenu();

            /*
             * Changes Made:
             * The program kept looping and not working correctly when trying to return to the purchase menu after
             * multiple transactions so I separated the menu into a main menu method and a purhcase menu method
             * and then each option in the purchase menu method has its own method. This allows for an easier return to the purhcase
             * menu after you do something like add money or purhcase an item. And looks a lot cleaner too.
             *
             * I moved the user interaction, like all of the Console.WriteLine's and special formatting, to the vending machine CLI.
             * No major changes to code, just moving between classes and having the vending machine process transactions versus talk to the user.
             *
             * I found out that the user was able to add decimal amounts when adding money, so I added a line of code to only accept whole numbers.
             *
             * I tried to break it in all sorts of different ways and it seems fairly strong. Log.TXT and SalesReport.TXT still work!
             *
             */
        }
        static void Main(string[] args)
        {
            VendingMachine    vm  = new VendingMachine();
            VendingMachineCLI cli = new VendingMachineCLI(vm);

            cli.Run();
        }
示例#5
0
        static void Main(string[] args)
        {
            VendingMachine    VM  = new VendingMachine("VendingMachine.txt");
            VendingMachineCLI CLI = new VendingMachineCLI(VM);

            CLI.Run();
        }
示例#6
0
        static void Main(string[] args)
        {
            VendingMachine    vm    = new VendingMachine();
            VendingMachineCLI vmcli = new VendingMachineCLI(vm);

            vmcli.Run();
            Environment.Exit(0);
        }
示例#7
0
        static void Main(string[] args)
        {
            VendingMachine    VendoMatic600 = new VendingMachine();
            VendingMachineCLI VCLI          = new VendingMachineCLI();

            VendoMatic600.FillMyMachine(@"..\..\..\..\VendingMachine.txt");
            VCLI.Start(VendoMatic600, @"..\..\..\..\Log.txt");
        }
示例#8
0
        static void Main(string[] args)
        {
            //A way to update vending machine
            //file that cotains list of items in correct format
            //create/update inventory with items in the file
            //if item is in file, When vending machine starts, slot indicated is filled with five of that item
            //constant fillWithFive
            VendingMachineCLI commandLineProgram = new VendingMachineCLI();

            commandLineProgram.StartTheMachine();
        }
        static void Main(string[] args)
        {
            VendingMachineFileReader reader = new VendingMachineFileReader("vendingmachine.csv");
            var inventory = reader.GetInventory();

            VendingMachine vm = new VendingMachine(inventory);

            VendingMachineCLI cli = new VendingMachineCLI(vm);

            cli.Run();
        }
示例#10
0
 static void Main(string[] args)
 {
     try
     {
         VendingMachine    vm  = new VendingMachine();
         VendingMachineCLI cli = new VendingMachineCLI(vm);
         Console.ReadLine();
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         Console.ReadKey();
     }
 }
示例#11
0
        static void Main(string[] args)
        {
            VendingMachine vendoMatic = null;

            try
            {
                vendoMatic = new VendingMachine();
                VendingMachineCLI vendCLI = new VendingMachineCLI(vendoMatic);
                vendCLI.OpeningSplash();
            }
            catch (OutOfOrderException ex)
            {
                Console.WriteLine(ex.Message);
                Console.WriteLine("\nPress any key to exit");
                Console.ReadKey();
            }
        }
示例#12
0
 static void Main(string[] args)
 {
     try
     {
         VendingMachine    vm    = new VendingMachine();
         VendingMachineCLI vmCLI = new VendingMachineCLI(vm);
         vmCLI.Start();
     }
     catch (CorruptInventoryException)
     {
         Console.WriteLine("The inventory file is corrupt.\nPress and key to continue...");
         Console.ReadKey();
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
         Console.ReadKey();
     }
 }
示例#13
0
        static void Main(string[] args)
        {
            const string localConnectionString = "Data Source=localhost\\sqlexpress;Initial Catalog=VendingMachine;Integrated Security=True";

            // Instantiate the dependencies

            IInventorySource   inventorySource;
            ITransactionLogger transactionLogger;

            string mode = Properties.Settings.Default.DataSource;

            if (mode == "file")
            {
                inventorySource   = new InventoryFileDAL("vendingmachine.csv");
                transactionLogger = new TransactionFileLog("transactions.txt");
            }
            else
            {
                inventorySource   = new InventorySqlDAL(localConnectionString);
                transactionLogger = new TransactionFileSqlLog(localConnectionString);
            }

            VendingMachine vm;

            try
            {
                // Inject the dependency into the class using the constructor
                vm = new VendingMachine(inventorySource, transactionLogger);
            }
            catch
            {
                Console.WriteLine();
                Console.WriteLine("An error occurred starting the vending machine. The program is going to exit.");
                return;
            }

            // Start the CLI and run the menu
            VendingMachineCLI cli = new VendingMachineCLI(vm);

            cli.Run();
        }
示例#14
0
        static void Main(string[] args)
        {
            VendingMachineCLI cli = new VendingMachineCLI("vendingmachine.csv");

            cli.Run();
        }
示例#15
0
        static void Main(string[] args)
        {
            VendingMachineCLI VendOMatic = new VendingMachineCLI();

            VendOMatic.StartTheMachine();
        }
示例#16
0
        static void Main(string[] args)
        {
            VendingMachineCLI cli = new VendingMachineCLI();

            cli.Display();
        }
        static void Main(string[] args)
        {
            VendingMachineCLI menu = new VendingMachineCLI();

            menu.DisplayMenu();
        }
示例#18
0
        static void Main(string[] args)
        {
            VendingMachineCLI program = new VendingMachineCLI();

            program.Display();
        }
        static void Main(string[] args)
        {
            VendingMachineCLI vend = new VendingMachineCLI();

            vend.Display();
        }
示例#20
0
        static void Main(string[] args)
        {
            VendingMachineCLI test = new VendingMachineCLI();

            test.Run();
        }