public SrirachaEmailMessage CreateMessage(string subject, List<string> emailAddressList, object dataObject, string razorView)
		{
            if(string.IsNullOrEmpty(subject))
            {
                throw new ArgumentNullException("subject");
            }
            if(emailAddressList == null || emailAddressList.Count == 0)
            {
                throw new ArgumentNullException("emailAddressList");
            }
            if(dataObject == null)
            {
                throw new ArgumentNullException("dataObject");
            }
            if(string.IsNullOrEmpty(razorView))
            {
                throw new ArgumentNullException("razorView");
            }
			var email = new SrirachaEmailMessage
			{
				Id = Guid.NewGuid().ToString(),
				EmailAddressList = emailAddressList, 
				Subject = subject,
				DataObject = dataObject,
				RazorView = razorView,
				QueueDateTimeUtc = DateTime.UtcNow,
                Status = EnumQueueStatus.New,
                CreatedByUserName = _userIdentity.UserName,
                CreatedDateTimeUtc = DateTime.UtcNow,
                UpdatedByUserName = _userIdentity.UserName,
                UpdatedDateTimeUtc = DateTime.UtcNow
			};
            return _documentSession.StoreSaveEvict(email);
		}
示例#2
0
		public void MarkReceipientFailed(SrirachaEmailMessage emailMessage, string emailAddress, Exception err)
		{
            _emailQueueRepository.AddReceipientResult(emailMessage.Id, EnumQueueStatus.Error, emailAddress, err);
		}
示例#3
0
		public void MarkReceipientSucceeded(SrirachaEmailMessage emailMessage, string emailAddress)
		{
            _emailQueueRepository.AddReceipientResult(emailMessage.Id, EnumQueueStatus.Error, emailAddress);
		}
示例#4
0
		public void MarkFailed(SrirachaEmailMessage emailMessage)
		{
            _emailQueueRepository.UpdateMessageStatus(emailMessage.Id, EnumQueueStatus.Error);
		}
示例#5
0
		public void MarkSucceeded(SrirachaEmailMessage emailMessage)
		{
            _emailQueueRepository.UpdateMessageStatus(emailMessage.Id, EnumQueueStatus.Completed);
		}