示例#1
0
        private void CheckScreeningAvailable()
        {
            if (movieComboBox.Text == "")
            {
                return;
            }
            if (auditoriumComboBox.Text == "")
            {
                return;
            }
            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);

            if (!screeningService.IsScreeningAvailableInAuditorium(auditoriumId, startTime, movieName, year))
            {
                ScreeningTaken.Visible = true;
                ScreeningTaken.Text    = "Screening is already taken!";
            }
            else
            {
                ScreeningTaken.Visible = false;
            }
        }
 public void ValidateScreeningTimeAvailable(DateTime startTime, int auditoriumId, string movieName, int movieYear)
 {
     if (!screeningService.IsScreeningAvailableInAuditorium(auditoriumId, startTime, movieName, movieYear))
     {
         throw new InvalidOperationException();
     }
 }