public async Task WhenAsync(MergePatchPhysicalInventoryDto c) { var idObj = (c as IMergePatchPhysicalInventory).DocumentNumber; var uriParameters = new PhysicalInventoryUriParameters(); uriParameters.Id = idObj; var req = new PhysicalInventoryPatchRequest(uriParameters, (MergePatchPhysicalInventoryDto)c); var resp = await _ramlClient.PhysicalInventory.Patch(req); PhysicalInventoryProxyUtils.ThrowOnHttpResponseError(resp); }
public async virtual Task <IPhysicalInventoryLineState> GetPhysicalInventoryLineAsync(string physicalInventoryDocumentNumber, InventoryItemId inventoryItemId) { var uriParameters = new PhysicalInventoryLineUriParameters(); uriParameters.PhysicalInventoryDocumentNumber = physicalInventoryDocumentNumber; uriParameters.InventoryItemId = ((new ValueObjectTextFormatter <InventoryItemId>())).ToString(inventoryItemId); var req = new PhysicalInventoryLineGetRequest(uriParameters); var resp = await _ramlClient.PhysicalInventoryLine.Get(req); PhysicalInventoryProxyUtils.ThrowOnHttpResponseError(resp); return((resp.Content == null) ? null : resp.Content.ToPhysicalInventoryLineState()); }
public async Task <IPhysicalInventoryState> GetHistoryStateAsync(string documentNumber, long version) { var idObj = documentNumber; var uriParameters = new PhysicalInventoryHistoryStateUriParameters(); uriParameters.Id = idObj; uriParameters.Version = version.ToString(); var req = new PhysicalInventoryHistoryStateGetRequest(uriParameters); var resp = await _ramlClient.PhysicalInventoryHistoryState.Get(req); PhysicalInventoryProxyUtils.ThrowOnHttpResponseError(resp); return((resp.Content == null) ? null : resp.Content.ToPhysicalInventoryState()); }
public async Task <IPhysicalInventoryState> GetAsync(string documentNumber) { IPhysicalInventoryState state = null; var idObj = documentNumber; var uriParameters = new PhysicalInventoryUriParameters(); uriParameters.Id = idObj; var req = new PhysicalInventoryGetRequest(uriParameters); var resp = await _ramlClient.PhysicalInventory.Get(req); PhysicalInventoryProxyUtils.ThrowOnHttpResponseError(resp); state = (resp.Content == null) ? null : resp.Content.ToPhysicalInventoryState(); return(state); }
public async Task <IEnumerable <IPhysicalInventoryState> > GetAsync(ICriterion 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.Filter = PhysicalInventoryProxyUtils.GetFilterQueryValueString(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 Task WhenAsync(DeletePhysicalInventoryDto c) { var idObj = (c as IDeletePhysicalInventory).DocumentNumber; var uriParameters = new PhysicalInventoryUriParameters(); uriParameters.Id = idObj; var q = new PhysicalInventoryDeleteQuery(); q.CommandId = c.CommandId; q.RequesterId = c.RequesterId; q.Version = Convert.ToString(c.Version); var req = new PhysicalInventoryDeleteRequest(uriParameters); req.Query = q; var resp = await _ramlClient.PhysicalInventory.Delete(req); PhysicalInventoryProxyUtils.ThrowOnHttpResponseError(resp); }
public async virtual Task <long> GetCountAsync(ICriterion filter) { var q = new PhysicalInventoriesCountGetQuery(); q.Filter = PhysicalInventoryProxyUtils.GetFilterQueryValueString(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)); }