コード例 #1
0
        /// <summary>
        /// Binds the grid.
        /// </summary>
        private void BindGrid()
        {
            using ( var rockContext = new RockContext() )
            {
                // limit to show only GroupTypes that have a group type purpose of Checkin Template
                int groupTypePurposeCheckInTemplateId = DefinedValueCache.Read( new Guid( Rock.SystemGuid.DefinedValue.GROUPTYPE_PURPOSE_CHECKIN_TEMPLATE ) ).Id;

                var qry = new GroupTypeService( rockContext )
                    .Queryable().AsNoTracking()
                    .Where( a => a.GroupTypePurposeValueId == groupTypePurposeCheckInTemplateId );

                SortProperty sortProperty = gGroupType.SortProperty;
                if ( sortProperty != null )
                {
                    gGroupType.DataSource = qry.Sort( sortProperty ).ToList();
                }
                else
                {
                    gGroupType.DataSource = qry.OrderBy( p => p.Name ).ToList();
                }

                gGroupType.DataBind();
            }
        }
コード例 #2
0
        /// <summary>
        /// Gets the group types.
        /// </summary>
        /// <returns></returns>
        private IQueryable<GroupType> GetGroupTypes( RockContext rockContext )
        {
            var qry = new GroupTypeService( rockContext ).Queryable();

            int? purposeId = rFilter.GetUserPreference( "Purpose" ).AsIntegerOrNull();
            if ( purposeId.HasValue )
            {
                qry = qry.Where( t => t.GroupTypePurposeValueId == purposeId.Value );
            }

            var isSystem = rFilter.GetUserPreference( "System Group Types" );
            if ( isSystem == "Yes" )
            {
                qry = qry.Where( t => t.IsSystem );
            }
            else if ( isSystem == "No" )
            {
                qry = qry.Where( t => !t.IsSystem );
            }

            var isShownInNavigation = rFilter.GetUserPreference("Shown in Navigation").AsBooleanOrNull();
            if (isShownInNavigation.HasValue)
            {
                if (isShownInNavigation.Value)
                {
                    qry = qry.Where(t => t.ShowInNavigation);
                }
                else if (!isShownInNavigation.Value)
                {
                    qry = qry.Where(t => !t.ShowInNavigation);
                }

            }

            return qry.OrderBy( g => g.Order );
        }
コード例 #3
0
ファイル: GroupTypeFieldType.cs プロジェクト: NewSpring/Rock
        /// <summary>
        /// Creates the control(s) necessary for prompting user for a new value
        /// </summary>
        /// <param name="configurationValues">The configuration values.</param>
        /// <param name="id"></param>
        /// <returns>
        /// The control
        /// </returns>
        public override System.Web.UI.Control EditControl( Dictionary<string, ConfigurationValue> configurationValues, string id )
        {
            var editControl = new GroupTypePicker { ID = id };
            var qryGroupTypes = new GroupTypeService( new RockContext() ).Queryable();

            if ( configurationValues.ContainsKey( GROUP_TYPE_PURPOSE_VALUE_GUID ) )
            {
                var groupTypePurposeValueGuid = ( configurationValues[GROUP_TYPE_PURPOSE_VALUE_GUID] ).Value.AsGuidOrNull();
                if ( groupTypePurposeValueGuid.HasValue )
                {
                    qryGroupTypes = qryGroupTypes.Where( a => a.GroupTypePurposeValue.Guid == groupTypePurposeValueGuid.Value );
                }
            }

            editControl.GroupTypes = qryGroupTypes.OrderBy( a => a.Name ).ToList();
            return editControl;
        }
コード例 #4
0
ファイル: GroupTypeList.ascx.cs プロジェクト: Ganon11/Rock
        /// <summary>
        /// Gets the group types.
        /// </summary>
        /// <returns></returns>
        private IQueryable<GroupType> GetGroupTypes()
        {
            var qry = new GroupTypeService( new RockContext() ).Queryable();

            int? purposeId = rFilter.GetUserPreference( "Purpose" ).AsIntegerOrNull();
            if ( purposeId.HasValue )
            {
                qry = qry.Where( t => t.GroupTypePurposeValueId == purposeId.Value );
            }

            var isSystem = rFilter.GetUserPreference( "System Group Types" );
            if ( isSystem == "Yes" )
            {
                qry = qry.Where( t => t.IsSystem );
            }
            else if ( isSystem == "No" )
            {
                qry = qry.Where( t => !t.IsSystem );
            }

            return qry.OrderBy( g => g.Order );
        }
コード例 #5
0
ファイル: GroupTypeList.ascx.cs プロジェクト: pkdevbox/Rock
        /// <summary>
        /// Gets the group types.
        /// </summary>
        /// <returns></returns>
        private IQueryable<GroupType> GetGroupTypes()
        {
            var qry = new GroupTypeService().Queryable();

            int purposeId = int.MinValue;
            if ( int.TryParse( rFilter.GetUserPreference( "Purpose" ), out purposeId ) )
            {
                qry = qry.Where( t => t.GroupTypePurposeValueId == purposeId );
            }

            var isSystem = rFilter.GetUserPreference( "System Group Types" );
            if ( isSystem == "Yes" )
            {
                qry = qry.Where( t => t.IsSystem );
            }
            else if (isSystem == "No")
            {
                qry = qry.Where( t => !t.IsSystem);
            }

            return qry.OrderBy( g => g.Order );
        }