Esempio n. 1
0
        public virtual void AddSomeItems()
        {
            Random rand = new Random();
            int    j    = rand.Next(1, 3);

            for (int i = 0; i < j; i++)
            {
                ListOfProducts.Add(new Item());
                System.Threading.Thread.Sleep(50);
            }
        }
Esempio n. 2
0
 public virtual void AddProduct(Product.Product product, int volume)
 {
     ListOfProducts.Add(new Item(product, volume));
 }
Esempio n. 3
0
 public virtual void AddItem(Item a)
 {
     ListOfProducts.Add(a);
 }
Esempio n. 4
0
    public void Run()
    {
        bool           exit           = false;
        ListOfProducts listOfProducts = new ListOfProducts();
        string         separator      = new string('_', Console.WindowWidth);

        do
        {
            Console.Clear();
            EnhancedConsole.WriteAt(0, 0, "PRODUCTSS  " + (currentRecord + 1).ToString("000")
                                    + "/" + listOfProducts.Amount.ToString("000"), "white");
            EnhancedConsole.WriteAt(0, 1, separator, "gray");

            WriteProduct(listOfProducts, currentRecord);

            EnhancedConsole.WriteAt(0, Console.WindowHeight - 4, separator, "gray");
            EnhancedConsole.WriteAt(0, Console.WindowHeight - 3, "1.-Previous" +
                                    "      2.-Next" + "     3.-Number" +
                                    "     4.-Search" + "     5.-Add", "white");
            EnhancedConsole.WriteAt(0, Console.WindowHeight - 2, "6.-Edit record"
                                    + "   0.-Exit     A.-Advanced   F1.-Help", "white");

            EnhancedConsole.ShowClock();

            switch (Console.ReadKey().Key)
            {
            case ConsoleKey.LeftArrow:
            case ConsoleKey.NumPad1:
            case ConsoleKey.D1:     //Previus
                if (currentRecord != 0)
                {
                    currentRecord--;
                }
                break;

            case ConsoleKey.RightArrow:
            case ConsoleKey.NumPad2:
            case ConsoleKey.D2:     //Next
                //I cant allProducts[currentRecord+1] != null
                if (currentRecord != listOfProducts.Amount - 1)
                {
                    currentRecord++;
                }
                break;

            case ConsoleKey.NumPad3:
            case ConsoleKey.D3:     //Search by number
                SearchByNumber(listOfProducts, ref currentRecord);
                break;

            case ConsoleKey.NumPad4:
            case ConsoleKey.D4:     //Search by text
                SearchByText(listOfProducts, ref currentRecord);
                break;

            case ConsoleKey.NumPad5:
            case ConsoleKey.D5:     //Add Product
                Console.Clear();
                listOfProducts.Add(GetDataToCreateProduct());
                break;

            case ConsoleKey.NumPad6:
            case ConsoleKey.D6:     //EDIT
                Modify(listOfProducts, currentRecord);
                break;

            case ConsoleKey.A:
                AdvancedMenu();
                break;

            case ConsoleKey.F1:
                HelpMenuAndControl(listOfProducts, currentRecord, separator);
                break;

            case ConsoleKey.NumPad0:
            case ConsoleKey.D0:     //EXIT
                exit = true;

                break;
            }
        } while (!exit);
    }