private void IntializeTable() { List <Label> tableLabelList = new List <Label> { table1, table2, table3, table4, table5, table6, table7, table8, table9, table10 }; List <Table> tables = table_Service.GetAllTables(); for (int i = 0; i < tables.Count; i++) { switch (tables[i].TableState) { case TableState.available: tableLabelList[i].BackColor = Color.Green; break; case TableState.occupied: tableLabelList[i].BackColor = Color.Red; break; case TableState.reserved: tableLabelList[i].BackColor = Color.Yellow; break; } } }
public void ChangeColor() { int count = 0; Table_Service tableservice = new Table_Service(); List <Table> tables = tableservice.GetAllTables(); Reservation_Service service = Reservation_Service.GetReservationService(); foreach (var groupBox in Controls.OfType <GroupBox>()) { foreach (var button in groupBox.Controls.OfType <Button>()) { Table t = tables[count]; if (t.TableStatus == 0) { button.BackColor = Color.Green; button.Enabled = false; } else { button.BackColor = Color.Red; button.Enabled = true; } count++; } } }
private void FillComboBox() //combobox vullen met alle tafelnummers { Table_Service table_Service = Table_Service.GetTableService(); List <Table> tables = table_Service.GetAllTables(); foreach (Table t in tables) { cmb_Tafelnr.Items.Add(t.TableID); } }
private void LoadForm() { //show a Welcome message, "Welcome, firstName!" lblWelcome.Text = $"Welcome, {employee.firstName}!"; Table_Service tableService = new Table_Service(); tables = tableService.GetAllTables(); //return all the tables from the database //add all the table images in a list tableImages = new PictureBox[10] { picTable1, picTable2, picTable3, picTable4, picTable5, picTable6, picTable7, picTable8, picTable9, picTable10 }; ChangeTableColor(); ShowTableInfo(1); }
private void ShowOccupiedTables() { tables = table_service.GetAllTables(); Button[] btnArray = new Button[] { Bill_btnTable1, Bill_btnTable2, Bill_btnTable3, Bill_btnTable4, Bill_btnTable5, Bill_btnTable6, Bill_btnTable7, Bill_btnTable8, Bill_btnTable9, Bill_btnTable10 }; for (int i = 0; i < tables.Count; i++) { if (tables[i].Occupied == true) { btnArray[i].BackColor = Color.Red; btnArray[i].Enabled = true; } else { btnArray[i].BackColor = Color.Green; btnArray[i].Enabled = false; } } }
private void OrderForm_Load(object sender, EventArgs e) { tafels = tableService.GetAllTables(); var color = System.Drawing.Color.White; List <Button> list = new List <Button>(); int i = 0; foreach (Table t in tafels) { if (t.Occupied) { color = System.Drawing.Color.Red; } else { color = System.Drawing.Color.Green; } Button btn = new Button(); btn.BackColor = color; btn.Name = ("tafel" + t.Number); btn.Text = t.Number.ToString(); btn.Click += new EventHandler(this.ClickEvent); Point point = new Point(); point.X = i * 83; point.Y = 35; btn.Size = new Size(50, 50); btn.PointToClient(point); btn.Show(); list.Add(btn); i++; this.Controls.Add(btn); } Button[] btns = list.ToArray(); flowPanel.Controls.AddRange(btns); }