Exemple #1
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!");
            }
        }