public async Task <IEnumerable <IPhysicalInventoryState> > GetAsync(IEnumerable <KeyValuePair <string, object> > filter, IList <string> orders = null, int firstResult = 0, int maxResults = int.MaxValue, IList <string> fields = null) { IEnumerable <IPhysicalInventoryState> states = null; var q = new PhysicalInventoriesGetQuery(); q.FirstResult = firstResult; q.MaxResults = maxResults; q.Sort = PhysicalInventoryProxyUtils.GetOrdersQueryValueString(orders); q.Fields = PhysicalInventoryProxyUtils.GetReturnedFieldsQueryValueString(fields, QueryFieldValueSeparator); q.FilterTag = PhysicalInventoryProxyUtils.GetFilterTagQueryValueString(filter); var req = new PhysicalInventoriesGetRequest(); req.Query = q; var resp = await _ramlClient.PhysicalInventories.Get(req); PhysicalInventoryProxyUtils.ThrowOnHttpResponseError(resp); states = (resp.Content == null) ? null : resp.Content.Select(e => e.ToPhysicalInventoryState()); return(states); }
public async virtual Task <long> GetCountAsync(IEnumerable <KeyValuePair <string, object> > filter) { var q = new PhysicalInventoriesCountGetQuery(); q.FilterTag = PhysicalInventoryProxyUtils.GetFilterTagQueryValueString(filter); var req = new PhysicalInventoriesCountGetRequest(); req.Query = q; var resp = await _ramlClient.PhysicalInventoriesCount.Get(req); PhysicalInventoryProxyUtils.ThrowOnHttpResponseError(resp); string str = await resp.RawContent.ReadAsStringAsync(); if (str.StartsWith("\"")) { str = str.Substring(1); } if (str.EndsWith("\"")) { str = str.Substring(0, str.Length - 1); } return(long.Parse(str)); }