1
using System;
2
using System.Data;
3
using System.Configuration;
4
using System.Web;
5
using System.Web.Security;
6
using System.Web.UI;
7
using System.Web.UI.WebControls;
8
using System.Web.UI.WebControls.WebParts;
9
using System.Web.UI.HtmlControls;
10
using DataBaseLayer;
11
/**//// <summary>
12
/// TitleClass 的摘要说明
13
/// </summary>
14
public class TopicClass
15
...{
16
私有成员#region 私有成员
17
18
private int _titleID; //帖子编号,主键
19
20
public int TitleID
21
...{
22
get ...{ return _titleID; }
23
set ...{ _titleID = value; }
24
}
25
private int _sectionID; //版块编号
26
27
public int SectionID
28
...{
29
get ...{ return _sectionID; }
30
set ...{ _sectionID = value; }
31
}
32
private string _sectionName; //版块名称
33
34
public string SectionName
35
...{
36
get ...{ return _sectionName; }
37
set ...{ _sectionName = value; }
38
}
39
private int _userID; //用户ID
40
41
public int UserID
42
...{
43
get ...{ return _userID; }
44
set ...{ _userID = value; }
45
}
46
private string _Title; //主题
47
48
public string Title
49
...{
50
get ...{ return _Title; }
51
set ...{ _Title = value; }
52
}
53
private string _titleType; //主题类型
54
55
public string TitleType
56
...{
57
get ...{ return _titleType; }
58
set ...{ _titleType = value; }
59
}
60
private string _Contents; //内容
61
62
public string Contents
63
...{
64
get ...{ return _Contents; }
65
set ...{ _Contents = value; }
66
}
67
private int _click_Count; //点击数
68
69
public int Click_Count
70
...{
71
get ...{ return _click_Count; }
72
set ...{ _click_Count = value; }
73
}
74
private DateTime _CreateTime; //帖子创建时间
75
76
public DateTime CreateTime
77
...{
78
get ...{ return _CreateTime; }
79
set ...{ _CreateTime = value; }
80
}
81
private DateTime _LastReplyTime; //最后回复时间
82
83
public DateTime LastReplyTime
84
...{
85
get ...{ return _LastReplyTime; }
86
set ...{ _LastReplyTime = value; }
87
}
88
private int _ReplyCount; //回复数量
89
90
public int ReplyCount
91
...{
92
get ...{ return _ReplyCount; }
93
set ...{ _ReplyCount = value; }
94
}
95
#endregion 私有成员
96
97
属性#region 属性
98
99
#endregion 属性
100
101
方法#region 方法
102
public TopicClass()
103
...{
104
}
105
//获得帖子列表
106
public DataSet getTopics(int SectionID)
107
...{
108
string sqlStr = "select * from LD_Topic where SectionID=" + SectionID;
109
DataBase db = new DataBase();
110
return db.GetDataSet(sqlStr);
111
}
112
113
//获得主帖内容
114
public DataSet getTopicContent(int TitleID)
115
...{
116
string sqlStr = "select Content from LD_Topic where TitleID=" + TitleID;
117
DataBase db = new DataBase();
118
return db.GetDataSet(sqlStr);
119
}
120
121
//获得回帖列表
122
public DataSet getReplyList(int TitleID)
123
...{
124
string sqlStr = "select ReplyContent from LD_Reply where TitleID=" + TitleID;
125
DataBase db = new DataBase();
126
return db.GetDataSet(sqlStr);
127
}
128
129
//插入新发表的帖子
130
public bool InsertTopic(TopicClass topic)
131
...{
132
string sqlStr = "insert into LD_Topic(SectionID,UserID,Title,TitleType,Content,Click_Count,CreateTime,LastReplyTime,ReplyCount)values('"
133
+ topic.SectionID + "','" + topic.UserID + "','" + topic.Title + "','" + topic.TitleType + "','" +topic.Contents+"',"+topic.Click_Count+",'"+topic.CreateTime + "','" + topic.LastReplyTime
134
+ "','" + ReplyCount + "')";
135
DataBase db = new DataBase();
136
if (db.ExecuteSQL(sqlStr)>0)
137
return true;
138
return false;
139
}
140
141
//回帖成功,更新点击率,最后回复时间,回帖数
142
public int UpdateTopic(TopicClass topic)
143
...{
144
string sqlStr = "update LD_Topic set Click_Count=" + topic.Click_Count + " , LastReplyTime='" + topic._LastReplyTime
145
+ "' , ReplyCount=" + topic.ReplyCount + " where TitleID=" + topic.TitleID;
146
DataBase db = new DataBase();
147
return db.ExecuteSQL(sqlStr);
148
}
149
#endregion 方法
150
151
}
152