توسعه سیستم مدیریت محتوای DNTCms - قسمت پنجم
نویسنده: سالار ربال
تاریخ: ۱۳۹۴/۱۰/۳۰ ۲۱:۳۵
آدرس: www.dntips.ir
| مطالب | ۳۶۹۴ |
| نویسندگان | ۲۷۶ |
| گروههای مطالب | ۱۰۲۴ |
| نقشههای راه | ۱۱۹ |
| دورهها | ۱۴ |
| اشتراکها | ۱۷۹۱۴ |
public abstract class BaseEntity
{
#region Properties
/// <summary>
/// gets or sets Identifier of this Entity
/// </summary>
public virtual long Id { get; set; }
/// <summary>
/// gets or sets date that this entity was created
/// </summary>
public virtual DateTime CreatedOn { get; set; }
/// <summary>
/// gets or sets Date that this entity was updated
/// </summary>
public virtual DateTime ModifiedOn { get; set; }
/// <summary>
/// indicate this entity is Locked for Modify
/// </summary>
public virtual bool ModifyLocked { get; set; }
/// <summary>
/// gets or sets date that this entity repoted last time
/// </summary>
public virtual DateTime? ReportedOn { get; set; }
/// <summary>
/// gets or sets counter for Content's report
/// </summary>
public virtual int ReportsCount { get; set; }
/// <summary>
/// gets or sets TimeStamp for prevent concurrency Problems
/// </summary>
public virtual byte[] RowVersion { get; set; }
#endregion
#region NavigationProperties
/// <summary>
/// gets ro sets User that Modify this entity
/// </summary>
public virtual User ModifiedBy { get; set; }
/// <summary>
/// gets ro sets Id of User that modify this entity
/// </summary>
public virtual long? ModifiedById { get; set; }
/// <summary>
/// gets ro sets User that Create this entity
/// </summary>
public virtual User CreatedBy { get; set; }
/// <summary>
/// gets ro sets User that Create this entity
/// </summary>
public virtual long CreatedById { get; set; }
#endregion
} /// <summary>
/// Represents the Collection for group posts by topic
/// </summary>
public class Collection : GuidBaseEntity
{
#region Properties
/// <summary>
/// gets or sets name of collection
/// </summary>
public virtual string Name { get; set; }
/// <summary>
/// gets or sets Alternative SlugUrl
/// </summary>
public virtual string SlugUrl { get; set; }
/// <summary>
/// gets or sets some description of group
/// </summary>
public virtual string Description { get; set; }
/// <summary>
/// gets or sets description that indicate how to pay
/// </summary>
public virtual string HowToPay { get; set; }
/// <summary>
/// gets or sets Visibility Type
/// </summary>
public virtual CollectionVisibility Visibility { get; set; }
/// <summary>
/// gets or sets color of Collection's Cover
/// </summary>
public virtual string Color { get; set; }
/// <summary>
/// gets or sets Name of Image that used as Cover
/// </summary>
public virtual string Photo { get; set; }
/// <summary>
/// gets or sets name of tags seperated by comma that assosiated with this content fo increase performance
/// </summary>
public virtual string TagNames { get; set; }
/// <summary>
/// indicate this collection is active or not
/// </summary>
public virtual bool IsActive { get; set; }
#endregion
#region NavigationProperties
/// <summary>
/// get or set collection of attachments that attached in this group
/// </summary>
public virtual ICollection<CollectionAttachment> Attachments { get; set; }
/// <summary>
/// get or set tags of collection
/// </summary>
public virtual ICollection<Tag> Tags { get; set; }
/// <summary>
/// get or set List Of Posts that Associated with this Collection
/// </summary>
public virtual ICollection<CollectionPost> Posts { get; set; }
/// <summary>
/// get or set Users that they are Member of this collection if visibility is Custom
/// </summary>
public virtual ICollection<User> Memebers { get; set; }
#endregion
}
public enum CollectionVisibility
{
Friends,
OnlyMe,
Public,
NotFree,
Custom
} public class CollectionPost : GuidBaseEntity
{
#region Properties
/// <summary>
/// indicate this post should be pin
/// </summary>
public virtual bool IsPin { get; set; }
/// <summary>
/// gets or sets the blog pot body
/// </summary>
public virtual string Body { get; set; }
/// <summary>
/// gets or sets the content title
/// </summary>
public virtual string Title { get; set; }
/// <summary>
/// gets or sets value indicating Custom Slug
/// </summary>
public virtual string SlugAltUrl { get; set; }
/// <summary>
/// gets or sets a value indicating whether the content comments are allowed
/// </summary>
public virtual bool AllowComments { get; set; }
/// <summary>
/// indicate comments should be approved before display
/// </summary>
public virtual bool ModerateComments { get; set; }
/// <summary>
/// gets or sets viewed count
/// </summary>
public virtual long ViewCount { get; set; }
/// <summary>
/// Gets or sets the total number of approved comments
/// <remarks>The same as if we run Item.Comments.Count()
/// We use this property for performance optimization (no SQL command executed)
/// </remarks>
/// </summary>
public virtual int ApprovedCommentsCount { get; set; }
/// <summary>
/// Gets or sets the total number of unapproved comments
/// <remarks>The same as if we run Item.Comments.Count()
/// We use this property for performance optimization (no SQL command executed)
/// </remarks>
/// </summary>
public virtual int UnApprovedCommentsCount { get; set; }
/// <summary>
/// gets or sets rating complex instance
/// </summary>
public virtual Rating Rating { get; set; }
/// <summary>
/// gets or sets information of User-Agent
/// </summary>
public virtual string Agent { get; set; }
/// <summary>
/// indicate users can share this post
/// </summary>
public virtual bool IsEnableForShare { get; set; }
#endregion
#region NavigationProperties
/// <summary>
/// get or set comments of this post
/// </summary>
public virtual ICollection<CollectionComment> Comments { get; set; }
/// <summary>
/// gets or sets collection that associated with this post
/// </summary>
public virtual Collection Collection { get; set; }
/// <summary>
/// gets or sets id of collection that associated with this post
/// </summary>
public virtual Guid CollectionId { get; set; }
#endregion
} public class CollectionComment
{
#region Ctor
public CollectionComment()
{
Id = SequentialGuidGenerator.NewSequentialGuid();
CreatedOn = DateTime.Now;
}
#endregion
#region Properties
/// <summary>
/// get or set identifier of record
/// </summary>
public virtual Guid Id { get; set; }
/// <summary>
/// gets or sets date of creation
/// </summary>
public virtual DateTime CreatedOn { get; set; }
/// <summary>
/// gets or sets body of blog post's comment
/// </summary>
public virtual string Body { get; set; }
/// <summary>
/// gets or sets body of blog post's comment
/// </summary>
public virtual Rating Rating { get; set; }
/// <summary>
/// gets or sets informations of agent
/// </summary>
public virtual string UserAgent { get; set; }
/// <summary>
/// indicate this comment is Approved
/// </summary>
public virtual bool IsApproved { get; set; }
/// <summary>
/// gets or sets Ip Address of Creator
/// </summary>
public virtual string CreatorIp { get; set; }
/// <summary>
/// gets or sets datetime that is modified
/// </summary>
public virtual DateTime? ModifiedOn { get; set; }
/// <summary>
/// gets or sets counter for report this comment
/// </summary>
public virtual int ReportsCount { get; set; }
/// <summary>
/// indicate this entity is Locked for Modify
/// </summary>
public virtual bool ModifyLocked { get; set; }
/// <summary>
/// gets or sets date that this entity repoted last time
/// </summary>
public virtual DateTime? ReportedOn { get; set; }
#endregion
#region NavigationProperties
/// <summary>
/// gets or sets post that this comment added it
/// </summary>
public virtual CollectionPost Post { get; set; }
/// <summary>
/// gets or sets id of post that this comment added it
/// </summary>
public virtual Guid PostId { get; set; }
/// <summary>
/// get or set user that create this record
/// </summary>
public virtual User Creator { get; set; }
/// <summary>
/// get or set Id of user that create this record
/// </summary>
public virtual long CreatorId { get; set; }
/// <summary>
/// gets or sets CollectionComment's identifier for Replying and impelemention self referencing
/// </summary>
public virtual Guid? ReplyId { get; set; }
/// <summary>
/// gets or sets Collection's comment for Replying and impelemention self referencing
/// </summary>
public virtual CollectionComment Reply { get; set; }
/// <summary>
/// get or set collection of Collection's comment for Replying and impelemention self referencing
/// </summary>
public virtual ICollection<CollectionComment> Children { get; set; }
#endregion
} مدل بالا نشان دهندهی نظرات ارسالی برای پستهای کلکسیونها میباشد. صرفا کاربران عضو سیستم این اجازه را در صورتی خواهند داشت که برای پست مورد نظر خصوصیت AllowComments با مقدار true مقدار دهی شده باشد
حالت درختی آن مشخص است. برای اعمال ارتباط یک به چند بین پستها و نظرات، از CollectionPost و CollectionPostId استفاده خواهد شد.
public class CollectionAttachment : BaseAttachment
{
#region NavigationProperties
/// <summary>
/// gets or sets Collection that this file attached
/// </summary>
public virtual Collection Collection { get; set; }
/// <summary>
/// gets or sets Id of Collection that this file attached
/// </summary>
public virtual Guid? CollectionId { get; set; }
#endregion
} /// <summary>
/// Represents Announcement For Announcement Section
/// </summary>
public class Announcement : BaseContent
{
#region Properties
/// <summary>
/// gets or sets Date that this Announcement will Expire
/// </summary>
public virtual DateTime? ExpireOn { get; set; }
/// <summary>
/// indicate this accouncement is approved by admin if announcementSetting.Moderate==true
/// </summary>
public virtual bool IsApproved { get; set; }
#endregion
#region NavigationProperties
/// <summary>
/// get or set Collection of Comments for this Announcement
/// </summary>
public virtual ICollection<AnnouncementComment> Comments { get; set; }
#endregion
} /// <summary>
/// Repersents Comment For Announcement
/// </summary>
public class AnnouncementComment : BaseComment
{
#region NavigationProperties
/// <summary>
/// gets or sets body of announcement's comment
/// </summary>
public virtual long? ReplyId { get; set; }
/// <summary>
/// gets or sets body of announcement's comment
/// </summary>
public virtual AnnouncementComment Reply { get; set; }
/// <summary>
/// gets or sets body of announcement's comment
/// </summary>
public virtual ICollection<AnnouncementComment> Children { get; set; }
/// <summary>
/// gets or sets announcement that this comment sent to it
/// </summary>
public virtual Announcement Announcement { get; set; }
/// <summary>
/// gets or sets announcement'Id that this comment sent to it
/// </summary>
public virtual long AnnouncementId { get; set; }
#endregion
} /// <summary>
/// Represent The Operation's log
/// </summary>
public class AuditLog
{
#region Ctor
/// <summary>
///
/// </summary>
public AuditLog()
{
Id = SequentialGuidGenerator.NewSequentialGuid();
OperatedOn = DateTime.Now;
}
#endregion
#region Properties
/// <summary>
/// sets or gets identifier of AuditLog
/// </summary>
public virtual Guid Id { get; set; }
/// <summary>
/// sets or gets description of Log
/// </summary>
public virtual string Description { get; set; }
/// <summary>
/// sets or gets when log is operated
/// </summary>
public virtual DateTime OperatedOn { get; set; }
/// <summary>
/// sets or gets log's section
/// </summary>
public virtual AuditSection Section { get; set; }
#endregion
#region NavigationProperties
/// <summary>
/// sets or gets log's creator
/// </summary>
public virtual User OperatedBy { get; set; }
/// <summary>
/// sets or gets identifier of log's creator
/// </summary>
public virtual long OperatedById { get; set; }
#endregion
}
public enum AuditSection
{
Blog,
News,
Forum,
...
} /// <summary>
/// Represents Domain that is banned
/// </summary>
public class BannedDomain
{
#region Propertie
/// <summary>
/// gets or sets identifier of Domain
/// </summary>
public virtual Guid Id { get; set; }
/// <summary>
/// gets or sets DomainName
/// </summary>
public virtual string Name { get; set; }
/// <summary>
/// gets or sets Date that this record added
/// </summary>
public virtual DateTime BannedOn { get; set; }
#endregion
} /// <summary>
/// Represents the banned words
/// </summary>
public class BannedWord
{
#region Ctor
/// <summary>
/// Create one instance of <see cref="BannedWord"/>
/// </summary>
public BannedWord()
{
Id = SequentialGuidGenerator.NewSequentialGuid();
}
#endregion
#region Properties
/// <summary>
/// gets or sets identifier of BannedWord
/// </summary>
public Guid Id { get; set; }
/// <summary>
/// gets or sets Bad word
/// </summary>
public string BadWord { get; set; }
/// <summary>
/// gets or sets Good replaceword
/// </summary>
public string GoodWord { get; set; }
/// <summary>
/// indicating that this Word is spam
/// </summary>
public bool IsStopWord { get; set; }
#endregion
} /// <summary>
/// Represent The CMS setting
/// </summary>
public class Setting
{
#region Properties
/// <summary>
/// sets or gets name of setting
/// </summary>
public virtual string Name { get; set; }
/// <summary>
/// sets or gets value of setting
/// </summary>
public virtual string Value { get; set; }
/// <summary>
/// sets or gets Type of setting
/// </summary>
public virtual string Type { get; set; }
#endregion
}