private void initOrderItems() { order = os.Db_Get_Orders_Of_Specific_Table(table.TableId); DisplayOrderItems(order); DisplayValues(order); }
private void GetSetformation() { Button[] butts = new Button[10] { Table1, Table2, Table3, Table4, Table5, Table6, Table7, Table8, Table9, Table10 }; Label[] labels = new Label[10] { Status1, Status2, Status3, Status4, Status5, Status6, Status7, Status8, Status9, Status10 }; Button[] occupyButtonList = new Button[10] { Occupy1, Occupy2, Occupy3, Occupy4, Occupy5, Occupy6, Occupy7, Occupy8, Occupy9, Occupy10 }; tables = table_service.GetRestaurantTables(); for (int x = 0; x < tables.Count; x++) { labels[x].ForeColor = tables[x].IsOccupied ? System.Drawing.Color.DarkGray : System.Drawing.Color.DarkOrange; occupyButtonList[x].Enabled = !tables[x].IsOccupied; labels[x].Text = tables[x].IsOccupied ? "Occupied" : "Free"; } // by default for (int tableNr = 0; tableNr <= labels.Length + 1; tableNr++) // looping to check all order from table list one by one { Order order = order_service.Db_Get_Orders_Of_Specific_Table(tableNr + 1); //filling the list if (order != null) { bool isFinished = order.OrderItemList.Any(item => item.Status == OrderStatus.Finished); bool orderTaken = order.OrderItemList.Any(item => item.Status != OrderStatus.Finished); if (isFinished) { labels[tableNr].Text = "Order is ready"; labels[tableNr].ForeColor = System.Drawing.Color.Green; } if (orderTaken) { labels[tableNr].Text = "Order taken"; labels[tableNr].ForeColor = System.Drawing.Color.Black; } } } }