/// <summary> /// This is the method that is called in the button event to add the data into the objects. /// </summary> private void saleConfirm() { str_customerName = userNameTxt.Text; Int32.TryParse(userPhoneTxt.Text, out int_customerPhone); /// <summary> /// Discount no spot prize /// <summary> if (bln_disTF == true) { pnl_panel2.Visible = true; pnl_panel2.Enabled = true; //Int32.TryParse(userPhoneTxt.Text, out int_tempPhone); BigSpender bigSpender = new BigSpender (int_invoiceNum, arr_products[lst_productList.SelectedIndex].str_ProductName, markUp(arr_products[lst_productList.SelectedIndex].dec_ProductPrice), int_userInput, str_customerName, int_customerPhone); bigSpender.dec_ValueOfSale = bigSpender.costOfTotal(); int_finalQty += bigSpender.int_SaleQuantity; dec_finalSalesValue += bigSpender.dec_ValueOfSale; arr_sales[int_updateCounter] = bigSpender; arr_products[lst_productList.SelectedIndex].makeSale(int_userInput); bln_disTF = false; } /// <summary> /// Discount with spot prize /// <summary> else if (bln_spotPrizeAward == true) { SpotPrize spotPrize = new SpotPrize (int_invoiceNum, arr_products[lst_productList.SelectedIndex].str_ProductName, dec_spotPrizeCost, int_userInput, str_customerName, int_customerPhone, arr_products[5].str_ProductName); spotPrize.dec_ValueOfSale = spotPrize.costOfTotal(); int_finalQty += spotPrize.int_SaleQuantity; dec_finalSalesValue += spotPrize.dec_ValueOfSale; arr_sales[int_updateCounter] = spotPrize; arr_products[lst_productList.SelectedIndex].makeSale(int_userInput); bln_spotPrizeAward = false; } /// <summary> /// Sale with no discount. /// <summary> else { arr_products[lst_productList.SelectedIndex].makeSale(int_userInput); SaleInvoice saleInvoice = new SaleInvoice (int_invoiceNum, arr_products[lst_productList.SelectedIndex].str_ProductName, markUp(arr_products[lst_productList.SelectedIndex].dec_ProductPrice), int_userInput); saleInvoice.dec_ValueOfSale = saleInvoice.costOfTotal(); int_finalQty += saleInvoice.int_SaleQuantity; dec_finalSalesValue += saleInvoice.dec_ValueOfSale; arr_sales[int_updateCounter] = saleInvoice; } saleConfirmUI(); }