本文整理汇总了C#中Rock.Model.GroupTypeRoleService.Queryable方法的典型用法代码示例。如果您正苦于以下问题:C# GroupTypeRoleService.Queryable方法的具体用法?C# GroupTypeRoleService.Queryable怎么用?C# GroupTypeRoleService.Queryable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rock.Model.GroupTypeRoleService
的用法示例。
在下文中一共展示了GroupTypeRoleService.Queryable方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: gp_SelectItem
/// <summary>
/// Handles the SelectItem event of the gp control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
protected void gp_SelectItem( object sender, EventArgs e )
{
int groupId = gp.SelectedValueAsId() ?? 0;
var groupService = new GroupService();
var group = groupService.Get( groupId );
if ( group != null )
{
var groupTypeRoleService = new GroupTypeRoleService();
var list = groupTypeRoleService.Queryable().Where( a => a.GroupTypeId == group.GroupTypeId ).OrderBy( a => a.Order ).ToList();
cblRole.Items.Clear();
foreach ( var item in list )
{
cblRole.Items.Add( new ListItem( item.Name, item.Id.ToString() ) );
}
cblRole.Visible = list.Count > 0;
}
else
{
cblRole.Visible = false;
}
}
示例2: ShowModal
private void ShowModal( Person person, int? roleId, int? groupMemberId )
{
Guid roleGuid = Guid.Empty;
if ( Guid.TryParse( GetAttributeValue( "GroupType/RoleFilter" ), out roleGuid ) )
{
var groupTypeRoleService = new GroupTypeRoleService( new RockContext() );
var role = groupTypeRoleService.Get( ownerRoleGuid );
grpRole.ExcludeGroupRoles.Add( role.Id );
grpRole.GroupTypeId = groupTypeRoleService.Queryable()
.Where( r => r.Guid == roleGuid )
.Select( r => r.GroupTypeId )
.FirstOrDefault();
}
grpRole.GroupRoleId = roleId;
ppPerson.SetValue( person );
ShowDialog( groupMemberId ?? 0, true );
}
示例3: gp_SelectItem
/// <summary>
/// Handles the SelectItem event of the gp control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
protected void gp_SelectItem( object sender, EventArgs e )
{
var rockContext = new RockContext();
var groupIdList = gp.SelectedValues.AsIntegerList();
var groupService = new GroupService( rockContext );
var qryGroups = groupService.GetByIds( groupIdList );
if ( qryGroups.Any() )
{
var groupTypeRoleService = new GroupTypeRoleService( rockContext );
var qryGroupTypeRoles = groupTypeRoleService.Queryable();
List<int> selectedGroupTypeIds = qryGroups.Select( a => a.GroupTypeId ).Distinct().ToList();
if ( cbChildGroups.Checked )
{
List<int> childGroupTypeIds = new List<int>();
foreach ( var groupId in qryGroups.Select( a => a.Id ).ToList() )
{
if ( cbChildGroupsPlusDescendants.Checked )
{
// get all children and descendants of the selected group(s)
var descendants = groupService.GetAllDescendents( groupId );
if ( !cbIncludeInactiveGroups.Checked )
{
descendants = descendants.Where( a => a.IsActive == true );
}
childGroupTypeIds.AddRange( descendants.Select( a => a.GroupTypeId ).Distinct().ToList() );
}
else
{
// get only immediate children of the selected group(s)
var childGroups = groupService.Queryable().Where( a => a.ParentGroupId == groupId );
if ( !cbIncludeInactiveGroups.Checked )
{
childGroups = childGroups.Where( a => a.IsActive == true );
}
childGroupTypeIds.AddRange( childGroups.Select( a => a.GroupTypeId ).Distinct().ToList() );
}
}
childGroupTypeIds = childGroupTypeIds.Distinct().ToList();
if ( cbIncludeSelectedGroup.Checked )
{
qryGroupTypeRoles = qryGroupTypeRoles.Where( a => a.GroupTypeId.HasValue && ( selectedGroupTypeIds.Contains( a.GroupTypeId.Value ) || childGroupTypeIds.Contains( a.GroupTypeId.Value ) ) );
}
else
{
qryGroupTypeRoles = qryGroupTypeRoles.Where( a => a.GroupTypeId.HasValue && childGroupTypeIds.Contains( a.GroupTypeId.Value ) );
}
}
else
{
qryGroupTypeRoles = qryGroupTypeRoles.Where( a => a.GroupTypeId.HasValue && selectedGroupTypeIds.Contains( a.GroupTypeId.Value ) );
}
var list = qryGroupTypeRoles.OrderBy( a => a.GroupType.Order ).ThenBy( a => a.GroupType.Name ).ThenBy( a => a.Order ).ThenBy( a => a.Name ).ToList();
cblRole.Items.Clear();
foreach ( var item in list )
{
cblRole.Items.Add( new ListItem( string.Format( "{0} ({1})", item.Name, item.GroupType.Name ), item.Guid.ToString() ) );
}
cblRole.Visible = list.Count > 0;
}
else
{
cblRole.Visible = false;
}
}
示例4: rblRole_SelectedIndexChanged
/// <summary>
/// Handles the SelectedIndexChanged event of the rblRole control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
protected void rblRole_SelectedIndexChanged( object sender, EventArgs e )
{
GroupTypeRoleService groupTypeRoleService = new GroupTypeRoleService( new RockContext() );
List<Guid> attributeGuidList = new List<Guid>();
var adultGuid = Rock.SystemGuid.GroupRole.GROUPROLE_FAMILY_MEMBER_ADULT.AsGuid();
var groupTypeGuid = Rock.SystemGuid.GroupType.GROUPTYPE_FAMILY.AsGuid();
var selectedId = rblRole.SelectedValueAsId();
if ( selectedId.HasValue )
{
if ( groupTypeRoleService.Queryable().Where( gr =>
gr.GroupType.Guid == groupTypeGuid &&
gr.Guid == adultGuid &&
gr.Id == selectedId ).Any() )
{
attributeGuidList = GetAttributeValue( "PersonAttributes(adults)" ).SplitDelimitedValues().AsGuidList();
ddlGradePicker.Visible = false;
}
else
{
attributeGuidList = GetAttributeValue( "PersonAttributes(children)" ).SplitDelimitedValues().AsGuidList();
ddlGradePicker.Visible = true;
}
if ( attributeGuidList.Any() )
{
pnlPersonAttributes.Visible = true;
DisplayEditAttributes( new Person(), attributeGuidList, phPersonAttributes, pnlPersonAttributes, true );
}
else
{
pnlPersonAttributes.Visible = false;
}
}
}
示例5: gp_SelectItem
/// <summary>
/// Handles the SelectItem event of the gp control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
protected void gp_SelectItem( object sender, EventArgs e )
{
var rockContext = new RockContext();
int groupId = gp.SelectedValueAsId() ?? 0;
var groupService = new GroupService( rockContext );
var group = groupService.Get( groupId );
if ( group != null )
{
var groupTypeRoleService = new GroupTypeRoleService( rockContext );
var qryGroupTypeRoles = groupTypeRoleService.Queryable();
if ( cbChildGroups.Checked )
{
var childGroupTypeIds = groupService.GetAllDescendents( group.Id ).Select( a => a.GroupTypeId ).Distinct().ToList();
qryGroupTypeRoles = qryGroupTypeRoles.Where( a => a.GroupTypeId.HasValue && ( a.GroupTypeId == group.GroupTypeId || childGroupTypeIds.Contains( a.GroupTypeId.Value ) ) );
}
else
{
qryGroupTypeRoles = qryGroupTypeRoles.Where( a => a.GroupTypeId.HasValue && a.GroupTypeId == group.GroupTypeId );
}
var list = qryGroupTypeRoles.OrderBy( a => a.GroupType.Order ).ThenBy( a => a.GroupType.Name ).ThenBy( a => a.Order ).ThenBy( a => a.Name ).ToList();
cblRole.Items.Clear();
foreach ( var item in list )
{
cblRole.Items.Add( new ListItem( string.Format( "{0} ({1})", item.Name, item.GroupType.Name ), item.Guid.ToString() ) );
}
cblRole.Visible = list.Count > 0;
cbChildGroups.Visible = true;
}
else
{
cblRole.Visible = false;
cbChildGroups.Visible = false;
}
}