/// <summary> /// Logs the error. /// </summary> /// <param name="screenName">Name of the screen.</param> /// <param name="eventName">Name of the event.</param> /// <param name="data">The data.</param> /// <param name="ex">The ex.</param> public void LogError(string screenName, string eventName, string data, ExceptionDescriptive ex) { if (this.started && this.databaseExists) { try { ErrorItem errorItem = new ErrorItem(this.applicationId, screenName, data, this.iDeviceDynamicInformation.GetDeviceGeneralInformation(), eventName, ex, this.sessionId, this.applicationVersion); this.iStorageDal.Save(errorItem); this.setItemsWaitingToBeUploaded(); if (this.uploadType == UploadType.WhileUsingAsync) { this.uploadIntelligent(); } } catch (ExceptionDatabaseLayer exceptionDatabaseLayer) { this.logSystemError(exceptionDatabaseLayer); } } }
/// <summary> /// Errors the specified device id. /// </summary> /// <param name="deviceId">The device id.</param> /// <param name="errorItem">The error item.</param> /// <returns></returns> public WebServiceResponseCodeType Error(Guid deviceId, ErrorItem errorItem) { KeyValuePair<string, string>[] keyValuePairs = new KeyValuePair<string, string>[] { new KeyValuePair<string, string>(QueryStringKeyType.DEVICE_GUID, deviceId.ToString()), new KeyValuePair<string, string>(QueryStringKeyType.APPLICATION_GUID, errorItem.ApplicationId.ToString()), new KeyValuePair<string, string>(QueryStringKeyType.DATE_CREATED, errorItem.DateCreatedFormatted), new KeyValuePair<string, string>(QueryStringKeyType.DATA, errorItem.Data), new KeyValuePair<string, string>(QueryStringKeyType.EVENT_NAME, errorItem.EventName), new KeyValuePair<string, string>(QueryStringKeyType.AVAILABLE_FLASH_DRIVE_SIZE, errorItem.AvailableFlashDriveSize.ToString()), new KeyValuePair<string, string>(QueryStringKeyType.AVAILABLE_MEMORY_SIZE, errorItem.AvailableMemorySize.ToString()), new KeyValuePair<string, string>(QueryStringKeyType.BATTERY, errorItem.Battery.ToString()), new KeyValuePair<string, string>(QueryStringKeyType.ERROR_MESSAGE, errorItem.ExceptionMessage), new KeyValuePair<string, string>(QueryStringKeyType.SCREEN_NAME, errorItem.ScreenName), new KeyValuePair<string, string>(QueryStringKeyType.SESSION_ID, errorItem.SessionId.ToString()), new KeyValuePair<string, string>(QueryStringKeyType.VERSION, errorItem.Version) }; return this.webServiceCall(this.baseUrl, WebServiceType.Error, keyValuePairs); }
/// <summary> /// Saves the specified error item. /// </summary> /// <param name="errorItem">The error item.</param> public void Save(ErrorItem errorItem) { try { threadQueue.WaitOne(); this.ErrorItem.InsertOnSubmit(errorItem); this.SubmitChanges(); } catch (Exception ex) { throw new ExceptionDatabaseLayer(ex); } finally { threadQueue.Set(); } }