本文整理汇总了C#中Rock.Model.GroupMemberService.OrderBy方法的典型用法代码示例。如果您正苦于以下问题:C# GroupMemberService.OrderBy方法的具体用法?C# GroupMemberService.OrderBy怎么用?C# GroupMemberService.OrderBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rock.Model.GroupMemberService
的用法示例。
在下文中一共展示了GroupMemberService.OrderBy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: rptrGroups_ItemDataBound
/// <summary>
/// Handles the ItemDataBound event of the rptrGroups control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.Web.UI.WebControls.RepeaterItemEventArgs"/> instance containing the event data.</param>
protected void rptrGroups_ItemDataBound( object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e )
{
if ( e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem )
{
var group = e.Item.DataItem as Group;
if ( group != null )
{
HyperLink hlEditGroup = e.Item.FindControl( "hlEditGroup" ) as HyperLink;
if ( hlEditGroup != null )
{
hlEditGroup.Visible = _allowEdit;
var pageParams = new Dictionary<string, string>();
pageParams.Add( "PersonId", Person.Id.ToString() );
pageParams.Add( "GroupId", group.Id.ToString() );
hlEditGroup.NavigateUrl = LinkedPageUrl( "GroupEditPage", pageParams );
}
Repeater rptrMembers = e.Item.FindControl( "rptrMembers" ) as Repeater;
if ( rptrMembers != null )
{
// use the _bindGroupsRockContext that is created/disposed in BindFamilies()
var members = new GroupMemberService( _bindGroupsRockContext ).Queryable( "GroupRole,Person", true )
.Where( m =>
m.GroupId == group.Id &&
m.PersonId != Person.Id )
.OrderBy( m => m.GroupRole.Order )
.ToList();
var orderedMembers = new List<GroupMember>();
if ( _IsFamilyGroupType )
{
// Add adult males
orderedMembers.AddRange( members
.Where( m => m.GroupRole.Guid.Equals( new Guid( Rock.SystemGuid.GroupRole.GROUPROLE_FAMILY_MEMBER_ADULT ) ) &&
m.Person.Gender == Gender.Male )
.OrderByDescending( m => m.Person.Age ) );
// Add adult females
orderedMembers.AddRange( members
.Where( m => m.GroupRole.Guid.Equals( new Guid( Rock.SystemGuid.GroupRole.GROUPROLE_FAMILY_MEMBER_ADULT ) ) &&
m.Person.Gender != Gender.Male )
.OrderByDescending( m => m.Person.Age ) );
// Add non-adults
orderedMembers.AddRange( members
.Where( m => !m.GroupRole.Guid.Equals( new Guid( Rock.SystemGuid.GroupRole.GROUPROLE_FAMILY_MEMBER_ADULT ) ) )
.OrderByDescending( m => m.Person.Age ) );
}
else
{
orderedMembers = members
.OrderBy( m => m.GroupRole.Order )
.ThenBy( m => m.Person.LastName )
.ThenBy( m => m.Person.NickName )
.ToList();
}
rptrMembers.ItemDataBound += rptrMembers_ItemDataBound;
rptrMembers.DataSource = orderedMembers;
rptrMembers.DataBind();
}
Repeater rptrAddresses = e.Item.FindControl( "rptrAddresses" ) as Repeater;
if ( rptrAddresses != null )
{
rptrAddresses.ItemDataBound += rptrAddresses_ItemDataBound;
rptrAddresses.ItemCommand += rptrAddresses_ItemCommand;
rptrAddresses.DataSource = new GroupLocationService( _bindGroupsRockContext ).Queryable( "Location,GroupLocationTypeValue" )
.Where( l => l.GroupId == group.Id )
.OrderBy( l => l.GroupLocationTypeValue.Order )
.ToList();
rptrAddresses.DataBind();
}
Panel pnlGroupAttributes = e.Item.FindControl( "pnlGroupAttributes" ) as Panel;
HyperLink hlShowMoreAttributes = e.Item.FindControl( "hlShowMoreAttributes" ) as HyperLink;
PlaceHolder phGroupAttributes = e.Item.FindControl( "phGroupAttributes" ) as PlaceHolder;
PlaceHolder phMoreGroupAttributes = e.Item.FindControl( "phMoreGroupAttributes" ) as PlaceHolder;
if ( pnlGroupAttributes != null && hlShowMoreAttributes != null && phGroupAttributes != null && phMoreGroupAttributes != null )
{
hlShowMoreAttributes.Visible = false;
phGroupAttributes.Controls.Clear();
phMoreGroupAttributes.Controls.Clear();
group.LoadAttributes();
var attributes = group.Attributes
.Select( a => a.Value )
.OrderBy( a => a.Order )
.ToList();
foreach( var attribute in attributes )
{
if ( attribute.IsAuthorized( Authorization.VIEW, CurrentPerson ) )
{
//.........这里部分代码省略.........
示例2: LoadDropDowns
/// <summary>
/// Loads the drop downs.
/// </summary>
private void LoadDropDowns( BenevolenceRequest benevolenceRequest )
{
ddlRequestStatus.BindToDefinedType( DefinedTypeCache.Read( new Guid( Rock.SystemGuid.DefinedType.BENEVOLENCE_REQUEST_STATUS ) ), false );
ddlConnectionStatus.BindToDefinedType( DefinedTypeCache.Read( new Guid( Rock.SystemGuid.DefinedType.PERSON_CONNECTION_STATUS ) ), true );
Guid groupGuid = GetAttributeValue( "CaseWorkerRole" ).AsGuid();
var personList = new GroupMemberService( new RockContext() )
.Queryable( "Person, Group" )
.Where( gm => gm.Group.Guid == groupGuid )
.Select( gm => gm.Person )
.ToList();
string caseWorkerPersonAliasValue = benevolenceRequest.CaseWorkerPersonAliasId.ToString();
if ( benevolenceRequest.CaseWorkerPersonAlias != null &&
benevolenceRequest.CaseWorkerPersonAlias.Person != null &&
!personList.Select( p => p.Id ).ToList().Contains( benevolenceRequest.CaseWorkerPersonAlias.Person.Id ) )
{
personList.Add( benevolenceRequest.CaseWorkerPersonAlias.Person );
}
ddlCaseWorker.DataSource = personList.OrderBy( p => p.NickName ).ThenBy( p => p.LastName ).ToList();
ddlCaseWorker.DataTextField = "FullName";
ddlCaseWorker.DataValueField = "PrimaryAliasId";
ddlCaseWorker.DataBind();
ddlCaseWorker.Items.Insert( 0, new ListItem() );
}
示例3: rptrGroups_ItemDataBound
/// <summary>
/// Handles the ItemDataBound event of the rptrGroups control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.Web.UI.WebControls.RepeaterItemEventArgs"/> instance containing the event data.</param>
protected void rptrGroups_ItemDataBound( object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e )
{
if ( e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem )
{
var group = e.Item.DataItem as Group;
if ( group != null )
{
HyperLink hlEditGroup = e.Item.FindControl( "hlEditGroup" ) as HyperLink;
if ( hlEditGroup != null )
{
hlEditGroup.Visible = _allowEdit;
var pageParams = new Dictionary<string, string>();
pageParams.Add( "PersonId", Person.Id.ToString() );
pageParams.Add( "GroupId", group.Id.ToString() );
hlEditGroup.NavigateUrl = LinkedPageUrl( "GroupEditPage", pageParams );
}
Literal lEditGroup = e.Item.FindControl( "lEditGroup" ) as Literal;
if ( lEditGroup != null )
{
lEditGroup.Text = "Edit " + _groupType.Name;
}
Repeater rptrMembers = e.Item.FindControl( "rptrMembers" ) as Repeater;
if ( rptrMembers != null )
{
// use the _bindGroupsRockContext that is created/disposed in BindFamilies()
var members = new GroupMemberService( _bindGroupsRockContext ).Queryable( "GroupRole,Person", true )
.Where( m =>
m.GroupId == group.Id &&
m.PersonId != Person.Id )
.OrderBy( m => m.GroupRole.Order )
.ToList();
var orderedMembers = new List<GroupMember>();
if ( _IsFamilyGroupType )
{
// Add adult males
orderedMembers.AddRange( members
.Where( m => m.GroupRole.Guid.Equals( new Guid( Rock.SystemGuid.GroupRole.GROUPROLE_FAMILY_MEMBER_ADULT ) ) &&
m.Person.Gender == Gender.Male )
.OrderByDescending( m => m.Person.Age ) );
// Add adult females
orderedMembers.AddRange( members
.Where( m => m.GroupRole.Guid.Equals( new Guid( Rock.SystemGuid.GroupRole.GROUPROLE_FAMILY_MEMBER_ADULT ) ) &&
m.Person.Gender != Gender.Male )
.OrderByDescending( m => m.Person.Age ) );
// Add non-adults
orderedMembers.AddRange( members
.Where( m => !m.GroupRole.Guid.Equals( new Guid( Rock.SystemGuid.GroupRole.GROUPROLE_FAMILY_MEMBER_ADULT ) ) )
.OrderByDescending( m => m.Person.Age ) );
}
else
{
orderedMembers = members
.OrderBy( m => m.GroupRole.Order )
.ThenBy( m => m.Person.LastName )
.ThenBy( m => m.Person.NickName )
.ToList();
}
rptrMembers.ItemDataBound += rptrMembers_ItemDataBound;
rptrMembers.DataSource = orderedMembers;
rptrMembers.DataBind();
}
Repeater rptrAddresses = e.Item.FindControl( "rptrAddresses" ) as Repeater;
{
rptrAddresses.ItemDataBound += rptrAddresses_ItemDataBound;
rptrAddresses.ItemCommand += rptrAddresses_ItemCommand;
rptrAddresses.DataSource = new GroupLocationService( _bindGroupsRockContext ).Queryable( "Location,GroupLocationTypeValue" )
.Where( l => l.GroupId == group.Id )
.OrderBy( l => l.GroupLocationTypeValue.Order )
.ToList();
rptrAddresses.DataBind();
}
}
}
}