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


C# RoleController.GetRolesByGroup方法代码示例

本文整理汇总了C#中DotNetNuke.Security.Roles.RoleController.GetRolesByGroup方法的典型用法代码示例。如果您正苦于以下问题:C# RoleController.GetRolesByGroup方法的具体用法?C# RoleController.GetRolesByGroup怎么用?C# RoleController.GetRolesByGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DotNetNuke.Security.Roles.RoleController的用法示例。


在下文中一共展示了RoleController.GetRolesByGroup方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BindData

        /// <summary>
        /// BindData gets the roles from the Database and binds them to the DataGrid
        /// </summary>
        /// <history>
        /// 	[cnurse]	9/10/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        ///     [cnurse]    01/05/2006  Updated to reflect Use of Role Groups
        /// </history>
        private void BindData()
        {
            // Get the portal's roles from the database
            RoleController objRoles = new RoleController();
            ArrayList arrRoles;

            if( RoleGroupId < - 1 )
            {
                arrRoles = objRoles.GetPortalRoles( PortalId );
            }
            else
            {
                arrRoles = objRoles.GetRolesByGroup( PortalId, RoleGroupId );
            }
            grdRoles.DataSource = arrRoles;

            if( RoleGroupId < 0 )
            {
                lnkEditGroup.Visible = false;
                cmdDelete.Visible = false;
            }
            else
            {
                lnkEditGroup.Visible = true;
                lnkEditGroup.NavigateUrl = EditUrl( "RoleGroupId", RoleGroupId.ToString(), "EditGroup" );
                cmdDelete.Visible = !( arrRoles.Count > 0 );
                ClientAPI.AddButtonConfirm( cmdDelete, Localization.GetString( "DeleteItem" ) );
            }

            Localization.LocalizeDataGrid( ref grdRoles, this.LocalResourceFile );

            grdRoles.DataBind();
        }
开发者ID:huayang912,项目名称:cs-dotnetnuke,代码行数:41,代码来源:Roles.ascx.cs

示例2: Page_Load

        /// <summary>
        /// Page_Load runs when the control is loaded
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// 	[cnurse]	9/10/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        protected void Page_Load( Object sender, EventArgs e )
        {
            try
            {
                if( ( Request.QueryString["RoleGroupID"] != null ) )
                {
                    RoleGroupID = int.Parse( Request.QueryString["RoleGroupID"] );
                }

                if( Page.IsPostBack == false )
                {
                    ClientAPI.AddButtonConfirm( cmdDelete, Localization.GetString( "DeleteItem" ) );
                    RoleController objRoles = new RoleController();
                    if( RoleGroupID != - 1 )
                    {
                        RoleGroupInfo objRoleGroupInfo = RoleController.GetRoleGroup( PortalId, RoleGroupID );
                        if( objRoleGroupInfo != null )
                        {
                            txtRoleGroupName.Text = objRoleGroupInfo.RoleGroupName;
                            txtDescription.Text = objRoleGroupInfo.Description;

                            //Check if Group has any roles assigned
                            int roleCount = objRoles.GetRolesByGroup( PortalId, RoleGroupID ).Count;

                            if( roleCount > 0 )
                            {
                                cmdDelete.Visible = false;
                            }
                        }
                        else // security violation attempt to access item not related to this Module
                        {
                            Response.Redirect( Globals.NavigateURL( "Security Roles" ) );
                        }
                    }
                    else
                    {
                        cmdDelete.Visible = false;
                    }
                }
            }
            catch( Exception exc ) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException( this, exc );
            }
        }
开发者ID:huayang912,项目名称:cs-dotnetnuke,代码行数:54,代码来源:EditGroups.ascx.cs

示例3: BindData

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// BindData gets the roles from the Database and binds them to the DataGrid
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// 	[cnurse]	9/10/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        ///     [cnurse]    01/05/2006  Updated to reflect Use of Role Groups
        /// </history>
        /// -----------------------------------------------------------------------------
        private void BindData()
        {
            //Get the portal's roles from the database
            var objRoles = new RoleController();

            var arrRoles = _roleGroupId < -1 ? objRoles.GetPortalRoles(PortalId) : objRoles.GetRolesByGroup(PortalId, _roleGroupId);
            grdRoles.DataSource = arrRoles;

            if (_roleGroupId < 0)
            {
                lnkEditGroup.Visible = false;
                cmdDelete.Visible = false;
            }
            else
            {
                lnkEditGroup.Visible = true;
                lnkEditGroup.NavigateUrl = EditUrl("RoleGroupId", _roleGroupId.ToString(), "EditGroup");
                cmdDelete.Visible = arrRoles.Count == 0;
            }
            Localization.LocalizeDataGrid(ref grdRoles, LocalResourceFile);

            grdRoles.DataBind();
        }
开发者ID:rickfox,项目名称:Steves,代码行数:35,代码来源:Roles.ascx.cs

示例4: GetRoles

        /// <summary>
        /// Gets the roles from the Database and loads them into the Roles property
        /// </summary>
        private void GetRoles()
        {
            RoleController objRoleController = new RoleController();
            int RoleGroupId = -2;
            if( ( cboRoleGroups != null ) && ( cboRoleGroups.SelectedValue != null ) )
            {
                RoleGroupId = int.Parse( cboRoleGroups.SelectedValue );
            }

            if( RoleGroupId > -2 )
            {
                _roles = objRoleController.GetRolesByGroup( PortalController.GetCurrentPortalSettings().PortalId, RoleGroupId );
            }
            else
            {
                _roles = objRoleController.GetPortalRoles( PortalController.GetCurrentPortalSettings().PortalId );
            }

            if( RoleGroupId < 0 )
            {
                RoleInfo r = new RoleInfo();
                r.RoleID = int.Parse( Globals.glbRoleUnauthUser );
                r.RoleName = Globals.glbRoleUnauthUserName;
                _roles.Add( r );
                r = new RoleInfo();
                r.RoleID = int.Parse( Globals.glbRoleAllUsers );
                r.RoleName = Globals.glbRoleAllUsersName;
                _roles.Add( r );
            }
            _roles.Reverse();
            _roles.Sort( new RoleComparer() );
        }
开发者ID:huayang912,项目名称:cs-dotnetnuke,代码行数:35,代码来源:PermissionsGrid.cs


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