Example #1
0
        /// <summary>
        /// Creates the entity object.
        /// </summary>
        /// <param name="metaClassName">Name of the meta class.</param>
        /// <param name="primaryKeyId">The primary key id.</param>
        /// <returns></returns>
        protected override EntityObject CreateEntityObject(string metaClassName, PrimaryKeyId? primaryKeyId)
        {
            if (metaClassName == EmailEntity.ClassName)
            {
                EmailEntity retVal = new EmailEntity();
                retVal.PrimaryKeyId = primaryKeyId;
                return retVal;
            }

            return base.CreateEntityObject(metaClassName, primaryKeyId);
        }
Example #2
0
        /// <summary>
        /// Copies the email entity to mail message.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <returns></returns>
        private MailMessage CopyEmailEntityToMailMessage(EmailEntity message)
        {
            MailMessage outputMessage = new MailMessage();

            outputMessage.Subject = message.Subject;
            outputMessage.From = EmailUtil.CreateMailAddress(message.From);
            outputMessage.To.Add(EmailUtil.CreateMailAddress(message.To));

            if (!string.IsNullOrEmpty(message.MessageContext))
            {
                outputMessage.MessageContent = message.MessageContext;
            }
            else
            {
                outputMessage.IsBodyHtml = true;
                outputMessage.Body = message.HtmlBody;
            }
            return outputMessage;
        }