private static Transaction AddProducts(Transaction transaction, Staff staff)
        {
            bool addingFinished = false;

            List <Product> products = ProductHandler.GetAllProducts();

            Console.WriteLine("** Add products to transaction **\n");

            while (!addingFinished)
            {
                Console.Clear();
                PrintSummary(transaction);
                Console.WriteLine("\n");

                ProductHandler.PrintInfoList(products);

                Console.WriteLine("Enter the id of the product wanted - enter 0 if you are finished.\n");
                Console.Write("Id: ");
                string idInput = Console.ReadLine();
                if (idInput == "0")
                {
                    break;
                }


                try
                {
                    int     productId     = int.Parse(idInput);
                    Product wantedProduct = products.Find(p => p.Id == productId);

                    if (wantedProduct != null)
                    {
                        Console.WriteLine("Enter the quantity required. Use , if decimals required");
                        Console.Write("Quantity: ");
                        double quantity = double.Parse(Console.ReadLine());

                        TransactionComponent productToAdd = TransactionComponentHandler.Create(transaction, wantedProduct, quantity);
                        transaction.TransactionComponent.Add(productToAdd);

                        Console.WriteLine(String.Format("{0} * {1} à {2} was added to transaction", quantity, productToAdd.ProductName, productToAdd.ProductPrice));
                    }
                    else
                    {
                        Console.WriteLine(String.Format("No product with id {0} was found", productId));
                    }
                }
                catch (FormatException)
                {
                    Console.WriteLine("Invalid format of input");
                }
            }
            return(transaction);
        }
 private static void PrintSummary(Transaction transaction) // Method to get summary of single transaction.
 {
     Console.WriteLine(String.Format("** Summary **\n" +
                                     "\tStaff: {0} {1}\n" +
                                     "\tTime of purchase: {2}\n" +
                                     "\tProducts: ",
                                     transaction.Staff.FirstName,
                                     transaction.Staff.LastName,
                                     transaction.TimeOfPurchase.ToShortDateString()));
     foreach (TransactionComponent tc in transaction.TransactionComponent)
     {
         Console.WriteLine("\t\t" + TransactionComponentHandler.Summarize(tc));
     }
     Console.WriteLine(String.Format("\tTotal: {0}", GetTotalSum(transaction)));
 }
 private static double GetTotalSum(Transaction transaction)
 {
     return(TransactionComponentHandler.GetSum(transaction.TransactionComponent));
 }