public async Task WhenAsync(MergePatchPicklistDto c)
        {
            var idObj         = (c as IMergePatchPicklist).PicklistId;
            var uriParameters = new PicklistUriParameters();

            uriParameters.Id = idObj;

            var req  = new PicklistPatchRequest(uriParameters, (MergePatchPicklistDto)c);
            var resp = await _ramlClient.Picklist.Patch(req);

            PicklistProxyUtils.ThrowOnHttpResponseError(resp);
        }
        public async virtual Task <IPicklistRoleState> GetPicklistRoleAsync(string picklistId, PartyRoleId partyRoleId)
        {
            var uriParameters = new PicklistRoleUriParameters();

            uriParameters.PicklistId  = picklistId;
            uriParameters.PartyRoleId = ((new ValueObjectTextFormatter <PartyRoleId>())).ToString(partyRoleId);

            var req  = new PicklistRoleGetRequest(uriParameters);
            var resp = await _ramlClient.PicklistRole.Get(req);

            PicklistProxyUtils.ThrowOnHttpResponseError(resp);
            return((resp.Content == null) ? null : resp.Content.ToPicklistRoleState());
        }
        public async Task <IPicklistState> GetHistoryStateAsync(string picklistId, long version)
        {
            var idObj         = picklistId;
            var uriParameters = new PicklistHistoryStateUriParameters();

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

            var req  = new PicklistHistoryStateGetRequest(uriParameters);
            var resp = await _ramlClient.PicklistHistoryState.Get(req);

            PicklistProxyUtils.ThrowOnHttpResponseError(resp);
            return((resp.Content == null) ? null : resp.Content.ToPicklistState());
        }
        public async Task <IPicklistEvent> GetStateEventAsync(string picklistId, long version)
        {
            var idObj         = picklistId;
            var uriParameters = new PicklistStateEventUriParameters();

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

            var req  = new PicklistStateEventGetRequest(uriParameters);
            var resp = await _ramlClient.PicklistStateEvent.Get(req);

            PicklistProxyUtils.ThrowOnHttpResponseError(resp);
            return(resp.Content);
        }
        public async Task <IPicklistState> GetAsync(string picklistId)
        {
            IPicklistState state         = null;
            var            idObj         = picklistId;
            var            uriParameters = new PicklistUriParameters();

            uriParameters.Id = idObj;

            var req = new PicklistGetRequest(uriParameters);

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

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

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

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

            PicklistProxyUtils.ThrowOnHttpResponseError(resp);
            states = (resp.Content == null) ? null : resp.Content.Select(e => e.ToPicklistState());
            return(states);
        }
        public async Task WhenAsync(DeletePicklistDto c)
        {
            var idObj         = (c as IDeletePicklist).PicklistId;
            var uriParameters = new PicklistUriParameters();

            uriParameters.Id = idObj;

            var q = new PicklistDeleteQuery();

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

            var req = new PicklistDeleteRequest(uriParameters);

            req.Query = q;

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

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

            q.Filter = PicklistProxyUtils.GetFilterQueryValueString(filter);
            var req = new PicklistsCountGetRequest();

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

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