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


C# DefinedValueService.ToList方法代码示例

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

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

示例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();
        }
开发者ID:jh2mhs8,项目名称:Rock-ChMS,代码行数:23,代码来源:DefinedTypes.ascx.cs


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