public VendingMachine()
        {
            string filePath;
            string currentDirectory = Directory.GetCurrentDirectory();

            filePath = Path.Combine(currentDirectory, "vendingmachineinventory.txt");
            InventoryFileDAL newMachine = new InventoryFileDAL(filePath);

            this.inventory = newMachine.GetInventory();
        }
        public VendingMachine(Dictionary <string, List <VendingMachineItem> > inventory)
        {
            string filePath;
            string currentDirectory = Directory.GetCurrentDirectory();

            filePath = Path.Combine(currentDirectory, "vendingmachineinventory.txt");
            InventoryFileDAL newMachine = new InventoryFileDAL(filePath);

            this.inventory = inventory;
        }
Example #3
0
            public void Display()
            {
                Dictionary <string, List <VendingMachineItem> > Inventory = new Dictionary <string, List <VendingMachineItem> >();
                InventoryFileDAL IFD = new InventoryFileDAL();

                Inventory = IFD.GetDictionary();


                foreach (var kvp in Inventory)
                {
                    Console.WriteLine((kvp.Key) + " " + (kvp.Value[0].Name) + " " + (kvp.Value[0].Price.ToString("C")));
                }
            }
Example #4
0
        public VendingMachine()
        {
            InventoryFileDAL fileReader = new InventoryFileDAL();

            this.inventory = fileReader.GetInventory();
        }
        public VendingMachine()
        {
            InventoryFileDAL IFD = new InventoryFileDAL();

            Inventory = IFD.GetDictionary();
        }