Esempio n. 1
0
        private void RefreshLocationIndicatorData()
        {
            _logHelper.WriteInfo("Location indicator data refresh started.");

            IList <metropolitan_area> metroAreas = _dl.GetAllMetropolitanAreas();

            try
            {
                foreach (metropolitan_area area in metroAreas)
                {
                    List <location> locations = _dl.GetLocationsByMetropolitanAreaId(area.id);
                    foreach (location l in locations)
                    {
                        string url = String.Format(_config.Update.NrelStationsUrl, l.city, l.state);
                        KeyValuePair <string, string> stationAndPortCounts = _locatorServicesClient.SendChargingStationsGet(url);
                        _logHelper.WriteInfo("postal code: " + l.postal_code + " stations: " + stationAndPortCounts.Key + " ports: " + stationAndPortCounts.Value);
                        _dl.AddChargingStationData(l.postal_code, Convert.ToInt32(stationAndPortCounts.Key), Convert.ToInt32(stationAndPortCounts.Value));
                    }
                }
            }
            catch (Exception ex)
            {
                _logHelper.WriteError(ex.Message);
            }

            _logHelper.WriteInfo("Location indicator data refresh completed.");
        }