/// <summary>
 /// Updates the state of the email message and DOES NOT wait for the context to commit if there is an associated database connection string
 /// </summary>
 /// <param name="messageId">The email message to update</param>
 /// <param name="toSet">the state to set it in</param>
 public void UpdateState(int messageId, EmailMessageState toSet)
 {
     if (DatabaseInstance is null)
     {
         this.Context.Where(e => e._Id == messageId).Single().State = toSet;
     }
     else
     {
         DatabaseInstance.Execute($"update emailmessages set state = {(int)toSet} where {nameof(Entity._Id)} = {messageId}");
     }
 }
 /// <summary>
 /// Retrieves all email messages with a given state
 /// </summary>
 /// <param name="target">The state to retrieve</param>
 /// <returns>All email messages with a given state</returns>
 public IEnumerable <EmailMessage> GetByState(EmailMessageState target) => this.Where(e => e.State == target);
Beispiel #3
0
        private EmailMessage CopyMessage(EmailMessage message, string newRecipient = null, EmailMessageState state = EmailMessageState.Unsent)
        {
            EmailMessage toReturn = this.EmailRepository.ShallowClone(message);

            toReturn.State = state;

            if (newRecipient != null)
            {
                toReturn.Recipients = newRecipient;
            }

            return(toReturn);
        }
Beispiel #4
0
 public void SetState(long id, EmailMessageState state)
 {
     _executor.Execute("[dbo].[EmailMessage_SetState]", new { id, state });
 }
Beispiel #5
0
 public EmailMessageData GetNext(EmailMessageState state, int partitionId)
 {
     return(_executor.Query <EmailMessageData>("[dbo].[EmailMessage_GetNext]", new { state, partitionId }));
 }
Beispiel #6
0
		public void SetState(long id, EmailMessageState state)
		{
			_executor.Execute("[dbo].[EmailMessage_SetState]", new {id, state});
		}
Beispiel #7
0
		public EmailMessageData GetNext(EmailMessageState state, int partitionId)
		{
			return _executor.Query<EmailMessageData>("[dbo].[EmailMessage_GetNext]", new {state, partitionId});
		}