本文整理汇总了C#中Rock.Model.GroupMemberService.GetFullStreetAddress方法的典型用法代码示例。如果您正苦于以下问题:C# GroupMemberService.GetFullStreetAddress方法的具体用法?C# GroupMemberService.GetFullStreetAddress怎么用?C# GroupMemberService.GetFullStreetAddress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rock.Model.GroupMemberService
的用法示例。
在下文中一共展示了GroupMemberService.GetFullStreetAddress方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Address
/// <summary>
/// Addresses the specified context.
/// </summary>
/// <param name="context">The context.</param>
/// <param name="input">The input.</param>
/// <param name="addressType">Type of the address.</param>
/// <param name="qualifier">The qualifier.</param>
/// <returns></returns>
public static string Address( DotLiquid.Context context, object input, string addressType, string qualifier = "" )
{
if ( input != null && input is Person )
{
var person = (Person)input;
Guid familyGuid = Rock.SystemGuid.GroupType.GROUPTYPE_FAMILY.AsGuid();
var location = new GroupMemberService( GetRockContext(context) )
.Queryable( "GroupLocations.Location" )
.Where( m =>
m.PersonId == person.Id &&
m.Group.GroupType.Guid == familyGuid )
.SelectMany( m => m.Group.GroupLocations )
.Where( gl =>
gl.GroupLocationTypeValue.Value == addressType )
.Select( gl => gl.Location )
.FirstOrDefault();
if (location != null)
{
if ( qualifier == "" )
{
return location.GetFullStreetAddress();
}
else
{
var matches = Regex.Matches(qualifier, @"\[\[([^\]]+)\]\]");
foreach ( var match in matches )
{
string propertyKey = match.ToString().Replace("[", "");
propertyKey = propertyKey.ToString().Replace( "]", "" );
propertyKey = propertyKey.ToString().Replace( " ", "" );
switch ( propertyKey )
{
case "Street1":
qualifier = qualifier.Replace( match.ToString(), location.Street1 );
break;
case "Street2":
qualifier = qualifier.Replace( match.ToString(), location.Street2 );
break;
case "City":
qualifier = qualifier.Replace( match.ToString(), location.City );
break;
case "State":
qualifier = qualifier.Replace( match.ToString(), location.State );
break;
case "PostalCode":
case "Zip":
qualifier = qualifier.Replace( match.ToString(), location.PostalCode );
break;
case "Country":
qualifier = qualifier.Replace( match.ToString(), location.Country );
break;
case "GeoPoint":
if ( location.GeoPoint != null )
{
qualifier = qualifier.Replace( match.ToString(), string.Format("{0},{1}", location.GeoPoint.Latitude.ToString(), location.GeoPoint.Longitude.ToString()) );
}
else
{
qualifier = qualifier.Replace( match.ToString(), "" );
}
break;
case "Latitude":
if ( location.GeoPoint != null )
{
qualifier = qualifier.Replace( match.ToString(), location.GeoPoint.Latitude.ToString() );
}
else
{
qualifier = qualifier.Replace( match.ToString(), "" );
}
break;
case "Longitude":
if ( location.GeoPoint != null )
{
qualifier = qualifier.Replace( match.ToString(), location.GeoPoint.Longitude.ToString() );
}
else
{
qualifier = qualifier.Replace( match.ToString(), "" );
}
break;
case "FormattedAddress":
qualifier = qualifier.Replace( match.ToString(), location.FormattedAddress );
break;
case "FormattedHtmlAddress":
qualifier = qualifier.Replace( match.ToString(), location.FormattedHtmlAddress );
break;
default:
qualifier = qualifier.Replace( match.ToString(), "" );
//.........这里部分代码省略.........