コード例 #1
0
    private void CreateInvoice()
    {
        bool exit = false;

        customerManager = new CustomerManager();
        productManager  = new ProductManager();
        Customer c = customerManager.RunToGetCustomer();
        Product  p;

        listOfInvoice.Add(c);
        do
        {
            p = productManager.RunToGetProduct();
            EnhancedConsole.WriteAt(2, Console.BufferHeight - 5
                                    , "AMOUNT?", "yellow");
            string amountSTR;
            int    amount;
            do
            {
                amountSTR = Console.ReadLine();
            }while (!Int32.TryParse(amountSTR, out amount));
            listOfInvoice.Get(listOfInvoice.Amount - 1).GetLines().Add
                (new Line(p, amount, p.GetSellPrice()));
            Console.Clear();
            EnhancedConsole.WriteAt(2, Console.BufferHeight - 5
                                    , "DO YOU NEED MORE PRODUCTS? Y/N", "yellow");
            if (Console.ReadKey().Key == ConsoleKey.Y)
            {
                exit = false;
            }
            else
            {
                exit = true;
            }
        }while (!exit);
        listOfInvoice.Save();
    }