⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 markallread.cs

📁 community server 源码
💻 CS
字号:
//------------------------------------------------------------------------------
// <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;
using CommunityServer.Discussions.Components;

namespace CommunityServer.Discussions.Controls 
{

    public class MarkAllRead : Button 
    {
        CSContext csContext = CSContext.Current;

        public MarkAllRead() 
        {
            Text = ResourceManager.GetString("MarkAllRead_Threads");
            Click += new EventHandler(MarkAllRead_Click);
        }


        // *********************************************************************
        //  CreateChildControls
        //
        /// <summary>
        /// This event handler adds the children controls.
        /// </summary>
        // ***********************************************************************/
        protected override void Render(HtmlTextWriter writer) 
        {

            // If the user is already authenticated we have no work to do
            if (!Page.Request.IsAuthenticated)
                return;

            if (csContext.SectionID < 0)
                return;

            base.Render(writer);

        }

        public void MarkAllRead_Click(Object sender, EventArgs e) 
        {

            // Mark all fourms as read
            //
			if ((csContext.GroupID == 0) && (csContext.SectionID == 0) )
				Forums.MarkAllForumsRead(csContext.User.UserID, 0, 0, false);

				// Mark all forums in a particular forum group as read
				//
			else if ( (csContext.GroupID > 0) && (csContext.SectionID == 0) )
				Forums.MarkAllForumsRead(csContext.User.UserID, csContext.GroupID, 0, false);


				// Mark all threads in a forum as read
				//
			else if ( csContext.SectionID > 0 )
			{
				Forums.MarkAllForumsRead(csContext.User.UserID, 0, csContext.SectionID, true);

				// Flush the current threads read status
				Threads.GetReadThreads(csContext.SectionID, csContext.User.UserID, true);
			}

			// Flush the sections read status
			Sections.GetSectionsRead(csContext.User.UserID, true);
			Page.DataBind();
        }

    }
}

⌨️ 快捷键说明

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