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 exception) { MessageBox.Show(Constants.ErrorMessages.TicketUpdateErrorMessage); } }
public KhachHangController() { customerService = new CustomerService(); ticketService = new TicketService(); showtimeService = new ShowtimeService(); seatService = new SeatService(); }
public void SeatService_deleteByAuditoriumId_SeatsRepository_DeleteByAuditoriumId_ReturnsNull_ReturnsNull() { //Arrange List <Seat> seatsModelsList = new List <Seat>(); seatsModelsList.Add(_seat); IEnumerable <Seat> seats = seatsModelsList; List <ReservationDomainModel> reservationDomainModelsList = new List <ReservationDomainModel>(); reservationDomainModelsList.Add(_reservationDomainModel); IEnumerable <ReservationDomainModel> reservations = reservationDomainModelsList; Task <IEnumerable <ReservationDomainModel> > reservationResponseTask = Task.FromResult(reservations); IEnumerable <Seat> nullList = null; Task <IEnumerable <Seat> > nullSeats = Task.FromResult(nullList); _mockSeatsRepository.Setup(x => x.GetByAuditoriumId(It.IsAny <int>())).Returns(seats); _mockReservationService.Setup(x => x.DeleteBySeatId(It.IsAny <Guid>())).Returns(reservationResponseTask); _mockSeatsRepository.Setup(x => x.DeleteByAuditoriumId(It.IsAny <int>())).Returns(nullSeats); SeatService seatService = new SeatService(_mockSeatsRepository.Object, _mockReservationService.Object); //Act var result = seatService.DeleteByAuditoriumId(_seat.AuditoriumId).ConfigureAwait(false).GetAwaiter().GetResult(); //Assert Assert.IsNull(result); }
public static void ValidateSeatDoesntExist(int seatNumber, int auditoriumId, int auditoriumNumber) { if (SeatService.IsSeatExisting(seatNumber, auditoriumId)) { throw new InvalidOperationException(string.Format(Constants.ErrorMessages.SeatAlreadyExists, seatNumber, auditoriumNumber)); } }
public BookingController() { seatService = new SeatService(); showtimeService = new ShowtimeService(); ticketService = new TicketService(); roomService = new RoomService(); }
public JsonResult ResellTicket(string ticketId, string buyerEmail, string sellerEmail) { Ticket ticket = new TicketService().FindByID(Convert.ToInt32(ticketId)); ticket.ticketStatus = TicketStatus.reselled; string newCode = ticket.ticketId + RandomUtility.RandomString(9); string content = "Chúc mừng quý khách đã mua lại vé thành công!"; content += "Bạn đã mua lại 1 vé của " + buyerEmail + "\n"; Seat seat = new SeatService().FindByID(ticket.seatId); Room room = new RoomService().FindByID(seat.roomId); Cinema cinema = new CinemaService().FindByID(room.cinemaId); MovieSchedule schedule = new MovieScheduleService().FindByID(ticket.scheduleId); Film film = new FilmService().FindByID(schedule.filmId); content += "Tại " + cinema.cinemaName + "\n"; content += "Mã vẽ mới của bạn là " + newCode + "\n"; content += "Phim " + film.name + "\n"; content += ". Ghế: " + ConstantArray.Alphabet[(int)seat.py] + "" + ((int)seat.px + 1) + "- Mã vé: " + newCode + "\n"; string mailSubject = "CinemaBookingTicket - Mua lại vé thành công " + cinema.cinemaName; MailUtility.SendEmail(mailSubject, content, buyerEmail); new TicketService().Update(ticket); var aObj = new { status = ticket.ticketStatus, statusvn = TicketStatus.ViStatus[ticket.ticketStatus] }; return(Json(aObj)); }
private static void ImportSeat(SeatDto seatDto) { string cinemaTown = seatDto.CinemaTown; TownValidator.CheckTownExisting(cinemaTown); int townId = TownService.GetTownId(cinemaTown); string cinemaName = seatDto.CinemaName; CinemaValidator.CheckCinemaExisting(cinemaName, townId); int cinemaId = CinemaService.GetCinemaId(cinemaName, townId); byte auditoriumNumber = seatDto.AuditoriumNumber; AuditoriumValidator.CheckAuditoriumExists(auditoriumNumber, cinemaId, cinemaName); int auditoriumId = AuditoriumService.GetAuditoriumId(auditoriumNumber, cinemaId); int row = seatDto.Row; int number = seatDto.Number; SeatValidator.ValidateSeatDoesntExist(number, auditoriumId, auditoriumNumber); SeatService.AddSeat(number, row, auditoriumId); Console.WriteLine(string.Format(Constants.ImportSuccessMessages.SeatAddedSuccess, number, auditoriumNumber, cinemaName, cinemaTown)); }
public TicketController() { ticketService = new TicketService(); showtimeService = new ShowtimeService(); seatService = new SeatService(); customerService = new CustomerService(); }
public PhimController() { filmService = new FilmService(); showtimeService = new ShowtimeService(); cinemaService = new CinemaService(); seatService = new SeatService(); ticketService = new TicketService(); }
public FlightController(FlightService flightService, AvioService avioService, UserService userService, AeroplaneService aeroplaneService, SeatService seatService) { FlightService = flightService; AvioService = avioService; UserService = userService; AeroplaneService = aeroplaneService; SeatService = seatService; }
public LichChieuController() { filmService = new FilmService(); showtimeService = new ShowtimeService(); roomService = new RoomService(); seatService = new SeatService(); cinemaService = new CinemaService(); ticketService = new TicketService(); }
private void typeComboBox_SelectedIndexChanged(object sender, EventArgs e) { this.seatComboBox.Items.Clear(); this.seatComboBox.Items.Add(ticket.Seat.Number.ToString()); string[] freeSeats = SeatService.GetFreeSeatsForScreening(ticket.ScreeningId, ticket.Screening.AuditoriumId) .Select(n => n.ToString()) .ToArray(); this.seatComboBox.Items.AddRange(freeSeats); }
public HomeController() { filmService = new FilmService(); showtimeService = new ShowtimeService(); roomService = new RoomService(); seatService = new SeatService(); cinemaService = new CinemaService(); ticketService = new TicketService(); newService = new NewService(); }
public DataProvider(TicketManagementContext context) { Context = context; VenueManager = new VenueService(new EntityVenueRepository(context)); LayoutManager = new LayoutService(new EntityLayoutRepository(context)); AreaManager = new AreaService(new EntityAreaRepository(context)); SeatManager = new SeatService(new EntitySeatRepository(context)); EventManager = new EventService(new EntityEventRepository(context), new EntityProcedureManager(context)); EventSeatService = new EventSeatService(new EntityEventSeatRepository(context)); EventAreaService = new EventAreaService(new EntityEventAreaRepository(context)); }
public void SeatService_AddSeat_ThrowsDbUpdateException() { //Arrange SeatService seatService = new SeatService(_mockSeatsRepository.Object, _mockReservationService.Object); _mockSeatsRepository.Setup(x => x.Insert(It.IsAny <Seat>())).Throws(new DbUpdateException()); //Act var result = seatService.AddSeat(_seatDomainModel).ConfigureAwait(false).GetAwaiter().GetResult(); }
public SeatImportService() { this.auditoriumService = new AuditoriumService(); this.cinemaService = new CinemaService(); this.auditoriumValidator = new AuditoriumValidator(auditoriumService); this.cinemaValidator = new CinemaValidator(cinemaService); this.townService = new TownService(); this.townValidator = new TownValidator(townService); this.seatService = new SeatService(); this.seatValidator = new SeatValidator(seatService); }
public void TestInitialize() { _mockSeatRepository = new Mock <ISeatsRepository>(); _seatService = new SeatService(_mockSeatRepository.Object); _seat = new Seat { Id = 1, Number = 1, Row = 1, AuditoriumId = 5 }; }
public DataProvider() { VenueManager = new VenueService(new FakeVenueRepo()); LayoutManager = new LayoutService(new FakeLayoutRepo()); AreaManager = new AreaService(new FakeAreaRepo()); SeatManager = new SeatService(new FakeSeatRepo()); var eventRepo = new FakeEventRepo(); EventManager = new EventService(eventRepo, new FakePropcedureManager(eventRepo)); EventAreaService = new EventAreaService(new FakeEventAreaRepo()); EventSeatService = new EventSeatService(new FakeEventSeatRepo()); }
public EditTicketForm(User user, Ticket ticket) { this.user = user; this.ticket = ticket; this.townService = new TownService(); this.cinemaService = new CinemaService(); this.ticketService = new TicketService(); this.movieService = new MovieService(); this.screeningService = new ScreeningService(); this.seatService = new SeatService(); InitializeComponent(); }
public SystemController(UserManager <RegularUser> userManager, UserService userService, AvioService avioService, RentACarService rentACarService, AvioAdminService avioAdminService, CarAdminService carAdminService, AeroplaneService aeroplaneService, SeatService seatService) { UserManager = userManager; UserService = userService; AvioService = avioService; RentACarService = rentACarService; AvioAdminService = avioAdminService; CarAdminService = carAdminService; AeroplaneService = aeroplaneService; SeatService = seatService; }
public SelectSeatsForm(Screening screening, int seatCount, int regularTckets, int childrenTickets, int seniorTickets, int studentTickets) { this.ticketService = new TicketService(); this.seatService = new SeatService(); this.RegularTicketsCount = regularTckets; this.ChildrenTicketsCount = childrenTickets; this.StudentsTicketsCount = studentTickets; this.SeniorsTicketsCount = seniorTickets; this._screening = screening; this._seatCount = seatCount; InitializeComponent(); }
public void SeatService_DeleteByAuditoriumId_SeatsRepository_GetByAuditoriumId_ReturnsNull_ReturnsNull() { //Arrange IEnumerable <Seat> seats = null; SeatService seatService = new SeatService(_mockSeatsRepository.Object, _mockReservationService.Object); _mockSeatsRepository.Setup(x => x.GetByAuditoriumId(It.IsAny <int>())).Returns(seats); //Act var result = seatService.DeleteByAuditoriumId(_seat.AuditoriumId).ConfigureAwait(false).GetAwaiter().GetResult(); //Assert Assert.IsNull(result); }
public void SeatService_DeleteSeat_SeatRepositoryReturnsNull_ReturnsNull() { //Arrange Seat nullSeat = null; SeatService seatService = new SeatService(_mockSeatsRepository.Object, _mockReservationService.Object); _mockSeatsRepository.Setup(x => x.Delete(It.IsAny <Guid>())).Returns(nullSeat); //Act var result = seatService.DeleteSeat(_seat.Id).ConfigureAwait(false).GetAwaiter().GetResult(); //Assert Assert.IsNull(result); }
public JsonResult GetTicketListBelongToMail(string confirmCode, string email) { if (confirmCode.Equals("123456")) { List <object> objectList = new List <object>(); List <Ticket> ticketList = new TicketService().getTicketByEmail(email); foreach (var item in ticketList) { MovieSchedule schedule = new MovieScheduleService().FindByID(item.scheduleId); Room room = new RoomService().FindByID(schedule.roomId); Seat seat = new SeatService().FindByID(item.seatId); string startTime = new ShowTimeService().FindByID(schedule.timeId).startTime; string filmName = new FilmService().FindByID(schedule.filmId).name; string cinemaName = new CinemaService().FindByID(room.cinemaId).cinemaName; string roomName = room.name; int seatId = seat.seatId; string seatName = ConstantArray.Alphabet[(int)seat.py] + "" + ((int)seat.px + 1); string date = String.Format("{0:dd/MM/yyyy}", schedule.scheduleDate); var aObj = new { ticketId = item.ticketId, bookingId = item.bookingId, scheduleId = item.scheduleId, seatId = seatId, filmName = filmName, cinemaNames = cinemaName.Split('-'), roomName = roomName, seatName = seatName, date = date, startTime = startTime, status = item.ticketStatus, statusvn = TicketStatus.ViStatus[item.ticketStatus], }; objectList.Add(aObj); } var returnObj = from s in objectList select s; return(Json(returnObj)); } else { var aObj = new { isWrong = "true" }; return(Json(aObj)); } }
public void SeatService_GetNumberOfSeats_RepositoryReturnsNull_ReturnsNull() { //Arrange List <int> numberOfSeats = null; SeatService seatService = new SeatService(_mockSeatsRepository.Object, _mockReservationService.Object); _mockSeatsRepository.Setup(x => x.GetMaxValuesByAuditoriumId(It.IsAny <int>())).Returns(numberOfSeats); //Act var result = seatService.GetNumberOfSeats(_seat.AuditoriumId).ConfigureAwait(false).GetAwaiter().GetResult(); //Assert Assert.IsNull(result); }
public void SeatService_GetSeatByAuditoriumIdRowSeatNum_RepositoryReturnsNull() { //Arrange Seat nullSeat = null; Task <Seat> seat = Task.FromResult(nullSeat); SeatService seatService = new SeatService(_mockSeatsRepository.Object, _mockReservationService.Object); _mockSeatsRepository.Setup(x => x.GetByAuditoriumIdRowColumn(It.IsAny <int>(), It.IsAny <int>(), It.IsAny <int>())).Returns(seat); //Act var result = seatService.GetSeatByAuditoriumIdRowSeatnum(_seat.AuditoriumId, _seat.Row, _seat.Number).ConfigureAwait(false).GetAwaiter().GetResult(); //Assert Assert.IsNull(result); }
public void SeatService_AddSeat_RepositoryReturnsNull_ReturnsNull() { //Arrange Seat nullSeat = null; SeatService seatService = new SeatService(_mockSeatsRepository.Object, _mockReservationService.Object); _mockSeatsRepository.Setup(x => x.Insert(It.IsAny <Seat>())).Returns(nullSeat); //Act var result = seatService.AddSeat(_seatDomainModel).ConfigureAwait(false).GetAwaiter().GetResult(); //Assert Assert.IsNull(result); }
public void GivenCinemaShowWithoutAvailableSeats_WhenGetAvailableSeats_ShouldReturnNull() { // ARRANGE var cinemaShow = _fixture.Create <CinemaShowDTO>(); _cinemaShowRepositoryMock.Setup(r => r.GetCinemaShow(It.IsAny <string>())).Returns(cinemaShow); _seatRepositoryMock.Setup(s => s.GetAvailableSeats(cinemaShow.Id)).Returns(() => null); // ACT var seatService = new SeatService(_seatRepositoryMock.Object, _cinemaShowRepositoryMock.Object, _mapperMock.Object); var response = seatService.GetAvailableSeats(cinemaShow.Name); // ASSERT response.Should().BeNull(); }
public void SeatService_GetSeatByAuditoriumIdRowSeatNum_ReturnsSeat() { //Arrange Task <Seat> seat = Task.FromResult(_seat); SeatService seatService = new SeatService(_mockSeatsRepository.Object, _mockReservationService.Object); _mockSeatsRepository.Setup(x => x.GetByAuditoriumIdRowColumn(It.IsAny <int>(), It.IsAny <int>(), It.IsAny <int>())).Returns(seat); // Act var result = seatService.GetSeatByAuditoriumIdRowSeatnum(_seat.AuditoriumId, _seat.Row, _seat.Number).ConfigureAwait(false).GetAwaiter().GetResult(); // Assert Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(SeatDomainModel)); Assert.AreEqual(result.Id, _seat.Id); }
public void SeatService_DeleteSeat_ReturnsDeletedSeat() { //Arrange SeatService seatService = new SeatService(_mockSeatsRepository.Object, _mockReservationService.Object); _mockSeatsRepository.Setup(x => x.Delete(It.IsAny <Guid>())).Returns(_seat); //Act var result = seatService.DeleteSeat(_seat.Id).ConfigureAwait(false).GetAwaiter().GetResult(); //Assert Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(SeatDomainModel)); Assert.AreEqual(result.Id, _seat.Id); }