Exemple #1
0
        public static void Main(string[] args)
        {
            InvManager manager = new InvManager();

            Product p = new Milestone3.Product();

            p.name     = "Gladiator";
            p.price    = 12.99;
            p.quantity = 72;


            manager.addItem(p);

            Product target = manager.findByName("123");

            if (target == null)
            {
                Console.WriteLine("Product with id \'superstar\' is ");
            }
        }
Exemple #2
0
        static void Main(string[] args)
        {
            //test the invManager
            InvManager manager = new InvManager();
            //make a product to add
            Product p = new Product();

            p.name     = "Silly Putty";
            p.quantity = 143;
            p.price    = 2.29;
            p.prodId   = "123-sdfg";

            //add p to the manager
            manager.addItem(p);

            Product c = new Product();

            c.name     = "Cards";
            c.quantity = 140;
            c.price    = 2.25;
            c.prodId   = "124-sdfg";

            manager.addItem(c);

            manager.restockItem(c);

            Console.WriteLine(c);

            manager.displayItems(manager);

            Product target = manager.findByIdOrName("123-sdfg", "Silly Putty");

            if (target == null)
            {
                System.Console.WriteLine("Product with id and name: " + target + " is not there");
            }
            else
            {
                System.Console.WriteLine(target);
            }
        }
 public void displayItems(InvManager manager)
 {
     Console.WriteLine(string.Join("\n", items));
 }