/// <summary> /// Method dedicated to the upload receipt process. Runs methods from the library depending on what /// is being uploaded. /// </summary> /// <returns></returns> private bool UploadFullReceipt() { // Get first and only receipt ReceiptModel r = receipts[0]; // Create receipt in the database first to ensure the other data is able to get access to the receipt ID. ReceiptUploader.UploadToReceiptTable(employeeKey, r.OrderBaseCost, r.OrderDeliveryCost, r.OrderReceiptCost); // Receipt ID int id = ReceiptUploader.GetReceiptID(); // If ID is present, cycle through everything in the order and run the corresponding methods to upload // their data to the database. if (id > 0) { foreach (PizzaModel p in r.PizzaList) { ReceiptUploader.UploadToPizzaTable(p.Size, ReceiptUtils.ToppingsToString(p.Toppings), p.Price, id); } foreach (SideModel s in r.SideList) { ReceiptUploader.UploadToSideTable(s.Name, s.Quantity, s.Price, id); } foreach (DrinkModel d in r.DrinkList) { ReceiptUploader.UploadToDrinkTable(d.Name, d.Quantity, d.Price, id); } // Upload customer information ReceiptUploader.UploadToCustomerTable(r.CustomerName, r.CustomerAddressLine1, r.CustomerPostCode, id); return(true); } else { MessageBox.Show("Receipt ID not found! Report to a developer immediately."); } return(false); }