コード例 #1
0
        /// <summary>
        /// Dependency-injected application settings which are then passed on to other components.
        /// </summary>
        public TransitApiController(IApplicationEnvironment appEnv)
        {
            _repository = new MemoryTransitRepository(appEnv.ApplicationBasePath);
            _client = new TransitClient();

            _getCurrentTime = () => TimeZoneInfo.ConvertTime(DateTimeOffset.Now, TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time"));
        }
コード例 #2
0
        /// <summary>
        /// Dependency-injected application settings which are then passed on to other components.
        /// </summary>
        public TransitApiController(IApplicationEnvironment appEnv)
        {
            _repository = new MemoryTransitRepository(appEnv.ApplicationBasePath);
            _client     = new TransitClient();

            _getCurrentTime = () => TimeZoneInfo.ConvertTime(DateTimeOffset.Now, TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time"));
        }
コード例 #3
0
 public TransitController(IMailService mailService, ITransitRepository repository, IMapper mapper, UserManager <StoreUser> userManager, IHostingEnvironment hostingEnvironment)
 {
     _mailService        = mailService;
     _repository         = repository;
     _mapper             = mapper;
     _userManager        = userManager;
     _hostingEnvironment = hostingEnvironment;
 }
コード例 #4
0
ファイル: TransitController.cs プロジェクト: UHgEHEP/test
		public TransitController(
			IIdentityService identity,
			ICityRepository cities,
			ITransitRepository transits)
		{
			_identity = identity;
			_cities = cities;
			_transits = transits;
		}
コード例 #5
0
 public TransitController(
     IIdentityService identity,
     ICityRepository cities,
     ITransitRepository transits)
 {
     _identity = identity;
     _cities   = cities;
     _transits = transits;
 }
コード例 #6
0
        public void TestInitialize()
        {
            _context = new CompositionHelper(Settings.Default.MainConnectionString, Settings.Default.FilesConnectionString);
            _fixture = new Fixture();

            _manager           = _context.Kernel.Get <IClientManager>();
            _userRepository    = _context.Kernel.Get <IUserRepository>();
            _clientRepository  = _context.Kernel.Get <IClientRepository>();
            _transitRepository = _context.Kernel.Get <ITransitRepository>();
        }
コード例 #7
0
ファイル: ClientManagerTests.cs プロジェクト: UHgEHEP/test
		public void TestInitialize()
		{
			_context = new CompositionHelper(Settings.Default.MainConnectionString, Settings.Default.FilesConnectionString);
			_fixture = new Fixture();

			_manager = _context.Kernel.Get<IClientManager>();
			_userRepository = _context.Kernel.Get<IUserRepository>();
			_clientRepository = _context.Kernel.Get<IClientRepository>();
			_transitRepository = _context.Kernel.Get<ITransitRepository>();
		}
コード例 #8
0
		public SenderApplicationManager(
			IApplicationRepository applications,
			IApplicationEditor editor,
			IForwarderService forwarders,
			ITransitRepository transits)
		{
			_applications = applications;
			_editor = editor;
			_forwarders = forwarders;
			_transits = transits;
		}
コード例 #9
0
 public SenderApplicationManager(
     IApplicationRepository applications,
     IApplicationEditor editor,
     IForwarderService forwarders,
     ITransitRepository transits)
 {
     _applications = applications;
     _editor       = editor;
     _forwarders   = forwarders;
     _transits     = transits;
 }
コード例 #10
0
ファイル: ApplicationPresenter.cs プロジェクト: UHgEHEP/test
		public ApplicationPresenter(
			IApplicationRepository applications,
			IIdentityService identity,
			IStateFilter stateFilter,
			ITransitRepository transits,
			IStateRepository states)
		{
			_applications = applications;
			_identity = identity;
			_stateFilter = stateFilter;
			_transits = transits;
			_states = states;
		}
コード例 #11
0
 public OrderController(IOrderRepository orderRepository, IOrderListRepository orderlistRepository,
                        IHubContext <OrderHub> order, ISequenceRepository sequenceRepository, ITransitRepository transitRepository,
                        ITransactionRepository transactionRepository, ITellerRepository tellerRepository)
 {
     //_get = get;
     _order                 = order;
     _orderRepository       = orderRepository;
     _sequenceRepository    = sequenceRepository;
     _tellerRepository      = tellerRepository;
     _transitRepository     = transitRepository;
     _transactionRepository = transactionRepository;
     _orderlistRepository   = orderlistRepository;
 }
コード例 #12
0
 public ApplicationPresenter(
     IApplicationRepository applications,
     IIdentityService identity,
     IStateFilter stateFilter,
     ITransitRepository transits,
     IStateRepository states)
 {
     _applications = applications;
     _identity     = identity;
     _stateFilter  = stateFilter;
     _transits     = transits;
     _states       = states;
 }
コード例 #13
0
        /// <summary>
        /// Dependency-injected application settings which are then passed on to other components.
        /// </summary>
        public TransitApiController()
        {
            if (bool.Parse(ConfigurationManager.AppSettings["UseAzureStorage"]))
            {
                var appSettings = new AppSettings(ConfigurationManager.AppSettings);
                _repository = new AzureTransitRepository(appSettings);
            }
            else
            {
                var filePath = HostingEnvironment.MapPath("~");
                _repository = new MemoryTransitRepository(filePath);
            }
            _client = new TransitClient();

            _getCurrentTime = () => TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTimeOffset.Now, "Pacific Standard Time");
        }
コード例 #14
0
        /// <summary>
        /// Dependency-injected application settings which are then passed on to other components.
        /// </summary>
        public TransitApiController()
        {
            if (bool.Parse(ConfigurationManager.AppSettings["UseAzureStorage"]))
            {
                var appSettings = new AppSettings(ConfigurationManager.AppSettings);
                _repository = new AzureTransitRepository(appSettings);
            }
            else
            {
                var filePath = HostingEnvironment.MapPath("~");
                _repository = new MemoryTransitRepository(filePath);
            }
            _client = new TransitClient();

            _getCurrentTime = () => TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTimeOffset.Now, "Pacific Standard Time");
        }
コード例 #15
0
        /// <summary>
        /// Gets the ETA info for a set of stop IDS.
        /// The outer dictionary takes a route number and gives a dictionary that takes a stop ID to an ETA.
        /// </summary>
        public static async Task <BusArrivalEstimates> GetEtas(ITransitRepository repository, ITransitClient client, IEnumerable <int> stopIds)
        {
            var toPlatformTag = await repository.GetPlatformTagsAsync();

            Func <int, Task <Tuple <int, ConnexionzPlatformET> > > getEtaIfTagExists =
                async id => Tuple.Create(id, toPlatformTag.ContainsKey(id) ? await client.GetEta(toPlatformTag[id]) : null);

            var tasks   = stopIds.Select(getEtaIfTagExists);
            var results = await Task.WhenAll(tasks);

            return(results.ToDictionary(eta => eta.Item1,
                                        eta => eta.Item2?.RouteEstimatedArrivals
                                        ?.ToDictionary(routeEta => routeEta.RouteNo,
                                                       routeEta => routeEta.EstimatedArrivalTime)
                                        ?? new Dictionary <string, List <int> >()));
        }
コード例 #16
0
        /// <summary>
        /// Gets the ETA info for a set of stop IDS.
        /// The outer dictionary takes a route number and gives a dictionary that takes a stop ID to an ETA.
        /// </summary>
        public static async Task <BusArrivalEstimates> GetEtas(ITransitRepository repository, ITransitClient client, IEnumerable <int> stopIds)
        {
            var toPlatformTag = await repository.GetPlatformTagsAsync();

            var tasks   = stopIds.Select(getEtaIfTagExists);
            var results = await Task.WhenAll(tasks);

            return(results.ToDictionary(eta => eta.stopId,
                                        eta => eta.platformET?.RouteEstimatedArrivals
                                        ?.ToDictionary(routeEta => routeEta.RouteNo,
                                                       routeEta => routeEta.EstimatedArrivalTime)
                                        ?? new Dictionary <string, List <int> >()));

            async Task <(int stopId, ConnexionzPlatformET?platformET)> getEtaIfTagExists(int id)
            => (id, toPlatformTag.TryGetValue(id, out int tag) ? await client.GetEta(tag) : null);
        }
コード例 #17
0
        /// <summary>
        /// Returns the bus schedule for the given stop IDs, incorporating the ETA from Connexionz.
        /// </summary>
        public static async Task<ClientBusSchedule> GetSchedule(ITransitRepository repository, ITransitClient client, DateTimeOffset currentTime, IEnumerable<int> stopIds)
        {
            var schedulesTask = repository.GetScheduleAsync();
            var estimatesTask = GetEtas(repository, client, stopIds);

            var schedule = await schedulesTask;
            var estimates = await estimatesTask;
            
            // Holy nested dictionaries batman
            var todaySchedule = stopIds.Where(schedule.ContainsKey)
                                       .ToDictionary(platformNo => platformNo,
                                                     platformNo => schedule[platformNo]
                .ToDictionary(routeSchedule => routeSchedule.RouteNo,
                              routeSchedule => InterleaveRouteScheduleAndEstimates(routeSchedule, estimates.ContainsKey(platformNo) ? estimates[platformNo] : new Dictionary<string, List<int>>(), currentTime)));

            return todaySchedule;
        }
コード例 #18
0
        /// <summary>
        /// Returns the bus schedule for the given stop IDs, incorporating the ETA from Connexionz.
        /// </summary>
        public static async Task <ClientBusSchedule> GetSchedule(ITransitRepository repository, ITransitClient client, DateTimeOffset currentTime, IEnumerable <int> stopIds)
        {
            var schedulesTask = repository.GetScheduleAsync();
            var estimatesTask = GetEtas(repository, client, stopIds);

            var schedule  = await schedulesTask;
            var estimates = await estimatesTask;

            // Holy nested dictionaries batman
            var todaySchedule = stopIds.Where(schedule.ContainsKey)
                                .ToDictionary(platformNo => platformNo,
                                              platformNo => schedule[platformNo]
                                              .ToDictionary(routeSchedule => routeSchedule.RouteNo,
                                                            routeSchedule => InterleaveRouteScheduleAndEstimates(routeSchedule, estimates.ContainsKey(platformNo) ? estimates[platformNo] : new Dictionary <string, List <int> >(), currentTime)));

            return(todaySchedule);
        }
コード例 #19
0
 public ProcessController(IAccountRepository accountRepository, ICustomerRepository customerRepository,
                          ISequenceRepository sequenceRepository, ITellerRepository tellerRepository, ICotRepository cotRepository,
                          IChequeRepository chequeRepository, INominalRepository nominalRepository, ISmsRepository smsRepository,
                          IAccountTypeRepository accounttypeRepository, ILocationRepository locationRepository,
                          ITransactionRepository transactionRepository, IChargeRepository chargeRepository,
                          ISmsApiRepository smsapiRepository, ITransitRepository transitRepository)
 {
     _cotRepository         = cotRepository;
     _smsRepository         = smsRepository;
     _chequeRepository      = chequeRepository;
     _chargeRepository      = chargeRepository;
     _tellerRepository      = tellerRepository;
     _transitRepository     = transitRepository;
     _accountRepository     = accountRepository;
     _nominalRepository     = nominalRepository;
     _customerRepository    = customerRepository;
     _locationRepository    = locationRepository;
     _sequenceRepository    = sequenceRepository;
     _accounttypeRepository = accounttypeRepository;
     _transactionRepository = transactionRepository;
 }
コード例 #20
0
        /// <summary>
        /// Gets the ETA info for a set of stop IDS.
        /// The outer dictionary takes a route number and gives a dictionary that takes a stop ID to an ETA.
        /// </summary>
        public static async Task<BusArrivalEstimates> GetEtas(ITransitRepository repository, ITransitClient client, IEnumerable<int> stopIds)
        {
            var toPlatformTag = await repository.GetPlatformTagsAsync();
            
            Func<int, Task<Tuple<int, ConnexionzPlatformET>>> getEtaIfTagExists =
                async id => Tuple.Create(id, toPlatformTag.ContainsKey(id) ? await client.GetEtaAsync(toPlatformTag[id]) : null);

            var tasks = stopIds.Select(getEtaIfTagExists);
            var results = await Task.WhenAll(tasks);

            return results.ToDictionary(eta => eta.Item1,
                eta => eta.Item2?.RouteEstimatedArrivals
                                ?.ToDictionary(routeEta => routeEta.RouteNo,
                                               routeEta => routeEta.EstimatedArrivalTime)
                       ?? new Dictionary<string, List<int>>());
        }
コード例 #21
0
ファイル: TransitService.cs プロジェクト: UHgEHEP/test
		public TransitService(ITransitRepository transits, ICarrierRepository carriers, IEventFacade events)
		{
			_transits = transits;
			_carriers = carriers;
			_events = events;
		}
コード例 #22
0
ファイル: ForwarderApplication.cs プロジェクト: UHgEHEP/test
		public ForwarderApplication(ICityRepository cities, IClientRepository clients, ITransitRepository transits)
		{
			_cities = cities;
			_clients = clients;
			_transits = transits;
		}
コード例 #23
0
 public UsersController(ITransitRepository repo)
 {
     _repo = repo;
 }
コード例 #24
0
        /// <summary>
        /// Gets a user friendly arrivals summary for the requested stops.
        /// Returns a dictionary which takes a stop ID and returns the list of route arrival summaries (used to populate a table).
        /// </summary>
        public static async Task <Dictionary <int, List <RouteArrivalsSummary> > > GetArrivalsSummary(ITransitRepository repository, ITransitClient client, DateTimeOffset currentTime, IEnumerable <int> stopIds)
        {
            var schedule = await GetSchedule(repository, client, currentTime, stopIds);

            return(schedule.ToDictionary(stopSchedule => stopSchedule.Key,
                                         stopSchedule => ToRouteArrivalsSummaries(stopSchedule.Value, currentTime)));
        }
コード例 #25
0
 public StopTimesController(ITransitRepository repo)
 {
     _repo = repo;
 }
コード例 #26
0
        /// <summary>
        /// Gets a user friendly arrivals summary for the requested stops.
        /// Returns a dictionary which takes a stop ID and returns the list of route arrival summaries (used to populate a table).
        /// </summary>
        public static async Task<Dictionary<int, List<RouteArrivalsSummary>>> GetArrivalsSummary(ITransitRepository repository, ITransitClient client, DateTimeOffset currentTime, IEnumerable<int> stopIds)
        {
            var schedule = await GetSchedule(repository, client, currentTime, stopIds);

            return schedule.ToDictionary(stopSchedule => stopSchedule.Key,
                stopSchedule => ToRouteArrivalsSummaries(stopSchedule.Value, currentTime));
        }
コード例 #27
0
        /// <summary>
        /// Gets a user friendly arrivals summary for the requested stops.
        /// Returns a dictionary which takes a stop ID and returns the list of route arrival summaries (used to populate a table).
        /// </summary>
        public static async Task <Dictionary <int, List <RouteArrivalsSummary> > > GetArrivalsSummary(ITransitRepository repository, ITransitClient client, DateTimeOffset currentTime, IEnumerable <int> stopIds)
        {
            var schedule = await GetSchedule(repository, client, currentTime, stopIds);

            var staticData = await repository.GetStaticDataAsync();

            var matchingStopIds   = stopIds.Where(staticData.Stops.ContainsKey);
            var arrivalsSummaries = matchingStopIds.ToDictionary(stopId => stopId,
                                                                 stopId => ToRouteArrivalsSummaries(staticData.Stops[stopId].RouteNames, schedule[stopId], currentTime));

            return(arrivalsSummaries);
        }
コード例 #28
0
ファイル: TransitService.cs プロジェクト: SKDon/Tracker
 public TransitService(ITransitRepository transits, ICarrierRepository carriers, IEventFacade events)
 {
     _transits = transits;
     _carriers = carriers;
     _events   = events;
 }
コード例 #29
0
        public static async Task<List<FavoriteStopViewModel>> GetFavoritesViewModel(ITransitRepository repository,
            ITransitClient client, DateTimeOffset currentTime, IEnumerable<int> stopIds, LatLong? optionalUserLocation)
        {
            var staticData = JsonConvert.DeserializeObject<BusStaticData>(await repository.GetSerializedStaticDataAsync());

            var favoriteStops = GetFavoriteStops(staticData, stopIds, optionalUserLocation);

            var scheduleTask = GetSchedule(repository, client, currentTime, favoriteStops.Select(f => f.Id));

            var schedule = await scheduleTask;

            var result = favoriteStops.Select(favorite => ToViewModel(favorite, staticData, schedule, currentTime))
                                      .ToList();

            return result;
        }
コード例 #30
0
 public TransitApiController(IHostingEnvironment env)
 {
     _repository     = new MemoryTransitRepository(env.WebRootPath);
     _client         = new TransitClient();
     _getCurrentTime = () => TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTimeOffset.Now, _destinationTimeZoneId);
 }
コード例 #31
0
 public TransitController(ITransitRepository transitRepository, ISequenceRepository sequenceRepository)
 {
     _transitRepository  = transitRepository;
     _sequenceRepository = sequenceRepository;
 }
コード例 #32
0
 public PPDCTransitReport([Dependency("PPDC")] IValidateInput inputValidation,
                          [Dependency("PPDC")] ITransitRepository transitRepo) : base(inputValidation, transitRepo)
 {
 }
コード例 #33
0
        public static async Task <List <FavoriteStopViewModel> > GetFavoritesViewModel(ITransitRepository repository,
                                                                                       ITransitClient client, DateTimeOffset currentTime, IEnumerable <int> stopIds, LatLong?optionalUserLocation)
        {
            var staticData = await repository.GetStaticDataAsync();

            var favoriteStops = GetFavoriteStops(staticData, stopIds, optionalUserLocation);

            var scheduleTask = GetSchedule(repository, client, currentTime, favoriteStops.Select(f => f.Id));

            var schedule = await scheduleTask;

            var result = favoriteStops.Select(favorite => ToViewModel(favorite, staticData, schedule, currentTime))
                         .ToList();

            return(result);
        }
コード例 #34
0
 public ForwarderApplication(ICityRepository cities, IClientRepository clients, ITransitRepository transits)
 {
     _cities   = cities;
     _clients  = clients;
     _transits = transits;
 }
コード例 #35
0
 protected TransitReportBase(IValidateInput inputValidation,
                             ITransitRepository transitRepo)
 {
     _inputValidation = inputValidation;
     _transitRepo     = transitRepo;
 }
コード例 #36
0
        /// <summary>
        /// Gets a user friendly arrivals summary for the requested stops.
        /// Returns a dictionary which takes a stop ID and returns the list of route arrival summaries (used to populate a table).
        /// </summary>
        public static async Task<Dictionary<int, List<RouteArrivalsSummary>>> GetArrivalsSummary(ITransitRepository repository, ITransitClient client, DateTimeOffset currentTime, IEnumerable<int> stopIds)
        {
            var schedule = await GetSchedule(repository, client, currentTime, stopIds);
            var staticData = await repository.GetStaticDataAsync();

            var matchingStopIds = stopIds.Where(staticData.Stops.ContainsKey);
            var arrivalsSummaries = matchingStopIds.ToDictionary(stopId => stopId,
                stopId => ToRouteArrivalsSummaries(staticData.Stops[stopId].RouteNames, schedule[stopId], currentTime));
            return arrivalsSummaries;
        }
コード例 #37
0
 public TransitController(ITransitRepository transitRepository)
 {
     _transitRepository = transitRepository;
 }