コード例 #1
0
        private DocumentDataCreate ConnectDocument(DocumentDataCreate _docData, string _parentId, string _parentDirection, string _parentConnectionName)
        {
            //Add parent
            _docData.dataelements.parentId        = _parentId;
            _docData.dataelements.parentDirection = _parentDirection;
            _docData.dataelements.parentRelName   = _parentConnectionName;

            return(_docData);
        }
コード例 #2
0
        private DocumentDataCreate AddFileToDocument(DocumentDataCreate _docData, string _fileTitle, string _fileUploadReceipt)
        {
            if (_docData.relateddata == null)
            {
                _docData.relateddata = new DocumentRelatedDataCreate();
            }

            _docData.relateddata.files.Add(new DocumentRelatedDataFilesCreate());
            _docData.relateddata.files[0].dataelements.title   = _fileTitle;
            _docData.relateddata.files[0].dataelements.receipt = _fileUploadReceipt;

            return(_docData);
        }
コード例 #3
0
        public async Task <DocumentResponse <DocumentCreated> > CreateDocumentAsAttachment(string _title, string _description, string _parentId, string _fileLocalPath, string _collabSpace = null)
        {
            //TODO: Check that the _fileLocalPath exists and the process has read permissions

            string filename = System.IO.Path.GetFileName(_fileLocalPath);

            string uploadFileReceipt = await UploadFile(_fileLocalPath);

            DocumentDataCreate docData = InitializeDocument(_title, _description, _collabSpace);

            docData = AddFileToDocument(docData, filename, uploadFileReceipt);

            return(await CreateDocumentAsAttachment(docData, _parentId));
        }
コード例 #4
0
        private async Task <DocumentResponse <DocumentCreated> > _CreateDocument(DocumentDataCreate _docData)
        {
            DocumentCreate doc = new DocumentCreate();

            doc.data.Add(_docData);

            string bodyRequest = doc.toJson();

            IRestResponse createDocumentResponse = await PostAsync(GetBaseResource(), null, null, bodyRequest);

            if (createDocumentResponse.StatusCode != System.Net.HttpStatusCode.OK)
            {
                //handle according to established exception policy
                throw (new CreateDocumentException(createDocumentResponse));
            }

            return(JsonConvert.DeserializeObject <DocumentResponse <DocumentCreated> >(createDocumentResponse.Content));
        }
コード例 #5
0
        private DocumentDataCreate InitializeDocument(string _title, string _description, string _collabSpace = null, string _type = null)
        {
            DocumentDataCreate _docData = new DocumentDataCreate();

            _docData.dataelements.title       = _title;
            _docData.dataelements.description = _description;

            if (_type != null)
            {
                _docData.type = _type;
            }

            if (_collabSpace != null)
            {
                _docData.dataelements.collabspace = _collabSpace;
            }

            return(_docData);
        }
コード例 #6
0
        private async Task <DocumentResponse <DocumentCreated> > CreateConnectedDocument(DocumentDataCreate _docData, string _parentId, string _parentDirection, string _parentConnectionName)
        {
            _docData = ConnectDocument(_docData, _parentId, _parentDirection, _parentConnectionName);

            return(await _CreateDocument(_docData));
        }
コード例 #7
0
 private async Task <DocumentResponse <DocumentCreated> > CreateDocumentAsSpecification(DocumentDataCreate _docData, string _parentId)
 {
     return(await CreateConnectedDocument(_docData, _parentId, SOURCE, SPECIFICATION));
 }
コード例 #8
0
 private async Task <DocumentResponse <DocumentCreated> > CreateDocumentAsAttachment(DocumentDataCreate _docData, string _parentId)
 {
     return(await CreateConnectedDocument(_docData, _parentId, SOURCE, ATTACHMENT));
 }