예제 #1
0
 public void UpdateStockAndVolume(ContainableItemsCollection collection)
 {
     for (int index = 0; index < collection.Count(); index++)
     {
         this.actualStock.Add(new ActualStock(collection.Get(index).Product));
         this.volume.Add(new Volume(collection.Get(index).Product, collection.Get(index).Product.Quantity));
     }
 }
예제 #2
0
        static void WrintingProductsInVolumes(ContainableItemsCollection produse)
        {
            Node temp = produse.GetFirst();

            for (int i = 0; i < produse.Count(); i++)
            {
                int quantity = temp.ContainableItem.Product.GetSize();
                Data.Instance.AddToVolumes(temp.ContainableItem.Product, quantity);
                temp = temp.To;
            }
        }
예제 #3
0
        static void SaleOperation(ContainableItemsCollection produse, PaymentTerminal paymentTerminal)
        {
            int idProduct = -1;
            int option    = -1;

            while (option != 0 && idProduct != 0)
            {
                Node temp = produse.GetFirst();
                for (int i = 0; i < produse.Count(); i++)
                {
                    Console.WriteLine(temp.ContainableItem.ToString());
                    temp = temp.To;
                }
                Console.WriteLine("ID Product:");
                int.TryParse(Console.ReadLine(), out idProduct);
                Console.WriteLine("Payment Option: (1-Coins;2-Banknote;3-Card)");
                int.TryParse(Console.ReadLine(), out option);
                paymentTerminal.Pay(idProduct, option);
            }
        }
예제 #4
0
        static void Main(string[] args)
        {
            ProductCategory productCategory1 = new ProductCategory()
            {
                Name = "Ciocolata"
            };

            ProductCategory productCategory2 = new ProductCategory()
            {
                Name = "Suc"
            };

            Position position1 = new Position()
            {
                Row    = 1,
                Column = 2,
                Size   = 3,
                Id     = 1
            };

            Position position2 = new Position()
            {
                Row    = 2,
                Column = 1,
                Size   = 4,
                Id     = 2
            };

            Product product1 = new Product()
            {
                Category = productCategory1,
                Price    = 4.5,
                Quantity = 3,
                Name     = "Milka"
            };

            Product product2 = new Product()
            {
                Category = productCategory2,
                Price    = 6.3,
                Quantity = 2,
                Name     = "Sprite"
            };

            Product product3 = new Product()
            {
                Category = productCategory1,
                Price    = 3.1,
                Quantity = 1,
                Name     = "Poiana"
            };

            ContainableItem containableItem1 = new ContainableItem()
            {
                Position = position2,
                Product  = product1
            };

            ContainableItem containableItem2 = new ContainableItem()
            {
                Position = position1,
                Product  = product2
            };

            ContainableItem containableItem3 = new ContainableItem()
            {
                Position = position1,
                Product  = product3
            };

            ContainableItemsCollection containableItemsCollection = new ContainableItemsCollection();
            Dispenser dispenser = new Dispenser(containableItemsCollection);

            PaymentTerminal paymentTerminal = new PaymentTerminal(dispenser);
            Payment         payment         = new BanknotePayment();

            containableItemsCollection.AddProduct(containableItem1);
            containableItemsCollection.AddProduct(containableItem2);
            containableItemsCollection.AddProduct(containableItem3);

            //  containableItemsCollection.RemoveAt(2);

            for (int i = 0; i < containableItemsCollection.Count(); i++)
            {
                Console.WriteLine(containableItemsCollection.GetItem(i));
            }

            Console.WriteLine("After dispense:");

            paymentTerminal.Pay(0, payment, 50);

            //Product dispenseProduct = dispenser.Dispense(0);
            // Console.WriteLine(dispenseProduct);
        }