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

📄 comment.cs

📁 如果不使用IIS,请先运行 XSP.exe,待提示已侦听 8080端口后
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.Web;
using Castle.ActiveRecord;
using Castle.ActiveRecord.Queries;
using Castle.Components.Validator;
using NHibernate.Expression;
using System.Text.RegularExpressions;

namespace DNNLite.DesktopModules.Comment
{
    #region 评论主表

    /// <summary>
    /// 评论主题
    /// </summary>
    [ActiveRecord( DynamicUpdate=true )]
    public class CommentSubject:ActiveRecordBase< CommentSubject >
    {
        private int _id;
        [PrimaryKey(  PrimaryKeyType.Native )]
        public int Id
        {
            get { return _id; }
            set { _id = value; }
        }

        private string _commentKey;
        /// <summary>
        /// 评论的key,标识评论的主题
        /// </summary>
        [Property(NotNull = true, Unique=true )]
        public string CommentKey { get { return _commentKey; } set { _commentKey = value; } }

        private int _commentcount;
        /// <summary>
        /// 评论总数
        /// </summary>
        [Property()]
        public int CommentCount { get { return _commentcount; } set { _commentcount=value  ;} }


        private int _backers;
        /// <summary>
        /// 支持数
        /// </summary>
        [Property()]
        public int Backers { get { return _backers ; } set { _backers  = value; } }

        private int _antis;
        /// <summary>
        /// 反对数
        /// </summary>
        [Property()]
        public int Antis { get { return _antis; } set { _antis = value; } }


        private int _neutrals;
        /// <summary>
        /// 中立数
        /// </summary>
        [Property()]
        public int Neutrals { get { return _neutrals; } set { _neutrals = value; } }


        private  string _subject;
        /// <summary>
        /// 主题
        /// </summary>
        [Property()]
        public string Subject { get { return _subject; } set { _subject = value; } }


        private int _sourceTabModule;
        /// <summary>
        /// 来源模块
        /// </summary>
        [Property()]
        public int SourceTabModule
        {
            get { return _sourceTabModule; }
            set { _sourceTabModule = value; }
        }
        


        private IList<Comment> _comments = new List<Comment>();

        /// <summary>
        /// 包括的评论
        /// </summary>
        [HasMany( typeof(Comment ), Lazy=true,OrderBy="CreateTime Desc", BatchSize=10 )]
        public IList<Comment> Comments
        {
            get { return _comments; }
            set { _comments = value; }
        }

        

    }

    #endregion

    #region 评论子表

    /// <summary>
    ///Comment 评论
    /// </summary>
    [ActiveRecord(DynamicUpdate=true )]
    public class Comment:ActiveRecordBase<Comment>
    {
        private int _id;
        [PrimaryKey(  PrimaryKeyType.Native   )]
        public int Id { get { return _id; } set {_id=value  ;} }

        private CommentSubject _subject;
        /// <summary>
        /// 所属评论主题
        /// </summary>
        [BelongsTo()]
        public CommentSubject Subject
        {
            get { return _subject; }
            set { _subject = value; }
        }
        
        private DateTime _createtime;
        /// <summary>
        /// 评论日期
        /// </summary>
        [Property( NotNull=true,Update=false,Insert=true  )]
        public DateTime CreateDate { get { return _createtime; } set { _createtime = value; } }

        private DateTime? _updatetime;
        /// <summary>
        /// 更新日期
        /// </summary>
        [Property(Update = true, Insert = false)]
        public DateTime? UpDateTime { get { return _updatetime; } set { _updatetime = value; } }

        private string _rawCommentContent;
        /// <summary>
        ///评论的原始内容
        /// </summary>
        [Property(Length = 9000)]
        public string RawCommentContent { get { return _rawCommentContent; } set { _rawCommentContent = value; } }

        private string _rawFeedBackContent;
        /// <summary>
        /// 管理员回复原始内容
        /// </summary>
        [Property("[RawFeedBackContent]", Length = 9000)]
        public string RawFeedBackContent { get { return _rawFeedBackContent; } set { _rawFeedBackContent = value; } }

        private int _parent;
        /// <summary>
        /// 回复的哪一条评论如果为0表示不是回复
        /// </summary>
        [Property(NotNull = true)]
        public int Parent { get { return _parent; } set { _parent = value; } }

        private string _ip;
        /// <summary>
        /// 发表评论的ip
        /// </summary>
        [Property()]
        public string Ip { get { return _ip; } set { _ip = value; } }

        private string _user;
        /// <summary>
        /// 评论人
        /// </summary>
        [Property()]
        public string CommentUser { get { return _user; } set { _user = value; } }

        private int _backers;
        /// <summary>
        /// 本条评论的支持人数
        /// </summary>
        [Property()]
        public int Backers { get { return _backers; } set { _backers = value; } }

        private int _antis;
        /// <summary>
        /// 本条评论的反对人数
        /// </summary>
        [Property()]
        public int Antis { get { return _antis; } set { _antis = value; } }


        private bool _visible;
        /// <summary>
        /// 是否通过审核
        /// </summary>
        [Property("[Visible]")]
        public bool Visible { get { return _visible; } set { _visible = value; } }

        private bool? _standpoint;
        /// <summary>
        /// 立场,true正方,false反方,null中立
        /// </summary>
        [Property()]
        public bool? StandPoint { get { return _standpoint; } set { _standpoint = value; } }


        #region 非activerecord

        public string CommentContent
        {
            get 
            {
                return  HttpUtility.HtmlEncode( _rawCommentContent);
            }
        }

        public string FeedBackContent
        {
            get
            {
                return HttpUtility.HtmlEncode(_rawFeedBackContent);
            }
        }

        #endregion



    }

    #endregion

}

⌨️ 快捷键说明

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