private void UpdateItem(string ItemBody, string Id, int RetryCount = 0)
 {
     try
     {
         string updateUrl = string.Format(this.urlFormat + "/tables/{1}/{2}", this.zumoName, this.tableName, Id);
         string result    = AzureWebServicesConnection.UpdateItem(new Uri(updateUrl), ItemBody, this.adminKey);
         if (result.Contains("Error"))
         {
             throw new Exception(result);
         }
     }
     catch (Exception ex)
     {
         this.ComponentMetaData.FireInformation(978, "UpdateItem", ex.Message, string.Empty, 0, ref pbCancel);
         if (RetryCount < 5)
         {
             var msg = string.Format("Waiting to retry call to update {0}: {1}", this.tableName, Id);
             this.ComponentMetaData.FireInformation(979, "UpdateItem", msg, string.Empty, 0, ref pbCancel);
             Thread.Sleep(1000);
             RetryCount++;
             UpdateItem(ItemBody, Id, RetryCount);
         }
         else
         {
             var msg = string.Format("Unable to update item: {0}, {1}", this.tableName, Id);
             this.ComponentMetaData.FireError(980, "UpdateItem", msg, string.Empty, 0, out pbCancel);
         }
     }
 }
 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);
         }
     }
 }
        private bool DeleteItems(DeleteBatch Batch)
        {
            var url      = string.Format(urlFormat + "/api/batchdelete", zumoName);
            var batchUri = new Uri(url);
            var body     = Serialize(Batch);

            return(AzureWebServicesConnection.DeleteBatch(batchUri, body, adminKey));
        }
        private string GetAllResp()
        {
            var getUrl = string.Format(this.urlFormat + "/api/getall/{1}", this.zumoName, this.tableName);

            return(AzureWebServicesConnection.Get(new Uri(getUrl), this.adminKey, true));
        }