public Guid CreateDocument(string subject, string body) { var document = new Document { Subject = subject, Body = body, Category = Guid.Parse("3b6d3833-b31b-423d-bc3c-39c62b8f2b12"), Type = 55, DocumentDate = DateTime.UtcNow.Date }; if (_client.For<Document>().Insert(ref document)) { return document.ID; } return Guid.Empty; }
public async Task<bool> NewDocument(string path) { ExactOnlineClient exactOnlineClient = this.GetExactOnlineClient(); Document document = new Document(); document.Subject = this.GetFileName(path); document.Type = 183; // Attachment Type document.Category = Guid.Parse("3b6d3833-b31b-423d-bc3c-39c62b8f2b12"); // General Category bool isCreated = exactOnlineClient.For<Document>().Insert(ref document); if (!isCreated) { throw new Exception("Document fail to create on Exact Online server"); } DropboxClient dropboxClient = this.GetDropboxClient(this.DropboxModel.AccessToken); DownloadArg arg = new DownloadArg(path); DocumentAttachment attachment = new DocumentAttachment(); attachment.Document = document.ID; attachment.FileName = this.GetFileName(path); attachment.Attachment = await this.GetDropboxService().DownloadContentAsByteArray(dropboxClient, arg); bool isAttached = exactOnlineClient.For<DocumentAttachment>().Insert(ref attachment); return isAttached; }
private bool CreateDocument(ExactOnlineClient client) { var document = new Document { Subject = "User Acceptance Test Document", Body = "User Acceptance Test Document", Category = GetCategoryId(client), Type = 55, //Miscellaneous DocumentDate = DateTime.Now.Date }; var created = client.For<Document>().Insert(ref document); if (created) { _documentId = document.ID; } return created; }