示例#1
0
 /*=========================================METHODS================================*/
 // Method to show the status of each invoice
 public void showInvoiceStatus()
 {
     Console.WriteLine("ID: {0}, Date: {1}", idInvoice, date);
     Console.WriteLine("Customer Name: {0}, Phone: {1}", customer.Customer.NameCustomer, customer.Customer.Phone);
     Console.WriteLine("Items List: ");
     itemsList.listArticlesByInvoice();
     Console.WriteLine("Total Invoice Value: {0}", itemsList.totalValue());
 }
示例#2
0
        // Parameters to add a new invoice
        static Invoice loadInvoice()
        {
            Console.WriteLine("Enter the details of the new invoice:");
            Console.WriteLine("Id Invoice:");
            int id = Int32.Parse(Console.ReadLine());

            Console.WriteLine("ID Customer:");
            int          idCli    = Int32.Parse(Console.ReadLine());
            CustomerNode customer = customerList.returnCustomerByID(idCli);

            Console.WriteLine("List articles:");
            ArticleList listItems = new ArticleList();
            int         var       = 1;

            do
            {
                Console.WriteLine("Enter the ID of the article you want to add:");
                int     idA        = Int32.Parse(Console.ReadLine());
                Article newArticle = articleList.returnArticleByID(idA).Article;
                Console.WriteLine("Enter the amount you want to carry:");
                int cant = Int32.Parse(Console.ReadLine());
                if (cant > newArticle.Stock)
                {
                    Console.WriteLine("Not all these drives are available.");
                    Console.WriteLine("Do you want to enter another quantity less than: {0}", newArticle.Stock, "units.");
                    Console.WriteLine("1- YES");
                    Console.WriteLine("0- NO");
                    Console.WriteLine("Please select an option:");
                    int a = Int32.Parse(Console.ReadLine());
                    if (a == 1)
                    {
                        Console.WriteLine("Enter the amount you want to carry:");
                        cant = Int32.Parse(Console.ReadLine());
                        newArticle.Quantity   = cant;
                        newArticle.TotalPrice = newArticle.Quantity * newArticle.Price;
                        articleList.returnArticleByID(idA).Article.updateStock(newArticle.Stock - cant);
                        listItems.addArticle(newArticle);
                    }
                    else
                    {
                        listItems.addArticle(null);
                    }
                }
                else
                {
                    newArticle.Quantity   = cant;
                    newArticle.TotalPrice = newArticle.Quantity * newArticle.Price;
                    articleList.returnArticleByID(idA).Article.updateStock(newArticle.Stock - cant);
                    listItems.addArticle(newArticle);
                }

                Console.WriteLine("You want to add another item to the invoice:");
                Console.WriteLine("1- YES");
                Console.WriteLine("0- NO");
                Console.WriteLine("Please select an option:");
                var = Int32.Parse(Console.ReadLine());
                Console.Write("Press any key to continue...");
                Console.ReadKey();
                Console.Clear();
            } while (var != 0);
            Double  valueInvoice = listItems.totalValue();
            Invoice invoice      = new Invoice(id, customer, listItems, valueInvoice);

            return(invoice);
        }