private string CheckForUpdates() { try { using (WebService.GTServiceClient client = new WebService.GTServiceClient()) { string updatePath = client.IsUpdatePresent(appId, Assembly.GetExecutingAssembly().GetName().Version.ToString()); return(updatePath); } } catch { return(string.Empty); } }
public static void ReportException(string ErrorCode, Exception ex) { try { if (settings == null || settings.Options == null || settings.Options.Rows.Count == 0 || !Convert.ToBoolean(settings.Options.Rows[0]["AutoReportErrors"])) { return; } using (WebService.GTServiceClient client = new WebService.GTServiceClient()) { client.ReportBug(appId, ErrorCode, ex.StackTrace ?? string.Empty, ex.Message ?? string.Empty, Assembly.GetCallingAssembly().GetName().Version.ToString()); } } catch (Exception ex2) { Errors.ServiceError(ex2); } }
private void uploadData(object oMeter) { if (settings != null) { string assemblyName = Assembly.GetCallingAssembly().GetName().Name; using (WebService.GTServiceClient client = new WebService.GTServiceClient()) { //upload meter info to database via web service Settings.LoginRow loginRow = settings.Login.FirstOrDefault(); if (loginRow != null && !loginRow.IsUsernameNull() && !loginRow.IsPasswordNull()) { WebService.Common userinfo = null; try { EventLog.WriteEntry("Validating User: Begin", EventLogEntryType.Information); //validate user userinfo = client.ValidateLogin(StringCipher.Encrypt(assemblyName), StringCipher.Encrypt(appId), StringCipher.Encrypt(loginRow.Username), StringCipher.Encrypt(loginRow.Password)); } catch (Exception ex) { //could not validate user Errors.ServiceError(ex); Detector.ReportException("W0007", ex); } finally { EventLog.WriteEntry("Validating User: End", EventLogEntryType.Information); } try { WebService.Records recordsToUpload = new WebService.Records(); foreach (Records.RecordRow row in ((AbstractMeter)oMeter).Records) { ((WebService.Records.RecordDataTable)(recordsToUpload.Tables[0])).AddRecordRow(row.Timestamp, row.Glucose, row.Units); } EventLog.WriteEntry("Uploading Data: Begin", EventLogEntryType.Information); client.PostGlucoseRecords(recordsToUpload, userinfo, ((AbstractMeter)oMeter).ID); EventLog.WriteEntry("Uploading Data: End", EventLogEntryType.Information); pipeWrite("MSG", "Sent Glucose Readings", "to BloodSpider website", 1); } catch (Exception ex) { Errors.ServiceError(ex); Detector.ReportException("W0008", ex); } } else { Exception ex = new Exception("uploadData-2: Could not upload data due to settings not being populated."); Errors.ServiceError(ex); Detector.ReportException("W0009", ex); } } } else { Exception ex = new Exception("uploadData-1: Could not upload data due to settings not being populated."); Errors.ServiceError(ex); Detector.ReportException("W000A", ex); } }
public static void ReportException(string ErrorCode, Exception ex) { try { if (settings == null || settings.Options == null || settings.Options.Rows.Count == 0 || !Convert.ToBoolean(settings.Options.Rows[0]["AutoReportErrors"])) return; using (WebService.GTServiceClient client = new WebService.GTServiceClient()) { client.ReportBug(appId, ErrorCode, ex.StackTrace ?? string.Empty, ex.Message ?? string.Empty, Assembly.GetCallingAssembly().GetName().Version.ToString()); } } catch(Exception ex2) { Errors.ServiceError(ex2); } }
private string CheckForUpdates() { try { using (WebService.GTServiceClient client = new WebService.GTServiceClient()) { string updatePath = client.IsUpdatePresent(appId, Assembly.GetExecutingAssembly().GetName().Version.ToString()); return updatePath; } } catch { return string.Empty; } }
private void uploadData(object oMeter) { if (settings != null) { string assemblyName = Assembly.GetCallingAssembly().GetName().Name; using (WebService.GTServiceClient client = new WebService.GTServiceClient()) { //upload meter info to database via web service Settings.LoginRow loginRow = settings.Login.FirstOrDefault(); if (loginRow != null && !loginRow.IsUsernameNull() && !loginRow.IsPasswordNull()) { WebService.Common userinfo = null; try { EventLog.WriteEntry("Validating User: Begin", EventLogEntryType.Information); //validate user userinfo = client.ValidateLogin(StringCipher.Encrypt(assemblyName), StringCipher.Encrypt(appId), StringCipher.Encrypt(loginRow.Username), StringCipher.Encrypt(loginRow.Password)); } catch (Exception ex) { //could not validate user Errors.ServiceError(ex); Detector.ReportException("W0007", ex); } finally { EventLog.WriteEntry("Validating User: End", EventLogEntryType.Information); } try { WebService.Records recordsToUpload = new WebService.Records(); foreach (Records.RecordRow row in ((AbstractMeter)oMeter).Records) { ((WebService.Records.RecordDataTable)(recordsToUpload.Tables[0])).AddRecordRow(row.Timestamp, row.Glucose, row.Units); } EventLog.WriteEntry("Uploading Data: Begin", EventLogEntryType.Information); client.PostGlucoseRecords(recordsToUpload, userinfo, ((AbstractMeter)oMeter).ID); EventLog.WriteEntry("Uploading Data: End", EventLogEntryType.Information); pipeWrite("MSG", "Sent Glucose Readings", "to BloodSpider website", 1); } catch(Exception ex) { Errors.ServiceError(ex); Detector.ReportException("W0008", ex); } } else { Exception ex = new Exception("uploadData-2: Could not upload data due to settings not being populated."); Errors.ServiceError(ex); Detector.ReportException("W0009", ex); } } } else { Exception ex = new Exception("uploadData-1: Could not upload data due to settings not being populated."); Errors.ServiceError(ex); Detector.ReportException("W000A", ex); } }