Click here to Skip to main content
15,891,846 members
Articles / Web Development / ASP.NET

Eucalypto - ASP.NET CMS Library using NHibernate

Rate me:
Please Sign up or sign in to vote.
4.84/5 (36 votes)
10 Jun 2009MIT24 min read 320.3K   4.6K   260  
An ASP.NET server library for creating CMS website (forums, articles/wiki, news, users/roles, ...), using NHibernate for data access.
using System;
using System.Collections.Generic;
using System.Text;

namespace Eucalypto.Wiki
{
    public class Article : ArticleBase, ISearchResult, IAudit
    {
        protected Article()
        {

        }

        public Article(Category pCategory, string pName, string pOwner, 
                        string pTitle, string pDescription, string pBody)
            : base(pOwner, pTitle)
        {
            Category = pCategory;
            Name = pName;
            Description = pDescription;
            Body = pBody;
        }

        private string mName;
        /// <summary>
        /// The unique name of the article item. Must be unique for all the categories
        /// </summary>
        public virtual string Name
        {
            get { return mName; }
            protected set
            {
                Eucalypto.EntityHelper.ValidateCode("Name", value);
                mName = value;
            }
        }

        private Category mCategory;
        public virtual Category Category
        {
            get { return mCategory; }
            protected set { mCategory = value; }
        }

        private bool mEnabled = true;
        /// <summary>
        /// Gets or sets if the article is enabled.
        /// A disabled article is visible only by an administrator/editor.
        /// When a user delete an article it became disable.
        /// Only the administrator can delete articles.
        /// </summary>
        public virtual bool Enabled
        {
            get { return mEnabled; }
            set { mEnabled = value; }
        }

        private bool mApproved = false;
        /// <summary>
        /// Gets or sets if the article is approved.
        /// A not approved article is visible only by an administrator/editor or by the owner.
        /// Only the administrator/editor can approve an article.
        /// When a user submit a new article it must be approved.
        /// </summary>
        public virtual bool Approved
        {
            get { return mApproved; }
            set { mApproved = value; }
        }

        private IList<FileAttachment> mAttachments;
        /// <summary>
        /// List used for cascading rules
        /// </summary>
        protected IList<FileAttachment> Attachments
        {
            get { return mAttachments; }
            set { mAttachments = value; }
        }

        private IList<VersionedArticle> mVersions;
        /// <summary>
        /// List used for cascading rules
        /// </summary>
        protected IList<VersionedArticle> Versions
        {
            get { return mVersions; }
            set { mVersions = value; }
        }

        #region ISearchResult Members

        string ISearchResult.Title
        {
            get { return this.Title; }
        }

        string ISearchResult.Owner
        {
            get { return this.Owner; }
        }

        string ISearchResult.Description
        {
            get { return this.Description; }
        }

        DateTime ISearchResult.Date
        {
            get { return this.UpdateDate; }
        }

        string ISearchResult.Category
        {
            get { return this.Category.DisplayName; }
        }

        #endregion
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The MIT License


Written By
Software Developer
Italy Italy
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions