private void EditTicketButton_Click(object sender, EventArgs e) { try { int ticketId = ticket.Id; string date = dateComboBox.Text; string time = timeComboBox.Text; DateTime screeningDateTime = screeningService.GetDateTimeFromDateAndTime(date, time); string townName = townComboBox.Text; string cinemaName = cinemaComboBox.Text; string movieName = GetMovieName(movieComboBox.Text); int movieYear = GetMovieYear(movieComboBox.Text); Screening screening = screeningService.GetScreeningUsingMovieYear(townName, cinemaName, movieName, screeningDateTime, movieYear); int screeningId = screening.Id; int auditoriumId = screening.AuditoriumId; Seat seat = seatService.GetSeat(auditoriumId, byte.Parse(seatComboBox.Text)); int seatId = seat.Id; string type = typeComboBox.Text; TicketType ticketType = (TicketType)Enum.Parse(typeof(TicketType), type); ticketService.UpdateTicket(ticketId, screeningId, seatId, ticketType); MessageBox.Show(Constants.SuccessMessages.TicketUpdatedSuccessfully); EditUserTicketsForm ticketsForm = new EditUserTicketsForm(user); ticketsForm.TopLevel = false; ticketsForm.AutoScroll = true; this.Hide(); ((Button)sender).Parent.Parent.Controls.Add(ticketsForm); ticketsForm.Show(); } catch (Exception) { MessageBox.Show(Constants.ErrorMessages.TicketUpdateErrorMessage); } }
private void timeComboBox_SelectedIndexChanged(object sender, EventArgs e) { string movie = GetMovieName(movieComboBox.Text); int movieYear = GetMovieYear(movieComboBox.Text); string cinemaName = cinema.Name; string townName = cinema.Town.Name; DateTime date = ScreeningService.GetDateTimeFromDateAndTime(dateComboBox.Text, timeComboBox.Text); Screening screening = ScreeningService.GetScreeningUsingMovieYear(townName, cinemaName, movie, date, movieYear); EditScreening editScreeningForm = new EditScreening(screening); editScreeningForm.TopLevel = false; editScreeningForm.AutoScroll = true; this.Hide(); ((ComboBox)sender).Parent.Parent.Controls.Add(editScreeningForm); editScreeningForm.Show(); }