Beispiel #1
0
        public async Task WhenAsync(MergePatchOrganizationDto c)
        {
            var idObj         = (c as IMergePatchOrganization).OrganizationId;
            var uriParameters = new OrganizationUriParameters();

            uriParameters.Id = idObj;

            var req  = new OrganizationPatchRequest(uriParameters, (MergePatchOrganizationDto)c);
            var resp = await _ramlClient.Organization.Patch(req);

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

            q.Filter = OrganizationProxyUtils.GetFilterQueryValueString(filter);
            var req = new OrganizationsCountGetRequest();

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

            OrganizationProxyUtils.ThrowOnHttpResponseError(resp);
            return(long.Parse(await resp.RawContent.ReadAsStringAsync()));
        }
Beispiel #3
0
        public async Task <IOrganizationState> GetHistoryStateAsync(string organizationId, long version)
        {
            var idObj         = organizationId;
            var uriParameters = new OrganizationHistoryStateUriParameters();

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

            var req  = new OrganizationHistoryStateGetRequest(uriParameters);
            var resp = await _ramlClient.OrganizationHistoryState.Get(req);

            OrganizationProxyUtils.ThrowOnHttpResponseError(resp);
            return((resp.Content == null) ? null : resp.Content.ToOrganizationState());
        }
Beispiel #4
0
        public async Task <IOrganizationStateEvent> GetStateEventAsync(string organizationId, long version)
        {
            var idObj         = organizationId;
            var uriParameters = new OrganizationStateEventUriParameters();

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

            var req  = new OrganizationStateEventGetRequest(uriParameters);
            var resp = await _ramlClient.OrganizationStateEvent.Get(req);

            OrganizationProxyUtils.ThrowOnHttpResponseError(resp);
            return(resp.Content);
        }
Beispiel #5
0
        public async Task <IOrganizationState> GetAsync(string organizationId)
        {
            IOrganizationState state = null;
            var idObj         = organizationId;
            var uriParameters = new OrganizationUriParameters();

            uriParameters.Id = idObj;

            var req = new OrganizationGetRequest(uriParameters);

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

            OrganizationProxyUtils.ThrowOnHttpResponseError(resp);
            state = (resp.Content == null) ? null : resp.Content.ToOrganizationState();
            return(state);
        }
        public async Task <IEnumerable <IOrganizationState> > GetRootsAsync(ICriterion filter, IList <string> orders = null, int firstResult = 0, int maxResults = int.MaxValue, IList <string> fields = null)
        {
            IEnumerable <IOrganizationState> states = null;
            var q = new OrganizationTreesGetQuery();

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

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

            OrganizationProxyUtils.ThrowOnHttpResponseError(resp);
            states = resp.Content;
            return(states);
        }
Beispiel #7
0
        public async Task <IEnumerable <IOrganizationState> > GetAsync(IEnumerable <KeyValuePair <string, object> > filter, IList <string> orders = null, int firstResult = 0, int maxResults = int.MaxValue, IList <string> fields = null)
        {
            IEnumerable <IOrganizationState> states = null;
            var q = new OrganizationsGetQuery();

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

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

            OrganizationProxyUtils.ThrowOnHttpResponseError(resp);
            states = (resp.Content == null) ? null : resp.Content.Select(e => e.ToOrganizationState());
            return(states);
        }
        public async Task <IEnumerable <string> > GetChildIdsAsync(string parentId, IEnumerable <KeyValuePair <string, object> > filter, IList <string> orders = null, int firstResult = 0, int maxResults = int.MaxValue, IList <string> fields = null)
        {
            IEnumerable <IOrganizationState> states = null;
            var q           = new OrganizationTreesGetQuery();
            var parentIdObj = (parentId);

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

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

            OrganizationProxyUtils.ThrowOnHttpResponseError(resp);
            states = resp.Content;
            return(OrganizationProxyUtils.ToIdCollection(states));
        }
Beispiel #9
0
        public async Task WhenAsync(DeleteOrganizationDto c)
        {
            var idObj         = (c as IDeleteOrganization).OrganizationId;
            var uriParameters = new OrganizationUriParameters();

            uriParameters.Id = idObj;

            var q = new OrganizationDeleteQuery();

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

            var req = new OrganizationDeleteRequest(uriParameters);

            req.Query = q;

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

            OrganizationProxyUtils.ThrowOnHttpResponseError(resp);
        }
Beispiel #10
0
        public async virtual Task <long> GetCountAsync(ICriterion filter)
        {
            var q = new OrganizationsCountGetQuery();

            q.Filter = OrganizationProxyUtils.GetFilterQueryValueString(filter);
            var req = new OrganizationsCountGetRequest();

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

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