📄 postinfo.cs
字号:
namespace ASPNET.StarterKit.Communities.Discuss {
using System;
using System.Data.SqlClient;
//*********************************************************************
//
// PostInfo Class
//
// Represents all information about a particular post.
//
//*********************************************************************
public class PostInfo : ContentInfo {
string _bodyText = String.Empty;
string _lastCommentUsername = String.Empty;
bool _isPinned = false;
bool _isAnnouncement = false;
bool _isLocked = false;
//*********************************************************************
//
// PostInfo Constructor
//
// Initializes post information from a SqlDataReader.
//
//*********************************************************************
public PostInfo(SqlDataReader dr) : base(dr) {
_isPinned = (bool)dr["Discuss_IsPinned"];
_isAnnouncement = (bool)dr["Discuss_IsAnnouncement"];
_isLocked = (bool)dr["Discuss_IsLocked"];
if (dr["LastCommentUsername"] != DBNull.Value)
_lastCommentUsername = (string)dr["LastCommentUsername"];
if (dr["Discuss_BodyText"] != DBNull.Value)
_bodyText = (string)dr["Discuss_BodyText"];
}
//*********************************************************************
//
// IsPinned Property
//
// Pinned posts always appear at top.
//
//*********************************************************************
public bool IsPinned {
get {return _isPinned; }
set {_isPinned = value; }
}
//*********************************************************************
//
// IsAnnouncement Property
//
// Announcements appear with a !.
//
//*********************************************************************
public bool IsAnnouncement {
get {return _isAnnouncement; }
set {_isAnnouncement = value; }
}
//*********************************************************************
//
// IsLocked Property
//
// Locked posts cannot have replies.
//
//*********************************************************************
public bool IsLocked {
get {return _isLocked; }
set {_isLocked = value; }
}
//*********************************************************************
//
// LastCommentUsername Property
//
// Represents the username of the last person to add a comment.
//
//*********************************************************************
public string LastCommentUsername {
get {return _lastCommentUsername;}
set {_lastCommentUsername = value;}
}
//*********************************************************************
//
// BodyText Property
//
// Represents the content of an post.
//
//*********************************************************************
public string BodyText {
get {return _bodyText;}
set {_bodyText = value;}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -