private void InsertSync(SyncItem syncItem) { var insertUrl = string.Format(urlFormat + "/tables/syncLog", zumoName); var insertUri = new Uri(insertUrl); var insertBody = Serialize(syncItem); var result = AzureWebServicesConnection.InsertItem(insertUri, insertBody, adminKey); }
private void InsertItem(string itemBody, string id, int RetryCount = 0) { try { string insertUrl = string.Format(urlFormat + "/tables/{1}", zumoName, tableName); var insertUri = new Uri(insertUrl); var result = AzureWebServicesConnection.InsertItem(insertUri, itemBody, adminKey); if (result.Contains("Error")) { throw new Exception(result); } } catch (Exception ex) { ComponentMetaData.FireInformation(978, ComponentMetaData.Name, ex.Message, "", 0, ref pbCancel); if (RetryCount < 5) { ComponentMetaData.FireInformation(979, ComponentMetaData.Name, string.Format("Waiting to insert into {0} table, id: {1}", tableName, id), "", 0, ref pbCancel); Thread.Sleep(1000); RetryCount++; InsertItem(itemBody, id, RetryCount); } else { ComponentMetaData.FireInformation(980, ComponentMetaData.Name, string.Format("Unable to insert into {0} table, id: {1} to service.", tableName, id), "", 0, ref pbCancel); } } }