public IndexModel() { string googleApiKey = Environment.GetEnvironmentVariable(EnvironmentVariables.GoogleApiKeyVarName) ?? throw new Exception("Api Key env-var not found."); SheetId = Environment.GetEnvironmentVariable(EnvironmentVariables.GoogleSheetIdKeyVarName) ?? throw new Exception("Sheet Id env-var not found."); string backupUrl = Environment.GetEnvironmentVariable(EnvironmentVariables.DataBackupUrlVarName) ?? throw new Exception("Data Backup URL env-var not found."); _liveDataSource = new WebRestService(new Uri($"{GoogleSheetsBaseUrl}{SheetId}/values/Sheet1!A1:Z500?key={googleApiKey}")); var backupWebService = new WebRestService(new Uri(backupUrl)); _backupService = new JsonBackupService( new TimeService(), backupWebService, 7); }
public String DoWork(DataHeader h, String classWithNs, String methodName, string paramStr) { try { String v = WebRestService.InvokeBp(h, classWithNs, methodName, paramStr); GuProxyService.Model.mServiceProxy res = JsonConvert.DeserializeObject <GuProxyService.Model.mServiceProxy>(v); if (!string.IsNullOrEmpty(res.ErrorMessage)) { throw new Exception(res.ErrorMessage); } return(v); } catch (Exception) { throw; } }
public String DoWorkWithWebGet() { NameValueCollection nvc = HttpUtility.ParseQueryString(HttpContext.Current.Request.Url.Query); String classWithNs = ""; String methodName = ""; String paramStr = ""; DataHeader h = null; classWithNs = nvc["classWithNs"]; methodName = nvc["methodName"]; string v = WebRestService.InvokeBpWithQueryParam(h, classWithNs, methodName, paramStr, nvc); //String v = WebRestService.InvokeBp(h, classWithNs, methodName, paramStr); return(v); }