温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:WO@BIZ第一季1.2版源码
当前文件:
WOBIZ/admin/AllPro.aspx.cs[5K,2009-6-12 11:58:35],打开代码结构图
WOBIZ/admin/AllPro.aspx.cs[5K,2009-6-12 11:58:35],打开代码结构图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_AllPro : System.Web.UI.Page 17
{ 18
protected void Page_Load(object sender, EventArgs e) 19
{ 20
if (Session["_AdminID"] == null) 21
{ 22
Response.Write("<script>top.location.href='admin_login.aspx';</script>"); 23
} 24
else 25
{ 26
if (!IsPostBack) 27
{ 28
init(); 29
string str = "select * from WO_ProInfo"; 30
bind(str); 31
} 32
} 33
} 34
35
protected void bind(string sql) 36
{ 37
Jpage1.JDataType = "2"; 38
Jpage1.Jconnstr = MyDB.GetMsSqlConnStr(); 39
Jpage1.Jselect = sql; // 查询语句 40
Jpage1.Jsortfield = "id desc";//排序方式 41
Jpage1.JControl = "Dlist"; 42
Jpage1.DataBind();//绑定数据 43
} 44
45
protected void init() 46
{ 47
ListItem li = new ListItem(); 48
li.Text = "所有宝贝"; 49
li.Value = "allpro"; 50
ddltype.Items.Add(li); 51
string sql = "select * from Wo_ProType where fromtypeid=0 order by orderid"; 52
IDataReader dr = MyDB.GetDataReader(sql); 53
while (dr.Read()) 54
{ 55
ListItem l = new ListItem(); 56
l.Text = dr["name"].ToString(); 57
l.Value = dr["id"].ToString(); 58
ddltype.Items.Add(l); 59
sql = "select * from Wo_ProType where fromtypeid=" + dr["id"].ToString() + " order by orderid"; 60
IDataReader dr2 = MyDB.GetDataReader(sql); 61
while (dr2.Read()) 62
{ 63
ListItem ll = new ListItem(); 64
ll.Text = "----" + dr2["name"].ToString(); 65
ll.Value = dr2["id"].ToString(); 66
ddltype.Items.Add(ll); 67
} 68
dr2.Close(); 69
dr2.Dispose(); 70
} 71
dr.Close(); 72
dr.Dispose(); 73
} 74
75
protected void ddltype_SelectedIndexChanged(object sender, EventArgs e) 76
{ 77
string sql = ""; 78
if (ddltype.SelectedValue == "allpro") 79
{ 80
sql = "select * from Wo_proInfo"; 81
bind(sql); 82
} 83
else 84
{ 85
sql = "select * from Wo_proInfo where typeid = " + ddltype.SelectedValue + " or ctypeid=" + ddltype.SelectedValue + ""; 86
bind(sql); 87
} 88
} 89
90
protected void DelPro(int id) 91
{ 92
//先删除标签表的 93
string Sql_Str = "Delete From Wo_ProTags Where proid=" + id; 94
MyDB.ExecSql(Sql_Str); 95
//删除收藏表的 96
Sql_Str = "Delete From Wo_ProFavorite where proid=" + id; 97
MyDB.ExecSql(Sql_Str); 98
//删除评论表的 99
Sql_Str = "Delete From Wo_ProRevert where proid=" + id; 100
MyDB.ExecSql(Sql_Str); 101
//删除产品表的 102
Sql_Str = "Delete From Wo_ProInfo where id=" + id; 103
MyDB.ExecSql(Sql_Str); 104
} 105
106
protected void Button2_Click(object sender, EventArgs e) 107
{ 108
Han_ProInfo han = new Han_ProInfo(); 109
int a = 0; 110
for (int i = 0; i < Dlist.Rows.Count; i++) 111
{ 112
CheckBox cbSelect = (CheckBox)Dlist.Rows[i].FindControl("chk_proID"); 113
if (cbSelect.Checked) //说明选中 114
{ 115
try 116
{ 117
DelPro(int.Parse(Dlist.Rows[i].Cells[0].Text)); 118
} 119
catch (Exception ex) 120
{ 121
a = a + 1; 122
} 123
} 124
} 125
if (a == 0) 126
{ 127
Response.Write(Function.msgbox("您选中的宝贝全部删除成功!", "AllPro.aspx", 1, 0)); 128
Response.End(); 129
} 130
else 131
{ 132
Response.Write(Function.msgbox("删除有出现错误,请重新删除!", "AllPro.aspx", 1, 0)); 133
Response.End(); 134
} 135
} 136
137
protected void Button3_Click(object sender, EventArgs e) 138
{ 139
Han_ProInfo han = new Han_ProInfo(); 140
bool b = false; 141
int a = 0; 142
for (int i = 0; i < Dlist.Rows.Count; i++) 143
{ 144
CheckBox cbSelect = (CheckBox)Dlist.Rows[i].FindControl("chk_proID"); 145
if (cbSelect.Checked) //说明选中 146
{ 147
b = han.Audit(int.Parse(Dlist.Rows[i].Cells[0].Text)); 148
if (!b) 149
a = a + 1; 150
} 151
} 152
if (a == 0) 153
{ 154
Response.Write(Function.msgbox("您选中的宝贝全部审核成功!", "AllPro.aspx", 1, 0)); 155
Response.End(); 156
} 157
else 158
{ 159
Response.Write(Function.msgbox("审核有出现错误,请重新审核!", "AllPro.aspx", 1, 0)); 160
Response.End(); 161
} 162
} 163
protected void Dlist_RowDataBound(object sender, GridViewRowEventArgs e) 164
{ 165
if (e.Row.RowType == DataControlRowType.DataRow) 166
{ 167
string a = e.Row.Cells[3].Text; 168
if (a == "False") 169
e.Row.Cells[3].Text = "已审核"; 170
else 171
e.Row.Cells[3].Text = "<font color='red'>未审核</font>"; 172
} 173
} 174
protected void LinkButton1_Click(object sender, EventArgs e) 175
{ 176
string s = "select * from wo_proinfo where state <> 0 "; 177
bind(s); 178
} 179
} 180






}
}