您目前尚未登陆,请选择【登陆】或【注册
首页->博客论坛->WO@BIZ第一季1.2版源码>>admin/ProductCat.aspx.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:WO@BIZ第一季1.2版源码
当前文件:文件类型 WOBIZ/admin/ProductCat.aspx.cs打开代码结构图
普通视图
		            
1using System; 2using System.Data; 3using System.Configuration; 4using System.Collections; 5using System.Web; 6using System.Web.Security; 7using System.Web.UI; 8using System.Web.UI.WebControls; 9using System.Web.UI.WebControls.WebParts; 10using System.Web.UI.HtmlControls; 11using WoNextDll.commen; 12using WoNextDll.component; 13using WoNextDll.Handler; 14using WoNextDll.Data; 15 16public partial class admin_ProductCat : 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 string str = "select * from WO_ProType"; 29 bind(str); 30 } 31 } 32 } 33 34 protected void bind(string sql) 35 { 36 Jpage1.JDataType = "2"; 37 Jpage1.Jconnstr = MyDB.GetMsSqlConnStr(); 38 Jpage1.Jselect = sql; // 查询语句 39 Jpage1.Jsortfield = "orderid asc,id asc";//排序方式 40 Jpage1.JControl = "Dlist"; 41 Jpage1.DataBind();//绑定数据 42 } 43 44 protected void Dlist_RowCommand(object sender, GridViewCommandEventArgs e) 45 { 46 if (e.CommandName == "lbdel") 47 { 48 int deleteid = int.Parse(e.CommandArgument.ToString()); 49 Han_ProType han = new Han_ProType(); 50 Han_ProTags ptag = new Han_ProTags(); 51 //先得到这个类别下有没有小类 52 ProType pro = han.GetproType(deleteid); 53 if (pro.Fromtypeid == 0) //说明是大类,先找出小类 54 { 55 DataSet ds = MyDB.GetDataSet("select * from WO_ProType where fromtypeid=" + deleteid + ""); 56 if (ds.Tables[0].Rows.Count > 0) 57 { 58 DataSet ds2 = new DataSet(); 59 for (int i = 0; i < ds.Tables[0].Rows.Count; i++) 60 { 61 //先根据小类编号找到这个类别下的所有宝贝 62 ds2 = MyDB.GetDataSet("select * from Wo_ProInfo where ctypeid='" + ds.Tables[0].Rows[i]["id"].ToString() + "'"); 63 if (ds2.Tables[0].Rows.Count > 0) //这个类别有宝贝 64 { 65 for (int ii = 0; ii < ds2.Tables[0].Rows.Count; ii++) 66 { 67 //先删除这个宝贝的标签 68 bool b = ptag.DelProTags(int.Parse(ds2.Tables[0].Rows[ii]["id"].ToString())); 69 if (!b) 70 { 71 Response.Write(Function.msgbox("删除出现错误,请重新删除!", "ProductCat.aspx", 1, 0)); 72 Response.End(); 73 } 74 //再删除类别下的宝贝和宝贝评论 75 b = MyDB.DelPKeyAndCKey("Wo_ProInfo", "Wo_ProRevert", "id", "proid", ds2.Tables[0].Rows[ii]["id"].ToString()); 76 if (!b) 77 { 78 Response.Write(Function.msgbox("删除出现错误,请重新删除!", "ProductCat.aspx", 1, 0)); 79 Response.End(); 80 } 81 } 82 } 83 //再把自己这个类别删除了 84 string str = "delete from Wo_ProType where id=" + ds.Tables[0].Rows[i]["id"].ToString(); 85 MyDB.ExecSql(str); 86 87 } 88 } 89 //小类删除完了,删除大类 90 string s = "delete from Wo_ProType where id=" + deleteid; 91 MyDB.ExecSql(s); 92 Response.Write(Function.msgbox("删除成功!", "ProductCat.aspx", 1, 0)); 93 Response.End(); 94 } 95 else //说明是小类 96 { 97 //先根据小类编号找到这个类别下的所有宝贝 98 DataSet ds3 = MyDB.GetDataSet("select * from Wo_ProInfo where ctypeid='" + deleteid.ToString() + "'"); 99 if (ds3.Tables[0].Rows.Count > 0) //这个类别有宝贝 100 { 101 for (int ii = 0; ii < ds3.Tables[0].Rows.Count; ii++) 102 { 103 //先删除这个宝贝的标签 104 bool b = ptag.DelProTags(int.Parse(ds3.Tables[0].Rows[ii]["id"].ToString())); 105 if (!b) 106 { 107 Response.Write(Function.msgbox("删除出现错误,请重新删除!", "ProductCat.aspx", 1, 0)); 108 Response.End(); 109 } 110 //再删除类别下的宝贝和宝贝评论 111 b = MyDB.DelPKeyAndCKey("Wo_ProInfo", "Wo_ProRevert", "id", "proid", ds3.Tables[0].Rows[ii]["id"].ToString()); 112 if (!b) 113 { 114 Response.Write(Function.msgbox("删除出现错误,请重新删除!", "ProductCat.aspx", 1, 0)); 115 Response.End(); 116 } 117 } 118 } 119 //再把自己这个类别删除了 120 string str = "delete from Wo_ProType where id=" + deleteid.ToString(); 121 MyDB.ExecSql(str); 122 Response.Write(Function.msgbox("删除成功!", "ProductCat.aspx", 1, 0)); 123 Response.End(); 124 } 125 } 126 } 127 protected void Dlist_RowDataBound(object sender, GridViewRowEventArgs e) 128 { 129 if (e.Row.RowType == DataControlRowType.DataRow) 130 { 131 int typeid = int.Parse(e.Row.Cells[2].Text); 132 if (typeid == 0) 133 { 134 e.Row.Cells[2].Text = "此类是大类"; 135 } 136 else 137 { 138 Han_ProType han = new Han_ProType(); 139 string typename = han.GetFromTypeName(typeid); 140 e.Row.Cells[2].Text = typename; 141 } 142 } 143 } 144 protected void Button1_Click(object sender, EventArgs e) 145 { 146 Response.Redirect("AddProCat.aspx?Flag=Add"); 147 Response.End(); 148 } 149} 150
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:WO@BIZ第一季1.2版源码
51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号