Пример #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)
            {
                MessageBox.Show("Screening updated failed!");
            }
        }
Пример #2
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!");
     }
 }
Пример #3
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;
            }
        }
Пример #4
0
 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);
     }
 }
Пример #5
0
        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();
        }
Пример #6
0
        private void ticketsButton_Click(object sender, EventArgs e)
        {
            string selectedDate = this.dateBox.SelectedItem.ToString();
            string selectedTime = this.hourBox.SelectedItem.ToString();

            DateTime screeningDate = screeningService.GetDateTimeFromDateAndTime(selectedDate, selectedTime);

            TicketForm.Screening = screeningService.GetScreening(this._townName, this._cinemaName, this._movieName, screeningDate);

            TicketTypeForm ticketTypeForm = new TicketTypeForm();

            ticketTypeForm.TopLevel   = false;
            ticketTypeForm.AutoScroll = true;
            this.Parent.Controls.Add(ticketTypeForm);
            ticketTypeForm.Show();
            this.Hide();
        }
Пример #7
0
        private void CheckScreening()
        {
            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);

            if (!ScreeningService.IsScreeningAvailable(screening.Id, startTime))
            {
                ScreeningTaken.Visible = true;
                ScreeningTaken.Text    = "Screening is already taken!";
            }
            else
            {
                ScreeningTaken.Visible = false;
            }
        }
Пример #8
0
        private void selectTicketTypeButton_Click(object sender, EventArgs e)
        {
            var dateTime = screeningService.GetDateTimeFromDateAndTime(_date, _time);

            TicketForm.Screening = screeningService.GetScreening(this._townName, this._cinemaName, this._movieName,
                                                                 dateTime);
            TicketTypeForm ticketTypeForm = new TicketTypeForm();

            ticketTypeForm.TopLevel   = false;
            ticketTypeForm.AutoScroll = true;
            this.Hide();
            var contentHolder = ((Button)sender).Parent.Parent;
            var formsCount    = contentHolder.Controls.Count;

            if (formsCount - 1 <= contentHolder.Controls.IndexOf(this))
            {
                contentHolder.Controls.Add(ticketTypeForm);
                ticketTypeForm.Show();
            }
            else
            {
                contentHolder.Controls[contentHolder.Controls.IndexOf(this) + 1].Show();
            }
        }