コード例 #1
0
 internal static DeliverySummary ToDeliverySummary(this EntityHistoryDeliveryItem item)
 {
     return(new DeliverySummary
     {
         SourceApplicationName = item.SourceApplicationName,
         ReplyToEmailAddress = item.ReplyToEmailAddress,
         ReplyToDisplayName = item.ReplyToDisplayName,
         Subject = item.Subject,
         Id = item.Id,
         FromEmailAddress = item.FromEmailAddress,
         FromDisplayName = item.FromDisplayName,
         CreatedDate = item.CreatedDate,
         DeliveryProvider = item.DeliveryProvider,
         ExceptionMessage = item.ExceptionMessage,
         IsSuccess = item.IsSuccess,
         ProviderMessageId = item.ProviderMessageId,
         ToDisplayName = item.ToDisplayName,
         ToEmailAddress = item.ToEmailAddress
     });
 }
コード例 #2
0
        internal static DeliveryItem ToDeliveryItem(this EntityHistoryDeliveryItem item)
        {
            var settings = new JsonSerializerSettings
            {
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            };

            settings.Converters.Add(new AttachmentStreamJsonConverter());

            return(new DeliveryItem
            {
                SourceApplicationName = item.SourceApplicationName,
                Body =
                    string.IsNullOrEmpty(item.TemplateName)
                        ? new ContentBody
                {
                    HtmlContent = item.HtmlContent,
                    PlainTextContent = item.TextContent
                }
                        : (IMessageBody) new TemplateBody
                {
                    TemplateName = item.TemplateName
                },
                Substitutions = JsonConvert.DeserializeObject <IDictionary <string, string> >(item.SubstitutionsJson),
                CreatedDate = item.CreatedDate,
                DeliveryProvider = item.DeliveryProvider,
                ExceptionMessage = item.ExceptionMessage,
                FromDisplayName = item.FromDisplayName,
                FromEmailAddress = item.FromEmailAddress,
                ReplyToDisplayName = item.ReplyToDisplayName,
                ReplyToEmailAddress = item.ReplyToEmailAddress,
                Id = item.Id,
                IsSuccess = item.IsSuccess,
                ProviderMessageId = item.ProviderMessageId,
                Subject = item.Subject,
                ToDisplayName = item.ToDisplayName,
                ToEmailAddress = item.ToEmailAddress,
                Attachments = JsonConvert.DeserializeObject <IDictionary <string, Stream> >(item.AttachmentsJson, settings)
            });
        }