Exemplo n.º 1
0
        public Theater1(Show show, Customer customer, int theater)
        {
            InitializeComponent();
            switch (THEATER)
            {
            case 1: listShows = Theater1.ReadXML <Show>(tab1path); break;      //get shows information

            case 2: listShows = Theater1.ReadXML <Show>(tab2path); break;      //get shows information

            case 3: listShows = Theater1.ReadXML <Show>(tab3path); break;      //get shows informationbreak;
            }
            int inde = 0; for (int i = 0; i < listShows.Count; i++)

            {
                if (listShows.ElementAt(i).Name == show.Name)
                {
                    inde = i; i = listShows.Count;
                }
            }                                                                                                                                            //gets index

            //all global vars for a particular customer
            INDEX    = inde;     //passing the index of the  show in the list of showws
            CUSTOMER = customer; //passing who the customer is
            SHOW     = show;     //passing show selected info
            THEATER  = theater;
        }
Exemplo n.º 2
0
        private void Theater1_Load(object sender, EventArgs e)
        {
            AlreadyReservedShow = false;
            CreateButtons();
            switch (THEATER)
            {
            case 1: listShows = Theater1.ReadXML <Show>(tab1path); break;                                 //get shows information

            case 2: listShows = Theater1.ReadXML <Show>(tab2path); break;                                 //get shows information

            case 3: listShows = Theater1.ReadXML <Show>(tab3path); break;                                 //get shows informationbreak;
            }
            foreach (Button a in buttonArray)                                                             //for the whole theater seats
            {
                foreach (Viewer b in listShows.ElementAt(INDEX).viewers)                                  //check everyone in the show, all the viewers
                {
                    foreach (string c in b.Seating)                                                       //if their seats
                    {
                        if (a.Text == c)                                                                  //match up with the button
                        {
                            a.BackColor = Color.Red;                                                      //then turn it red indicate taken
                            a.Enabled   = false;                                                          //disable reserved seats
                            if ((b.Firstname == CUSTOMER.Firstname) && (b.Lastname == CUSTOMER.Lastname)) //checks to see if the vewer matches with the customer
                            {
                                AlreadyReservedShow = true;
                            }                                 // bool indicating person already in show
                        }
                    }
                }
            }
        }