private void cmbSession_SelectedIndexChanged(object sender, EventArgs e) { ClearForm.DisposePanels(this); if (cmbSession.SelectedIndex > -1) { Session session = (Session)cmbSession.SelectedItem; if (session.MovieTheatre.MovieTheatreID == 1) { CreateTheatreA(); foreach (Control ctrl in this.Controls) { if (ctrl is Panel) { foreach (Control control in ctrl.Controls) { if (control is Button) { foreach (Ticket ticket in TicketDataTransaction.GetTicketList(session)) { if ((short)control.Tag == ticket.SeatNumber) { control.BackgroundImage = Image.FromFile(@"fullSeat.png"); control.BackgroundImageLayout = ImageLayout.Stretch; control.Enabled = false; } } } } } } } else if (session.MovieTheatre.MovieTheatreID == 2) { CreateTheatreB(); foreach (Control ctrl in this.Controls) { if (ctrl is Panel) { foreach (Control control in ctrl.Controls) { if (control is Button) { foreach (Ticket ticket in TicketDataTransaction.GetTicketList(session)) { if ((short)control.Tag == ticket.SeatNumber) { control.BackgroundImage = Image.FromFile(@"fullSeat.png"); control.BackgroundImageLayout = ImageLayout.Stretch; control.Enabled = false; } } } } } } } else if (session.MovieTheatre.MovieTheatreID == 3) { CreateTheatreC(); foreach (Control ctrl in this.Controls) { if (ctrl is Panel) { foreach (Control control in ctrl.Controls) { if (control is Button) { foreach (Ticket ticket in TicketDataTransaction.GetTicketList(session)) { if ((short)control.Tag == ticket.SeatNumber) { control.BackgroundImage = Image.FromFile(@"fullSeat.png"); control.BackgroundImageLayout = ImageLayout.Stretch; control.Enabled = false; } } } } } } } } }