public TableOverviewUI(Employee employee) { InitializeComponent(); currentEmployee = employee; tableButtons = new List <Button> { btnTable1, btnTable2, btnTable3, btnTable4, btnTable5, btnTable6, btnTable7, btnTable8, btnTable9, btnTable10 }; tableLabels = new List <Label> { lblTable1, lblTable2, lblTable3, lblTable4, lblTable5, lblTable6, lblTable7, lblTable8, lblTable9, lblTable10 }; tables = table_Service.GetTables(); for (int i = 1; i < tables.Count; i++) { if (tables[i].InUse) { tableButtons[i].BackColor = Color.Red; } else { tableButtons[i].BackColor = Color.LightGreen; } } }
//check table statu and give it a color private void TablesStatus() { List <Table> tables = tableService.GetTables(); //checking the status of each table and giving it the right color //the buttons list is used here. foreach (Button button in tablButtonsList) { checkColor(button, tablButtonsList.IndexOf(button) + 1, tables); } }
// bestelling items in het lijst zetten private void FillOrderItemList() { AllOrders_pnl.Show(); AllOrderslv.Items.Clear(); ChooseTableDD.Items.Clear(); foreach (Table t in t_service.GetTables()) { ChooseTableDD.Items.Add(t.tableId); } if (ChooseTableDD.SelectedIndex > 0) { FillMenuItemSpec(0); // kies tafel uit dropdown om alleen bestelingen van die tafel te zien } else { foreach (BestellingItem be in be_service.GetBestellingItems()) { ListViewItem item = new ListViewItem(be.orderId.ToString()); item.SubItems.Add(be.orderTableId.ToString()); item.SubItems.Add(be.itemName); item.SubItems.Add(be.amount.ToString()); if (be.orderItemStatus == false) { item.SubItems[0].BackColor = Color.IndianRed; item.SubItems.Add("Niet geserveerd"); } else { item.SubItems[0].BackColor = Color.LightGreen; item.SubItems.Add("Geserveerd"); } AllOrderslv.Items.Add(item); } } }
private void TablesStatus() { List <Table> tables = tableService.GetTables(); //checking the status of each table and giving it the right color checkColor(btn_Table1, 1, tables); checkColor(btn_Table2, 2, tables); checkColor(btn_Table3, 3, tables); checkColor(btn_Table4, 4, tables); checkColor(btn_Table5, 5, tables); checkColor(btn_Table6, 6, tables); checkColor(btn_Table7, 7, tables); checkColor(btn_Table8, 8, tables); checkColor(btn_Table9, 9, tables); checkColor(btn_Table10, 10, tables); }