protected void sc_Command(object sender, CommandEventArgs e) { string size_id = Convert.ToString(e.CommandArgument); BLL.size bsize = new BLL.size(); int result = bsize.delete(size_id); BLL.proimage myb = new BLL.proimage(); MySqlDataReader dr = myb.s_imageurl(size_id); BLL.proimage isize = new BLL.proimage(); int i_result = isize.delete_1(size_id); dr.Read(); string path = "~/" + dr["_imageurl"].ToString(); dr.Close(); if (File.Exists(Server.MapPath(path))) { File.Delete(Server.MapPath(path)); } if (i_result > 0) { msg("删除成功!!"); bing(); } }
protected void sc_Command(object sender, CommandEventArgs e) { string size_id = Convert.ToString(e.CommandArgument); BLL.size bsize = new BLL.size(); int result = bsize.delete(size_id); BLL.proimage myb = new BLL.proimage(); SqlDataReader dr = myb.s_imageurl(size_id); BLL.proimage isize = new BLL.proimage(); int i_result = isize.delete_1(size_id); dr.Read(); string path = "~/" + dr["_imageurl"].ToString(); dr.Close(); if (File.Exists(Server.MapPath(path))) { File.Delete(Server.MapPath(path)); } if (i_result > 0) { msg("删除成功!!"); bing(); } }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Delete") { Model.product mym = new Model.product(); mym.id = Convert.ToInt32(e.CommandArgument); BLL.product myb = new BLL.product(); string s_imageid = myb.select_imageid(mym); BLL.proimage b_image = new BLL.proimage(); DataSet ds = b_image.select_sizeid(s_imageid); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { string size_id = Convert.ToString(ds.Tables[0].Rows[i]["_sizeid"]); BLL.size s_bll = new BLL.size(); int result_s = s_bll.delete(size_id); string path1 = Convert.ToString(ds.Tables[0].Rows[i]["_imageurl"]); string path = "~/" + path1; if (File.Exists(Server.MapPath(path))) { File.Delete(Server.MapPath(path)); } } int r_image = b_image.delete(s_imageid); int result = myb.delete_id(mym); if (result > 0) { msg("删除成功!!"); bing(); } } if (e.CommandName == "Edit") { Response.Redirect("proupdate.aspx?id=" + e.CommandArgument + ""); } }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Delete") { Model.product mym = new Model.product(); mym.id = Convert.ToInt32(e.CommandArgument); BLL.product myb = new BLL.product(); string s_imageid = myb.select_imageid(mym); BLL.proimage b_image = new BLL.proimage(); DataSet ds = b_image.select_sizeid(s_imageid); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { string size_id = Convert.ToString(ds.Tables[0].Rows[i]["_sizeid"]); BLL.size s_bll = new BLL.size(); int result_s = s_bll.delete(size_id); string path1 = Convert.ToString(ds.Tables[0].Rows[i]["_imageurl"]); string path = "~/" + path1; if (File.Exists(Server.MapPath(path))) { File.Delete(Server.MapPath(path)); } } int r_image = b_image.delete(s_imageid); int result = myb.delete_id(mym); if (result > 0) { msg("删除成功!!"); bing(); } } if (e.CommandName == "Edit") { Response.Redirect("proupdate.aspx?id="+e.CommandArgument+""); } }