|
|
@ -180,6 +180,8 @@ namespace ServerManager.SyncMethods |
|
|
|
await m_httpClient.PostAsJsonAsync("/api/SyncProducts/setsyncdate", syncTimestamp); |
|
|
|
} |
|
|
|
private async Task SyncProductAltUnitAsync() |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
var responseMessage = await m_httpClient.GetAsync("/api/SyncProducts/lastsyncdate/productaltunit"); |
|
|
|
if (!responseMessage.IsSuccessStatusCode) |
|
|
@ -188,7 +190,7 @@ namespace ServerManager.SyncMethods |
|
|
|
} |
|
|
|
|
|
|
|
DateTime date = await responseMessage.Content.ReadFromJsonAsync<DateTime>(); |
|
|
|
IEnumerable<RestockLevel> modifiedCart = await m_productService.FetchRestockAsync(date, "BRID0"); |
|
|
|
IEnumerable<ProductAltUnit> modifiedCart = await m_productService.FetchProductAltUnit(date, "BRID0"); |
|
|
|
SyncTimestamp syncTimestamp = new SyncTimestamp { TableName = "productaltunit", Timestamp = DateTime.Now.AddSeconds(-10) }; |
|
|
|
int batchSize = 200; |
|
|
|
int totalItems = modifiedCart.Count(); |
|
|
@ -196,7 +198,7 @@ namespace ServerManager.SyncMethods |
|
|
|
|
|
|
|
for (int batchIndex = 0; batchIndex < batches; batchIndex++) |
|
|
|
{ |
|
|
|
List<RestockLevel> batch = modifiedCart.Skip(batchIndex * batchSize).Take(batchSize).ToList(); |
|
|
|
List<ProductAltUnit> batch = modifiedCart.Skip(batchIndex * batchSize).Take(batchSize).ToList(); |
|
|
|
|
|
|
|
var response = await m_httpClient.PostAsJsonAsync("/api/SyncProducts/publish/tblProductAltUnit", batch); |
|
|
|
if (response.IsSuccessStatusCode) |
|
|
@ -207,6 +209,10 @@ namespace ServerManager.SyncMethods |
|
|
|
|
|
|
|
//Set last sync date
|
|
|
|
await m_httpClient.PostAsJsonAsync("/api/SyncProducts/setsyncdate", syncTimestamp); |
|
|
|
}catch (Exception ex) |
|
|
|
{ |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
private async Task SyncStockAsync() |
|
|
|
{var responseMessage = await m_httpClient.GetAsync("/api/SyncProducts/lastsyncdate/tbstock"); |
|
|
|