public void SetTotal(long value) { Total = value; TotalChanged?.Invoke(value); }
/// <summary> /// Event handler for when the submit button for cash transactions /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void OnSubmitButtonClicked(object sender, EventArgs e) { TotalChanged?.Invoke(this, new EventArgs()); foreach (object obj in CashControlGrid.Children) { if (obj is CoinControl c) { switch (c.Denomination) { case CashRegister.Coins.Penny: OrderControl.CashDrawer.AddCoin(CashRegister.Coins.Penny, c.Amount); c.Amount = 0; break; case CashRegister.Coins.Nickel: OrderControl.CashDrawer.AddCoin(CashRegister.Coins.Nickel, c.Amount); c.Amount = 0; break; case CashRegister.Coins.Dime: OrderControl.CashDrawer.AddCoin(CashRegister.Coins.Dime, c.Amount); c.Amount = 0; break; case CashRegister.Coins.Quarter: OrderControl.CashDrawer.AddCoin(CashRegister.Coins.Quarter, c.Amount); c.Amount = 0; break; case CashRegister.Coins.HalfDollar: OrderControl.CashDrawer.AddCoin(CashRegister.Coins.HalfDollar, c.Amount); c.Amount = 0; break; case CashRegister.Coins.Dollar: OrderControl.CashDrawer.AddCoin(CashRegister.Coins.Dollar, c.Amount); c.Amount = 0; break; } } else if (obj is BillControl b) { switch (b.Denomination) { case CashRegister.Bills.One: OrderControl.CashDrawer.AddBill(CashRegister.Bills.One, b.Amount); b.Amount = 0; break; case CashRegister.Bills.Two: OrderControl.CashDrawer.AddBill(CashRegister.Bills.Two, b.Amount); b.Amount = 0; break; case CashRegister.Bills.Five: OrderControl.CashDrawer.AddBill(CashRegister.Bills.Five, b.Amount); b.Amount = 0; break; case CashRegister.Bills.Ten: OrderControl.CashDrawer.AddBill(CashRegister.Bills.Ten, b.Amount); b.Amount = 0; break; case CashRegister.Bills.Twenty: OrderControl.CashDrawer.AddBill(CashRegister.Bills.Twenty, b.Amount); b.Amount = 0; break; case CashRegister.Bills.Fifty: OrderControl.CashDrawer.AddBill(CashRegister.Bills.Fifty, b.Amount); b.Amount = 0; break; case CashRegister.Bills.Hundred: OrderControl.CashDrawer.AddBill(CashRegister.Bills.Hundred, b.Amount); b.Amount = 0; break; } } } }