Пример #1
0
 public void addL(logs l)
 {
     log.Add(l);
 }
Пример #2
0
        static void Main(string[] args)
        {
            Shops      shop      = new Shops();
            products   product   = new products();
            developers developer = new developers();
            logs       log       = new logs();
            sells      sell      = new sells();

            int    i;
            string buf;

            while (true)
            {
                Console.Clear();
                Console.WriteLine("1. Show out of stock products");
                Console.WriteLine("----");
                Console.WriteLine("2. Add product");
                Console.WriteLine("3. Remove product");
                Console.WriteLine("4. Print products");
                Console.WriteLine("----");
                Console.WriteLine("5. Add developer");
                Console.WriteLine("6. Remove developer");
                Console.WriteLine("7. Print developers");
                Console.WriteLine("----");
                Console.WriteLine("8. Add to log");
                Console.WriteLine("9. Remove from log");
                Console.WriteLine("10. Print log");
                Console.WriteLine("----");
                Console.WriteLine("11. Add to sells");
                Console.WriteLine("12. Remove from sells");
                Console.WriteLine("13. Print sells");
                Console.WriteLine("----");
                Console.WriteLine("0. Exit");
                do
                {
                    buf = Console.ReadLine();
                } while (!Int32.TryParse(buf, out i));
                Console.Clear();
                switch (i)
                {
                case 1:
                    shop.showExpired();
                    break;

                case 2:
                    product = new products();
                    Console.WriteLine("List of developers");
                    shop.showD();
                    Console.WriteLine("Name:");
                    product.name = Console.ReadLine();
                    Console.WriteLine("Category:");
                    product.category = Console.ReadLine();
                    Console.WriteLine("Price:");
                    product.price = float.Parse(Console.ReadLine());
                    Console.WriteLine("Id of Developer:");
                    product.developer = Convert.ToInt32(Console.ReadLine());
                    Console.WriteLine("Expiry:");
                    product.expiry = Console.ReadLine();
                    Console.WriteLine("Count:");
                    product.count = Convert.ToInt32(Console.ReadLine());
                    shop.addP(product);
                    break;

                case 3:
                    shop.showP();
                    shop.removeP(Convert.ToInt32(Console.ReadLine()));
                    break;

                case 4:
                    shop.showP();
                    break;

                case 5:
                    developer = new developers();
                    Console.WriteLine("Name:");
                    developer.name = Console.ReadLine();
                    Console.WriteLine("Country:");
                    developer.country = Console.ReadLine();
                    Console.WriteLine("City:");
                    developer.city = Console.ReadLine();
                    shop.addD(developer);
                    break;

                case 6:
                    shop.showD();
                    shop.removeD(Convert.ToInt32(Console.ReadLine()));
                    break;

                case 7:
                    shop.showD();
                    break;

                case 8:
                    log = new logs();
                    Console.WriteLine("List of products");
                    shop.showP();
                    Console.WriteLine("Id of product:");
                    log.product = Convert.ToInt32(Console.ReadLine());
                    Console.WriteLine("Date in:");
                    log.dateIn = Console.ReadLine();
                    shop.addL(log);
                    break;

                case 9:
                    shop.showL();
                    shop.removeL(Convert.ToInt32(Console.ReadLine()));
                    break;

                case 10:
                    shop.showL();
                    break;

                case 11:
                    sell = new sells();
                    Console.WriteLine("List of products");
                    shop.showP();
                    Console.WriteLine("Id of product:");
                    sell.product = Convert.ToInt32(Console.ReadLine());
                    Console.WriteLine("Name of buyer:");
                    sell.owner = Console.ReadLine();
                    shop.addS(sell);
                    break;

                case 12:
                    shop.showS();
                    shop.removeS(Convert.ToInt32(Console.ReadLine()));
                    break;

                case 13:
                    shop.showS();
                    break;

                case 0:
                    Environment.Exit(0);
                    break;
                }
                Console.ReadKey();
                Console.Clear();
            }
        }