public async Task <IList <ICase> > GetCasesFromArrayAsync(string[] casesArray) { string filter = "WHERE CaseNumber in " + "('" + string.Join("','", casesArray) + "')"; string qry = @"SELECT Id, CaseNumber, Subject, Description, Status, Sub_Status__c, Priority, Type, RecordTypeId, RecordType.Id, RecordType.Name, OwnerId, Owner.Id, Owner.Name, CreatedDate, CreatedById, CreatedBy.Id, CreatedBy.Name, ClosedDate FROM CASE " + filter; if (string.IsNullOrEmpty(qry)) { return(new List <ICase>()); } IAsyncEnumerable <CaseDataHolder> result; try { var client = await GetForceClient(); result = client.QueryAsync <CaseDataHolder>(qry); } catch (Exception) { throw; } IList <ICase> cases = new List <ICase>(); using (IAsyncEnumerator <CaseDataHolder> contactsEnumerator = result.GetEnumerator()) { // MoveNext() will execute the query and get the first batch of results. // Once the inital result batch has been exhausted, the remaining batches, if any, will be retrieved. while (await contactsEnumerator.MoveNext()) { CaseDataHolder acase = contactsEnumerator.Current; cases.Add(acase.Convert()); } } if (Encrypt) { HideSensitive(cases); } return(cases); }
public async Task <IList <ICase> > GetCasesAsync(string casesQueue) { string qry = FormQuery(casesQueue); if (string.IsNullOrEmpty(qry)) { return(new List <ICase>()); } IAsyncEnumerable <CaseDataHolder> result; try { var client = await GetForceClient(); result = client.QueryAsync <CaseDataHolder>(qry); } catch (Exception e) { var ms = e.Message; throw; } IList <ICase> cases = new List <ICase>(); using (IAsyncEnumerator <CaseDataHolder> contactsEnumerator = result.GetEnumerator()) { // MoveNext() will execute the query and get the first batch of results. // Once the inital result batch has been exhausted, the remaining batches, if any, will be retrieved. while (await contactsEnumerator.MoveNext()) { CaseDataHolder acase = contactsEnumerator.Current; cases.Add(acase.Convert()); } } //var obj = JsonConvert.SerializeObject(cases); //Debug.WriteLine(obj); if (Encrypt) { HideSensitive(cases); } return(cases); }