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

📄 section.cs

📁 本系统是在asp版《在线文件管理器》的基础上设计制作
💻 CS
📖 第 1 页 / 共 2 页
字号:
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
//     Copyright (c) Telligent Systems Corporation.  All rights reserved.
// </copyright> 
//------------------------------------------------------------------------------

using System;
using System.Collections;
using System.Collections.Specialized;
using System.Text.RegularExpressions;

namespace CommunityServer.Components {
    /// <summary>
    /// A Section is the base container for a group of posts. 
    /// </summary>
    [Serializable]
	public abstract class Section : ExtendedAttributes, IComparable {

        #region Private Members
        // Member Variables
        int sectionID = 0;				// Unique section identifier
        int parentId = 0;
		int settingsID = 0;
                                               // moved to constructor try/catch for import/export
		ThreadDateFilterMode threadDateFilter; //= CSContext.Current.SiteSettings.DefaultThreadDateFilter;
        int totalPosts = -1;			// Total posts in the forum
        int totalThreads = -1;			// Total threads in the forum
        int groupId = -1;          // Identifier for the forum group this forum belongs to
        int sortOrder = 0;              // Used to control sorting of forums
        String name = "";				// Name of the forum
        String description = "";		// Description of the forum
        bool isModerated = false;	    // Is the forum isModerated?
        bool isActive = true;          // Is the forum isActive?
        bool isPrivate = false;         // Is the forum private?
        DateTime mostRecentPostDate = DateTime.MinValue.AddMonths(1);	        // The date of the most recent post to the forum
        int mostRecentPostId = 0;       // the most recent post id
        int mostRecentThreadId = 0;     // Post ID of the most recent thread
        String mostRecentUser = "";		// The author of the most recent post to the forum
        string mostRecentPostSubject =""; // most recent post subject
        DateTime dateCreated;			// The date/time the forum was created
        byte[] displayMask;
		Hashtable permissions = new Hashtable();
//        ForumPermission permission = new ForumPermission();
        static SectionSortBy sortBy = SectionSortBy.SortOrder;
        ArrayList sections = null;
        bool enablePostStatistics = true;
        bool enableAutoDelete = false;
        bool enableAnonymousPosts = false;
        bool isSearchable = true;
        int autoDeleteThreshold = 90;
        int mostRecentAuthorID;
        int postsToModerate = 0;
        int mostRecentThreadReplies = 0;

		private string appKey;
		private ApplicationType appType = ApplicationType.Unknown;
        #endregion

        public Section() 
        {
			try {
				threadDateFilter = CSContext.Current.SiteSettings.DefaultThreadDateFilter;
			} catch {
				threadDateFilter = ThreadDateFilterMode.TwoMonths;
			}
		}
        public Section(int sectionID) : this() { SectionID = sectionID; }

        #region Public Properties
		public string ApplicationKey
		{
			get{return appKey;}
			set
            {
                if(value != null && value.Trim().Length > 0)
                    appKey = value.ToLower().Replace(" ","_");
                else
                    appKey = null;
            }
		}

		public ApplicationType ApplicationType
		{
			get{return appType;}
			set{appType = value;}
		}

		ForumType forumType = ForumType.Normal;
		public ForumType ForumType {
			get {
				return forumType;
			}
			set {
				forumType = value;
			}
		}

		string navigateUrl;
		public string NavigateUrl {
			get {
				return navigateUrl;
			}
			set {
				navigateUrl = value;
			}
		}

        public int AutoDeleteThreshold {
            get {
                return autoDeleteThreshold;
            }
            set {
                autoDeleteThreshold = value;
            }
        }

        string newsgroupName;
        public string NewsgroupName {
            get { 
                if (newsgroupName != string.Empty)
                    return newsgroupName.ToLower();

                return name.Replace(" ", ".").ToLower();
            }
            set { newsgroupName = value; }
             
        }

        public int PostsToModerate {
            get {
                return postsToModerate;
            }
            set {
                postsToModerate = value;
            }
        }
        
        public bool EnablePostStatistics {
            get {
                return enablePostStatistics;
            }
            set {
                enablePostStatistics = value;
            }
        }

        public bool EnableAnonymousPosting {
            get {
                return enableAnonymousPosts;
            }
            set {
                enableAnonymousPosts = value;
            }
        }

        public bool IsSearchable {
            get {
                return isSearchable;
            }
            set {
                isSearchable = value;
            }
        }

        public bool EnableAutoDelete {
            get {
                return enableAutoDelete;
            }
            set {
                enableAutoDelete = value;
            }
        }

        public ArrayList Sections {
            get
            {
				if(sections == null)
					sections = new ArrayList();

            	return sections;
            }
            set { sections = value; }
        }

        

        #region CompareTo
        // *********************************************************************
        //  CompareTo
        //
        /// <summary>
        /// All forums have a SortOrder property. CompareTo compares on SortOrder
        /// to sort the forums appropriately.
        /// </summary>
        // ********************************************************************/
        public virtual int CompareTo(object value)
        {
            if (value == null) return 1;

            switch (SortBy) 
            {
                case SectionSortBy.Name:
                    return (this.Name.CompareTo( ((Section) value).Name) );

                case SectionSortBy.Thread:
                    return (this.TotalThreads.CompareTo( ((Section) value).TotalThreads) );

                case SectionSortBy.Post:
                    return (this.TotalPosts.CompareTo( ((Section) value).TotalPosts) );

                case SectionSortBy.LastPost:
                    return (this.MostRecentPostDate.CompareTo( ((Section) value).MostRecentPostDate) );

                case SectionSortBy.LastPostDescending:
                    return (  ((Section)value).MostRecentPostDate.CompareTo( this.MostRecentPostDate ) );

                default:
                    return (this.SortOrder.CompareTo( ((Section) value).SortOrder) );
            }
   
        }

        #endregion

    

        public enum SectionSortBy 
        {
            SortOrder,
            Name,
            Thread,
            Post,
            LastPost,
			LastPostDescending
        }

        public static SectionSortBy SortBy {
            get {
                return sortBy;
            }
            set {
                sortBy = value;
            }
        }

        // *********************************************************************
        //  IsAnnouncement
        //
        /// <summary>
        /// If post is locked and post date > 2 years
        /// </summary>
        // ********************************************************************/
        public virtual bool IsAnnouncement {
            get { 
                if (MostRecentPostDate > DateTime.Now.AddYears(2))
                    return true;
                else
                    return false;
            }
        }

        // *********************************************************************
        //  IsPrivate
        //
        /// <summary>
        /// Is the forum private, e.g. a role is required to access?
        /// </summary>
        // ********************************************************************/
        public virtual bool IsPrivate {
            get { return isPrivate; }
            set { isPrivate = value; }
        }

        /*************************** PROPERTY STATEMENTS *****************************/
        /// <summary>
        /// Specifies the unique identifier for the each forum.
        /// </summary>
        public int SectionID {
            get { return sectionID; }
            set {
                if (value < 0)
                    sectionID = 0;
                else
                    sectionID = value;
            }
        }

        
        // *********************************************************************
        //  ParentID
        //
        /// <summary>
        /// If ParentId > 0 this forum has a parent and is not a top-level forum
        /// </summary>
        // ********************************************************************/
        public int ParentID {
            get { return parentId; }
            set {
                if (value < 0)
                    parentId = 0;
                else
                    parentId = value;
            }
        }


		// *********************************************************************
		//  SettingsID
		//
		/// <summary>
		/// Specifies the unique identifier for the site the forum belongs to.
		/// </summary>
		// ********************************************************************/
		public int SettingsID 
		{
			get { return settingsID; }
			set 
			{
				if (value < 0)
					settingsID = 0;
				else
					settingsID = value;
			}
		}

        

⌨️ 快捷键说明

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