public async Task WhenAsync(MergePatchPicklistBinDto c)
        {
            var idObj         = (c as IMergePatchPicklistBin).PicklistBinId;
            var uriParameters = new PicklistBinUriParameters();

            uriParameters.Id = idObj;

            var req  = new PicklistBinPatchRequest(uriParameters, (MergePatchPicklistBinDto)c);
            var resp = await _ramlClient.PicklistBin.Patch(req);

            PicklistBinProxyUtils.ThrowOnHttpResponseError(resp);
        }
        public async virtual Task <IPicklistItemState> GetPicklistItemAsync(string picklistBinId, PicklistItemOrderShipGrpInvId picklistItemOrderShipGrpInvId)
        {
            var uriParameters = new PicklistItemUriParameters();

            uriParameters.PicklistBinId = picklistBinId;
            uriParameters.PicklistItemOrderShipGrpInvId = ((new ValueObjectTextFormatter <PicklistItemOrderShipGrpInvId>())).ToString(picklistItemOrderShipGrpInvId);

            var req  = new PicklistItemGetRequest(uriParameters);
            var resp = await _ramlClient.PicklistItem.Get(req);

            PicklistBinProxyUtils.ThrowOnHttpResponseError(resp);
            return((resp.Content == null) ? null : resp.Content.ToPicklistItemState());
        }
        public async Task <IPicklistBinState> GetHistoryStateAsync(string picklistBinId, long version)
        {
            var idObj         = picklistBinId;
            var uriParameters = new PicklistBinHistoryStateUriParameters();

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

            var req  = new PicklistBinHistoryStateGetRequest(uriParameters);
            var resp = await _ramlClient.PicklistBinHistoryState.Get(req);

            PicklistBinProxyUtils.ThrowOnHttpResponseError(resp);
            return((resp.Content == null) ? null : resp.Content.ToPicklistBinState());
        }
        public async Task <IPicklistBinEvent> GetStateEventAsync(string picklistBinId, long version)
        {
            var idObj         = picklistBinId;
            var uriParameters = new PicklistBinStateEventUriParameters();

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

            var req  = new PicklistBinStateEventGetRequest(uriParameters);
            var resp = await _ramlClient.PicklistBinStateEvent.Get(req);

            PicklistBinProxyUtils.ThrowOnHttpResponseError(resp);
            return(resp.Content);
        }
        public async Task <IPicklistBinState> GetAsync(string picklistBinId)
        {
            IPicklistBinState state = null;
            var idObj         = picklistBinId;
            var uriParameters = new PicklistBinUriParameters();

            uriParameters.Id = idObj;

            var req = new PicklistBinGetRequest(uriParameters);

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

            PicklistBinProxyUtils.ThrowOnHttpResponseError(resp);
            state = (resp.Content == null) ? null : resp.Content.ToPicklistBinState();
            return(state);
        }
        public async Task <IEnumerable <IPicklistBinState> > GetAsync(ICriterion filter, IList <string> orders = null, int firstResult = 0, int maxResults = int.MaxValue, IList <string> fields = null)
        {
            IEnumerable <IPicklistBinState> states = null;
            var q = new PicklistBinsGetQuery();

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

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

            PicklistBinProxyUtils.ThrowOnHttpResponseError(resp);
            states = (resp.Content == null) ? null : resp.Content.Select(e => e.ToPicklistBinState());
            return(states);
        }
        public async Task WhenAsync(DeletePicklistBinDto c)
        {
            var idObj         = (c as IDeletePicklistBin).PicklistBinId;
            var uriParameters = new PicklistBinUriParameters();

            uriParameters.Id = idObj;

            var q = new PicklistBinDeleteQuery();

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

            var req = new PicklistBinDeleteRequest(uriParameters);

            req.Query = q;

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

            PicklistBinProxyUtils.ThrowOnHttpResponseError(resp);
        }
        public async virtual Task <long> GetCountAsync(ICriterion filter)
        {
            var q = new PicklistBinsCountGetQuery();

            q.Filter = PicklistBinProxyUtils.GetFilterQueryValueString(filter);
            var req = new PicklistBinsCountGetRequest();

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

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