예제 #1
0
        public void SendCandidateEmailMessageWithAttachmentsTest()
        {
            DeleteAllTestMessages();

            EmailMessage message1 = PrepareMailMessageWithAttachments();
            EmailMessage message2 = PrepareMailMessageWithAttachments();

            EmailMessageCollection messages = new EmailMessageCollection();

            messages.Add(message1);
            messages.Add(message2);

            EmailMessageAdapter.Instance.Insert(messages);

            try
            {
                SmtpParameters sp = PrepareSmtpParameters();

                EmailMessageAdapter.Instance.SendCandidateMessages(10, sp);

                CheckSentMessage(message1);
                CheckSentMessage(message2);
            }
            finally
            {
                DeleteAllTestMessages();
            }
        }
예제 #2
0
        public EmailMessageCollection LoadCandidateMessages(int batchCount)
        {
            string topDesp = batchCount >= 0 ? string.Format(" TOP {0} ", batchCount) : string.Empty;

            WhereSqlClauseBuilder builder = new WhereSqlClauseBuilder();

            builder.AppendItem("1", 1);
            builder.AppendTenantCode();

            string sql = string.Format("SELECT {0}* FROM MSG.EMAIL_MESSAGES WITH (UPDLOCK, READPAST) WHERE {1} ORDER BY SORT_ID",
                                       topDesp,
                                       builder.ToSqlString(TSqlBuilder.Instance));

            EmailMessageCollection result = new EmailMessageCollection();

            DataTable table = DbHelper.RunSqlReturnDS(sql, GetConnectionName()).Tables[0];

            foreach (DataRow row in table.Rows)
            {
                EmailMessage message = new EmailMessage();

                DataRowToEmailMessage(row, message);

                result.Add(message);
            }

            return(result);
        }
예제 #3
0
        public void Send(EmailMessage message, SmtpParameters sp, bool throwError = false)
        {
            EmailMessageCollection messages = new EmailMessageCollection();

            messages.Add(message);

            Send(messages, sp, throwError);
        }
예제 #4
0
        public void Send(EmailMessage message, SmtpParameters sp)
        {
            EmailMessageCollection messages = new EmailMessageCollection();

            messages.Add(message);

            Send(messages, sp);
        }
        public void Send(EmailMessage message, SmtpParameters sp)
        {
            EmailMessageCollection messages = new EmailMessageCollection();

            messages.Add(message);

            Send(messages, sp);
        }
예제 #6
0
        public void SendEmailMessageWithAttachmentTest()
        {
            EmailMessage message = PrepareMailMessageWithAttachments();

            SmtpParameters sp = PrepareSmtpParameters();

            EmailMessageCollection messages = new EmailMessageCollection();

            messages.Add(message);

            EmailMessageAdapter.Instance.Send(messages, sp);
        }
예제 #7
0
		public void SendEmailMessageWithAttachmentTest()
		{
			EmailMessage message = PrepareMailMessageWithAttachments();

			SmtpParameters sp = PrepareSmtpParameters();

			EmailMessageCollection messages = new EmailMessageCollection();

			messages.Add(message);

			EmailMessageAdapter.Instance.Send(messages, sp);
		}
예제 #8
0
		public void SendCandidateEmailMessageWithAttachmentsTest()
		{
			DeleteAllTestMessages();

			EmailMessage message1 = PrepareMailMessageWithAttachments();
			EmailMessage message2 = PrepareMailMessageWithAttachments();

			EmailMessageCollection messages = new EmailMessageCollection();

			messages.Add(message1);
			messages.Add(message2);

			EmailMessageAdapter.Instance.Insert(messages);

			try
			{
				SmtpParameters sp = PrepareSmtpParameters();

				EmailMessageAdapter.Instance.SendCandidateMessages(10, sp);

				CheckSentMessage(message1);
				CheckSentMessage(message2);
			}
			finally
			{
				DeleteAllTestMessages();
			}
		}
        public EmailMessageCollection LoadCandidateMessages(int batchCount)
        {
            string topDesp = batchCount >= 0 ? string.Format(" TOP {0} ", batchCount) : string.Empty;

            WhereSqlClauseBuilder builder = new WhereSqlClauseBuilder();

            builder.AppendItem("1", 1);
            builder.AppendTenantCode();

            string sql = string.Format("SELECT {0}* FROM MSG.EMAIL_MESSAGES WITH (UPDLOCK READPAST) WHERE {1} ORDER BY SORT_ID",
                topDesp,
                builder.ToSqlString(TSqlBuilder.Instance));

            EmailMessageCollection result = new EmailMessageCollection();

            DataTable table = DbHelper.RunSqlReturnDS(sql, GetConnectionName()).Tables[0];

            foreach (DataRow row in table.Rows)
            {
                EmailMessage message = new EmailMessage();

                DataRowToEmailMessage(row, message);

                result.Add(message);
            }

            return result;
        }