本文整理汇总了C#中Rock.Model.GroupMemberService.RemoveAll方法的典型用法代码示例。如果您正苦于以下问题:C# GroupMemberService.RemoveAll方法的具体用法?C# GroupMemberService.RemoveAll怎么用?C# GroupMemberService.RemoveAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rock.Model.GroupMemberService
的用法示例。
在下文中一共展示了GroupMemberService.RemoveAll方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: btnConfirm_Click
//.........这里部分代码省略.........
}
}
if ( SelectedFields.Contains( cpCampus.ClientID ) && cpCampus.SelectedCampusId.HasValue )
{
int campusId = cpCampus.SelectedCampusId.Value;
Guid familyGuid = new Guid( Rock.SystemGuid.GroupType.GROUPTYPE_FAMILY );
var familyMembers = new GroupMemberService( rockContext ).Queryable()
.Where( m => ids.Contains( m.PersonId ) && m.Group.GroupType.Guid == familyGuid )
.Select( m => new { m.PersonId, m.GroupId } )
.Distinct()
.ToList();
var families = new GroupMemberService( rockContext ).Queryable()
.Where( m => ids.Contains( m.PersonId ) && m.Group.GroupType.Guid == familyGuid )
.Select( m => m.Group )
.Distinct()
.ToList();
foreach ( int personId in ids )
{
var familyIds = familyMembers.Where( m => m.PersonId == personId ).Select( m => m.GroupId ).ToList();
if ( familyIds.Count == 1 )
{
int familyId = familyIds.FirstOrDefault();
var family = families.Where( g => g.Id == familyId ).FirstOrDefault();
{
if ( family != null )
{
family.CampusId = campusId;
}
familyMembers.RemoveAll( m => m.GroupId == familyId );
}
}
}
rockContext.SaveChanges();
}
// Update following
if ( SelectedFields.Contains( ddlFollow.ClientID ) )
{
var personAliasEntityType = EntityTypeCache.Read( "Rock.Model.PersonAlias" );
if ( personAliasEntityType != null )
{
int personAliasEntityTypeId = personAliasEntityType.Id;
bool follow = true;
if ( !string.IsNullOrWhiteSpace( ddlFollow.SelectedValue ) )
{
follow = ddlFollow.SelectedValue == "Add";
}
var personAliasService = new PersonAliasService( rockContext );
var followingService = new FollowingService( rockContext );
if ( follow )
{
var paQry = personAliasService.Queryable();
var alreadyFollowingIds = followingService.Queryable()
.Where( f =>
f.EntityTypeId == personAliasEntityTypeId &&
f.PersonAlias.Id == CurrentPersonAlias.Id )
.Join( paQry, f => f.EntityId, p => p.Id, ( f, p ) => new { PersonAlias = p } )