本文整理汇总了C#中Rock.Model.DefinedValueService.Reorder方法的典型用法代码示例。如果您正苦于以下问题:C# DefinedValueService.Reorder方法的具体用法?C# DefinedValueService.Reorder怎么用?C# DefinedValueService.Reorder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rock.Model.DefinedValueService
的用法示例。
在下文中一共展示了DefinedValueService.Reorder方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: gDefinedValues_GridReorder
/// <summary>
/// Handles the GridReorder event of the gDefinedValues control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="GridReorderEventArgs"/> instance containing the event data.</param>
private void gDefinedValues_GridReorder( object sender, GridReorderEventArgs e )
{
int definedTypeId = hfDefinedTypeId.ValueAsInt();
DefinedTypeCache.Flush( definedTypeId );
using ( new UnitOfWorkScope() )
{
var definedValueService = new DefinedValueService();
var definedValues = definedValueService.Queryable().Where( a => a.DefinedTypeId == definedTypeId ).OrderBy( a => a.Order );
definedValueService.Reorder( definedValues.ToList(), e.OldIndex, e.NewIndex, CurrentPersonId );
BindDefinedValuesGrid();
}
}
示例2: gDefinedValues_GridReorder
/// <summary>
/// Handles the GridReorder event of the gDefinedValues control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="GridReorderEventArgs"/> instance containing the event data.</param>
private void gDefinedValues_GridReorder( object sender, GridReorderEventArgs e )
{
int definedTypeId = hfDefinedTypeId.ValueAsInt();
DefinedTypeCache.Flush( definedTypeId );
var rockContext = new RockContext();
var definedValueService = new DefinedValueService( rockContext );
var definedValues = definedValueService.Queryable().Where( a => a.DefinedTypeId == definedTypeId ).OrderBy( a => a.Order ).ThenBy( a => a.Name);
var changedIds = definedValueService.Reorder( definedValues.ToList(), e.OldIndex, e.NewIndex );
rockContext.SaveChanges();
Rock.Web.Cache.DefinedTypeCache.Flush( definedTypeId );
foreach(int id in changedIds)
{
Rock.Web.Cache.DefinedValueCache.Flush( id );
}
BindDefinedValuesGrid();
}
示例3: gDefinedValues_GridReorder
/// <summary>
/// Handles the GridReorder event of the gDefinedValues control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="GridReorderEventArgs"/> instance containing the event data.</param>
protected void gDefinedValues_GridReorder( object sender, GridReorderEventArgs e )
{
var definedType = DefinedTypeCache.Read( Rock.SystemGuid.DefinedType.PROTECT_MY_MINISTRY_PACKAGES.AsGuid() );
if ( definedType != null )
{
var changedIds = new List<int>();
using ( var rockContext = new RockContext() )
{
var definedValueService = new DefinedValueService( rockContext );
var definedValues = definedValueService.Queryable().Where( a => a.DefinedTypeId == definedType.Id ).OrderBy( a => a.Order ).ThenBy( a => a.Value );
changedIds = definedValueService.Reorder( definedValues.ToList(), e.OldIndex, e.NewIndex );
rockContext.SaveChanges();
}
DefinedTypeCache.Flush( definedType.Id );
foreach ( int id in changedIds )
{
Rock.Web.Cache.DefinedValueCache.Flush( id );
}
}
BindPackageGrid();
}
示例4: gLinks_GridReorder
/// <summary>
/// Handles the GridReorder event of the gLinks control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="GridReorderEventArgs"/> instance containing the event data.</param>
void gLinks_GridReorder( object sender, GridReorderEventArgs e )
{
using ( var rockContext = new RockContext() )
{
var service = new DefinedValueService( rockContext );
var definedValues = service.Queryable().Where( a => a.DefinedTypeId == _definedType.Id ).OrderBy( a => a.Order ).ThenBy( a => a.Value );
var changedIds = service.Reorder( definedValues.ToList(), e.OldIndex, e.NewIndex );
rockContext.SaveChanges();
foreach ( int id in changedIds )
{
Rock.Web.Cache.DefinedValueCache.Flush( id );
}
}
DefinedTypeCache.Flush( _definedType.Id );
BindGrid();
}