private async Task <bool> RunQueuedResourceScheduleUpdate(ModelData.Queue q) { if (_webAPIDataService == null) { return(false); } var record = await _db.GetAsyncConnection().Table <dataModel.PendingResourceSchedule>().Where(x => x.Id == q.RecordId).FirstOrDefaultAsync(); if (record != null) { var result = await _webAPIDataService.UpdateResourceScheduleAsync(record.ToDto()); if (result.IsSuccessStatusCode) { Debug.WriteLine($"Successfully Sent Queued PendingResourceSchedule Update Record"); return(true); } else if (result.StatusCode == System.Net.HttpStatusCode.Conflict) { //do something here with the conflict } Analytics.TrackEvent($"Error Sending Queued PendingResourceSchedule Update record {q.RecordId}"); return(false); } return(false); }
private async Task <bool> RunQueuedUserUpdate(ModelData.Queue q) { if (_webAPIDataService == null) { return(false); } var record = await _db.GetAsyncConnection().Table <dataModel.User>().Where(x => x.Id == q.RecordId).FirstOrDefaultAsync(); if (record != null) { var result = await _webAPIDataService.UpdateUserAsync(record.ToDto()); if (result.IsSuccessStatusCode) { Debug.WriteLine($"Successfully Sent Queued UserUpdate Record"); return(true); } Analytics.TrackEvent($"Error Sending Queued UserUpdate record {q.RecordId}"); return(false); } return(false); }
//queue a record in SQLite public async Task QueueAsync(Guid recordId, QueueableObjects objName) { try { ModelData.Queue queue = new ModelData.Queue() { RecordId = recordId, QueueableObject = objName.ToString(), DateQueued = DateTime.UtcNow, NumAttempts = 0, Success = false }; int count = await _db.GetAsyncConnection().InsertOrReplaceAsync(queue); Debug.WriteLine($"Queued {recordId} of type {objName}"); } catch (Exception ex) { Crashes.TrackError(ex); Debug.WriteLine($"Error in {nameof(QueueAsync)}"); } }