当前位置: 首页>>代码示例>>C#>>正文


C# Rock.GetMediumDataValue方法代码示例

本文整理汇总了C#中Rock.GetMediumDataValue方法的典型用法代码示例。如果您正苦于以下问题:C# Rock.GetMediumDataValue方法的具体用法?C# Rock.GetMediumDataValue怎么用?C# Rock.GetMediumDataValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Rock的用法示例。


在下文中一共展示了Rock.GetMediumDataValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ProcessHtmlBody

        /// <summary>
        /// Processes the HTML body.
        /// </summary>
        /// <param name="communication">The communication.</param>
        /// <param name="globalAttributes">The global attributes.</param>
        /// <param name="mergeObjects">The merge objects.</param>
        /// <param name="currentPersonOverride">The current person override.</param>
        /// <returns></returns>
        public static string ProcessHtmlBody( Rock.Model.Communication communication,
            Rock.Web.Cache.GlobalAttributesCache globalAttributes,
            Dictionary<string, object> mergeObjects,
            Person currentPersonOverride = null )
        {
            string htmlBody = communication.GetMediumDataValue( "HtmlMessage" );
            if ( !string.IsNullOrWhiteSpace( htmlBody ) )
            {
                // Get the unsubscribe content and add a merge field for it
                string unsubscribeHtml = communication.GetMediumDataValue( "UnsubscribeHTML" ).ResolveMergeFields( mergeObjects, currentPersonOverride );
                if (mergeObjects.ContainsKey( "UnsubscribeOption"))
                {
                    mergeObjects.Add( "UnsubscribeOption", unsubscribeHtml );
                }
                else
                {
                    mergeObjects["UnsubscribeOption"] = unsubscribeHtml;
                }
                
                // Resolve merge fields
                htmlBody = htmlBody.ResolveMergeFields( mergeObjects, currentPersonOverride );

                // Resolve special syntax needed if option was included in global attribute
                if ( Regex.IsMatch( htmlBody, @"\[\[\s*UnsubscribeOption\s*\]\]" ) )
                {
                    htmlBody = Regex.Replace( htmlBody, @"\[\[\s*UnsubscribeOption\s*\]\]", unsubscribeHtml );
                }

                // Add the unsubscribe option at end if it wasn't included in content
                if ( !htmlBody.Contains( unsubscribeHtml ) )
                {
                    htmlBody += unsubscribeHtml;
                }

                // Resolve any relative paths
                string publicAppRoot = globalAttributes.GetValue( "PublicApplicationRoot" ).EnsureTrailingForwardslash();
                htmlBody = htmlBody.Replace( @" src=""/", @" src=""" + publicAppRoot );
                htmlBody = htmlBody.Replace( @" href=""/", @" href=""" + publicAppRoot );
            }

            return htmlBody;

        }
开发者ID:tcavaletto,项目名称:Rock-CentralAZ,代码行数:51,代码来源:Email.cs

示例2: ProcessTextBody

        /// <summary>
        /// Processes the text body.
        /// </summary>
        /// <param name="communication">The communication.</param>
        /// <param name="globalAttributes">The global attributes.</param>
        /// <param name="mergeObjects">The merge objects.</param>
        /// <param name="currentPersonOverride">The current person override.</param>
        /// <returns></returns>
        public static string ProcessTextBody ( Rock.Model.Communication communication,
            Rock.Web.Cache.GlobalAttributesCache globalAttributes,
            Dictionary<string, object> mergeObjects,
            Person currentPersonOverride = null )
        {

            string defaultPlainText = communication.GetMediumDataValue( "DefaultPlainText" );
            string plainTextBody = communication.GetMediumDataValue( "TextMessage" );

            if ( string.IsNullOrWhiteSpace( plainTextBody ) && !string.IsNullOrWhiteSpace(defaultPlainText))
            {
                plainTextBody = defaultPlainText;
            }

            return plainTextBody.ResolveMergeFields( mergeObjects, currentPersonOverride );

        }
开发者ID:tcavaletto,项目名称:Rock-CentralAZ,代码行数:25,代码来源:Email.cs

示例3: AppendMediumData

 private void AppendMediumData( Rock.Model.Communication communication, StringBuilder sb, string key )
 {
     string value = communication.GetMediumDataValue( key );
     if ( !string.IsNullOrWhiteSpace( value ) )
     {
         AppendMediumData( sb, key, value );
     }
 }
开发者ID:BricksandMortar,项目名称:AlphanumericTwilio,代码行数:8,代码来源:AlphanumericSMS.cs


注:本文中的Rock.GetMediumDataValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。