private void Table_Click(object sender, EventArgs e) { Button button = (Button)sender; Table table = (Table)button.Tag; if (!table.Occupied) { tableService.ChangeOccupation(table, true); } DisplayMenuPanel(table); }
private void btnPay_Click(object sender, EventArgs e) { decimal tip = decimal.Parse(lblTip.Text); decimal price = decimal.Parse(lblSubTotal.Text) + decimal.Parse(lblSubTotal.Text); int employeeID = Order.Employee.EmployeeID; int orderID = Order.OrderID; PaymentMethod method; try { if (rbnCash.Checked) { method = PaymentMethod.Cash; } else if (rbnDebitCard.Checked) { method = PaymentMethod.CreditCard; } else if (rbnIDeal.Checked) { method = PaymentMethod.Pin; } else { throw new Exception("No payment method selected!"); } } catch (Exception exception) { errorBox.Show(exception.Message); return; } Payment = new Payment(tip, price, DateTime.Now, employeeID, orderID, method); paymentService.InsertPayment(Payment); tableService.ChangeOccupation(Order.Table, false); errorBox.Show("Payment successful!"); Hide(); new OrderForm(Order.Employee).Show(); }