Esempio n. 1
0
 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)
     {
         MessageBox.Show("Add screening failed!");
     }
 }
Esempio n. 2
0
        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!");
            }
        }
Esempio n. 3
0
        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();
        }
Esempio n. 4
0
        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();
            }
        }