private void BackButton_Click(object sender, EventArgs e) { Cinema cinemaWithScreenings = cinemaService.GetCinemaWithScreenings(cinema.Id); SelectScreeningForm screeningsForm = new SelectScreeningForm(cinemaWithScreenings); screeningsForm.TopLevel = false; screeningsForm.AutoScroll = true; this.Hide(); ((Button)sender).Parent.Parent.Controls.Add(screeningsForm); screeningsForm.Show(); }
private void BackButton_Click(object sender, EventArgs e) { DialogResult dialogResult = MessageBox.Show(Constants.WarningMessages.UnsavedChanges, Constants.GoBackPrompt, MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { Cinema cinema = cinemaService.GetCinemaWithScreenings(screening.Auditorium.CinemaId); SelectScreeningForm screeningsForm = new SelectScreeningForm(cinema); screeningsForm.TopLevel = false; screeningsForm.AutoScroll = true; this.Hide(); ((Button)sender).Parent.Parent.Controls.Add(screeningsForm); screeningsForm.Show(); } }
private void AddScreeningButton_Click(object sender, EventArgs e) { try { string movieName = GetMovieName(movieComboBox.Text); int year = GetMovieYear(movieComboBox.Text); DateTime getDate = DateCalendar.SelectionRange.Start; string date = getDate.Day.ToString() + " " + getDate.ToString("MMM") + " " + getDate.DayOfWeek.ToString(); DateTime getTime = TimePicker.Value; string time = getTime.ToString("hh") + ":" + getTime.ToString("mm") + " " + getTime.ToString("tt", CultureInfo.InvariantCulture); DateTime startTime = ScreeningService.GetDateTimeFromDateAndTime(date, time); byte auditoriumNumber = byte.Parse(auditoriumComboBox.Text); int auditoriumId = AuditoriumService.GetAuditoriumId(auditoriumNumber, this.cinema.Id); int movieId = MovieService.GetMovieId(movieName, year); ScreeningValidator.ValidateScreeningTimeAvailable(startTime, auditoriumId, movieName, year); ScreeningService.AddScreening(auditoriumId, movieId, startTime); MessageBox.Show("Screening added successfully!"); Cinema cinema = CinemaService.GetCinemaWithScreenings(this.cinema.Id); SelectScreeningForm screeningsForm = new SelectScreeningForm(cinema); screeningsForm.TopLevel = false; screeningsForm.AutoScroll = true; this.Hide(); ((Button)sender).Parent.Parent.Controls.Add(screeningsForm); screeningsForm.Show(); } catch (Exception exception) { MessageBox.Show("Add screening failed!"); } }
private void EditScreeningButton_Click(object sender, EventArgs e) { try { DateTime getDate = DateCalendar.SelectionRange.Start; string date = getDate.Day.ToString() + " " + getDate.ToString("MMM") + " " + getDate.DayOfWeek.ToString(); DateTime getTime = TimePicker.Value; string time = getTime.ToString("hh") + ":" + getTime.ToString("mm") + " " + getTime.ToString("tt", CultureInfo.InvariantCulture); DateTime startTime = ScreeningService.GetDateTimeFromDateAndTime(date, time); ScreeningValidator.ValidateScreeningAvailable(screening.Id, startTime); ScreeningService.UpdateScreening(screening.Id, startTime); MessageBox.Show("Screening updated successfully!"); Cinema cinema = CinemaService.GetCinemaWithScreenings(screening.Auditorium.CinemaId); SelectScreeningForm screeningsForm = new SelectScreeningForm(cinema); screeningsForm.TopLevel = false; screeningsForm.AutoScroll = true; this.Hide(); ((Button)sender).Parent.Parent.Controls.Add(screeningsForm); screeningsForm.Show(); } catch (Exception exception) { MessageBox.Show("Screening updated failed!"); } }