Exemplo n.º 1
0
        private void SaveUpdateValidate(Area area, ILayoutService ls, ISeatService ss)
        {
            var lsAll = ls.GetAll();
            var ssAll = ss.GetAll();
            var all   = GetAll();

            if (!(from x in lsAll
                  where x.Id == area.LayoutId
                  select x).Any())
            {
                throw new Exception("No such layout");
            }

            var areaLowerSet = from x in all
                               where x.LayoutId == area.LayoutId &&
                               (x.CoordX < area.CoordX ||
                                x.CoordY < area.CoordY)
                               select x;

            if (areaLowerSet.Any())
            {
                foreach (var v in areaLowerSet.ToList())
                {
                    var seatSet = from x in ssAll where x.AreaId == v.Id select x;
                    if (seatSet.Any())
                    {
                        if (v.CoordX + seatSet.Max(x => x.Row) > area.CoordX ||
                            v.CoordY + seatSet.Max(x => x.Number) > area.CoordY)
                        {
                            throw new Exception("Area coords out of range");
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
 public SeatController(IErrorService errorService, ICarService carService, IBookService bookService, ISeatService seatService, ISeatNoService seatnoService)
     : base(errorService)
 {
     this._seatService   = seatService;
     this._seatnoService = seatnoService;
     this._bookService   = bookService;
 }
Exemplo n.º 3
0
 public CinemaService(DB_Context context, IUserService usService, ISeatService stService)
 {
     unitOfWork  = new UnitOfWork(context);
     userService = usService;
     seatService = stService;
     // userService.id_owner = 1;
 }
Exemplo n.º 4
0
        public SeatController()
        {
            var dbFactory = new DatabaseFactory();

            this.seatRepository = new Repository <Domain.Seat>(dbFactory);
            this.unitOfWork     = new UnitOfWork(dbFactory);
            this.seatService    = new SeatService(dbFactory);
        }
Exemplo n.º 5
0
        public PaymentPresenter(IFilmScreeningService screeningService, ISeatService seatService)
        {
            Guard.WhenArgument(screeningService, "screeningService").IsNull().Throw();
            Guard.WhenArgument(seatService, "seatService").IsNull().Throw();

            this.screeningService = screeningService;
            this.seatService      = seatService;
        }
Exemplo n.º 6
0
 public VenueModelsController(IVenueService venueService, ISeatService seatService,
                              ITMLayoutService tmlayoutService, IAreaService areaService)
 {
     _venueService    = venueService;
     _seatService     = seatService;
     _tmlayoutService = tmlayoutService;
     _areaService     = areaService;
 }
Exemplo n.º 7
0
 public VenueService(IVenueRepository venueRepository, ITMLayoutService tmlayoutService,
                     IAreaService areaService, ISeatService seatService)
 {
     _venueRepository = venueRepository;
     _tmlayoutService = tmlayoutService;
     _areaService     = areaService;
     _seatService     = seatService;
 }
Exemplo n.º 8
0
 public CinemaController(IBookingService bookingService,
                         ICinemaShowService cinemaShowService,
                         ISeatService seatService)
 {
     _bookingService    = bookingService;
     _cinemaShowService = cinemaShowService;
     _seatService       = seatService;
 }
Exemplo n.º 9
0
 public SessionController(ISeatService seatService,
                          ISelectSeatTaskService selectSeatTaskService,
                          ISessionService sessionService)
 {
     this._seatService           = seatService;
     this._selectSeatTaskService = selectSeatTaskService;
     this._sessionService        = sessionService;
 }
Exemplo n.º 10
0
 public CarController(IErrorService errorService, ICarService carService, ITypeCarService typecarService, ISeatService seatService, ISeatNoService seatnoService)
     : base(errorService)
 {
     this._carService     = carService;
     this._typecarService = typecarService;
     this._seatService    = seatService;
     this._seatnoService  = seatnoService;
 }
Exemplo n.º 11
0
 public DisplayController(IBallot ballot, ISeatService seatService, IMember member, ICouncilSession session, IVote vote)
 {
     _ballot      = ballot;
     _member      = member;
     _session     = session;
     _vote        = vote;
     _seatService = seatService;
 }
        public MainWindowViewModel(ITrainService trainService, ICarriageService carriageService, ITicketService ticketService, ISeatService seatService)
        {
            _trainService    = trainService;
            _carriageService = carriageService;
            _ticketService   = ticketService;
            _seatService     = seatService;

            Date = DateTime.Today;
        }
Exemplo n.º 13
0
 public TicketController(ITicketService ticketService, IMapper mapper, IUserService userService, ISeatService seatService, IBusService busService, AppDbContext context)
 {
     _mapper        = mapper;
     _context       = context;
     _ticketService = ticketService;
     _userService   = userService;
     _seatService   = seatService;
     _busService    = busService;
 }
Exemplo n.º 14
0
 public StationViewModel()
 {
     stationService          = new StationService();
     trainService            = new TrainService();
     vanService              = new VanService();
     seatService             = new SeatService();
     passangerService        = new PassangerService();
     classProperetiesService = new ClassProperetiesService();
     ticketService           = new TicketService();
 }
Exemplo n.º 15
0
        public void ThrowWnehSeatServiceHasNullValue()
        {
            var          mockedScreeningService = new Mock <IFilmScreeningService>();
            ISeatService nullSeatService        = null;

            Assert.That(
                () => new Presenters.PaymentPresenters.PaymentPresenter(
                    mockedScreeningService.Object,
                    nullSeatService),
                Throws.InstanceOf <ArgumentNullException>());
        }
Exemplo n.º 16
0
        public MoviesController(ILogger <MoviesController> logger, IMovieService movieService, IProjectionService projectionService, ITagService tagService, ISeatService seatService)

        {
            _logger            = logger;
            _movieService      = movieService;
            _projectionService = projectionService;

            _seatService = seatService;

            _tagService = tagService;
        }
Exemplo n.º 17
0
 public VenueService(IRepository <Venue> repo,
                     IRepository <Address> addressRepo,
                     ISeatRepository seatRepo,
                     IRepository <Performance> performanceRepo,
                     ISeatService _seatService)
 {
     _repository            = repo;
     _addressRepository     = addressRepo;
     _seatRepository        = seatRepo;
     _performanceRepository = performanceRepo;
     seatService            = _seatService;
 }
Exemplo n.º 18
0
 public SessionController(ISessionService sessionService,
                          IDivisionService divisionService,
                          HallService hallService, CinemaService cinemaService, IActivityService activityService,
                          ISelectSeatTaskService selectSeatTaskService, ISeatService seatService)
 {
     this._sessionService        = sessionService;
     this._divisionService       = divisionService;
     this._hallService           = hallService;
     this._cinemaService         = cinemaService;
     this._activityService       = activityService;
     this._selectSeatTaskService = selectSeatTaskService;
     this._seatService           = seatService;
 }
Exemplo n.º 19
0
 public ServiceManager(CQRSContext cQRSContext, ITravelerService travelerService,
                       IBookingService bookingService,
                       ISeatService seatService,
                       IPlaneService planeService,
                       IFlightService flightService,
                       IEventService eventService)
 {
     _cQRSContext    = cQRSContext;
     _travelService  = travelerService;
     _bookingService = bookingService;
     _seatService    = seatService;
     _planeService   = planeService;
     _flightService  = flightService;
     _eventService   = eventService;
 }
Exemplo n.º 20
0
 public PerformanceService(IRepository <Performance> repository,
                           IRepository <Performer> performerRepository,
                           IReservationRepository reservationRepository,
                           ISeatRepository seatRepository,
                           IRepository <Venue> venueRepository,
                           ISeatService _seatService,
                           IReservationService _reservationService)
 {
     _repository            = repository;
     _performerRepository   = performerRepository;
     _seatRepository        = seatRepository;
     _reservationRepository = reservationRepository;
     _venueRepository       = venueRepository;
     seatService            = _seatService;
     reservationService     = _reservationService;
 }
Exemplo n.º 21
0
        public HomeController(ILogger <HomeController> logger, IMemberRegister memberRegister, ICouncilSession session, IBallot ballot, IMember member, IVote vote, ISeatService seatService, IConfiguration configuration)
        {
            _configuration  = configuration;
            _memberRegister = memberRegister;
            _session        = session;
            _ballot         = ballot;
            _member         = member;
            _vote           = vote;
            _logger         = logger;
            _seatService    = seatService;

            model = new HomeIndexViewModel
            {
                Session = _session.GetActiveSession(),
                Ballot  = _ballot.GetActiveOrLast()
            };
        }
        public void Should_return_reservation_valid_when_ticket_office_make_reservation_request_for_one_seat()
        {
            string       trainId     = "train1";
            ISeatService seatService = Substitute.For <ISeatService>();

            seatService.GetAvailableSeats(trainId).Returns(new List <Seat>()
            {
                new Seat(new Coach("01"), 1), new Seat(new Coach("01"), 2)
            });
            IBookingService bookingService = Substitute.For <IBookingService>();

            bookingService.GetBookingId().Returns("RES1");
            var reservationRequest = new ReservationRequest(trainId, 1);

            var makeReservation = new TicketOffice(seatService, bookingService).MakeReservation(reservationRequest);

            Check.That(reservationRequest.TrainId).IsEqualTo(makeReservation.TrainId);
            Check.That(makeReservation.Seats.Count).IsEqualTo(reservationRequest.SeatCount);
        }
        public void Should_not_reserve_when_seat_count_of_reservation_is_greather_than_available_seats()
        {
            string       trainId     = "train1";
            ISeatService seatService = Substitute.For <ISeatService>();

            seatService.GetAvailableSeats(trainId).Returns(
                new List <Seat>()
            {
                new Seat(new Coach("01"), 1), new Seat(new Coach("01"), 2)
            });
            IBookingService bookingService = Substitute.For <IBookingService>();

            bookingService.GetBookingId().Returns("RES1");
            var reservationRequest = new ReservationRequest(trainId, 5);

            var makeReservation = new TicketOffice(seatService, bookingService).MakeReservation(reservationRequest);

            Check.That(makeReservation).IsNull();
        }
Exemplo n.º 24
0
        public bool Update(Area area, ILayoutService ls, ISeatService ss)
        {
            var all = GetAll();

            if (Get(area.Id).Description != area.Description ||
                Get(area.Id).LayoutId != area.LayoutId)
            {
                if ((from x in all
                     where x.LayoutId == area.LayoutId &&
                     x.Description == area.Description
                     select x).Any())
                {
                    throw new Exception("Area with such description already exists");
                }
            }

            if (Get(area.Id).CoordX != area.CoordX ||
                Get(area.Id).LayoutId != area.LayoutId)
            {
                if ((from x in all
                     where x.LayoutId == area.LayoutId &&
                     (x.CoordX == area.CoordX)
                     select x).Any())
                {
                    throw new Exception("Area with such coords already exists");
                }
            }

            if (Get(area.Id).CoordY != area.CoordY ||
                Get(area.Id).LayoutId != area.LayoutId)
            {
                if ((from x in all
                     where x.LayoutId == area.LayoutId &&
                     (x.CoordY == area.CoordY)
                     select x).Any())
                {
                    throw new Exception("Area with such coords already exists");
                }
            }

            SaveUpdateValidate(area, ls, ss);
            return(Repository.Update(area));
        }
        public void Should_not_return_reservation_of_train_if_seat_count_greater_than_70_percent_seat_train_count()
        {
            string       trainId     = "train1";
            ISeatService seatService = Substitute.For <ISeatService>();

            seatService.GetAvailableSeats(trainId).Returns(
                new List <Seat>()
            {
                new Seat(new Coach("01"), 1), new Seat(new Coach("01"), 2)
                , new Seat(new Coach("01"), 3), new Seat(new Coach("01"), 4), new Seat(new Coach("01"), 5), new Seat(new Coach("01"), 6)
                , new Seat(new Coach("01"), 7), new Seat(new Coach("01"), 8), new Seat(new Coach("01"), 9), new Seat(new Coach("01"), 10)
            });
            IBookingService bookingService = Substitute.For <IBookingService>();

            bookingService.GetBookingId().Returns("RES1");
            var reservationRequest = new ReservationRequest(trainId, 8);

            var makeReservation = new TicketOffice(seatService, bookingService).MakeReservation(reservationRequest);

            Check.That(makeReservation).IsNull();
        }
Exemplo n.º 26
0
        public AdminController(ILogger <AdminController> logger, ICouncilSession session, IBallot ballot,
                               IMember member, IMemberRegister memberRegister, IConfiguration configuration,
                               IHostingEnvironment hostingEnvironment, ISeatService seatService)
        {
            _logger  = logger;
            _session = session;
            _ballot  = ballot;
            _member  = member;

            _memberRegister = memberRegister;
            _seatService    = seatService;

            _configuration = configuration;
            _env           = hostingEnvironment;

            model = new AdminIndexViewModel
            {
                ActiveOrLastBallot = _ballot.GetActiveOrLast(),
                Members            = _member.GetAllMembers(true),
                CouncilSession     = _session.GetActiveSession(),
                Register           = _memberRegister.GetStatusAllMember(),
                BallotsThisSession = _ballot.GetBallotsThisSession(_session.GetActiveSession())
            };
        }
Exemplo n.º 27
0
 public TicketOffice(ISeatService seatService, IBookingService bookingService)
 {
     _seatService    = seatService;
     _bookingService = bookingService;
 }
 public SeatController(ISeatService seatService)
 {
     _seatService = seatService;
 }
Exemplo n.º 29
0
 public SeatsController(ISeatService seatService, IReservationService reservationService)
 {
     _seatService        = seatService;
     _reservationService = reservationService;
 }
 public SeatController(ISeatService ser)
 {
     service = ser;
 }