示例#1
0
        public List <AttachmentData> GetDocuments(SendEnvelopeConfigurationBase configuration)
        {
            var attachments = new List <AttachmentData>();

            if (configuration.AttachmentSelection.AttachmentsChoosingOption == AttachmentsChoosingOptions.Category)
            {
                _logger.AppendLine("Downloading attachments by category");

                foreach (var att in Context.CurrentDocument.Attachments)
                {
                    if (IsValidCategory(att, configuration))
                    {
                        if (string.IsNullOrEmpty(configuration.AttachmentSelection.AttRegularExpression) || Regex.IsMatch(att.FileName, configuration.AttachmentSelection.AttRegularExpression))
                        {
                            attachments.Add(att);
                        }
                    }
                }

                return(attachments);
            }
            _logger.AppendLine("Downloading attachments by SQL query");
            var attIDs = WebCon.WorkFlow.SDK.Tools.Data.SqlExecutionHelper.GetDataTableForSqlCommand(configuration.AttachmentSelection.AttQuery, Context);

            foreach (DataRow row in attIDs.Rows)
            {
                var att = WebCon.WorkFlow.SDK.Documents.DocumentAttachmentsManager.GetAttachment(row.Field <int>(0));
                attachments.Add(att);
            }
            return(attachments);
        }
示例#2
0
        private bool IsValidCategory(AttachmentData att, SendEnvelopeConfigurationBase configuration)
        {
            bool isValid = false;

            switch (configuration.AttachmentSelection.CategorySelectionOptions)
            {
            case CategorySelectionOptions.None:
                isValid = att.FileGroup == null;
                break;

            case CategorySelectionOptions.All:
                isValid = true;
                break;

            default:
                isValid = att?.FileGroup?.ID == configuration.AttachmentSelection.GroupID;
                break;
            }
            return(isValid);
        }
 public EnvelopSendingHelper(StringBuilder logger, SendEnvelopeConfigurationBase config, bool useSms)
 {
     _logger       = logger;
     Configuration = config;
     UseSms        = useSms;
 }