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


C# RoleController.GetRoles方法代码示例

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


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

示例1: LoadAllRoles

        private void LoadAllRoles()
        {
            var rc = new RoleController();
            ArrayList roles = rc.GetRoles();

            foreach (RoleInfo role in roles)
            {
                if (role.PortalID == PortalId)
                {
                    var li = new ListItem(role.RoleName, role.RoleID.ToString(CultureInfo.InvariantCulture));
                    lstItems.Items.Add(li);
                }
            }
        }
开发者ID:ChrisHammond,项目名称:Engage-Publish,代码行数:14,代码来源:CategoryPermissions.ascx.cs

示例2: GetUserRoles

        private static string GetUserRoles()
        {
            if (HttpContext.Current != null && HttpContext.Current.User.Identity.IsAuthenticated)
            {
                var sb = new StringBuilder(128);

                UserInfo ui = UserController.GetCurrentUserInfo();
                var rc = new RoleController();

                // Not sure why DNN methods that return roles don't consistently return RoleInfo objects. hk
                if (ui.IsSuperUser)
                {
                    foreach (RoleInfo role in rc.GetRoles())
                    {
                        sb.Append("'");
                        sb.Append(role.RoleName);
                        sb.Append("',");
                    }
                }
                else
                {
                    string[] roles = rc.GetRolesByUser(ui.UserID, ui.PortalID);
                    foreach (string s in roles)
                    {
                        sb.Append("'");
                        sb.Append(s);
                        sb.Append("',");
                    }
                }

                // trim the last ,
                if (sb.Length > 0)
                {
                    sb.Length -= 1;
                }

                return sb.ToString();
            }

            return "'Everyone'"; // is this always 'Everyone'?
        }
开发者ID:EngageSoftware,项目名称:Engage-Publish,代码行数:41,代码来源:SqlDataProvider.cs

示例3: DisplayRoles

        private void DisplayRoles()
        {
            // Get all the Roles
            RoleController RoleController = new RoleController();
            ArrayList colArrayList = RoleController.GetRoles();

            // Create a ListItemCollection to hold the Roles 
            ListItemCollection colListItemCollection = new ListItemCollection();

            // Add the Roles to the List
            foreach (RoleInfo Role in colArrayList)
            {
                if (Role.PortalID == PortalId)
                {
                    ListItem RoleListItem = new ListItem();
                    RoleListItem.Text = Role.RoleName;
                    RoleListItem.Value = Role.RoleID.ToString();
                    colListItemCollection.Add(RoleListItem);
                }
            }

            // Add the Roles to the ListBox
            ddlRole.DataSource = colListItemCollection;
            ddlRole.DataBind();
        }
开发者ID:roman-yagodin,项目名称:R7.HelpDesk,代码行数:25,代码来源:AdminSettings.ascx.cs

示例4: GetRoleName

        public static string GetRoleName(int RoleID)
        {
            if (Convert.ToString(RoleID) == glbRoleAllUsers)
            {
                return "All Users";
            }
            else if (Convert.ToString(RoleID) == glbRoleUnauthUser)
            {
                return "Unauthenticated Users";
            }

            Hashtable htRoles = null;
            if (PerformanceSetting != PerformanceSettings.NoCaching)
            {
                htRoles = (Hashtable)DataCache.GetCache("GetRoles");
            }

            if (htRoles == null)
            {
                RoleController objRoleController = new RoleController();
                ArrayList arrRoles;
                arrRoles = objRoleController.GetRoles();
                htRoles = new Hashtable();
                int i;
                for (i = 0; i <= arrRoles.Count - 1; i++)
                {
                    RoleInfo objRole;
                    objRole = (RoleInfo)arrRoles[i];
                    htRoles.Add(objRole.RoleID, objRole.RoleName);
                }
                if (PerformanceSetting != PerformanceSettings.NoCaching)
                {
                    DataCache.SetCache("GetRoles", htRoles);
                }
            }
            return Convert.ToString(htRoles[RoleID]);
        }
开发者ID:huayang912,项目名称:cs-dotnetnuke,代码行数:37,代码来源:Globals.cs

示例5: DisplayAdminRoleDropDown

        private void DisplayAdminRoleDropDown()
        {
            // Get all the Roles
            RoleController RoleController = new RoleController();
            ArrayList colArrayList = RoleController.GetRoles();

            // Create a ListItemCollection to hold the Roles 
            ListItemCollection colListItemCollection = new ListItemCollection();

            // Add the Roles to the List
            foreach (RoleInfo Role in colArrayList)
            {
                if (Role.PortalID == PortalId)
                {
                    ListItem RoleListItem = new ListItem();
                    RoleListItem.Text = Role.RoleName;
                    RoleListItem.Value = Role.RoleID.ToString();
                    colListItemCollection.Add(RoleListItem);
                }
            }

            // Add the Roles to the ListBox
            ddlAdminRole.DataSource = colListItemCollection;
            ddlAdminRole.DataBind();

            // Get Admin Role
            string strAdminRoleID = GetAdminRole();

            try
            {
                // Try to set the role
                ddlAdminRole.SelectedValue = strAdminRoleID;
            }
            catch
            {

            }
        }
开发者ID:roman-yagodin,项目名称:R7.HelpDesk,代码行数:38,代码来源:AdminSettings.ascx.cs


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