private void bnClear_Click(object sender, EventArgs e) { syst.clearTransaction(); tbName.Text = ""; tbPrice.Text = ""; currentTransaction = null; }
private void bnScan_Click(object sender, EventArgs e) { if (currentTransaction == null) currentTransaction = new Transaction(); try { int bc = int.Parse(tbBarCode.Text); Item i = syst.locateItem(bc); currentTransaction.addItem(i); tbName.Text = i.getName(); tbPrice.Text = String.Format("{0:0.00}", i.getPrice()); } catch { MessageBox.Show("Item not found"); } tbBarCode.Text = ""; }
private void bnTotal_Click(object sender, EventArgs e) { if (currentTransaction == null) MessageBox.Show("No current Transaction"); else { currentTransaction.executeTransaction(); List<string> sl = currentTransaction.displayItems(); if (sl != null) { ListDialog listDialog = new ListDialog(); listDialog.AddDisplayItems(sl.ToArray()); listDialog.ShowDialog(); syst.addTransaction(currentTransaction); } currentTransaction = null; } tbName.Text = ""; tbPrice.Text = ""; }
/* * Add a transaction to the list. */ public void addTransaction(Transaction t) { _transactionList.Add(t); }