Example #1
0
        public async Task WhenAsync(MergePatchInOutDto c)
        {
            var idObj         = (c as IMergePatchInOut).DocumentNumber;
            var uriParameters = new InOutUriParameters();

            uriParameters.Id = idObj;

            var req  = new InOutPatchRequest(uriParameters, (MergePatchInOutDto)c);
            var resp = await _ramlClient.InOut.Patch(req);

            InOutProxyUtils.ThrowOnHttpResponseError(resp);
        }
Example #2
0
        public async virtual Task <IInOutLineState> GetInOutLineAsync(string inOutDocumentNumber, long lineNumber)
        {
            var uriParameters = new InOutLineUriParameters();

            uriParameters.InOutDocumentNumber = inOutDocumentNumber;
            uriParameters.LineNumber          = lineNumber;

            var req  = new InOutLineGetRequest(uriParameters);
            var resp = await _ramlClient.InOutLine.Get(req);

            InOutProxyUtils.ThrowOnHttpResponseError(resp);
            return((resp.Content == null) ? null : resp.Content.ToInOutLineState());
        }
Example #3
0
        public async Task <IInOutState> GetHistoryStateAsync(string documentNumber, long version)
        {
            var idObj         = documentNumber;
            var uriParameters = new InOutHistoryStateUriParameters();

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

            var req  = new InOutHistoryStateGetRequest(uriParameters);
            var resp = await _ramlClient.InOutHistoryState.Get(req);

            InOutProxyUtils.ThrowOnHttpResponseError(resp);
            return((resp.Content == null) ? null : resp.Content.ToInOutState());
        }
Example #4
0
        public async Task <IInOutStateEvent> GetStateEventAsync(string documentNumber, long version)
        {
            var idObj         = documentNumber;
            var uriParameters = new InOutStateEventUriParameters();

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

            var req  = new InOutStateEventGetRequest(uriParameters);
            var resp = await _ramlClient.InOutStateEvent.Get(req);

            InOutProxyUtils.ThrowOnHttpResponseError(resp);
            return(resp.Content);
        }
Example #5
0
        public async Task <IInOutState> GetAsync(string documentNumber)
        {
            IInOutState state         = null;
            var         idObj         = documentNumber;
            var         uriParameters = new InOutUriParameters();

            uriParameters.Id = idObj;

            var req = new InOutGetRequest(uriParameters);

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

            InOutProxyUtils.ThrowOnHttpResponseError(resp);
            state = (resp.Content == null) ? null : resp.Content.ToInOutState();
            return(state);
        }
Example #6
0
        public async Task <IEnumerable <IInOutState> > GetAsync(ICriterion filter, IList <string> orders = null, int firstResult = 0, int maxResults = int.MaxValue, IList <string> fields = null)
        {
            IEnumerable <IInOutState> states = null;
            var q = new InOutsGetQuery();

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

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

            InOutProxyUtils.ThrowOnHttpResponseError(resp);
            states = (resp.Content == null) ? null : resp.Content.Select(e => e.ToInOutState());
            return(states);
        }
Example #7
0
        public async Task WhenAsync(DeleteInOutDto c)
        {
            var idObj         = (c as IDeleteInOut).DocumentNumber;
            var uriParameters = new InOutUriParameters();

            uriParameters.Id = idObj;

            var q = new InOutDeleteQuery();

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

            var req = new InOutDeleteRequest(uriParameters);

            req.Query = q;

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

            InOutProxyUtils.ThrowOnHttpResponseError(resp);
        }
Example #8
0
        public async virtual Task <long> GetCountAsync(ICriterion filter)
        {
            var q = new InOutsCountGetQuery();

            q.Filter = InOutProxyUtils.GetFilterQueryValueString(filter);
            var req = new InOutsCountGetRequest();

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

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