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); } }
public ActionResult Details(int id) { var result = Authenticate(); if (result == 1) { Seat seat = seatService.GetSeat(id); if (seat == null) { return(HttpNotFound()); } return(View(seat)); } else { return(View("Error404")); } }
private void ReserveTickets() { var selectedSeats = this._seatsSchema.GetSelectedSeats(); var holderId = Services.AuthenticationManager.GetCurrentUser().Id; for (int i = 0; i < selectedSeats.Count;) { while (RegularTicketsCount > 0) { var seat = seatService.GetSeat(_screening.AuditoriumId, (byte)selectedSeats[i].Number); ticketService.AddTicket(this._screening.Id, TicketType.Regular, seat.Id, holderId); RegularTicketsCount--; i++; } while (ChildrenTicketsCount > 0) { var seat = seatService.GetSeat(_screening.AuditoriumId, (byte)selectedSeats[i].Number); ticketService.AddTicket(this._screening.Id, TicketType.Children, seat.Id, holderId); ChildrenTicketsCount--; i++; } while (SeniorsTicketsCount > 0) { var seat = seatService.GetSeat(_screening.AuditoriumId, (byte)selectedSeats[i].Number); ticketService.AddTicket(this._screening.Id, TicketType.Seniors, seat.Id, holderId); SeniorsTicketsCount--; i++; } while (StudentsTicketsCount > 0) { var seat = seatService.GetSeat(_screening.AuditoriumId, (byte)selectedSeats[i].Number); ticketService.AddTicket(this._screening.Id, TicketType.Students, seat.Id, holderId); StudentsTicketsCount--; i++; } } }
public ActionResult CreateTicket(int showtimeId, int[] lstCheckedSeat) { var user = Session["Customer"] as Customer; if (ModelState.IsValid && user != null) { foreach (int item in lstCheckedSeat) { ticketService.Add(new Ticket { ShowtimeId = showtimeId, SeatId = item, Price = double.Parse(seatService.GetSeat(item).SeatType.Description), CustomerId = user.CustomerId, DateCreate = DateTime.Now }); } return(Json(new { Messenger = "Bạn đã đặt vé thành công!", Status = "success" }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { Messenger = "Đặt vé thất bại!", Status = "failed" }, JsonRequestBehavior.AllowGet)); } }