示例#1
0
        public async Task WhenAsync(MergePatchUomTypeDto c)
        {
            var idObj         = (c as IMergePatchUomType).UomTypeId;
            var uriParameters = new UomTypeUriParameters();

            uriParameters.Id = idObj;

            var req  = new UomTypePatchRequest(uriParameters, (MergePatchUomTypeDto)c);
            var resp = await _ramlClient.UomType.Patch(req);

            UomTypeProxyUtils.ThrowOnHttpResponseError(resp);
        }
示例#2
0
        public async Task <IUomTypeState> GetHistoryStateAsync(string uomTypeId, long version)
        {
            var idObj         = uomTypeId;
            var uriParameters = new UomTypeHistoryStateUriParameters();

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

            var req  = new UomTypeHistoryStateGetRequest(uriParameters);
            var resp = await _ramlClient.UomTypeHistoryState.Get(req);

            UomTypeProxyUtils.ThrowOnHttpResponseError(resp);
            return((resp.Content == null) ? null : resp.Content.ToUomTypeState());
        }
示例#3
0
        public async Task <IUomTypeEvent> GetStateEventAsync(string uomTypeId, long version)
        {
            var idObj         = uomTypeId;
            var uriParameters = new UomTypeStateEventUriParameters();

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

            var req  = new UomTypeStateEventGetRequest(uriParameters);
            var resp = await _ramlClient.UomTypeStateEvent.Get(req);

            UomTypeProxyUtils.ThrowOnHttpResponseError(resp);
            return(resp.Content);
        }
示例#4
0
        public async Task <IUomTypeState> GetAsync(string uomTypeId)
        {
            IUomTypeState state         = null;
            var           idObj         = uomTypeId;
            var           uriParameters = new UomTypeUriParameters();

            uriParameters.Id = idObj;

            var req = new UomTypeGetRequest(uriParameters);

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

            UomTypeProxyUtils.ThrowOnHttpResponseError(resp);
            state = (resp.Content == null) ? null : resp.Content.ToUomTypeState();
            return(state);
        }
示例#5
0
        public async Task <IEnumerable <IUomTypeState> > GetAsync(ICriterion filter, IList <string> orders = null, int firstResult = 0, int maxResults = int.MaxValue, IList <string> fields = null)
        {
            IEnumerable <IUomTypeState> states = null;
            var q = new UomTypesGetQuery();

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

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

            UomTypeProxyUtils.ThrowOnHttpResponseError(resp);
            states = (resp.Content == null) ? null : resp.Content.Select(e => e.ToUomTypeState());
            return(states);
        }
示例#6
0
        public async Task WhenAsync(DeleteUomTypeDto c)
        {
            var idObj         = (c as IDeleteUomType).UomTypeId;
            var uriParameters = new UomTypeUriParameters();

            uriParameters.Id = idObj;

            var q = new UomTypeDeleteQuery();

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

            var req = new UomTypeDeleteRequest(uriParameters);

            req.Query = q;

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

            UomTypeProxyUtils.ThrowOnHttpResponseError(resp);
        }
示例#7
0
        public async virtual Task <long> GetCountAsync(ICriterion filter)
        {
            var q = new UomTypesCountGetQuery();

            q.Filter = UomTypeProxyUtils.GetFilterQueryValueString(filter);
            var req = new UomTypesCountGetRequest();

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

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