本文整理汇总了C#中Rock.Model.ScheduleService.Sort方法的典型用法代码示例。如果您正苦于以下问题:C# ScheduleService.Sort方法的具体用法?C# ScheduleService.Sort怎么用?C# ScheduleService.Sort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rock.Model.ScheduleService
的用法示例。
在下文中一共展示了ScheduleService.Sort方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BindGrid
/// <summary>
/// Binds the group members grid.
/// </summary>
protected void BindGrid()
{
if ( _group != null )
{
lHeading.Text = _group.Name;
var qry = new ScheduleService( _rockContext ).GetGroupOccurrences( _group ).AsQueryable();
SortProperty sortProperty = gOccurrences.SortProperty;
List<ScheduleOccurrence> occurrences = null;
if ( sortProperty != null )
{
occurrences = qry.Sort( sortProperty ).ToList();
}
else
{
occurrences = qry.OrderByDescending( a => a.StartDateTime ).ToList();
}
gOccurrences.DataSource = occurrences;
gOccurrences.DataBind();
}
}
示例2: BindGrid
/// <summary>
/// Binds the group members grid.
/// </summary>
protected void BindGrid()
{
if ( _group != null )
{
lHeading.Text = _group.Name;
DateTime? fromDateTime = drpDates.LowerValue;
DateTime? toDateTime = drpDates.UpperValue;
List<int> locationIds = new List<int>();
List<int> scheduleIds = new List<int>();
// Location Filter
if ( ddlLocation.Visible )
{
string locValue = ddlLocation.SelectedValue;
if ( locValue.StartsWith( "P" ) )
{
int? parentLocationId = locValue.Substring( 1 ).AsIntegerOrNull();
if ( parentLocationId.HasValue )
{
locationIds = new LocationService( _rockContext )
.GetAllDescendents( parentLocationId.Value )
.Select( l => l.Id )
.ToList();
}
}
else
{
int? locationId = locValue.AsIntegerOrNull();
if ( locationId.HasValue )
{
locationIds.Add( locationId.Value );
}
}
}
// Schedule Filter
if ( ddlSchedule.Visible && ddlSchedule.SelectedValue != "0" )
{
scheduleIds.Add( ddlSchedule.SelectedValueAsInt() ?? 0 );
}
var qry = new ScheduleService( _rockContext )
.GetGroupOccurrences( _group, fromDateTime, toDateTime, locationIds, scheduleIds, true, bddlCampus.SelectedValueAsInt() )
.AsQueryable();
SortProperty sortProperty = gOccurrences.SortProperty;
List<ScheduleOccurrence> occurrences = null;
if ( sortProperty != null )
{
occurrences = qry.Sort( sortProperty ).ToList();
}
else
{
occurrences = qry.OrderByDescending( a => a.Date ).ThenByDescending( a => a.StartTime ).ToList();
}
gOccurrences.DataSource = occurrences;
gOccurrences.DataBind();
}
}