温馨提示:代码在线浏览功能只能做为源码浏览参考,不能展示项目的全部,如果想更进一步了解该代码请下载:三层班级留言本源码
当前文件路径:ClassSay/Class/index.aspx.cs

1using System; 2
using System.Data; 3
using System.Configuration; 4
using System.Collections; 5
using System.Web; 6
using System.IO; 7
using System.Web.Security; 8
using System.Web.UI; 9
using System.Web.UI.WebControls; 10
using System.Web.UI.WebControls.WebParts; 11
using System.Web.UI.HtmlControls; 12
using UserInfoLib; 13
14
15
public partial class index : System.Web.UI.Page 16
{ 17
private void BindToDataGrid() 18
{ 19
DataSet table = UserInfo.Sele(); 20
21
DataView dv = table.Tables[0].DefaultView; 22
23
dv.Sort = "TextID DESC"; 24
25
this.DataGrid1.DataSource = dv; 26
int i = UserInfo.CountTextSum(); 27
this.Label1.Text = i.ToString(); 28
this.Label3.Text = this.Application["SumConunt"].ToString(); 29
this.Label2.Text = this.Application["CountUser"].ToString(); 30
this.Label4.Text = UserInfo.SeleGG(); 31
this.DataGrid1.DataBind(); 32
} 33
34
protected void Page_Load(object sender, EventArgs e) 35
{ 36
if (!Page.IsPostBack) 37
{ 38
//B 39
Image10.Attributes.Add("onclick", "LinkImage(1);"); 40
//U 41
Image2.Attributes.Add("onclick", "LinkImage(2);"); 42
//EMAIL 43
Image6.Attributes.Add("onclick", "LinkImage(3);"); 44
//CENTER 45
Image8.Attributes.Add("onclick", "LinkImage(4);"); 46
//LINK 47
Image3.Attributes.Add("onclick", "LinkImage(5);"); 48
//IMAGE 49
Image4.Attributes.Add("onclick", "LinkImage(6);"); 50
51
Image0.Attributes.Add("onclick", "LinkFace('[/呲牙]');"); 52
Image7.Attributes.Add("onclick", "LinkFace('[/微笑]');"); 53
Image9.Attributes.Add("onclick", "LinkFace('[/偷笑]');"); 54
Image11.Attributes.Add("onclick", "LinkFace('[/害羞]');"); 55
Image12.Attributes.Add("onclick", "LinkFace('[/色]');"); 56
Image13.Attributes.Add("onclick", "LinkFace('[/调皮]');"); 57
Image14.Attributes.Add("onclick", "LinkFace('[/大兵]');"); 58
Image15.Attributes.Add("onclick", "LinkFace('[/饥饿]');"); 59
Image16.Attributes.Add("onclick", "LinkFace('[/睡]');"); 60
Image17.Attributes.Add("onclick", "LinkFace('[/惊讶]');"); 61
Image18.Attributes.Add("onclick", "LinkFace('[/疑问]');"); 62
Image19.Attributes.Add("onclick", "LinkFace('[/咒骂]');"); 63
Image20.Attributes.Add("onclick", "LinkFace('[/大哭]');"); 64
Image21.Attributes.Add("onclick", "LinkFace('[/抓狂]');"); 65
Image22.Attributes.Add("onclick", "LinkFace('[/流汗]');"); 66
Image23.Attributes.Add("onclick", "LinkFace('[/衰]');"); 67
Image24.Attributes.Add("onclick", "LinkFace('[/难过]');"); 68
Image25.Attributes.Add("onclick", "LinkFace('[/敲打]');"); 69
Image26.Attributes.Add("onclick", "LinkFace('[/发怒]');"); 70
Image27.Attributes.Add("onclick", "LinkFace('[/尴尬]');"); 71
Image28.Attributes.Add("onclick", "LinkFace('[/困]');"); 72
Image29.Attributes.Add("onclick", "LinkFace('[/嘘]');"); 73
Image30.Attributes.Add("onclick", "LinkFace('[/晕]');"); 74
Image31.Attributes.Add("onclick", "LinkFace('[/折磨]');"); 75
Image32.Attributes.Add("onclick", "LinkFace('[/骷髅]');"); 76
Image33.Attributes.Add("onclick", "LinkFace('[/再见]');"); 77
Image34.Attributes.Add("onclick", "LinkFace('[/得意]');"); 78
Image35.Attributes.Add("onclick", "LinkFace('[/奋斗]');"); 79
Image36.Attributes.Add("onclick", "LinkFace('[/玫瑰]');"); 80
Image37.Attributes.Add("onclick", "LinkFace('[/猪头]');"); 81
Image38.Attributes.Add("onclick", "LinkFace('[/吻]');"); 82
Image39.Attributes.Add("onclick", "LinkFace('[/爱心]');"); 83
Image40.Attributes.Add("onclick", "LinkFace('[/心碎]');"); 84
Image41.Attributes.Add("onclick", "LinkFace('[/电话]');"); 85
Image42.Attributes.Add("onclick", "LinkFace('[/邮件]');"); 86
Image43.Attributes.Add("onclick", "LinkFace('[/强]');"); 87
Image44.Attributes.Add("onclick", "LinkFace('[/弱]');"); 88
Image45.Attributes.Add("onclick", "LinkFace('[/握手]');"); 89
Image46.Attributes.Add("onclick", "LinkFace('[/胜利]');"); 90
Image47.Attributes.Add("onclick", "LinkFace('[/礼物]');"); 91
Image48.Attributes.Add("onclick", "LinkFace('[/蛋糕]');"); 92
Image49.Attributes.Add("onclick", "LinkFace('[/钱]');"); 93
94
this.Image1.ImageUrl = "MAC.aspx"; 95
BindToDataGrid(); 96
if (this.Session["Root"] == null) 97
{ 98
this.PanelTwo.Visible = false; 99
this.PanelOne.Visible = true; 100
this.ButtonSend.Enabled = false; 101
this.FileUpload1.Visible = false; 102
this.LinkButtonInsert.Visible = false; 103
} 104
else 105
{ 106
this.PanelTwo.Visible = true; 107
this.PanelOne.Visible = false; 108
this.ButtonSend.Enabled = true; 109
this.FileUpload1.Visible = true; 110
this.LinkButtonInsert.Visible = true; 111
} 112
113
CleaALL(); 114
} 115
} 116
117
private void CleaALL() 118
{ 119
this.TextBoxTitle.Text = null; 120
this.TextBoxBody.Text = null; 121
this.TextBoxMAC.Text = null; 122
this.TextBoxUsername.Text = null; 123
this.TextBoxPassword.Text = null; 124
125
} 126
//添加记录 127
protected void ButtonSend_Click(object sender, EventArgs e) 128
{ 129
if (this.TextBoxMAC.Text == Session["ValidateCode"].ToString() 130
&& this.TextBoxTitle.Text != "" && this.TextBoxBody.Text != "") 131
{ 132
UserInfo user = new UserInfo(); 133
134
user.UserTitle = this.TextBoxTitle.Text; 135
user.UserText = this.TextBoxBody.Text; 136
user.UserName = this.Session["User"].ToString(); 137
user.Time = DateTime.Now; 138
int rows = user.InsertText(); 139
140
if (rows == 1) 141
{ 142
this.Response.Write("<script>alert('添加留言成功!');</script>"); 143
CleaALL(); 144
} 145
BindToDataGrid(); 146
} 147
else 148
{ 149
this.Response.Write("<script>alert('输入出错!');</script>"); 150
} 151
152
} 153
protected void DataGrid1_PageIndexChanged(object source, DataGridPageChangedEventArgs e) 154
{ 155
this.DataGrid1.CurrentPageIndex = e.NewPageIndex; 156
BindToDataGrid(); 157
} 158
//重置 159
protected void ButtonExit_Click(object sender, EventArgs e) 160
{ 161
this.TextBoxUsername.Text = ""; 162
this.TextBoxPassword.Text = ""; 163
} 164
//登陆 165
protected void ButtonLogin_Click(object sender, EventArgs e) 166
{ 167
168
UserInfo user = new UserInfo(); 169
user.UserName = this.TextBoxUsername.Text; 170
user.UserPassword = this.TextBoxPassword.Text; 171
string Root = user.UserRoot(); 172
if (Root != "0") 173
{ 174
this.PanelOne.Visible = false; 175
this.PanelTwo.Visible = true; 176
if (Root == "1") 177
{ 178
this.TextBox1.Visible = true; 179
this.Button2.Visible = true; 180
} 181
else 182
{ 183
this.TextBox1.Visible = false; 184
this.Button2.Visible = false; 185
} 186
this.LabelUserInfo.Text = this.TextBoxUsername.Text; 187
this.ButtonSend.Enabled = true; 188
this.Session["Root"] = Root; 189
this.Session["User"] = this.TextBoxUsername.Text; 190
this.FileUpload1.Visible = true; 191
this.LinkButtonInsert.Visible = true; 192
} 193
else 194
{ 195
this.Response.Write("<script>alert('用户名密码错误!');</script>"); 196
} 197
BindToDataGrid(); 198
this.CleaALL(); 199
200
} 201
//修改密码 202
protected void ButtonModifyPass_Click(object sender, EventArgs e) 203
{ 204
this.Response.Write("<script>window.open('ModifyPass.aspx','_blank','toolbar=no,width=390,height=200,status=no,scrollbars=no,resizable=no,menubar=no');</script>"); 205
206
} 207
//注册 208
protected void ButtonLoginone_Click(object sender, EventArgs e) 209
{ 210
this.Server.Transfer("AddUser.aspx"); 211
} 212
// 213
protected void DataGrid1_ItemCommand(object source, DataGridCommandEventArgs e) 214
{ 215
if (e.CommandName == "Jump") 216
{ 217
this.Session["TitleID"] = ((Label)e.Item.Cells[0].FindControl("LabelTitle")).Text; 218
this.Response.Redirect("body.aspx"); 219
} 220
else if (e.CommandName == "TextIDdele") 221
{ 222
if ((Session["User"] != null) && (Session["Root"] != null) && (Session["Root"].ToString()) != "0") 223
{ 224
UserInfo user = new UserInfo(); 225
user.TextID = int.Parse(((Label)e.Item.Cells[0].FindControl("LabelTitle")).Text); 226
user.DeleText(); 227
} 228
} 229
else if (e.CommandName == "点击回复") 230
{ 231
if ((Session["User"] != null) && (Session["Root"] != null) && (Session["Root"].ToString()) != "0") 232
{ 233
Session["TextID"] = int.Parse(((Label)e.Item.Cells[0].FindControl("LabelTitle")).Text); 234
this.Response.Write("<script>window.open('AddBack.aspx ','_blank','toolbar=no,width=490,height=260,status=no,scrollbars=no,resizable=no,menubar=no');</script>"); 235
} 236
else 237
{ 238
this.Response.Write("<script>alert('请登陆后再回复!查看留言点击标题!');</script>"); 239
} 240
} 241
BindToDataGrid(); 242
} 243
protected void DataGrid1_PageIndexChanged1(object source, DataGridPageChangedEventArgs e) 244
{ 245
this.DataGrid1.CurrentPageIndex = e.NewPageIndex; 246
BindToDataGrid(); 247
} 248
protected void DataGrid1_SelectedIndexChanged(object sender, EventArgs e) 249
{ 250
251
} 252
protected void Button1_Click(object sender, EventArgs e) 253
{ 254
this.Session.Remove("Root"); 255
this.Session.Remove("User"); 256
this.Session.Remove("TitleID"); 257
this.PanelTwo.Visible = false; 258
this.PanelOne.Visible = true; 259
this.ButtonSend.Enabled = false; 260
this.FileUpload1.Visible = false; 261
this.LinkButtonInsert.Visible = false; 262
CleaALL(); 263
BindToDataGrid(); 264
} 265
//排序 266
protected void DataGrid1_SortCommand(object source, DataGridSortCommandEventArgs e) 267
{ 268
269
} 270
public string BackSum(int i) 271
{ 272
string str = null; 273
![]()





}