/// <summary> /// Takes the user to the ticketBookingform, and allows him/her to alter the booked tickets /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void changeButton_Click(object sender, EventArgs e) { TicketBookingForm ticketBookingForm = new TicketBookingForm(); ticketBookingForm.Customer = ActiveCustomer; ticketBookingForm.ReturnForm = this; ticketBookingForm.Movie = shows[showComboBox.SelectedIndex].Movie; //This checks startTime for the given show, and sets index in the ticketBookingForm to the right show if (shows[showComboBox.SelectedIndex].StartTime.Hour == 20) { ticketBookingForm.CurrentStartTimeIndex = 0; } else if (shows[showComboBox.SelectedIndex].StartTime.Hour == 22) { ticketBookingForm.CurrentStartTimeIndex = 1; } else if (shows[showComboBox.SelectedIndex].StartTime.Hour == 0) { ticketBookingForm.CurrentStartTimeIndex = 2; } else { ticketBookingForm.CurrentStartTimeIndex = 3; } ticketBookingForm.Show(); this.Enabled = false; }
/// <summary> /// When user clicks on one of the movie-posters, this method is called, which sends the user to a new form, where /// he or she can choose to book tickets for the given movie /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void movie_Click(object sender, EventArgs e) { PictureBox picBox = sender as PictureBox; string chosenMovie = picBox.Name; TicketBookingForm ticketBookingForm = new TicketBookingForm(); ticketBookingForm.Customer = ActiveCustomer; ticketBookingForm.ReturnForm = this; ticketBookingForm.Movie = (from movie in movies where movie.Name == chosenMovie select movie).FirstOrDefault(); ticketBookingForm.Show(); this.Enabled = false; }