Exemple #1
0
 private void AppendChannelData( Model.Communication communication, StringBuilder sb, string key )
 {
     string value = communication.GetChannelDataValue( key );
     if ( !string.IsNullOrWhiteSpace( value ) )
     {
         AppendChannelData( sb, key, value );
     }
 }
Exemple #2
0
        /// <summary>
        /// Gets the read-only message details.
        /// </summary>
        /// <param name="communication">The communication.</param>
        /// <returns></returns>
        public override string GetMessageDetails( Model.Communication communication )
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("<div class='row'>");
            sb.AppendLine( "<div class='col-md-6'>" );

            AppendChannelData( communication, sb, "FromName" );
            AppendChannelData( communication, sb, "FromAddress" );
            AppendChannelData( communication, sb, "ReplyTo" );
            AppendChannelData( communication, sb, "Subject" );

            sb.AppendLine( "</div>" );
            sb.AppendLine( "<div class='col-md-6'>" );
            AppendAttachmentData( sb, communication.GetChannelDataValue( "Attachments" ) );
            sb.AppendLine( "</div>" );
            sb.AppendLine( "</div>" );

            string value = communication.GetChannelDataValue( "HtmlMessage" );
            if (!string.IsNullOrWhiteSpace(value))
            {
                AppendChannelData( sb, "HtmlMessage", string.Format( @"
                        <iframe id='js-email-body-iframe' class='email-body'></iframe>
                        <script id='email-body' type='text/template'>{0}</script>
                        <script type='text/javascript'>
                            var doc = document.getElementById('js-email-body-iframe').contentWindow.document;
                            doc.open();
                            doc.write('<html><head><title></title></head><body>' +  $('#email-body').html() + '</body></html>');
                            doc.close();
                        </script>
                    ", value ) );
            }

            AppendChannelData( communication, sb, "TextMessage" );

            return sb.ToString();
        }