/// <summary> /// Paints the seat blue or red for reserver or sold /// </summary> /// <param name="ticket">Ticket</param> private void PaintSeat(Ticket ticket) { bool disabled = false; Seat seat = new Seat() { IdScreen = ticket.IdScreen, Number = ticket.Number, Row = ticket.Row }; string pbName = "pb_" + ticket.Row + "_" + ticket.Number; // cria o label do picture box PictureBox pb = (PictureBox)this.Controls[pbName]; // aponta para o controlo com o nome da picture box disabled = BoxOfficeHelper.IsDisabledSeat(seat); if (ticket.IdClient.HasValue) { if (disabled) { pb.Image = Properties.Resources.Seat_Disabled_Reserved; pb.Enabled = false; // TEMPORARIO disables picture box because sit is already reserved } else { pb.Image = Properties.Resources.Seat_Reserved; pb.Enabled = false; // TEMPORARIO disables picture box because sit is already reserved } } else { if (disabled) { pb.Image = Properties.Resources.Seat_Disabled_Occupied; pb.Enabled = false; // disables picture box because sit is already sold } else { pb.Image = Properties.Resources.Seat_Occupied; pb.Enabled = false; // disables picture box because sit is already sold } } }
/// <summary> /// Verifies number and disposition of seats for selected screen, enables them for selection and paints them green. /// </summary> /// <param name="seat">Seat</param> private void PaintSeat(Seat seat) { bool disabled = false; string pbName = "pb_" + seat.Row + "_" + seat.Number; // creats label for picture box PictureBox pb = (PictureBox)this.Controls[pbName]; // points to the control with the name of the picture box disabled = BoxOfficeHelper.IsDisabledSeat(seat); if (pb != null) // if it's a seat on the selected screen { if (disabled) { pb.Image = Properties.Resources.Seat_Disabled_Free; } else { pb.Image = Properties.Resources.Seat_Free; } pb.Enabled = true; // enables the seats that are valid for selected screen } }
/// <summary> /// Paints the seat black when the user selects it and green if he cancels the seletin /// </summary> /// <param name="ticket">Ticket</param> /// <param name="selection">Selection - True, is seat is being selected by user</param> private void PaintSeat(Ticket ticket, bool selection) { bool disabled = false; Seat seat = new Seat() { IdScreen = ticket.IdScreen, Number = ticket.Number, Row = ticket.Row }; string pbName = "pb_" + ticket.Row + "_" + ticket.Number; // cria o label do picture box PictureBox pb = (PictureBox)this.Controls[pbName]; // aponta para o controlo com o nome da picture box disabled = BoxOfficeHelper.IsDisabledSeat(seat); // checks if it's a disabled seat // paint the selected seat black if (selection) { if (disabled) { pb.Image = Properties.Resources.Seat_Disabled_Selected; } else { pb.Image = Properties.Resources.Seat_Selected; } } else { if (disabled) { pb.Image = Properties.Resources.Seat_Disabled_Free; } else { pb.Image = Properties.Resources.Seat_Free; } } }