예제 #1
0
        public async Task WhenAsync(MergePatchInventoryPostingRuleDto c)
        {
            var idObj         = (c as IMergePatchInventoryPostingRule).InventoryPostingRuleId;
            var uriParameters = new InventoryPostingRuleUriParameters();

            uriParameters.Id = idObj;

            var req  = new InventoryPostingRulePatchRequest(uriParameters, (MergePatchInventoryPostingRuleDto)c);
            var resp = await _ramlClient.InventoryPostingRule.Patch(req);

            InventoryPostingRuleProxyUtils.ThrowOnHttpResponseError(resp);
        }
예제 #2
0
        public async Task <IInventoryPostingRuleState> GetHistoryStateAsync(string inventoryPostingRuleId, long version)
        {
            var idObj         = inventoryPostingRuleId;
            var uriParameters = new InventoryPostingRuleHistoryStateUriParameters();

            uriParameters.Id      = idObj;
            uriParameters.Version = version.ToString();

            var req  = new InventoryPostingRuleHistoryStateGetRequest(uriParameters);
            var resp = await _ramlClient.InventoryPostingRuleHistoryState.Get(req);

            InventoryPostingRuleProxyUtils.ThrowOnHttpResponseError(resp);
            return((resp.Content == null) ? null : resp.Content.ToInventoryPostingRuleState());
        }
예제 #3
0
        public async Task <IInventoryPostingRuleEvent> GetStateEventAsync(string inventoryPostingRuleId, long version)
        {
            var idObj         = inventoryPostingRuleId;
            var uriParameters = new InventoryPostingRuleStateEventUriParameters();

            uriParameters.Id      = idObj;
            uriParameters.Version = version.ToString();

            var req  = new InventoryPostingRuleStateEventGetRequest(uriParameters);
            var resp = await _ramlClient.InventoryPostingRuleStateEvent.Get(req);

            InventoryPostingRuleProxyUtils.ThrowOnHttpResponseError(resp);
            return(resp.Content);
        }
예제 #4
0
        public async Task <IInventoryPostingRuleState> GetAsync(string inventoryPostingRuleId)
        {
            IInventoryPostingRuleState state = null;
            var idObj         = inventoryPostingRuleId;
            var uriParameters = new InventoryPostingRuleUriParameters();

            uriParameters.Id = idObj;

            var req = new InventoryPostingRuleGetRequest(uriParameters);

            var resp = await _ramlClient.InventoryPostingRule.Get(req);

            InventoryPostingRuleProxyUtils.ThrowOnHttpResponseError(resp);
            state = (resp.Content == null) ? null : resp.Content.ToInventoryPostingRuleState();
            return(state);
        }
예제 #5
0
        public async Task <IEnumerable <IInventoryPostingRuleState> > GetAsync(ICriterion filter, IList <string> orders = null, int firstResult = 0, int maxResults = int.MaxValue, IList <string> fields = null)
        {
            IEnumerable <IInventoryPostingRuleState> states = null;
            var q = new InventoryPostingRulesGetQuery();

            q.FirstResult = firstResult;
            q.MaxResults  = maxResults;
            q.Sort        = InventoryPostingRuleProxyUtils.GetOrdersQueryValueString(orders);
            q.Fields      = InventoryPostingRuleProxyUtils.GetReturnedFieldsQueryValueString(fields, QueryFieldValueSeparator);
            q.Filter      = InventoryPostingRuleProxyUtils.GetFilterQueryValueString(filter);
            var req = new InventoryPostingRulesGetRequest();

            req.Query = q;
            var resp = await _ramlClient.InventoryPostingRules.Get(req);

            InventoryPostingRuleProxyUtils.ThrowOnHttpResponseError(resp);
            states = (resp.Content == null) ? null : resp.Content.Select(e => e.ToInventoryPostingRuleState());
            return(states);
        }
예제 #6
0
        public async Task WhenAsync(DeleteInventoryPostingRuleDto c)
        {
            var idObj         = (c as IDeleteInventoryPostingRule).InventoryPostingRuleId;
            var uriParameters = new InventoryPostingRuleUriParameters();

            uriParameters.Id = idObj;

            var q = new InventoryPostingRuleDeleteQuery();

            q.CommandId   = c.CommandId;
            q.RequesterId = c.RequesterId;
            q.Version     = Convert.ToString(c.Version);

            var req = new InventoryPostingRuleDeleteRequest(uriParameters);

            req.Query = q;

            var resp = await _ramlClient.InventoryPostingRule.Delete(req);

            InventoryPostingRuleProxyUtils.ThrowOnHttpResponseError(resp);
        }
예제 #7
0
        public async virtual Task <long> GetCountAsync(ICriterion filter)
        {
            var q = new InventoryPostingRulesCountGetQuery();

            q.Filter = InventoryPostingRuleProxyUtils.GetFilterQueryValueString(filter);
            var req = new InventoryPostingRulesCountGetRequest();

            req.Query = q;
            var resp = await _ramlClient.InventoryPostingRulesCount.Get(req);

            InventoryPostingRuleProxyUtils.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));
        }