Ejemplo n.º 1
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);
     }
 }
Ejemplo n.º 2
0
        private void BackButton_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageBox.Show(Constants.WarningMessages.UnsavedChanges, Constants.GoBackPrompt, MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.Yes)
            {
                EditUserTicketsForm ticketsForm = new EditUserTicketsForm(user);
                ticketsForm.TopLevel   = false;
                ticketsForm.AutoScroll = true;
                this.Hide();
                ((Button)sender).Parent.Parent.Controls.Add(ticketsForm);
                ticketsForm.Show();
            }
        }
Ejemplo n.º 3
0
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageBox.Show(Constants.DeleteTicketMessage, Constants.TicketDeletePrompt, MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.Yes)
            {
                try
                {
                    ticketService.RemoveTicket(ticket.Id);
                    MessageBox.Show(Constants.SuccessMessages.TicketDeletedSuccessfully);
                    EditUserTicketsForm userTickets = new EditUserTicketsForm(user);
                    userTickets.TopLevel   = false;
                    userTickets.AutoScroll = true;
                    this.Hide();
                    ((Button)sender).Parent.Parent.Controls.Add(userTickets);
                    userTickets.Show();
                }
                catch (Exception)
                {
                    MessageBox.Show(Constants.ErrorMessages.TicketDeleteMessage);
                }
            }
        }