private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
        {
            // Changing the tab (table) essentially assigns the selectedTable variable

            // trap door the event if we are midway through an order or if the table
            // has already ordered

            if (newOrder != null)
                return;

            selectedSeat = null;

            TabControl selectedTab = (TabControl)sender;

            selectedTable = tables[selectedTab.SelectedIndex];

            // trapdoor the event if the table has already ordered
            // this has to be done after the selectedTable var is
            // updated or a subtle bug is introduced

            if (selectedTable.OrderPlaced == true)
                return;

            // The selected table has its seats added to the 'seated' arraylist
            // for the table object. The seats are disabled in preparation
            // for when the start new order button is hit

            foreach (Control ctrl in tabControl1.SelectedTab.Controls)
            {
                if (ctrl is Seat)
                {
                    if (selectedTable.seated.Count < 4)
                    {
                        selectedTable.seated.Add((Seat)ctrl);
                        ctrl.Enabled = false;
                    }
                }
            }
            selectedTable.Waiter = labelWaiter.Text;

            // a new order may now be raised

            buttonStartOrder.Enabled = true;
        }
        private void seat_click(object sender, EventArgs e)
        {
            // A seat has been clicked so we can enable the menu

            listBoxMeals.Enabled = true;

            selectedSeat = (Seat)sender;

            // once a seat has ordered it is put on the ordered queue, a member of the table
            // class. We dont want to reorder for a seat so we test this selected seat
            // against each seat that has ordered. If it has ordered already we drop out of
            // the event handler

            foreach (Seat s in selectedTable.ordered)
            {
                if (selectedSeat.Equals(s))
                    return;
            }

            // repaint the seats in case a new seat has been selected

            foreach (Seat s in selectedTable.seated)
            {
                s.Image = Properties.Resources.Button_Blank_Green_icon;
            }

            // the selected seat is now colored blue

            selectedSeat.Image = Properties.Resources.Button_Blank_Blue_icon;
        }