示例#1
0
        /// <summary>
        /// Prints the current seating for the show which is chosen at the moment
        /// </summary>
        private void PopulateSeats()
        {
            Show          currentShow    = shows[startTimeComboBox.SelectedIndex];
            List <Ticket> ticketsForShow = handler.GetTicketsForShow(currentShow);

            seatsToAdd.Clear();
            seatsToRemove.Clear();
            foreach (Label seat in seats)
            {
                seat.BackColor = Color.Green;
            }
            foreach (Ticket ticket in ticketsForShow)
            {
                //SeatNum is -1 because list is 0-based, and the seats aren't
                int seatNum = ticket.Seat - 1;
                //if current customer holds the ticket for the given seat, set it to yellow
                if (ticket.CustomerId == Customer.CustomerId)
                {
                    seats[seatNum].BackColor = Color.Yellow;
                }
                else
                {
                    seats[seatNum].BackColor = Color.Red;
                }
            }
            UpdateOccupiedNumbers();
        }