private void handleClick(object sender, System.Windows.RoutedEventArgs e) { string name = this.Seat.Text; if (BillItemControl.Selected != null) { MenuItem item = BillItemControl.Selected.Item; if (item == null) return; BillItemControl.Selected.Remove(); MainWindow.getTableManager().CurrentTable.addItem(item, name); } else { if (OrderBillControl.Selected != null) { OrderBillControl.Selected.reset(); if (OrderBillControl.Selected == this) OrderBillControl.Selected = null; else this.select(); } else { this.select(); } } }
private void addSeat(object sender, System.Windows.RoutedEventArgs e) { string seatName = "Seat " + (seatID++).ToString(); OrderBillControl obc = new OrderBillControl(seatName); this.TableBillStack.Children.Add(obc); tableManager.CurrentTable.SeatControls.Add(seatName, obc); }
private void setupTableBill(int table) { // Remove all children. this.TableBillStack.Children.Clear(); // Get the table that we want to set up. Table t = tableManager.getTable(table); t.SeatControls.Clear(); // Create seat for table. if (!t.Bill.ContainsKey("Table")) { OrderBillControl tbc = new OrderBillControl("Table"); this.TableBillStack.Children.Add(tbc); t.SeatControls.Add("Table", tbc); } // Loop over each person in the keys. foreach (string person in t.Bill.Keys) { OrderBillControl obc = new OrderBillControl(person); // Get the items that are attributed to that person. List<MenuItem> items = t.Bill[person]; double total = 0; foreach (MenuItem i in items) { // Add the new item to the bill. obc.ItemList.Children.Add(new BillItemControl(i)); total += i.Cost; } obc.SubTotal.Text = total.ToString("C"); this.TableBillStack.Children.Add(obc); t.SeatControls.Add(person, obc); } updateTotals(); }
private void select() { this.bgFill.Fill = new SolidColorBrush(Color.FromArgb(255, 255, 255, 30)); OrderBillControl.Selected = this; MainWindow.selectedSeat = this.Seat.Text; }