Exemple #1
0
        public async Task WhenAsync(MergePatchOrganizationStructureDto c)
        {
            var idObj         = OrganizationStructureProxyUtils.ToIdString((c as IMergePatchOrganizationStructure).Id);
            var uriParameters = new OrganizationStructureUriParameters();

            uriParameters.Id = idObj;

            var req  = new OrganizationStructurePatchRequest(uriParameters, (MergePatchOrganizationStructureDto)c);
            var resp = await _ramlClient.OrganizationStructure.Patch(req);

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

            q.Filter = OrganizationStructureProxyUtils.GetFilterQueryValueString(filter);
            var req = new OrganizationStructuresCountGetRequest();

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

            OrganizationStructureProxyUtils.ThrowOnHttpResponseError(resp);
            return(long.Parse(await resp.RawContent.ReadAsStringAsync()));
        }
Exemple #3
0
        public async Task <IOrganizationStructureState> GetHistoryStateAsync(OrganizationStructureId id, long version)
        {
            var idObj         = OrganizationStructureProxyUtils.ToIdString(id);
            var uriParameters = new OrganizationStructureHistoryStateUriParameters();

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

            var req  = new OrganizationStructureHistoryStateGetRequest(uriParameters);
            var resp = await _ramlClient.OrganizationStructureHistoryState.Get(req);

            OrganizationStructureProxyUtils.ThrowOnHttpResponseError(resp);
            return((resp.Content == null) ? null : resp.Content.ToOrganizationStructureState());
        }
Exemple #4
0
        public async Task <IOrganizationStructureEvent> GetStateEventAsync(OrganizationStructureId id, long version)
        {
            var idObj         = OrganizationStructureProxyUtils.ToIdString(id);
            var uriParameters = new OrganizationStructureStateEventUriParameters();

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

            var req  = new OrganizationStructureStateEventGetRequest(uriParameters);
            var resp = await _ramlClient.OrganizationStructureStateEvent.Get(req);

            OrganizationStructureProxyUtils.ThrowOnHttpResponseError(resp);
            return(resp.Content);
        }
Exemple #5
0
        public async Task <IOrganizationStructureState> GetAsync(OrganizationStructureId id)
        {
            IOrganizationStructureState state = null;
            var idObj         = OrganizationStructureProxyUtils.ToIdString(id);
            var uriParameters = new OrganizationStructureUriParameters();

            uriParameters.Id = idObj;

            var req = new OrganizationStructureGetRequest(uriParameters);

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

            OrganizationStructureProxyUtils.ThrowOnHttpResponseError(resp);
            state = (resp.Content == null) ? null : resp.Content.ToOrganizationStructureState();
            return(state);
        }
Exemple #6
0
        public async Task <IEnumerable <IOrganizationStructureState> > GetAsync(ICriterion filter, IList <string> orders = null, int firstResult = 0, int maxResults = int.MaxValue, IList <string> fields = null)
        {
            IEnumerable <IOrganizationStructureState> states = null;
            var q = new OrganizationStructuresGetQuery();

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

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

            OrganizationStructureProxyUtils.ThrowOnHttpResponseError(resp);
            states = (resp.Content == null) ? null : resp.Content.Select(e => e.ToOrganizationStructureState());
            return(states);
        }
Exemple #7
0
        public async Task WhenAsync(DeleteOrganizationStructureDto c)
        {
            var idObj         = OrganizationStructureProxyUtils.ToIdString((c as IDeleteOrganizationStructure).Id);
            var uriParameters = new OrganizationStructureUriParameters();

            uriParameters.Id = idObj;

            var q = new OrganizationStructureDeleteQuery();

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

            var req = new OrganizationStructureDeleteRequest(uriParameters);

            req.Query = q;

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

            OrganizationStructureProxyUtils.ThrowOnHttpResponseError(resp);
        }
Exemple #8
0
        public async virtual Task <long> GetCountAsync(ICriterion filter)
        {
            var q = new OrganizationStructuresCountGetQuery();

            q.Filter = OrganizationStructureProxyUtils.GetFilterQueryValueString(filter);
            var req = new OrganizationStructuresCountGetRequest();

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

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