简单评论系统开发过程(二)
上回说到程序设计,这次继续往下看。
⑵评论实体类
这个代码大家都了解了,可是我原来不知道可以动态生成,所以就手写的,看起来还真累人。
后来查资料有“NET代码生成器”,或者用CodeSmith等吧。话不多说了,看代码吧。
comment.cs
1
using System;
2
using System.Collections.Generic;
3
using System.Text;
4
5
namespace Model
6
{
7
public class comment
8
{
9
private int comm_id;
10
private int comm_tid;
11
private string comm_name;
12
private DateTime comm_time;
13
private string comm_ip;
14
private int comm_agree;
15
private int comm_against;
16
private int comm_audit;
17
private int comm_hot;
18
private int comm_hits;
19
private string comm_content;
20
21
public comment() { }
22
/// <summary>
23
/// 初始化评论构造器
24
/// </summary>
25
/// <param name="comm_id">评论ID</param>
26
/// <param name="comm_title">评论标题</param>
27
/// <param name="comm_name">评论人</param>
28
/// <param name="comm_time">发布时间</param>
29
/// <param name="comm_ip">评论人IP</param>
30
/// <param name="comm_agree">赞同</param>
31
/// <param name="comm_against">反对</param>
32
/// <param name="comm_audit">审核</param>
33
/// <param name="comm_hot">精华</param>
34
/// <param name="comm_hits">阅读次数</param>
35
/// <param name="comm_content">评论内容</param>
36
public comment(int id, int tid, string name, DateTime time, string ip, int agree, int against, int audit, int hot, int hits, string content)
37
{
38
this.comm_id = id;
39
this.comm_tid = tid;
40
this.comm_name = name;
41
this.comm_time = time;
42
this.comm_ip = ip;
43
this.comm_agree = agree;
44
this.comm_against = against;
45
this.comm_audit = audit;
46
this.comm_hot = hot;
47
this.comm_hits = hits;
48
this.comm_content = content;
49
}
50
51
public int Comm_id
52
{
53
get
54
{
55
return this.comm_id;
56
}
57
set
58
{
59
this.comm_id = value;
60
}
61
}
62
63
public int Comm_tid
64
{
65
get
66
{
67
return this.comm_tid;
68
}
69
set
70
{
71
this.comm_tid = value;
72
}
73
}
74
75
public string Comm_name
76
{
77
get
78
{
79
return this.comm_name;
80
}
81
set
82
{
83
this.comm_name = value;
84
}
85
}
86
87
public DateTime Comm_time
88
{
89
get
90
{
91
return this.comm_time;
92
}
93
set
94
{
95
this.comm_time = value;
96
}
97
}
98
99
public string Comm_ip
100
{
101
get
102
{
103
return this.comm_ip;
104
}
105
set
106
{
107
this.comm_ip = value;
108
}
109
}
110
111
public int Comm_agree
112
{
113
get
114
{
115
return this.comm_agree;
116
}
117
set
118
{
119
this.comm_agree = value;
120
}
121
}
122
123
public int Comm_against
124
{
125
get
126
{
127
return this.comm_against;
128
}
129
set
130
{
131
this.comm_against = value;
132
}
133
}
134
135
public int Comm_audit
136
{
137
get
138
{
139
return this.comm_audit;
140
}
141
set
142
{
143
this.comm_audit = value;
144
}
145
}
146
147
public int Comm_hot
148
{
149
get
150
{
151
return this.comm_hot;
152
}
153
set
154
{
155
this.comm_hot = value;
156
}
157
}
158
159
public int Comm_hits
160
{
161
get
162
{
163
return this.comm_hits;
164
}
165
set
166
{
167
this.comm_hits = value;
168
}
169
}
170
171
public string Comm_content
172
{
173
get
174
{
175
return this.comm_content;
176
}
177
set
178
{
179
this.comm_content = value;
180
}
181
}
182
}
183
}
184
using System;2
using System.Collections.Generic;3
using System.Text;4

5
namespace Model6
{7
public class comment8
{9
private int comm_id;10
private int comm_tid;11
private string comm_name;12
private DateTime comm_time;13
private string comm_ip;14
private int comm_agree;15
private int comm_against;16
private int comm_audit;17
private int comm_hot;18
private int comm_hits;19
private string comm_content;20

21
public comment() { }22
/// <summary>23
/// 初始化评论构造器24
/// </summary>25
/// <param name="comm_id">评论ID</param>26
/// <param name="comm_title">评论标题</param>27
/// <param name="comm_name">评论人</param>28
/// <param name="comm_time">发布时间</param>29
/// <param name="comm_ip">评论人IP</param>30
/// <param name="comm_agree">赞同</param>31
/// <param name="comm_against">反对</param>32
/// <param name="comm_audit">审核</param>33
/// <param name="comm_hot">精华</param>34
/// <param name="comm_hits">阅读次数</param>35
/// <param name="comm_content">评论内容</param>36
public comment(int id, int tid, string name, DateTime time, string ip, int agree, int against, int audit, int hot, int hits, string content)37
{38
this.comm_id = id;39
this.comm_tid = tid;40
this.comm_name = name;41
this.comm_time = time;42
this.comm_ip = ip;43
this.comm_agree = agree;44
this.comm_against = against;45
this.comm_audit = audit;46
this.comm_hot = hot;47
this.comm_hits = hits;48
this.comm_content = content;49
}50

51
public int Comm_id52
{53
get54
{55
return this.comm_id;56
}57
set58
{59
this.comm_id = value;60
}61
}62

63
public int Comm_tid64
{65
get66
{67
return this.comm_tid;68
}69
set70
{71
this.comm_tid = value;72
}73
}74

75
public string Comm_name76
{77
get78
{79
return this.comm_name;80
}81
set82
{83
this.comm_name = value;84
}85
}86

87
public DateTime Comm_time88
{89
get90
{91
return this.comm_time;92
}93
set94
{95
this.comm_time = value;96
}97
}98

99
public string Comm_ip100
{101
get102
{103
return this.comm_ip;104
}105
set106
{107
this.comm_ip = value;108
}109
}110

111
public int Comm_agree112
{113
get114
{115
return this.comm_agree;116
}117
set118
{119
this.comm_agree = value;120
}121
}122

123
public int Comm_against124
{125
get126
{127
return this.comm_against;128
}129
set130
{131
this.comm_against = value;132
}133
}134

135
public int Comm_audit136
{137
get138
{139
return this.comm_audit;140
}141
set142
{143
this.comm_audit = value;144
}145
}146

147
public int Comm_hot148
{149
get150
{151
return this.comm_hot;152
}153
set154
{155
this.comm_hot = value;156
}157
}158

159
public int Comm_hits160
{161
get162
{163
return this.comm_hits;164
}165
set166
{167
this.comm_hits = value;168
}169
}170

171
public string Comm_content172
{173
get174
{175
return this.comm_content;176
}177
set178
{179
this.comm_content = value;180
}181
}182
}183
}184

待续……


浙公网安备 33010602011771号