本文整理汇总了C#中Rock.Model.PersonService.GetGeopoints方法的典型用法代码示例。如果您正苦于以下问题:C# PersonService.GetGeopoints方法的具体用法?C# PersonService.GetGeopoints怎么用?C# PersonService.GetGeopoints使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rock.Model.PersonService
的用法示例。
在下文中一共展示了PersonService.GetGeopoints方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetNearestGroup
/// <summary>
/// Gets the nearest group.
/// </summary>
/// <param name="personId">The person identifier.</param>
/// <param name="groupTypeId">The group type identifier.</param>
/// <returns></returns>
public Group GetNearestGroup( int personId, int groupTypeId )
{
var rockContext = (RockContext)this.Context;
var personService = new PersonService( rockContext );
var personGeopoint = personService.GetGeopoints( personId ).FirstOrDefault();
if ( personGeopoint != null )
{
var groupLocation = this.Queryable()
.Where( g =>
g.GroupTypeId.Equals( groupTypeId ) )
.SelectMany( g =>
g.GroupLocations
.Where( gl =>
gl.Location != null &&
gl.Location.GeoPoint != null
)
)
.OrderBy( gl => gl.Location.GeoPoint.Distance( personGeopoint ) )
.FirstOrDefault();
if ( groupLocation != null )
{
return groupLocation.Group;
}
}
return null;
}
示例2: GetGeofencingGroups
/// <summary>
/// Gets the groups of a particular type that geofence the selected person's mapped location(s)
/// </summary>
/// <param name="personId">The person identifier.</param>
/// <param name="groupTypeGuid">The group type unique identifier.</param>
/// <returns></returns>
public IQueryable<Group> GetGeofencingGroups( int personId, Guid groupTypeGuid )
{
var rockContext = (RockContext)this.Context;
var personService = new PersonService( rockContext );
var personGeopoints = personService.GetGeopoints( personId );
return GetGeofencingGroups( personGeopoints, groupTypeGuid );
}