EconomicIndicatorsPage
This commit is contained in:
@@ -149,6 +149,54 @@ namespace MarketData.Service
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ********************************************************** E C O N O M I C I N D I C A T O R S *************************************************
|
||||
public ServiceResult GetDistinctEconomicIndicatorCodes()
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!IsNetworkAvailable()) return new ServiceResult(false, "No network.");
|
||||
if (!IsAuthorized()) return new ServiceResult(false, "Unauthorized.");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append("/api/EconomicIndicators/GetDistinctEconomicIndicators?").Append("token=").Append(accessToken);
|
||||
String json = httpClient.GetStringAsync(sb.ToString()).Result;
|
||||
List<String> priceIndices = JsonConvert.DeserializeObject<List<String>>(json);
|
||||
return new ServiceResult(priceIndices);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
exceptions.Add(exception);
|
||||
Debug.WriteLine(exception.ToString());
|
||||
return new ServiceResult(false, exception.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ServiceResult GetGetEconomicIndicators(String indicatorCode)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!IsNetworkAvailable()) return new ServiceResult(false, "No network.");
|
||||
if (!IsAuthorized()) return new ServiceResult(false, "Unauthorized.");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append("/api/EconomicIndicators/GetEconomicIndicators?").Append("token=").Append(accessToken).Append("&").Append("indicatorCode=").Append(HttpUtility.UrlEncode(indicatorCode));
|
||||
String json = httpClient.GetStringAsync(sb.ToString()).Result;
|
||||
List<EconomicIndicator> priceIndices = JsonConvert.DeserializeObject<List<EconomicIndicator>>(json);
|
||||
return new ServiceResult(priceIndices);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
exceptions.Add(exception);
|
||||
Debug.WriteLine(exception.ToString());
|
||||
return new ServiceResult(false, exception.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ********************************************************** C O N S U M E R P R I C E I N D E X *************************************************
|
||||
public ServiceResult GetDistinctConsumerPriceIndices()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user