示例#1
0
        /// <summary>
        /// Creates the HTML controls required to configure this type of field
        /// </summary>
        /// <returns></returns>
        public override List <Control> ConfigurationControls()
        {
            var controls = base.ConfigurationControls();

            // build a drop down list of defined types (the one that gets selected is
            // used to build a list of defined values)
            var ddl = new RockDropDownList();

            controls.Add(ddl);
            ddl.AutoPostBack          = true;
            ddl.SelectedIndexChanged += OnQualifierUpdated;
            ddl.Label = "Group Type";
            ddl.Help  = "Type of group to select roles from, if left blank any group type's role can be selected.";

            ddl.Items.Add(new ListItem());

            var groupTypeService = new Rock.Model.GroupTypeService();
            var groupTypes       = groupTypeService.Queryable().OrderBy(a => a.Name).ToList();

            groupTypes.ForEach(g =>
                               ddl.Items.Add(new ListItem(g.Name, g.Id.ToString().ToUpper()))
                               );

            return(controls);
        }
示例#2
0
        /// <summary>
        /// Loads the group types.
        /// </summary>
        private void LoadGroupTypes()
        {
            _ddlGroupType.Items.Clear();

            var groupTypeService = new Rock.Model.GroupTypeService();
            var groupTypes       = groupTypeService.Queryable().OrderBy(a => a.Name).ToList();

            foreach (var g in groupTypes)
            {
                _ddlGroupType.Items.Add(new ListItem(g.Name, g.Id.ToString().ToUpper()));
            }
        }
示例#3
0
        /// <summary>
        /// Loads the group types.
        /// </summary>
        private void LoadGroupTypes()
        {
            _ddlGroupType.Items.Clear();
            _ddlGroupType.Items.Add(Rock.Constants.None.ListItem);

            var groupTypeService = new Rock.Model.GroupTypeService(new RockContext());

            // get all group types that have the ShowInGroupList flag set
            var groupTypes = groupTypeService.Queryable().Where(a => a.ShowInGroupList).OrderBy(a => a.Name).ToList();

            foreach (var g in groupTypes)
            {
                _ddlGroupType.Items.Add(new ListItem(g.Name, g.Id.ToString().ToUpper()));
            }
        }
示例#4
0
        /// <summary>
        /// Loads the group types.
        /// </summary>
        private void LoadGroupTypes()
        {
            _ddlGroupType.Items.Clear();

            if (!Required)
            {
                _ddlGroupType.Items.Add(new ListItem(string.Empty, Rock.Constants.None.IdValue));
            }

            using (var rockContext = new RockContext())
            {
                var groupTypeService = new Rock.Model.GroupTypeService(rockContext);

                // get all group types that have at least one role
                var groupTypes = groupTypeService.Queryable().Where(a => a.Roles.Any()).OrderBy(a => a.Name).ToList();
                foreach (var g in groupTypes)
                {
                    _ddlGroupType.Items.Add(new ListItem(g.Name, g.Id.ToString().ToUpper()));
                }
            }
        }
示例#5
0
        /// <summary>
        /// Loads the group types.
        /// </summary>
        private void LoadGroupTypes()
        {
            _ddlGroupType.Items.Clear();

            if ( !Required )
            {
                _ddlGroupType.Items.Add( new ListItem( string.Empty, Rock.Constants.None.IdValue ) );
            }

            using ( var rockContext = new RockContext() )
            {
                var groupTypeService = new Rock.Model.GroupTypeService( rockContext );

                // get all group types that have at least one role
                var groupTypes = groupTypeService.Queryable().Where( a => a.Roles.Any() ).OrderBy( a => a.Name ).ToList();
                foreach ( var g in groupTypes )
                {
                    _ddlGroupType.Items.Add( new ListItem( g.Name, g.Id.ToString().ToUpper() ) );
                }
            }
        }
示例#6
0
        /// <summary>
        /// Loads the group types.
        /// </summary>
        private void LoadGroupTypes()
        {
            _ddlGroupType.Items.Clear();

            var groupTypeService = new Rock.Model.GroupTypeService();
            var groupTypes = groupTypeService.Queryable().OrderBy( a => a.Name ).ToList();

            foreach ( var g in groupTypes )
            {
                _ddlGroupType.Items.Add( new ListItem( g.Name, g.Id.ToString().ToUpper() ) );
            }
        }
示例#7
0
        /// <summary>
        /// Loads the group types.
        /// </summary>
        private void LoadGroupTypes()
        {
            _ddlGroupType.Items.Clear();
            _ddlGroupType.Items.Add( Rock.Constants.None.ListItem );

            var groupTypeService = new Rock.Model.GroupTypeService( new RockContext() );

            // get all group types that have the ShowInGroupList flag set
            var groupTypes = groupTypeService.Queryable().Where( a => a.ShowInGroupList ).OrderBy( a => a.Name ).ToList();

            foreach ( var g in groupTypes )
            {
                _ddlGroupType.Items.Add( new ListItem( g.Name, g.Id.ToString().ToUpper() ) );
            }
        }
示例#8
0
        /// <summary>
        /// Loads the group types.
        /// </summary>
        private void LoadGroupTypes()
        {
            _ddlGroupType.Items.Clear();

            var groupTypeService = new Rock.Model.GroupTypeService( new RockContext() );

            // get all group types that have at least one role
            var groupTypes = groupTypeService.Queryable().Where( a => a.Roles.Any()).OrderBy( a => a.Name ).ToList();

            foreach ( var g in groupTypes )
            {
                _ddlGroupType.Items.Add( new ListItem( g.Name, g.Id.ToString().ToUpper() ) );
            }
        }