コード例 #1
0
        private void cmbTheatreList_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cmbTheatreList.SelectedIndex > -1)
            {
                MovieTheatre theatre = (MovieTheatre)cmbTheatreList.SelectedItem;

                lblTheatreNumber.Text = theatre.MovieTheatreID.ToString();
                lblTheatreName.Text   = theatre.MovieTheatreName;
                lblCapacity.Text      = theatre.SeatingCapacity.ToString();
            }

            ClearForm.DisposePanels(this);

            if (cmbTheatreList.SelectedIndex == 0)
            {
                CreateTheatre.TheatreA(this);
            }
            else if (cmbTheatreList.SelectedIndex == 1)
            {
                ;
                CreateTheatre.TheatreB(this);
            }
            if (cmbTheatreList.SelectedIndex == 2)
            {
                CreateTheatre.TheatreC(this);
            }
        }
コード例 #2
0
        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;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }