public static void TextToScreen() { var dateReceipt = DateTime.Now; Console.WriteLine("\n\t\t\t\t***CASH REGISTER***"); Console.WriteLine("\nREGISTER"); Console.WriteLine("RECEIPT " + dateReceipt); Console.WriteLine("Item Price Quantity Total\n\n"); TheProducts(); Console.WriteLine("\nTOTAL: {0:C}", grandTotal); Produces.ProduceInfo(); }
public static void ProduceInfo() { string input = ""; var readers = "..\\..\\Products.txt"; List <string> line = File.ReadAllLines(readers).ToList(); foreach (var reads in line) { string[] productSplit = reads.Split(' '); Produces newProduct = new Produces(); newProduct.ProductName = productSplit[0]; newProduct.ProductPrice = Double.Parse(productSplit[1]); newProduct.ProductType = productSplit[2]; newProduct.ProductID = Int32.Parse(productSplit[3]); Products.Add(newProduct); } bool keepGoing = true; while (keepGoing) { Console.Write("\n<ProductID> <Quantity>\n"); string answer = Console.ReadLine(); var data = answer.Split(' '); var data1 = int.Parse(data[0]); var data2 = int.Parse(data[1]); foreach (var item in Products) { if (item.ProductID == data1) { item.TotalPrice = item.ProductPrice * data2; if (item.ProductID == data1) { //Console.WriteLine("{0} {1:C} * {2}{3:C} = {4}", item.ProductName, item.ProductPrice, data2, item.ProductType, item.TotalPrice); input = String.Format("{0} {1:C} * {2}{3:C} = {4:C}", item.ProductName, item.ProductPrice, data2, item.ProductType, item.TotalPrice); Purchase.grandTotal += item.TotalPrice; } } } finalProducts.Add(input); Console.Clear(); Purchase.TextToScreen(); } }
public static void RegisterRunning(Produces products) { receiptSave.WriteLine(ReceiptPrintText(products)); ReceiptToText(); //grandTotal += products.TotalPrice; }
public void printReceipt(Produces products) { Console.WriteLine(products.Receipt()); }
private static string ReceiptPrintText(Produces products) { string allUserChoices = String.Format("{0} --- {1} --- {2:C} --- {3:C}", products.ProductName, products.ProductAmount, products.ProductPrice, products.TotalPrice); return(allUserChoices); }