本文整理汇总了C#中Rock.Model.PersonService.GetEmailTag方法的典型用法代码示例。如果您正苦于以下问题:C# PersonService.GetEmailTag方法的具体用法?C# PersonService.GetEmailTag怎么用?C# PersonService.GetEmailTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rock.Model.PersonService
的用法示例。
在下文中一共展示了PersonService.GetEmailTag方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetPopupHtml
public PersonSearchResult GetPopupHtml( int personId, bool emailAsLink )
{
var result = new PersonSearchResult();
result.Id = personId;
result.PickerItemDetailsHtml = "No Details Available";
var html = new StringBuilder();
// Create new service (need ProxyServiceEnabled)
var rockContext = new Rock.Data.RockContext();
var person = new PersonService( rockContext ).Queryable( "ConnectionStatusValue, PhoneNumbers" )
.Where( p => p.Id == personId )
.FirstOrDefault();
if ( person != null )
{
Guid? recordTypeValueGuid = null;
if ( person.RecordTypeValueId.HasValue )
{
recordTypeValueGuid = DefinedValueCache.Read( person.RecordTypeValueId.Value ).Guid;
}
var appPath = System.Web.VirtualPathUtility.ToAbsolute( "~" );
html.AppendFormat(
"<header>{0} <h3>{1}<small>{2}</small></h3></header>",
Person.GetPersonPhotoImageTag( person, 65, 65 ),
person.FullName,
person.ConnectionStatusValue != null ? person.ConnectionStatusValue.Value : string.Empty );
html.Append( "<div class='body'>" );
var spouse = person.GetSpouse( rockContext );
if ( spouse != null )
{
html.AppendFormat(
"<div><strong>Spouse</strong> {0}</div>",
spouse.LastName == person.LastName ? spouse.FirstName : spouse.FullName );
}
int? age = person.Age;
if ( age.HasValue )
{
html.AppendFormat( "<div><strong>Age</strong> {0}</div>" , age );
}
if ( !string.IsNullOrWhiteSpace( person.Email ) )
{
if ( emailAsLink )
{
html.AppendFormat( "<div style='text-overflow: ellipsis; white-space: nowrap; overflow:hidden; width: 245px;'><strong>Email</strong> {0}</div>", person.GetEmailTag( VirtualPathUtility.ToAbsolute( "~/" ) ) );
}
else
{
html.AppendFormat( "<div style='text-overflow: ellipsis; white-space: nowrap; overflow:hidden; width: 245px;'><strong>Email</strong> {0}</div>", person.Email );
}
}
foreach ( var phoneNumber in person.PhoneNumbers.Where( n => n.IsUnlisted == false && n.NumberTypeValueId.HasValue ).OrderBy( n => n.NumberTypeValue.Order ) )
{
html.AppendFormat( "<div><strong>{0}</strong> {1}</div>", phoneNumber.NumberTypeValue.Value, phoneNumber.ToString() );
}
html.Append( "</div>" );
result.PickerItemDetailsHtml = html.ToString();
}
return result;
}