private void SaveAtt(CurrentDocumentData currentDocument, byte[] newAttContent)
        {
            var sourceAttData = currentDocument.GetFieldValue(Configuration.AttConfig.AttTechnicalFieldID).ToString();
            var sourceAtt     = currentDocument.Attachments.GetByID(Convert.ToInt32(sourceAttData));

            sourceAtt.Content  = newAttContent;
            sourceAtt.FileName = $"{Path.GetFileNameWithoutExtension(sourceAtt.FileName)}{Configuration.AttConfig.AttSufix}{sourceAtt.FileExtension}";

            if (!string.IsNullOrEmpty(Configuration.AttConfig.SaveCategory))
            {
                sourceAtt.FileGroup = new AttachmentsGroup(Configuration.AttConfig.SaveCategory, null);
            }

            DocumentAttachmentsManager.UpdateAttachment(new UpdateAttachmentParams()
            {
                Attachment = sourceAtt
            });
        }
Exemplo n.º 2
0
        private void SaveAtt(CurrentDocumentData currentDocument, byte[] newAttContent)
        {
            if (newAttContent == null)
            {
                throw new Exception("API returned empty document content!");
            }

            int sourceAttData = Convert.ToInt32(currentDocument.GetFieldValue(Configuration.AttConfig.AttTechnicalFieldID));

            var sourceAtt = currentDocument.Attachments.GetByID(sourceAttData);

            sourceAtt.Content  = newAttContent;
            sourceAtt.FileName = $"{Path.GetFileNameWithoutExtension(sourceAtt.FileName)}{Configuration.AttConfig.AttSufix}{sourceAtt.FileExtension}";

            if (!string.IsNullOrEmpty(Configuration.AttConfig.SaveCategory))
            {
                sourceAtt.FileGroup = new WorkFlow.SDK.Documents.Model.Attachments.AttachmentsGroup(Configuration.AttConfig.SaveCategory, null);
            }

            DocumentAttachmentsManager.UpdateAttachment(new WorkFlow.SDK.Documents.Model.Attachments.UpdateAttachmentParams()
            {
                Attachment = sourceAtt
            });
        }