private void ChangeTableState(int tableID, Label tableLabel) { List <Table> tables = table_Service.GetAllTables(); Table table = tables[tableID - 1]; CustomDialogBoxforTableView dialogBox = new CustomDialogBoxforTableView(table, employee, this); DialogResult result = dialogBox.ShowDialog(); if (result == DialogResult.No) { tableLabel.BackColor = Color.Red; table.TableState = TableState.occupied; } else if (result == DialogResult.Yes) { tableLabel.BackColor = Color.Yellow; table.TableState = TableState.reserved; } else if (result == DialogResult.OK) { tableLabel.BackColor = Color.Green; table.TableState = TableState.available; } try { table_Service.EditTable(table); } catch (Exception e) { MessageBox.Show("Unable to change table state " + e.Message); } }
private void ChangeTableState(int tableID, Label tableLabel) { CustomDialogBoxforTableView dialogResult = new CustomDialogBoxforTableView(table, employee, this); table.TableID = tableID; dialogResult.ShowDialog(); if (dialogResult.DialogResult.Equals(DialogResult.No)) { tableLabel.BackColor = Color.Red; table.TableState = TableState.occupied; } else if (dialogResult.DialogResult.Equals(DialogResult.Yes)) { tableLabel.BackColor = Color.Yellow; table.TableState = TableState.reserved; } else if (dialogResult.DialogResult.Equals(DialogResult.OK)) { tableLabel.BackColor = Color.Green; table.TableState = TableState.available; } try { table_Service.EditTable(table); } catch (Exception e) { MessageBox.Show("Unable to change table state " + e.Message); } }