Пример #1
0
        public async Task WhenAsync(MergePatchUomConversionDto c)
        {
            var idObj         = UomConversionProxyUtils.ToIdString((c as IMergePatchUomConversion).UomConversionId);
            var uriParameters = new UomConversionUriParameters();

            uriParameters.Id = idObj;

            var req  = new UomConversionPatchRequest(uriParameters, (MergePatchUomConversionDto)c);
            var resp = await _ramlClient.UomConversion.Patch(req);

            UomConversionProxyUtils.ThrowOnHttpResponseError(resp);
        }
Пример #2
0
        public async Task <IUomConversionState> GetHistoryStateAsync(UomConversionId uomConversionId, long version)
        {
            var idObj         = UomConversionProxyUtils.ToIdString(uomConversionId);
            var uriParameters = new UomConversionHistoryStateUriParameters();

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

            var req  = new UomConversionHistoryStateGetRequest(uriParameters);
            var resp = await _ramlClient.UomConversionHistoryState.Get(req);

            UomConversionProxyUtils.ThrowOnHttpResponseError(resp);
            return((resp.Content == null) ? null : resp.Content.ToUomConversionState());
        }
Пример #3
0
        public async Task <IUomConversionEvent> GetStateEventAsync(UomConversionId uomConversionId, long version)
        {
            var idObj         = UomConversionProxyUtils.ToIdString(uomConversionId);
            var uriParameters = new UomConversionStateEventUriParameters();

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

            var req  = new UomConversionStateEventGetRequest(uriParameters);
            var resp = await _ramlClient.UomConversionStateEvent.Get(req);

            UomConversionProxyUtils.ThrowOnHttpResponseError(resp);
            return(resp.Content);
        }
Пример #4
0
        public async Task <IUomConversionState> GetAsync(UomConversionId uomConversionId)
        {
            IUomConversionState state = null;
            var idObj         = UomConversionProxyUtils.ToIdString(uomConversionId);
            var uriParameters = new UomConversionUriParameters();

            uriParameters.Id = idObj;

            var req = new UomConversionGetRequest(uriParameters);

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

            UomConversionProxyUtils.ThrowOnHttpResponseError(resp);
            state = (resp.Content == null) ? null : resp.Content.ToUomConversionState();
            return(state);
        }
Пример #5
0
        public async Task <IEnumerable <IUomConversionState> > GetAsync(ICriterion filter, IList <string> orders = null, int firstResult = 0, int maxResults = int.MaxValue, IList <string> fields = null)
        {
            IEnumerable <IUomConversionState> states = null;
            var q = new UomConversionsGetQuery();

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

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

            UomConversionProxyUtils.ThrowOnHttpResponseError(resp);
            states = (resp.Content == null) ? null : resp.Content.Select(e => e.ToUomConversionState());
            return(states);
        }
Пример #6
0
        public async Task WhenAsync(DeleteUomConversionDto c)
        {
            var idObj         = UomConversionProxyUtils.ToIdString((c as IDeleteUomConversion).UomConversionId);
            var uriParameters = new UomConversionUriParameters();

            uriParameters.Id = idObj;

            var q = new UomConversionDeleteQuery();

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

            var req = new UomConversionDeleteRequest(uriParameters);

            req.Query = q;

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

            UomConversionProxyUtils.ThrowOnHttpResponseError(resp);
        }
Пример #7
0
        public async virtual Task <long> GetCountAsync(ICriterion filter)
        {
            var q = new UomConversionsCountGetQuery();

            q.Filter = UomConversionProxyUtils.GetFilterQueryValueString(filter);
            var req = new UomConversionsCountGetRequest();

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

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