예제 #1
0
        public async Task WhenAsync(MergePatchMovementTypeDto c)
        {
            var idObj         = (c as IMergePatchMovementType).MovementTypeId;
            var uriParameters = new MovementTypeUriParameters();

            uriParameters.Id = idObj;

            var req  = new MovementTypePatchRequest(uriParameters, (MergePatchMovementTypeDto)c);
            var resp = await _ramlClient.MovementType.Patch(req);

            MovementTypeProxyUtils.ThrowOnHttpResponseError(resp);
        }
예제 #2
0
        public async Task <IMovementTypeState> GetHistoryStateAsync(string movementTypeId, long version)
        {
            var idObj         = movementTypeId;
            var uriParameters = new MovementTypeHistoryStateUriParameters();

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

            var req  = new MovementTypeHistoryStateGetRequest(uriParameters);
            var resp = await _ramlClient.MovementTypeHistoryState.Get(req);

            MovementTypeProxyUtils.ThrowOnHttpResponseError(resp);
            return((resp.Content == null) ? null : resp.Content.ToMovementTypeState());
        }
예제 #3
0
        public async Task <IMovementTypeEvent> GetStateEventAsync(string movementTypeId, long version)
        {
            var idObj         = movementTypeId;
            var uriParameters = new MovementTypeStateEventUriParameters();

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

            var req  = new MovementTypeStateEventGetRequest(uriParameters);
            var resp = await _ramlClient.MovementTypeStateEvent.Get(req);

            MovementTypeProxyUtils.ThrowOnHttpResponseError(resp);
            return(resp.Content);
        }
예제 #4
0
        public async Task <IMovementTypeState> GetAsync(string movementTypeId)
        {
            IMovementTypeState state = null;
            var idObj         = movementTypeId;
            var uriParameters = new MovementTypeUriParameters();

            uriParameters.Id = idObj;

            var req = new MovementTypeGetRequest(uriParameters);

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

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

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

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

            MovementTypeProxyUtils.ThrowOnHttpResponseError(resp);
            states = (resp.Content == null) ? null : resp.Content.Select(e => e.ToMovementTypeState());
            return(states);
        }
예제 #6
0
        public async Task WhenAsync(DeleteMovementTypeDto c)
        {
            var idObj         = (c as IDeleteMovementType).MovementTypeId;
            var uriParameters = new MovementTypeUriParameters();

            uriParameters.Id = idObj;

            var q = new MovementTypeDeleteQuery();

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

            var req = new MovementTypeDeleteRequest(uriParameters);

            req.Query = q;

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

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

            q.Filter = MovementTypeProxyUtils.GetFilterQueryValueString(filter);
            var req = new MovementTypesCountGetRequest();

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

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