private void SetInvalidBulkEmailCounters(Guid bulkEmailId, int invalidAddresseeCount)
        {
            var actualInvalidAdresseeExpression =
                MailingDbUtilities.GetAddCountColumnExpression("InvalidAddresseeCount", invalidAddresseeCount);

            BulkEmailQueryHelper.UpdateBulkEmail(bulkEmailId, UserConnection,
                                                 new KeyValuePair <string, object>("SendDueDate", Column.Const(null)),
                                                 new KeyValuePair <string, object>("InvalidAddresseeCount", actualInvalidAdresseeExpression));
        }
        private void ShiftTriggerEmailStartDate(Guid bulkEmailId, int daysCount)
        {
            var parameters = new KeyValuePair <string, object>[] {
                new KeyValuePair <string, object>("RecordId", bulkEmailId),
                new KeyValuePair <string, object>("DaysCount", daysCount)
            };

            MailingDbUtilities.ExecuteStoredProcedure(UserConnection, "tsp_ShiftTriggerEmailStartDate", parameters);
        }
Esempio n. 3
0
        private QueryCase GetDefaultResponseCase(bool isSystemEmail)
        {
            var responseCase = new QueryCase();

            MailingDbUtilities.AddWhenCondition(
                responseCase, "Contact", "Email", QueryConditionType.Equal, string.Empty,
                (int)MailingResponseCode.CanceledBlankEmail);
            MailingDbUtilities.AddWhenCondition(
                responseCase, "Contact", "Email", QueryConditionType.IsNull, null,
                (int)MailingResponseCode.CanceledBlankEmail);
            MailingDbUtilities.AddWhenCondition(
                responseCase, "Contact", "IsNonActualEmail", QueryConditionType.Equal, true,
                (int)MailingResponseCode.CanceledInvalidEmail);
            if (!isSystemEmail)
            {
                MailingDbUtilities.AddWhenCondition(
                    responseCase, "Contact", "DoNotUseEmail", QueryConditionType.Equal, true,
                    (int)MailingResponseCode.CanceledDoNotUseEmail);
            }
            responseCase.ElseExpression =
                new QueryColumnExpression(Column.Parameter((int)MailingResponseCode.PostedProvider));
            return(responseCase);
        }
        /// <summary>
        /// Updates StartDate, SendStartDate, SendDueDate, RecipientCount and CommonError count columns.
        /// </summary>
        /// <param name="userConnection">User connection instance.</param>
        /// <param name="isError">Indicates whether there is sending error.</param>
        public void UpdateMessageInfo(UserConnection userConnection, bool isError = false)
        {
            int count  = Recipients.Count();
            var update = new Update(userConnection, "BulkEmail")
                         .Set("StartDate", Column.Parameter(SendDate))
                         .Set("SendStartDate", Column.Parameter(SendDate))
                         .Set("SendDueDate", Column.Parameter(SendDate))
                         .Set("RecipientCount", QueryColumnExpression.Add(new QueryColumnExpression("RecipientCount"),
                                                                          Column.Parameter(count)));

            if (isError)
            {
                update.Set("CommonErrorCount", QueryColumnExpression.Add(new QueryColumnExpression("CommonErrorCount"),
                                                                         Column.Parameter(count)));
            }
            else
            {
                QueryColumnExpression actualSentExpression
                    = MailingDbUtilities.GetAddCountColumnExpression("SendCount", count);
                update.Set("SendCount", actualSentExpression);
            }
            update.Where("Id").IsEqual(Column.Parameter(MessageId));
            (update as Update).Execute();
        }