温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:WO@BIZ第一季1.2版源码
当前文件:
WOBIZ/admin/Tags.aspx.cs,打开代码结构图
WOBIZ/admin/Tags.aspx.cs,打开代码结构图1using System; 2
using System.Data; 3
using System.Configuration; 4
using System.Collections; 5
using System.Web; 6
using System.Web.Security; 7
using System.Web.UI; 8
using System.Web.UI.WebControls; 9
using System.Web.UI.WebControls.WebParts; 10
using System.Web.UI.HtmlControls; 11
using WoNextDll.commen; 12
using WoNextDll.component; 13
using WoNextDll.Handler; 14
using WoNextDll.Data; 15
16
public partial class admin_Tags : System.Web.UI.Page 17
{ 18
protected string tagtype; 19
protected string s; 20
protected string str; 21
22
protected void Page_Load(object sender, EventArgs e) 23
{ 24
if (Session["_AdminID"] == null) 25
{ 26
Response.Write("<script>top.location.href='admin_login.aspx';</script>"); 27
} 28
else 29
{ 30
if (Request.QueryString["s"] != null) 31
{ 32
s = Request.QueryString["s"].ToString(); 33
if (s == "1") //群组标签 34
{ 35
tagtype = "群组标签"; 36
Dlist.Visible = true; 37
Dlist2.Visible = false; 38
Dlist3.Visible = false; 39
if (!IsPostBack) 40
{ 41
str = "select * from WO_GroupTags"; 42
bind(str, "Dlist"); 43
} 44
} 45
if (s == "2") //宝贝标签 46
{ 47
tagtype = "宝贝标签"; 48
Dlist2.Visible = true; 49
Dlist.Visible = false; 50
Dlist3.Visible = false; 51
if (!IsPostBack) 52
{ 53
str = "select * from WO_ProTags"; 54
bind(str, "Dlist2"); 55
} 56
} 57
if (s == "3") //文章标签 58
{ 59
tagtype = "文章标签"; 60
Dlist3.Visible = true; 61
Dlist2.Visible = false; 62
Dlist.Visible = false; 63
if (!IsPostBack) 64
{ 65
str = "select * from WO_TopicTags"; 66
bind(str, "Dlist3"); 67
} 68
} 69
} 70
else 71
{ 72
Response.Write("参数错误!"); 73
Response.End(); 74
} 75
} 76
} 77
78
protected void bind(string sql, string jcontrol) 79
{ 80
Jpage1.JDataType = "2"; 81
Jpage1.Jconnstr = MyDB.GetMsSqlConnStr(); 82
Jpage1.Jselect = sql; // 查询语句 83
Jpage1.Jsortfield = "id desc";//排序方式 84
Jpage1.JControl = jcontrol; 85
Jpage1.DataBind();//绑定数据 86
} 87
88
protected void Dlist_RowDataBound(object sender, GridViewRowEventArgs e) 89
{ 90
if (e.Row.RowType == DataControlRowType.DataRow) 91
{ 92
string gid = e.Row.Cells[1].Text; 93
Han_Group han = new Han_Group(); 94
string gname = han.GetGroupName(int.Parse(gid)); 95
e.Row.Cells[1].Text = "<a href='../Group-" + gid + ".htm' target='_blank'>" + gname + "</a>"; 96
} 97
} 98
protected void Dlist2_RowDataBound(object sender, GridViewRowEventArgs e) 99
{ 100
if (e.Row.RowType == DataControlRowType.DataRow) 101
{ 102
string gid = e.Row.Cells[1].Text; 103
Han_ProInfo han = new Han_ProInfo(); 104
string gname = han.GetProName(int.Parse(gid)); 105
e.Row.Cells[1].Text = "<a href='../Goods-" + gid + ".htm' target='_blank'>" + gname + "</a>"; 106
} 107
} 108
protected void Dlist3_RowDataBound(object sender, GridViewRowEventArgs e) 109
{ 110
if (e.Row.RowType == DataControlRowType.DataRow) 111
{ 112
string tid = e.Row.Cells[1].Text; 113
Han_Topic han = new Han_Topic(); 114
string ttitle = han.GetTitle(int.Parse(tid)); 115
e.Row.Cells[1].Text = "<a href='../ShowPost-" + tid + ".htm' target='_blank'>" + ttitle + "</a>"; 116
} 117
} 118
protected void Button2_Click(object sender, EventArgs e) 119
{ 120
bool b = false; 121
int a = 0; 122
if (s == "1") 123
{ 124
Han_GroupTags han = new Han_GroupTags(); 125
for (int i = 0; i < Dlist.Rows.Count; i++) 126
{ 127
CheckBox cbSelect = (CheckBox)Dlist.Rows[i].FindControl("chk_groupID"); 128
if (cbSelect.Checked) //说明选中 129
{ 130
b = han.DelTag(int.Parse(Dlist.Rows[i].Cells[0].Text)); 131
if (!b) 132
a = a + 1; 133
} 134
} 135
} 136
else if (s == "2") 137
{ 138
Han_ProTags han = new Han_ProTags(); 139
for (int i = 0; i < Dlist2.Rows.Count; i++) 140
{ 141
CheckBox cbSelect = (CheckBox)Dlist2.Rows[i].FindControl("chk_proID"); 142
if (cbSelect.Checked) //说明选中 143
{ 144
b = han.DelTag(int.Parse(Dlist2.Rows[i].Cells[0].Text)); 145
if (!b) 146
a = a + 1; 147
} 148
} 149
} 150
else if (s == "3") 151
{ 152
Han_TopicTags han = new Han_TopicTags(); 153
for (int i = 0; i < Dlist3.Rows.Count; i++) 154
{ 155
CheckBox cbSelect = (CheckBox)Dlist3.Rows[i].FindControl("chk_topicID"); 156
if (cbSelect.Checked) //说明选中 157
{ 158
b = han.DelTag(int.Parse(Dlist3.Rows[i].Cells[0].Text)); 159
if (!b) 160
a = a + 1; 161
} 162
} 163
} 164
if (a == 0) 165
{ 166
Response.Write(Function.msgbox("您选中的标签全部删除成功!", "Tags.aspx?s=" + s, 1, 0)); 167
Response.End(); 168
} 169
else 170
{ 171
Response.Write(Function.msgbox("删除有出现错误,请重新删除!", "Tags.aspx?s=" + s, 1, 0)); 172
Response.End(); 173
} 174
} 175
} 176





}
}