Esempio n. 1
0
        public async Task WhenAsync(MergePatchMovementDto c)
        {
            var idObj         = (c as IMergePatchMovement).DocumentNumber;
            var uriParameters = new MovementUriParameters();

            uriParameters.Id = idObj;

            var req  = new MovementPatchRequest(uriParameters, (MergePatchMovementDto)c);
            var resp = await _ramlClient.Movement.Patch(req);

            MovementProxyUtils.ThrowOnHttpResponseError(resp);
        }
Esempio n. 2
0
        public async virtual Task <IMovementLineState> GetMovementLineAsync(string movementDocumentNumber, string lineNumber)
        {
            var uriParameters = new MovementLineUriParameters();

            uriParameters.MovementDocumentNumber = movementDocumentNumber;
            uriParameters.LineNumber             = lineNumber;

            var req  = new MovementLineGetRequest(uriParameters);
            var resp = await _ramlClient.MovementLine.Get(req);

            MovementProxyUtils.ThrowOnHttpResponseError(resp);
            return((resp.Content == null) ? null : resp.Content.ToMovementLineState());
        }
Esempio n. 3
0
        public async Task <IMovementState> GetHistoryStateAsync(string documentNumber, long version)
        {
            var idObj         = documentNumber;
            var uriParameters = new MovementHistoryStateUriParameters();

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

            var req  = new MovementHistoryStateGetRequest(uriParameters);
            var resp = await _ramlClient.MovementHistoryState.Get(req);

            MovementProxyUtils.ThrowOnHttpResponseError(resp);
            return((resp.Content == null) ? null : resp.Content.ToMovementState());
        }
Esempio n. 4
0
        public async Task <IMovementEvent> GetStateEventAsync(string documentNumber, long version)
        {
            var idObj         = documentNumber;
            var uriParameters = new MovementStateEventUriParameters();

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

            var req  = new MovementStateEventGetRequest(uriParameters);
            var resp = await _ramlClient.MovementStateEvent.Get(req);

            MovementProxyUtils.ThrowOnHttpResponseError(resp);
            return(resp.Content);
        }
Esempio n. 5
0
        public async Task <IMovementState> GetAsync(string documentNumber)
        {
            IMovementState state         = null;
            var            idObj         = documentNumber;
            var            uriParameters = new MovementUriParameters();

            uriParameters.Id = idObj;

            var req = new MovementGetRequest(uriParameters);

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

            MovementProxyUtils.ThrowOnHttpResponseError(resp);
            state = (resp.Content == null) ? null : resp.Content.ToMovementState();
            return(state);
        }
Esempio n. 6
0
        public async Task <IEnumerable <IMovementState> > GetAsync(ICriterion filter, IList <string> orders = null, int firstResult = 0, int maxResults = int.MaxValue, IList <string> fields = null)
        {
            IEnumerable <IMovementState> states = null;
            var q = new MovementsGetQuery();

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

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

            MovementProxyUtils.ThrowOnHttpResponseError(resp);
            states = (resp.Content == null) ? null : resp.Content.Select(e => e.ToMovementState());
            return(states);
        }
Esempio n. 7
0
        public async Task WhenAsync(DeleteMovementDto c)
        {
            var idObj         = (c as IDeleteMovement).DocumentNumber;
            var uriParameters = new MovementUriParameters();

            uriParameters.Id = idObj;

            var q = new MovementDeleteQuery();

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

            var req = new MovementDeleteRequest(uriParameters);

            req.Query = q;

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

            MovementProxyUtils.ThrowOnHttpResponseError(resp);
        }
Esempio n. 8
0
        public async virtual Task <long> GetCountAsync(ICriterion filter)
        {
            var q = new MovementsCountGetQuery();

            q.Filter = MovementProxyUtils.GetFilterQueryValueString(filter);
            var req = new MovementsCountGetRequest();

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

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