本文整理汇总了C#中Rock.Model.GroupTypeRoleService.Count方法的典型用法代码示例。如果您正苦于以下问题:C# GroupTypeRoleService.Count方法的具体用法?C# GroupTypeRoleService.Count怎么用?C# GroupTypeRoleService.Count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rock.Model.GroupTypeRoleService
的用法示例。
在下文中一共展示了GroupTypeRoleService.Count方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FormatSelection
/// <summary>
/// Formats the selection.
/// </summary>
/// <param name="entityType">Type of the entity.</param>
/// <param name="selection">The selection.</param>
/// <returns></returns>
public override string FormatSelection( Type entityType, string selection )
{
string result = "Group Member";
string[] selectionValues = selection.Split( '|' );
if ( selectionValues.Length >= 2 )
{
var rockContext = new RockContext();
var group = new GroupService( rockContext ).Get( selectionValues[0].AsGuid() );
var groupTypeRoleGuidList = selectionValues[1].Split( new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries ).Select( a => a.AsGuid() ).ToList();
var groupTypeRoles = new GroupTypeRoleService( rockContext ).Queryable().Where( a => groupTypeRoleGuidList.Contains( a.Guid ) ).ToList();
if ( group != null )
{
result = string.Format( "Not in group: {0}", group.Name );
if ( groupTypeRoles.Count() > 0 )
{
result += string.Format( ", with role(s): {0}", groupTypeRoles.Select( a => a.Name ).ToList().AsDelimited( "," ) );
}
}
}
return result;
}
示例2: FormatSelection
/// <summary>
/// Formats the selection.
/// </summary>
/// <param name="entityType">Type of the entity.</param>
/// <param name="selection">The selection.</param>
/// <returns></returns>
public override string FormatSelection( Type entityType, string selection )
{
string result = "Group Member";
string[] selectionValues = selection.Split( '|' );
if ( selectionValues.Length >= 2 )
{
var groupType = Rock.Web.Cache.GroupTypeCache.Read( selectionValues[0].AsInteger() ?? 0 );
var groupTypeRoleIdList = selectionValues[1].Split( new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries ).Select( a => a.AsInteger() ).ToList();
var groupTypeRoles = new GroupTypeRoleService().Queryable().Where( a => groupTypeRoleIdList.Contains( a.Id ) ).ToList();
if ( groupType != null )
{
result = string.Format( "In group of group type: {0}", groupType.Name );
if ( groupTypeRoles.Count() > 0 )
{
result += string.Format( ", with role(s): {0}", groupTypeRoles.Select( a => a.Name ).ToList().AsDelimited( "," ) );
}
}
}
return result;
}
示例3: GroupFilterFormatSelection
/// <summary>
/// Formats the selection for the InGroupFilter/NotInGroupFilter based on if we are in "Not" mode
/// </summary>
/// <param name="selection">The selection.</param>
/// <param name="not">if set to <c>true</c> [not].</param>
/// <returns></returns>
public virtual string GroupFilterFormatSelection( string selection, bool not )
{
string result = "Group Member";
string[] selectionValues = selection.Split( '|' );
if ( selectionValues.Length >= 2 )
{
var rockContext = new RockContext();
var groupGuids = selectionValues[0].Split( ',' ).AsGuidList();
var groups = new GroupService( rockContext ).GetByGuids( groupGuids );
var groupTypeRoleGuidList = selectionValues[1].Split( new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries ).Select( a => a.AsGuid() ).ToList();
var groupTypeRoles = new GroupTypeRoleService( rockContext ).Queryable().Where( a => groupTypeRoleGuidList.Contains( a.Guid ) ).ToList();
SlidingDateRangePicker fakeSlidingDateRangePicker = null;
bool includeChildGroups = false;
bool includeChildGroupsPlusDescendants = false;
bool includeChildGroupsIncludeSelected = false;
bool includeInactiveGroups = false;
if ( selectionValues.Length >= 3 )
{
includeChildGroups = selectionValues[2].AsBooleanOrNull() ?? false;
if ( selectionValues.Length >= 6 )
{
includeChildGroupsIncludeSelected = selectionValues[4].AsBooleanOrNull() ?? false;
includeChildGroupsPlusDescendants = selectionValues[5].AsBooleanOrNull() ?? false;
}
if ( selectionValues.Length >= 7 )
{
includeInactiveGroups = selectionValues[6].AsBooleanOrNull() ?? false;
}
if ( selectionValues.Length >= 8 )
{
fakeSlidingDateRangePicker = new SlidingDateRangePicker();
// convert comma delimited to pipe
fakeSlidingDateRangePicker.DelimitedValues = selectionValues[7].Replace( ',', '|' );
}
}
GroupMemberStatus? groupMemberStatus = null;
if ( selectionValues.Length >= 4 )
{
groupMemberStatus = selectionValues[3].ConvertToEnumOrNull<GroupMemberStatus>();
}
if ( groups != null )
{
result = string.Format( not ? "Not in groups: {0}" : "In groups: {0}", groups.Select( a => a.Name ).ToList().AsDelimited( ", ", " or " ) );
if ( includeChildGroups )
{
if ( includeChildGroupsPlusDescendants )
{
result += " or descendant groups";
}
else
{
result += " or child groups";
}
if ( includeInactiveGroups )
{
result += ", including inactive groups";
}
if ( !includeChildGroupsIncludeSelected )
{
result += ", not including selected groups";
}
}
if ( groupTypeRoles.Count() > 0 )
{
result += string.Format( ", with role(s): {0}", groupTypeRoles.Select( a => string.Format( "{0} ({1})", a.Name, a.GroupType.Name ) ).ToList().AsDelimited( "," ) );
}
if ( groupMemberStatus.HasValue )
{
result += string.Format( ", with member status: {0}", groupMemberStatus.ConvertToString() );
}
if ( fakeSlidingDateRangePicker != null )
{
result += string.Format( ", added to group in Date Range: {0}", SlidingDateRangePicker.FormatDelimitedValues( fakeSlidingDateRangePicker.DelimitedValues ) );
}
}
}
return result;
}
示例4: FormatSelection
/// <summary>
/// Formats the selection.
/// </summary>
/// <param name="entityType">Type of the entity.</param>
/// <param name="selection">The selection.</param>
/// <returns></returns>
public override string FormatSelection( Type entityType, string selection )
{
string result = "Group Member";
string[] selectionValues = selection.Split( '|' );
if ( selectionValues.Length >= 2 )
{
var rockContext = new RockContext();
var group = new GroupService( rockContext ).Get( selectionValues[0].AsGuid() );
var groupTypeRoleGuidList = selectionValues[1].Split( new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries ).Select( a => a.AsGuid() ).ToList();
var groupTypeRoles = new GroupTypeRoleService( rockContext ).Queryable().Where( a => groupTypeRoleGuidList.Contains( a.Guid ) ).ToList();
bool includeChildGroups = false;
if ( selectionValues.Length >= 3 )
{
includeChildGroups = selectionValues[2].AsBooleanOrNull() ?? false;
}
if ( group != null )
{
result = string.Format( "In group: {0}", group.Name );
if ( includeChildGroups )
{
result += " or child groups";
}
if ( groupTypeRoles.Count() > 0 )
{
result += string.Format( ", with role(s): {0}", groupTypeRoles.Select( a => string.Format( "{0} ({1})", a.Name, a.GroupType.Name ) ).ToList().AsDelimited( "," ) );
}
}
}
return result;
}