//non-default constructor #1 for new show public frmSeatingChart(aShow show) { InitializeComponent(); //set current show CurrentShow = show; //since this is a new show, set the default night to night 1 CurrentNight = (Night)CurrentShow.htNights2Nights[1]; //clear save path this.Path = null; }
//non-default constructor #2 for existing show public frmSeatingChart(aShow show, string path) { InitializeComponent(); //set current show CurrentShow = show; //set current night CurrentNight = (Night)CurrentShow.htNights2Nights[1]; //assign path this.Path = path; }
//default constructor public aShow(int nights, string name) { //set the show's name this.ShowName = name; //initialize seat numbers seatNums = new SeatNumbers(); //initialize hashtable HtNights2Night = new Hashtable(nights); for (int i = 1; i <= nights; i++) { //create a night object for each desired night Night night = new Night(); night.night = i; //and add it to the hashtable HtNights2Night.Add(i, night); }//end for }
private NightlySum sumNight(Night nightTable) { //declare placeholders int tickets = 0; int adults = 0; int students = 0; int seniors = 0; int comps = 0; int parPass = 0; foreach (string key in SeatNumbers.seatNums) { //create a local object for each seat Seat seat = (Seat)nightTable.htSeats2Bits[key]; //no need to include it if it is not reserved if (seat.reserved == true) { //increment total tickets++; //increment each type if (seat.ticket.type == "Adult") { adults++; }//end if else if (seat.ticket.type == "Student") { students++; }//end if else if (seat.ticket.type == "Senior") { seniors++; }//end if else if (seat.ticket.type == "Comp") { comps++; }//end if else if (seat.ticket.type == "Parent Pass") { parPass++; }//end if }//end outer if }//end foreach //create a new object to hold the sum NightlySum sum = new NightlySum(tickets, adults, students, seniors, comps, parPass); //return that object return sum; }
public void updateNight(int night) { //change the current night this.CurrentNight = (Night)this.CurrentShow.htNights2Nights[night]; //update the text box txtCurrentNight.Text = Convert.ToString(night); //make sure not to set if there is only 1 Night if (this.currentShow.htNights2Nights.Count == 1) { //disable buttons if there is only one show btnPrevNight.Enabled = false; btnNextNight.Enabled = false; }//end else if //if the current Night is 1, assign val to prev and disable it else if (this.currentNight.night == 1) { btnPrevNight.Tag = 0; btnPrevNight.Enabled = false; if (CurrentShow.htNights2Nights.Count > 1) { btnNextNight.Enabled = true; btnNextNight.Tag = (this.CurrentNight.night + 1); }//end if }//end else if else if (this.CurrentNight.night > 1) { btnPrevNight.Enabled = true; btnPrevNight.Tag = (night - 1); btnNextNight.Enabled = true; btnNextNight.Tag = (night + 1); }//end else if if (this.CurrentNight.night < this.CurrentShow.htNights2Nights.Count) { btnPrevNight.Enabled = true; btnPrevNight.Tag = (night - 1); btnNextNight.Enabled = true; btnNextNight.Tag = (night + 1); }//end else if if (this.currentNight.night == this.CurrentShow.htNights2Nights.Count) { btnNextNight.Enabled = false; btnNextNight.Tag = (this.CurrentShow.htNights2Nights.Count + 1); btnPrevNight.Enabled = true; btnPrevNight.Tag = (this.CurrentNight.night - 1); }//end else if //reflect changes in the seating chart this.updateForm(); }