当前位置: 首页>>代码示例>>C#>>正文


C# DefinedValueService.Reorder方法代码示例

本文整理汇总了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();
            }
        }
开发者ID:pkdevbox,项目名称:Rock,代码行数:18,代码来源:DefinedValueList.ascx.cs

示例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();
        }
开发者ID:CentralAZ,项目名称:Rockit-CentralAZ,代码行数:24,代码来源:DefinedValueList.ascx.cs

示例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();
        }
开发者ID:RMRDevelopment,项目名称:Rockit,代码行数:29,代码来源:ProtectMyMinistrySettings.ascx.cs

示例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();
        }
开发者ID:NewPointe,项目名称:Rockit,代码行数:24,代码来源:LinkListLava.ascx.cs


注:本文中的Rock.Model.DefinedValueService.Reorder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。