本文整理汇总了C#中Rock.Model.DefinedValueService.ToList方法的典型用法代码示例。如果您正苦于以下问题:C# DefinedValueService.ToList方法的具体用法?C# DefinedValueService.ToList怎么用?C# DefinedValueService.ToList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rock.Model.DefinedValueService
的用法示例。
在下文中一共展示了DefinedValueService.ToList方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BindDefinedValuesGrid
/// <summary>
/// Binds the defined values grid.
/// </summary>
protected void BindDefinedValuesGrid()
{
if ( _definedType != null )
{
var queryable = new DefinedValueService( new RockContext() ).Queryable().Where( a => a.DefinedTypeId == _definedType.Id ).OrderBy( a => a.Order );
var result = queryable.ToList();
gDefinedValues.DataSource = result;
gDefinedValues.DataBind();
}
}
示例2: BindDefinedValuesGrid
/// <summary>
/// Binds the defined values grid.
/// </summary>
protected void BindDefinedValuesGrid()
{
AttributeService attributeService = new AttributeService();
int definedTypeId = hfDefinedTypeId.ValueAsInt();
// add attributes with IsGridColumn to grid
string qualifierValue = hfDefinedTypeId.Value;
var qryDefinedTypeAttributes = attributeService.GetByEntityTypeId( new DefinedValue().TypeId ).AsQueryable()
.Where( a => a.EntityTypeQualifierColumn.Equals( "DefinedTypeId", StringComparison.OrdinalIgnoreCase )
&& a.EntityTypeQualifierValue.Equals( qualifierValue ) );
qryDefinedTypeAttributes = qryDefinedTypeAttributes.Where( a => a.IsGridColumn );
List<Attribute> gridItems = qryDefinedTypeAttributes.ToList();
foreach ( var item in gDefinedValues.Columns.OfType<AttributeField>().ToList() )
{
gDefinedValues.Columns.Remove( item );
}
foreach ( var item in gridItems.OrderBy( a => a.Order ).ThenBy( a => a.Name ) )
{
string dataFieldExpression = item.Key;
bool columnExists = gDefinedValues.Columns.OfType<AttributeField>().FirstOrDefault( a => a.DataField.Equals( dataFieldExpression ) ) != null;
if ( !columnExists )
{
AttributeField boundField = new AttributeField();
boundField.DataField = dataFieldExpression;
boundField.HeaderText = item.Name;
boundField.SortExpression = string.Empty;
int insertPos = gDefinedValues.Columns.IndexOf( gDefinedValues.Columns.OfType<DeleteField>().First());
gDefinedValues.Columns.Insert(insertPos, boundField );
}
}
var queryable = new DefinedValueService().Queryable().Where( a => a.DefinedTypeId == definedTypeId ).OrderBy( a => a.Order );
var result = queryable.ToList();
gDefinedValues.DataSource = result;
gDefinedValues.DataBind();
}
示例3: rGridValue_Bind
/// <summary>
/// Binds the grid for defined values.
/// </summary>
/// <param name="typeId">The type id.</param>
protected void rGridValue_Bind( string typeId )
{
int definedTypeId = Int32.Parse( typeId );
var queryable = new DefinedValueService().Queryable().
Where( a => a.DefinedTypeId == definedTypeId );
SortProperty sortProperty = rGridValue.SortProperty;
if ( sortProperty != null )
queryable = queryable.
Sort( sortProperty );
else
queryable = queryable.
OrderBy( a => a.Id);
rGridValue.DataSource = queryable.ToList();
rGridValue.DataBind();
}