public Task Execute(IJobExecutionContext context) { _aerisJobParams = AerisJobParamsValueOf(context); _weatherRepository = _weatherRepositoryValueOf(_aerisJobParams); //Log.Information("\nWeather job starting...\n"); //var clock = System.Diagnostics.Stopwatch.StartNew(); //GatherWeatherData(); //clock.Stop(); //var t = clock.Elapsed; //Log.Error(t.ToString()); _sPRegressionJob.Execute(context); //PopulateWthExpUsageTable(); //Log.Information($"WeatherData gathered and WthExpUsage calculated for Readings going back to {fromDateStart.ToShortDateString()}"); //Log.Information("\nWeather job finished.\n"); //PopulateWthNormalParams(); return(Task.FromResult(0)); }
public void GetCountries() { IWeatherRepository _iWeatherRepository = null; _iWeatherRepository = new WeatherRepository(); List <Country> expectedCountries = new List <Country>() { new Country(1, "Australia"), new Country(2, "America"), new Country(3, "England") }; List <Country> actualCountries = null; WeatherController wc = new WeatherController(_iWeatherRepository); wc.Request = new HttpRequestMessage() { Properties = { { HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration() } } }; HttpResponseMessage response = wc.GetCountries(); response.TryGetContentValue <List <Country> >(out actualCountries); Assert.AreEqual(expectedCountries, actualCountries); }
public WeatherController(IWeatherRepository weatherRepo, ISettingsRepository settingsRepo, IMapper mapper, IConfiguration config) { _settingsRepo = settingsRepo; _config = config; _mapper = mapper; _weatherRepo = weatherRepo; }
public void Execute(IJobExecutionContext context) { _aerisJobParams = AerisJobParamsValueOf(context); _weatherRepository = _weatherRepositoryValueOf(_aerisJobParams); _aerisJob = new AerisJob(); Log.Information("Starting WNRdngData01RegressionJob...\n"); _aerisJob.ExecuteZipHistoryCheckOnlyForRegression(context); _aerisJob = null; ////_weatherRepository.ClearWthNormalParams(); PopulateWthNormalParams(); _aerisJob = new AerisJob(); _aerisJob.PopulateWthExpUsageTableAfterRegression(context); _aerisJob = null; Log.Information("\nFinished WNRdngData01RegressionJob. \n"); }
public WeatherHandler( IWeatherRepository repository, IWeatherCalculator weatherCalculator) { _repository = repository; _weatherCalculator = weatherCalculator; }
public void PopulateWthExpUsageTableAfterRegression(IJobExecutionContext context) { _aerisJobParams = AerisJobParamsValueOf(context); _weatherRepository = _weatherRepositoryValueOf(_aerisJobParams); PopulateWthExpUsageTable(); }
public void GetWeatherDataByCity() { IWeatherRepository _iWeatherRepository = null; int cityID = 1; _iWeatherRepository = new WeatherRepository(); tblTemperature expectedTempData = new tblTemperature(); expectedTempData.CityID = 1; expectedTempData.Location = "Paramatta"; expectedTempData.Preasure = 30; expectedTempData.RelativeHumidity = 50; expectedTempData.SkyCondition = "Good"; expectedTempData.Visibility = 1; expectedTempData.DewPoint = 1; List <Country> actualTempData = null; WeatherController wc = new WeatherController(_iWeatherRepository); wc.Request = new HttpRequestMessage() { Properties = { { HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration() } } }; HttpResponseMessage response = wc.GetWeatherDataByCity(cityID); response.TryGetContentValue <List <Country> >(out actualTempData); Assert.AreEqual(expectedTempData, actualTempData); }
public WeatherViewModel() { repository = new OpenWeatherApiRepository(); GetWeatherCommand = new Command(GetWeather); GetWeatherByCurrentLocationAsync(); }
public SensorDataController() { _mqtt = new Mqtt(); _repository = new WeatherRepository(MongoDBConnector.GetInstance()); HttpClient httpClient = new HttpClient(); httpClient.PostAsync("http://sensoranalyticsservice/api/SensorAnalytics/CreateAnalyticsService", null); }
public WeatherListViewModel(IWeatherRepository weather) { _weather = weather; foreach (var entity in _weather.GetData()) { Weathers.Add(new WeatherListViewModelWeather(entity)); } }
public WeatherController(ILogger <WeatherController> logger, IWeatherRepository weatherRepository) { _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _weatherRepository = weatherRepository ?? throw new ArgumentNullException(nameof(weatherRepository)); }
public CityAppService(ICityRepository cityRepository, IWeatherRepository weatherRepository, IMapper mapper, IRestClient restClient ) { _cityRepository = cityRepository; _weatherRepository = weatherRepository; _mapper = mapper; _restClient = restClient; }
public WeatherService(IWeatherRepository weatherRepository) { if (ReferenceEquals(weatherRepository, null)) { throw new ArgumentNullException("weatherRepository"); } this._weatherRepository = weatherRepository; }
public WeatherForecastController( IWeatherRepository repository, IWeatherCacheRepository cacheRepository, ILogger <WeatherForecastController> logger) { this.repository = repository; this.cacheRepository = cacheRepository; this.logger = logger; }
private async Task InitDatabaseAsync(IWeatherRepository weatherRepository) { var cites = await weatherRepository.CityListAsyc(); if (!cites.Any()) { await weatherRepository.LoadStaticCityData(); } }
public WeatherForecastController(ILogger <WeatherForecastController> logger, IWeatherRepository weatherRepository, IHubContext <WeatherHub, IWeatherHub> WeatherHub, IHubContext <NotificationHub, INotificationHub> notificationHub) { _logger = logger; this.weatherRepository = weatherRepository; this._weatherHub = WeatherHub; this._notificationHub = notificationHub; }
public OpenWeatherService(HttpClient httpClient, IOptions <OpenWeatherSettings> options, IWeatherRepository weatherRepository, IMediatorHandler mediator) : base(mediator) { _appSettings = options.Value; httpClient.BaseAddress = new Uri(_appSettings.WeatherBaseAddress); _httpClient = httpClient; _weatherRepository = weatherRepository; }
public WeatherLatestViewModel(IWeatherRepository weather, IAreaRepository areas) { _weather = weather; _areas = areas; foreach (var area in _areas.Getdata()) { Areas.Add(new AreaEntity(area.AreaID, area.AreaName)); } }
public MainWindowViewModel( ICountryRepository countryRepository, IWeatherRepository weatherRepository ) { this.countryRepository = countryRepository; this.weatherRepository = weatherRepository; Countries = new ObservableCollection <Country>(); LoadCountriesAsync(); }
public WeatherLatestViewModel(IWeatherRepository weather, IAreasRepository areas) //テストコード用 モックを指定する { _weather = weather; _areas = areas; foreach (var area in areas.GetData()) { Areas.Add(new AreaEntity(area.AreaId, area.AreaName)); } }
/// <summary> /// コンストラクター(引数あり) /// 呼び出し時に引数で指定し呼ばれる /// 評価と本番の切替ができる /// </summary> /// <param name="weather"></param> public WeathrLatestViewModel(IWeatherRepository weather, IAreasRepository areas) { // 引数ありも引数なしも、どちらからも呼ばれる _weather = weather; _areas = areas; foreach (var area in _areas.GetData()) { Areas.Add(new AreaEntity(area.AreaId, area.AreaName)); } }
private async Task CreateRepositories(string cityCode) { HistoricalDataRepository = null; CurrentWeatherRepository = new AccuWeatherCurrentWeatherRepository(_restClient, $"currentconditions/v1/{cityCode}", _apiKey, _provider); HourlyForecastsRepository = new AccuWeatherHourlyForecastRepository(_restClient, $"forecasts/v1/hourly/12hour/{cityCode}", _apiKey, _provider); DailyForecastsRepository = new AccuWeatherDailyForecastRepository(_restClient, $"forecasts/v1/daily/5day/{cityCode}", _apiKey, _provider); await ChangeLanguage(Language); }
public WeatherLatestViewModel(IWeatherRepository weather, IAreasRepository areas) { _weather = weather; //weatherを _weatherに代入 _areas = areas; //areasを _areasに代入 foreach (var area in _areas.GetData()) //foreachループ { Areas.Add(new AreaEntity(area.AreaId, area.AreaName)); } }
private void CreateRepositories() { CurrentWeatherRepository = new OpenWeatherMapCurrentWeatherRepository(_restClient, "", _apiKey, _dateProvider, _coordinates); DailyForecastsRepository = new OpenWeatherMapDailyForecastsRepository(_restClient, "", _apiKey, _dateProvider, _coordinates); HourlyForecastsRepository = new OpenWeatherMapHourlyForecastsRepository(_restClient, "", _apiKey, _dateProvider, _coordinates); HistoricalDataRepository = null; ChangeLanguage(_language); }
/// <summary> /// Initializes a new instance of the <see cref="HomeController"/> class. /// </summary> /// <param name="logger">The logger.</param> /// <param name="geoCodeRepository">The geo code repository.</param> /// <param name="weatherRepository">The weather repository.</param> /// <param name="configuration">The configuration.</param> public HomeController( ILogger <HomeController> logger, IGeoCodeRepository geoCodeRepository, IWeatherRepository weatherRepository, IConfiguration configuration) { this.logger = logger; this.geoCodeRepository = geoCodeRepository; this.weatherRepository = weatherRepository; this.configuration = configuration; }
public WeatherForecastService( ICityRepository cityRepository, ICityToCityContractTranslator cityToCityContractTranslator, IWeatherRepository weatherRepository, IWeatherToWeatherContractTranslator weatherToWeatherContractTranslator) { _cityRepository = cityRepository; _cityToCityContractTranslator = cityToCityContractTranslator; _weatherRepository = weatherRepository; _weatherToWeatherContractTranslator = weatherToWeatherContractTranslator; }
public WeatherApiController(IMemoryCache cache, IHttpClientFactory httpClientFactory, IWeatherRepository weatherRepository, INotificationDispatcher notificationDispatcher ) { _memoryCache = cache; _httpClientFactory = httpClientFactory; _weatherRepository = weatherRepository; _notificationDispatcher = notificationDispatcher; }
public WeatherQueryApplicationService( IMapper mapper , IWeatherRepository weatherRepository , IJuHeApiRepository juHeApiRepository , IRedisCache redisCache ) { this.mapper = mapper; this.weatherRepository = weatherRepository; this.juHeApiRepository = juHeApiRepository; this.redisCache = redisCache; }
public WeatherServiceTests() { CreateScope(); _options = Options.Create(new OpenWeatherSettings() { WeatherAppId = "a20bc11389c24a4d67419a201d95b798", WeatherBaseAddress = "http://api.openweathermap.org" }); _weatherRepository = GetInstance <IWeatherRepository>(); _mediatorHandler = GetInstance <IMediatorHandler>(); _notifications = (NotificationHandler)GetInstance <INotificationHandler <Notification> >(); }
public void ExecuteZipHistoryCheckOnlyForRegression(IJobExecutionContext context) { _aerisJobParams = AerisJobParamsValueOf(context); _weatherRepository = _weatherRepositoryValueOf(_aerisJobParams); Log.Information("Checking if Historical WeatherData is needed..."); try { _allZips = _weatherRepository.GetDistinctZipCodes(); GatherHistoricalWeatherData(_allZips); //int difZip = 0; //List<WthNormalParams> allParams = _weatherRepository.GetAllParams(); //foreach (WthNormalParams param in allParams) //{ // string bZip = _weatherRepository.GetBZip(param.AccID, 0, 0); // if (bZip.Length > 0) // { // if (!bZip.Equals(param.ZipW)) // { // difZip++; // Log.Information("Different Zip. bZip: {0}, wnpZip: {1}", bZip, param.ZipW); // } // } //} //Log.Information("Different zips: {0}", difZip); if (newZipsDailyGatherNeededForRegression) { GatherDailyWeatherData(-3, _allZips); _actualZipDateEntriesTotal = _weatherRepository.GetZipDateRowCount(); } } catch (Exception ex) { Log.Error(ex.Message + " " + ex.StackTrace); } if (newZipsDailyGatherNeededForRegression) { Log.Information($"Finished GatherWeatherData(). " + $"Expected Total ZipDates Entries: {_expectedZipDateEntriesTotal}.. Actual: {_actualZipDateEntriesTotal}.\n"); } _expectedZipDateEntriesTotal = 0; _actualZipDateEntriesTotal = 0; }
public MyDayViewModel(IWeatherRepository weatherRepository, IProgressService progressService) { _weatherRepository = weatherRepository; _refreshCommand = new LoadingRelayCommand(Refresh); Forecasts = _weatherRepository.GetForecasts(); if (!IsInDesignMode) { if (_refreshCommand.CanExecute(null)) _refreshCommand.Execute(null); } }
public WeatherAggregatorService(IWeatherRepository weatherRepository, IWeatherServiceStore weatherServiceStore, IWeatherUnitConverterService weatherUnitConverterService) { _weatherRepository = weatherRepository; _weatherServiceStore = weatherServiceStore; _weatherUnitConverterService = weatherUnitConverterService; }
public WeatherController() { _repository = new Repository(); }
public WeatherService(IWeatherRepository weatherRepository, ICityService cityService) { WeatherRepository = weatherRepository; CityService = cityService; }
public WeatherService(IWeatherRepository repo) { _repository = repo; }
public GeonamesController(IWeatherRepository repo) { _repository = repo; }
public WeatherService(IWeatherRepository repository) { this._repository = repository; }
public WeatherService(IWeatherUnderGroundAdapter weatherUnderGroundAdapter, IWeatherRepository weatherRepository, ITypedConfiguration typedConfiguration) { _weatherUnderGroundAdapter = weatherUnderGroundAdapter; _weatherRepository = weatherRepository; _typedConfiguration = typedConfiguration; }