Example #1
0
        public async Task WhenAsync(MergePatchDocumentTypeDto c)
        {
            var idObj         = (c as IMergePatchDocumentType).DocumentTypeId;
            var uriParameters = new DocumentTypeUriParameters();

            uriParameters.Id = idObj;

            var req  = new DocumentTypePatchRequest(uriParameters, (MergePatchDocumentTypeDto)c);
            var resp = await _ramlClient.DocumentType.Patch(req);

            DocumentTypeProxyUtils.ThrowOnHttpResponseError(resp);
        }
Example #2
0
        public async Task <IDocumentTypeState> GetHistoryStateAsync(string documentTypeId, long version)
        {
            var idObj         = documentTypeId;
            var uriParameters = new DocumentTypeHistoryStateUriParameters();

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

            var req  = new DocumentTypeHistoryStateGetRequest(uriParameters);
            var resp = await _ramlClient.DocumentTypeHistoryState.Get(req);

            DocumentTypeProxyUtils.ThrowOnHttpResponseError(resp);
            return((resp.Content == null) ? null : resp.Content.ToDocumentTypeState());
        }
Example #3
0
        public async Task <IDocumentTypeEvent> GetStateEventAsync(string documentTypeId, long version)
        {
            var idObj         = documentTypeId;
            var uriParameters = new DocumentTypeStateEventUriParameters();

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

            var req  = new DocumentTypeStateEventGetRequest(uriParameters);
            var resp = await _ramlClient.DocumentTypeStateEvent.Get(req);

            DocumentTypeProxyUtils.ThrowOnHttpResponseError(resp);
            return(resp.Content);
        }
Example #4
0
        public async Task <IDocumentTypeState> GetAsync(string documentTypeId)
        {
            IDocumentTypeState state = null;
            var idObj         = documentTypeId;
            var uriParameters = new DocumentTypeUriParameters();

            uriParameters.Id = idObj;

            var req = new DocumentTypeGetRequest(uriParameters);

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

            DocumentTypeProxyUtils.ThrowOnHttpResponseError(resp);
            state = (resp.Content == null) ? null : resp.Content.ToDocumentTypeState();
            return(state);
        }
Example #5
0
        public async Task <IEnumerable <IDocumentTypeState> > GetAsync(ICriterion filter, IList <string> orders = null, int firstResult = 0, int maxResults = int.MaxValue, IList <string> fields = null)
        {
            IEnumerable <IDocumentTypeState> states = null;
            var q = new DocumentTypesGetQuery();

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

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

            DocumentTypeProxyUtils.ThrowOnHttpResponseError(resp);
            states = (resp.Content == null) ? null : resp.Content.Select(e => e.ToDocumentTypeState());
            return(states);
        }
Example #6
0
        public async Task WhenAsync(DeleteDocumentTypeDto c)
        {
            var idObj         = (c as IDeleteDocumentType).DocumentTypeId;
            var uriParameters = new DocumentTypeUriParameters();

            uriParameters.Id = idObj;

            var q = new DocumentTypeDeleteQuery();

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

            var req = new DocumentTypeDeleteRequest(uriParameters);

            req.Query = q;

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

            DocumentTypeProxyUtils.ThrowOnHttpResponseError(resp);
        }
Example #7
0
        public async virtual Task <long> GetCountAsync(ICriterion filter)
        {
            var q = new DocumentTypesCountGetQuery();

            q.Filter = DocumentTypeProxyUtils.GetFilterQueryValueString(filter);
            var req = new DocumentTypesCountGetRequest();

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

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