コード例 #1
0
        public async Task <IEnumerable <IPartyRoleState> > GetAsync(IEnumerable <KeyValuePair <string, object> > filter, IList <string> orders = null, int firstResult = 0, int maxResults = int.MaxValue, IList <string> fields = null)
        {
            IEnumerable <IPartyRoleState> states = null;
            var q = new PartyRolesGetQuery();

            q.FirstResult = firstResult;
            q.MaxResults  = maxResults;
            q.Sort        = PartyRoleProxyUtils.GetOrdersQueryValueString(orders);
            q.Fields      = PartyRoleProxyUtils.GetReturnedFieldsQueryValueString(fields, QueryFieldValueSeparator);
            q.FilterTag   = PartyRoleProxyUtils.GetFilterTagQueryValueString(filter);
            var req = new PartyRolesGetRequest();

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

            PartyRoleProxyUtils.ThrowOnHttpResponseError(resp);
            states = (resp.Content == null) ? null : resp.Content.Select(e => e.ToPartyRoleState());
            return(states);
        }
コード例 #2
0
        public async virtual Task <long> GetCountAsync(IEnumerable <KeyValuePair <string, object> > filter)
        {
            var q = new PartyRolesCountGetQuery();

            q.FilterTag = PartyRoleProxyUtils.GetFilterTagQueryValueString(filter);
            var req = new PartyRolesCountGetRequest();

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

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