Esempio n. 1
0
        private BulkEmail GetBulkEmailFromDB(Guid bulkEmailId)
        {
            var bulkEmail            = new BulkEmail(_userConnection);
            var fetchBulkEmailResult = bulkEmail.FetchFromDB("Id", bulkEmailId,
                                                             new[] {
                "Id",
                "StartDate",
                "TemplateSubject",
                "SenderName",
                "SenderEmail",
                "UseUtm",
                "Domains",
                "UtmSource",
                "UtmMedium",
                "UtmCampaign",
                "UtmTerm",
                "UtmContent"
            });

            if (fetchBulkEmailResult)
            {
                return(bulkEmail);
            }
            MailingUtilities.Log.WarnFormat(
                "[CESMaillingProvider.GetBulkEmailFromDB]: FetchFromDB BulkEmail: {0} fails.", bulkEmailId);
            throw new Exception(
                      $"[CESMaillingProvider.GetBulkEmailFromDB]: FetchFromDB BulkEmail: {bulkEmailId} fails.");
        }
 /// <summary>
 /// Prepares message before sending.
 /// </summary>
 /// <param name="userConnection">Instance of user connection.</param>
 public void PrepareMessage(UserConnection userConnection)
 {
     BulkEmail = new BulkEmail(userConnection);
     BulkEmail.FetchFromDB(MessageId);
     SendDate       = DateTime.UtcNow;
     MailingStartTS = ConvertDateTimeToTimestamp(SendDate);
 }
Esempio n. 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BulkEmailAudienceDataSource"/> class.
        /// </summary>
        /// <param name="userConnection">Current user connection.</param>
        /// <param name="bulkEmailId">The bulk email identifier.</param>
        /// <param name="batchSize">Size of the batch of the recipients to select.</param>
        public BulkEmailAudienceDataSource(UserConnection userConnection, Guid bulkEmailId, int batchSize)
        {
            _userConnection = userConnection;
            var argsRecipientMacroRepository = GetArgumentsRecipientMacroRepository(userConnection);

            _bulkEmailRecipientMacroRepository =
                ClassFactory.Get <BulkEmailRecipientMacroRepository>(argsRecipientMacroRepository);
            _batchSize = batchSize;
            _bulkEmail = new BulkEmail(_userConnection);
            _bulkEmail.FetchFromDB("Id", bulkEmailId, new[] {
                "Id", "Category", "SendStartDate", "StartDate", "IsSystemEmail"
            });
            _bulkEmailExpirationPeriod = (int)Core.Configuration.SysSettings.GetValue(userConnection,
                                                                                      "BulkEmailExpirationPeriod");
            _duplicatingRecipients = new Lazy <Dictionary <Guid, int> >(GetAudienceDuplicateResponses);
            InitCommunicationRestrictions(userConnection, bulkEmailId);
        }