/// <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")); }
public TransitController(IMailService mailService, ITransitRepository repository, IMapper mapper, UserManager <StoreUser> userManager, IHostingEnvironment hostingEnvironment) { _mailService = mailService; _repository = repository; _mapper = mapper; _userManager = userManager; _hostingEnvironment = hostingEnvironment; }
public TransitController( IIdentityService identity, ICityRepository cities, ITransitRepository transits) { _identity = identity; _cities = cities; _transits = transits; }
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>(); }
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>(); }
public SenderApplicationManager( IApplicationRepository applications, IApplicationEditor editor, IForwarderService forwarders, ITransitRepository transits) { _applications = applications; _editor = editor; _forwarders = forwarders; _transits = transits; }
public ApplicationPresenter( IApplicationRepository applications, IIdentityService identity, IStateFilter stateFilter, ITransitRepository transits, IStateRepository states) { _applications = applications; _identity = identity; _stateFilter = stateFilter; _transits = transits; _states = states; }
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; }
/// <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"); }
/// <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> >())); }
/// <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); }
/// <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; }
/// <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); }
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; }
/// <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>>()); }
public TransitService(ITransitRepository transits, ICarrierRepository carriers, IEventFacade events) { _transits = transits; _carriers = carriers; _events = events; }
public ForwarderApplication(ICityRepository cities, IClientRepository clients, ITransitRepository transits) { _cities = cities; _clients = clients; _transits = transits; }
public UsersController(ITransitRepository repo) { _repo = repo; }
/// <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))); }
public StopTimesController(ITransitRepository repo) { _repo = repo; }
/// <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)); }
/// <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); }
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; }
public TransitApiController(IHostingEnvironment env) { _repository = new MemoryTransitRepository(env.WebRootPath); _client = new TransitClient(); _getCurrentTime = () => TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTimeOffset.Now, _destinationTimeZoneId); }
public TransitController(ITransitRepository transitRepository, ISequenceRepository sequenceRepository) { _transitRepository = transitRepository; _sequenceRepository = sequenceRepository; }
public PPDCTransitReport([Dependency("PPDC")] IValidateInput inputValidation, [Dependency("PPDC")] ITransitRepository transitRepo) : base(inputValidation, transitRepo) { }
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); }
protected TransitReportBase(IValidateInput inputValidation, ITransitRepository transitRepo) { _inputValidation = inputValidation; _transitRepo = transitRepo; }
/// <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; }
public TransitController(ITransitRepository transitRepository) { _transitRepository = transitRepository; }