public PushResponseforMultipleEntries <T> BuildResponse(string sessionId, T[] arrayofData, string moduleName) { PushResponseforMultipleEntries <T> pushResponse = new PushResponseforMultipleEntries <T>(); int SucceedCount = 0; int FailedCount = 0; foreach (var data in arrayofData) { try { var req = new AddUpdateSingleEntryRequest(); req.SessionId = sessionId; req.ModuleName = moduleName; req.Entity = data; var response = SuiteWrapper.AddUpdateSingleEntry(req).GetAwaiter().GetResult(); if (!string.IsNullOrEmpty(response.Id)) { SucceedCount++; } else { FailedCount++; } } catch (Exception) { FailedCount++; } } pushResponse.SucceedCount = SucceedCount; pushResponse.FailedCount = FailedCount; return(pushResponse); }
public static PullResponse <T> pullResponse(ReadEntryListResponse res, string methodName, bool deleted, string lastSyncDate) { PullResponse <T> response = new PullResponse <T>(); var listObjectConverted = SuiteWrapper.GetListObjectConverted <T>(res); response.data = listObjectConverted; if (int.Parse(res.TotalCount) == res.NextOffset || int.Parse(res.TotalCount) < res.NextOffset) { response.IsDataAvailable = false; } else { response.IsDataAvailable = true; } if (!response.IsDataAvailable) { response.NextDataURL = null; } else { response.NextDataURL = SuiteWrapper.nextURL + "api/SyncMasters/PullMasterData?methodName=" + methodName + "&lastSyncDate=" + lastSyncDate + "&nextOffSet=" + res.NextOffset + "&deleted=" + deleted + ""; } return(response); }
public static PullResponseWithoutPagination <T> pullResponse(ReadEntryListResponse res) { PullResponseWithoutPagination <T> response = new PullResponseWithoutPagination <T>(); var listObjectConverted = SuiteWrapper.GetListObjectConverted <T>(res); response.data = listObjectConverted; return(response); }