温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:LiveBlog v1.0测试版源码
当前文件:
LiveBlog/LiveBlog.Core/Post.cs,打开代码结构图
LiveBlog/LiveBlog.Core/Post.cs,打开代码结构图1Using#region Using 2
3
using System; 4
using System.Web; 5
using System.IO; 6
using System.Xml; 7
using System.Text; 8
using System.Net.Mail; 9
using System.Globalization; 10
using System.Collections.ObjectModel; 11
using System.Collections.Specialized; 12
using System.Collections.Generic; 13
using System.ComponentModel; 14
using LiveBlog.Core.Providers; 15
16
#endregion 17
18
namespace LiveBlog.Core 19
...{ 20
/**//// <summary> 21
/// A post is an entry on the blog - a blog post. 22
/// </summary> 23
[Serializable] 24
public class Post : BusinessBase<Post, Guid>, IComparable<Post>, IPublishable 25
...{ 26
27
Constructor#region Constructor 28
29
/**//// <summary> 30
/// The default contstructor assign default values. 31
/// </summary> 32
public Post() 33
...{ 34
base.Id = Guid.NewGuid(); 35
_Comments = new List<Comment>(); 36
_Categories = new StateList<Category>(); 37
_Tags = new StateList<string>(); 38
DateCreated = DateTime.Now; 39
_IsPublished = true; 40
_IsCommentsEnabled = true; 41
} 42
43
#endregion 44
45
Properties#region Properties 46
47
private string _Author; 48
/**//// <summary> 49
/// Gets or sets the Author or the post. 50
/// </summary> 51
public string Author 52
...{ 53
get ...{ return _Author; } 54
set 55
...{ 56
if (_Author != value) MarkChanged("Author"); 57
_Author = value; 58
} 59
} 60
61
private string _Title; 62
/**//// <summary> 63
/// Gets or sets the Title or the post. 64
/// </summary> 65
public string Title 66
...{ 67
get ...{ return _Title; } 68
set 69
...{ 70
if (_Title != value) MarkChanged("Title"); 71
_Title = value; 72
} 73
} 74
75
private string _Description; 76
/**//// <summary> 77
/// Gets or sets the Description or the post. 78
/// </summary> 79
public string Description 80
...{ 81
get ...{ return _Description; } 82
set 83
...{ 84
if (_Description != value) MarkChanged("Description"); 85
_Description = value; 86
} 87
} 88
89
private string _Content; 90
/**//// <summary> 91
/// Gets or sets the Content or the post. 92
/// </summary> 93
public string Content 94
...{ 95
get ...{ return _Content; } 96
set 97
...{ 98
if (_Content != value) MarkChanged("Content"); 99
_Content = value; 100
} 101
} 102
103
private readonly List<Comment> _Comments; 104
/**//// <summary> 105
/// A collection of Approved comments for the post sorted by date. 106
/// </summary> 107
public List<Comment> ApprovedComments 108
...{ 109
get 110
...{ 111
return _Comments.FindAll(delegate(Comment obj) 112
...{ 113
return obj.IsApproved; 114
}); 115
} 116
} 117
118
/**//// <summary> 119
/// A collection of comments waiting for approval for the post, sorted by date. 120
/// </summary> 121
public List<Comment> NotApprovedComments 122
...{ 123
get 124
...{ 125
return _Comments.FindAll(delegate(Comment obj) 126
...{ 127
return !obj.IsApproved; 128
}); 129
} 130
} 131
132
/**//// <summary> 133
/// A Collection of Approved Comments for the post 134
/// </summary> 135
public List<Comment> Comments 136
...{ 137
get ...{ return _Comments; } 138
139
} 140
141
private StateList<Category> _Categories; 142
/**//// <summary> 143
/// An unsorted List of categories. 144
/// </summary> 145
public StateList<Category> Categories 146
...{ 147
get ...{ return _Categories; } 148
} 149
150
private StateList<string> _Tags; 151
/**//// <summary> 152
/// An unsorted collection of tags. 153
/// </summary> 154
public StateList<string> Tags 155
...{ 156
get ...{ return _Tags; } 157
} 158
159
private bool _IsCommentsEnabled; 160
/**//// <summary> 161
/// Gets or sets the EnableComments or the object. 162
/// </summary> 163
public bool IsCommentsEnabled 164
...{ 165
get ...{ return _IsCommentsEnabled; } 166
set 167
...{ 168
if (_IsCommentsEnabled != value) MarkChanged("IsCommentsEnabled"); 169
_IsCommentsEnabled = value; 170
} 171
} 172
173
private bool _IsPublished; 174
/**//// <summary> 175
/// Gets or sets the IsPublished or the object. 176
/// </summary> 177
public bool IsPublished 178
...{ 179
get ...{ return _IsPublished; } 180
set 181
...{ 182
if (_IsPublished != value) MarkChanged("IsPublished"); 183
_IsPublished = value; 184
} 185
} 186
187
private float _Rating; 188
/**//// <summary> 189
/// Gets or sets the rating or the post. 190
/// </summary> 191
public float Rating 192
...{ 193
get ...{ return _Rating; } 194
set 195
...{ 196
if (_Rating != value) MarkChanged("Rating"); 197
_Rating = value; 198
} 199
} 200
201
private int _Raters; 202
/**//// <summary> 203
/// Gets or sets the number of raters or the object. 204
/// </summary> 205
public int Raters 206
...{ 207
get ...{ return _Raters; } 208
set 209
...{ 210
if (_Raters != value) MarkChanged("Raters"); 211
_Raters = value; 212
} 213
} 214
215
private string _Slug; 216
/**//// <summary> 217
/// Gets or sets the Slug of the Post. 218
/// A Slug is the relative URL used by the posts. 219
/// </summary> 220
public string Slug 221
...{ 222
get 223
...{ 224
if (string.IsNullOrEmpty(_Slug)) 225
return Utils.RemoveIllegalCharacters(Title); 226
227
return _Slug; 228
} 229
set ...{ _Slug = value; } 230
} 231
232
private StringCollection _NotificationEmails; 233
/**//// <summary> 234
/// Gets a collection of email addresses that is signed up for 235
/// comment notification on the specific post. 236
/// </summary> 237
public StringCollection NotificationEmails 238
...{ 239
get 240
...{ 241
if (_NotificationEmails == null) 242
_NotificationEmails = new StringCollection(); 243
244
return _NotificationEmails; 245
} 246
} 247
248
/**//// <summary> 249
/// Gets whether or not the post is visible or not. 250
/// </summary>




