rolemembersview.cs

来自「本系统是在asp版《在线文件管理器》的基础上设计制作」· CS 代码 · 共 88 行

CS
88
字号
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
//     Copyright (c) Telligent Systems Corporation.  All rights reserved.
// </copyright> 
//------------------------------------------------------------------------------

using System;using System.Web.UI;using System.Web.UI.WebControls;using CommunityServer.Components;namespace CommunityServer.Discussions.Controls 
{

    /// <summary>
    /// This server control is used to display all the members of the current forum.
    /// </summary>
    [
    ParseChildren(true)
    ]
    public class RoleMembersView : ForumMembersView 
    {
        CSContext csContext = CSContext.Current;
        Role role; 

        // *********************************************************************
        //  RoleMembersView
        //
        /// <summary>
        /// Constructor
        /// </summary>
        /// 
        // ********************************************************************/
        public RoleMembersView() : base() 
        {
            role = Roles.GetRole( new Guid(Context.Request.QueryString["Role"]));
        }

        // *********************************************************************
        //  InitializeControlTemplate
        //
        /// <summary>
        /// Initializes the user control loaded in CreateChildControls. Initialization
        /// consists of finding well known control names and wiring up any necessary events.
        /// </summary>
        /// 
        // ********************************************************************/ 
        override protected void InitializeSkin(Control skin) 
        {

            // Set the title and description
            //
            sectionTitle = (Label) skin.FindControl("SectionTitle");
            sectionTitle.Text = string.Format(ResourceManager.GetString("RoleMembers_Title"), role.Name);	

            sectionDescription = (Label) skin.FindControl("SectionDescription");
            sectionDescription.Text = ((role.Description != string.Empty) ? role.Description : "") + ResourceManager.GetString("RoleMembers_Description");

            // Disable the alpha picker
            //
            EnableAlphaPicker = false;

            base.InitializeSkin(skin);

        }

        public override void DataBind() 
        {

            UserSet userSet = Roles.UsersInRole(pager.PageIndex, pager.PageSize, sort.SelectedSortOrder, sortOrder.SelectedValue, role.RoleID);

            // Do we have data to display?
            //
            if (!userSet.HasResults) 
				Page.Response.Redirect( Globals.GetSiteUrls().Message(CSExceptionType.UserSearchNotFound), true );

            userList.DataSource = userSet.Users;
            userList.DataBind();

            pager.TotalRecords = currentPage.TotalRecords = userSet.TotalRecords;
            currentPage.TotalPages = pager.CalculateTotalPages();
            currentPage.PageIndex = pager.PageIndex;

        }

    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?