public void changeTheOrdersList(List <Order> orders)
 {
     listVOrders.Items.Clear();
     foreach (Order order in orders)
     {
         OrderTableItem item = new OrderTableItem();
         item.OrderID = order.Id;
         item.TableID = order.TableID;
         item.Product = order.Product;
         item.Amount  = order.Amount;
         item.State   = orderStatus[order.Status];
         item.Date    = order.Date.ToString();
         if (order.Status < 3)
         {
             listVOrders.Items.Add(new ListViewItem());
             ((ListViewItem)listVOrders.Items[listVOrders.Items.Count - 1]).Content    = item;
             ((ListViewItem)listVOrders.Items[listVOrders.Items.Count - 1]).Background = itemColor[order.Status];
         }
     }
     if (cbbTablesView.SelectedIndex != -1)
     {
         int tableID = Convert.ToInt16(cbbTablesView.SelectedItem.ToString().Substring(5));
         cleanTableData();
         loadTableData(tableID);
     }
 }
        // Carga la información detallada de una mesa
        private void loadTableData(int tableID)
        {
            List <int> tables = manager.RoomManager.getCandidateTables();
            int        i      = 0;

            foreach (int table in tables)   // Carga las mesas ocupadas
            {
                cbbTablesView.Items.Add("Mesa " + table);
                if (tableID == table)
                {
                    cbbTablesView.SelectedIndex = i;
                }
                i++;
            }
            List <Object> info = manager.RoomManager.updateTable(tableID);   // Devuelve el estado actualizado de la mesa

            foreach (Object o in info)
            {
                if (o.GetType() == typeof(Client))  // Información del cliente que ocupa la mesa
                {
                    txtbDNI.Text         = ((Client)o).Dni;
                    txtbName.Text        = ((Client)o).Name;
                    txtbSurname.Text     = ((Client)o).Surname;
                    txtbAppearances.Text = Convert.ToString(((Client)o).Appearances);
                }
                else if (o.GetType() == typeof(Bar.domain.TableInf))   // Información de la mesa
                {
                    txtbTableID.Text     = Convert.ToString(((Bar.domain.TableInf)o).Id);
                    txtbTableStatus.Text = tableStatus[((Bar.domain.TableInf)o).Status];
                    if (((Bar.domain.TableInf)o).Status == 2)
                    {
                        btnCheckIn.IsEnabled = true;
                        btnCheckIn.Content   = "Facturar";
                    }
                    else if (((Bar.domain.TableInf)o).Status == 3)
                    {
                        btnCheckIn.IsEnabled = true;
                        btnCheckIn.Content   = "Ver factura";
                    }
                    txtbTableOccupation.Text = Convert.ToString(((Bar.domain.TableInf)o).Guests) +
                                               "/" + Convert.ToString(((Bar.domain.TableInf)o).Capacity);
                }
                else if (o.GetType() == typeof(List <Order>))    // Lista de pedidos de la mesa
                {
                    foreach (Order order in ((List <Order>)o))
                    {
                        OrderTableItem item = new OrderTableItem();
                        item.OrderID = order.Id;
                        item.TableID = order.TableID;
                        item.Product = order.Product;
                        item.Amount  = order.Amount;
                        item.State   = orderStatus[order.Status];
                        item.Date    = order.Date.ToString();
                        listVTablesOrders.Items.Add(new ListViewItem());
                        ((ListViewItem)listVTablesOrders.Items[listVTablesOrders.Items.Count - 1]).Content    = item;
                        ((ListViewItem)listVTablesOrders.Items[listVTablesOrders.Items.Count - 1]).Background = itemColor[order.Status];
                    }
                }
            }
        }