//deserialization constructor.
 public Seat(SerializationInfo info, StreamingContext ctxt)
 {
     //grab data from the serialization and assign it to local vars
     SeatNum = (string)info.GetValue("seatNumbers", typeof(string));
     ArrayIndex = (int)info.GetValue("arrayDex", typeof(int));
     Reserved = (bool)info.GetValue("reserved?", typeof(bool));
     Handicapped = (bool)info.GetValue("handicapped?", typeof(bool));
     this.Ticket = (Ticket)info.GetValue("theTicket", typeof(Ticket));
 }
        private void search(bool handi)
        {
            ArrayList foundSeats;
            string type = "";
            int total = adultTotal + studentTotal + seniorTotal + compTotal;
            double costTotal = (adultTotal * Ticket.adultCost) + (studentTotal * Ticket.studentCost) + (seniorTotal * Ticket.seniorCost);

            //search for the seats
            foundSeats = SeatingChart.currentNight.findSeats(total, true);

            if (foundSeats.Count > 0)
            {
                //display found seats in seating chart
                indicateSeats(foundSeats, true);

                //confirmation save
                DialogResult accept = MessageBox.Show("Total Cost: $" + String.Format("{0:0.00}", Convert.ToString(costTotal)), "Reserve Tickets?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (accept == System.Windows.Forms.DialogResult.Yes)
                {
                    //indicate that changes have been made
                    SeatingChart.changed = true;

                    //go through array list
                    for (int i = 0; i < foundSeats.Count; i++)
                    {
                        //grab the seat
                        Seat thisSeat = (Seat)foundSeats[i];

                        //reserve the seat
                        thisSeat.reserved = true;

                        //check for existing ticket types and assign to type var
                        if (adultTotal > 0)
                        {
                            type = "Adult";
                            adultTotal--;
                        }//end if

                        else if (studentTotal > 0)
                        {
                            type = "Student";
                            studentTotal--;
                        }//end else if

                        else if (seniorTotal > 0)
                        {
                            type = "Senior";
                            seniorTotal--;
                        }//end else if

                        else if (compTotal > 0)
                        {
                            type = "Comp";
                            compTotal--;
                        }//end else if

                        //this is used to add the free comp.
                        //on the second iter, there will be no other types, so this should just add
                                //the one free ticket
                        else if (i == (foundSeats.Count - 1))
                        {
                            type = "comp";
                        }//end else if

                        //reserve the seat
                        if (!SeatingChart.currentNight.reserveSeat(thisSeat.seatNum, true))
                        {
                            //if there is an error saving seats, break and throw error
                            MessageBox.Show("Error reserving seats", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);

                            //deselect seats
                            indicateSeats(foundSeats, false);

                            //renable this form
                            this.Enabled = true;

                            break;
                        }//end if

                        else
                        {
                            //otherwise, assign it a ticket and move on to the next seat

                            //create a ticket for the seat
                            Ticket thisTicket = new Ticket(type);

                            //assign the ticket to the seat
                            thisSeat.ticket = thisTicket;
                        }//end else
                    }//end for

                    //confirm that reservation has been made

                    //create new reservation confirmation form
                    frmReservedSeats reserved = new frmReservedSeats(this, foundSeats, costTotal);

                    //disable this form
                    this.Enabled = true;

                    //display the form
                    reserved.Show();
                }//end if
            }//end if

            else
            {
                MessageBox.Show("Empty seats could not be found. Try searching for a smaller number.", "Seats not found", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                //re-enable form
                this.Enabled = true;
            }//end else

            //deselect seats
            indicateSeats(foundSeats, false);

            //reset combos
            this.enableCombos();

            //clear running totals
            resetTotals();

            //re-enable the form
            this.Enabled = true;
        }
        private void submit()
        {
            if (cmboTixType.SelectedIndex >= 0)
            {
                string type = "";

                if (cmboTixType.SelectedIndex == 0)
                {
                    type = "Adult";
                }//end if

                else if (cmboTixType.SelectedIndex == 1)
                {
                    type = "Student";
                }//end else if

                else if (cmboTixType.SelectedIndex == 2)
                {
                    type = "Senior";
                }//end else if

                else if (cmboTixType.SelectedIndex == 3)
                {
                    type = "Parent Pass";
                }//end else if

                else if (cmboTixType.SelectedIndex == 4)
                {
                    type = "Comp";
                }//end else if

                //create new ticket
                Ticket thisTicket = new Ticket(type);

                //create seat
                Night thisNight = (Night)seatForm.mainChart.currentShow.htNights2Nights[seatForm.night];
                Seat thisSeat = (Seat)thisNight.htSeats2Bits[seatForm.seatNum];

                //assign that ticket to the seat
                thisSeat.ticket = thisTicket;

                //replace the originals with the modified ones
                thisNight.htSeats2Bits[seatForm.night] = thisSeat;
                seatForm.mainChart.currentNight = thisNight;

                //reserve the seat
                this.seatForm.reserveSeat();

                //close this form
                this.Close();
            }//end outer if

            else
            {
                //if no index is selected, throw an error and return to the form
                MessageBox.Show("Please select a ticket type", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                //focus combo box
                cmboTixType.Focus();
            }//end else
        }