protected void Page_Load(object sender, EventArgs e) { TtNum1.BLL.GoodSort2 bllGoodSort2 = new TtNum1.BLL.GoodSort2(); TtNum1.Model.GoodSort2 modGoodSort2 = new TtNum1.Model.GoodSort2(); TtNum1.BLL.GoodsInfo bllgoodsinfo = new TtNum1.BLL.GoodsInfo(); TtNum1.Model.GoodsInfo modgoodsinfo = new TtNum1.Model.GoodsInfo(); if (!IsPostBack) { //if (Session["ht_username"] == null) //{ // Response.Write("<script type='text/javascript'>alert('您尚未登录!');</script>"); // Response.Redirect("../Shopping.aspx"); // ViewState["retu"] = Request.UrlReferrer.ToString(); //} //else //{ string a = Request.QueryString["S_ID"].ToString(); DataSet ds = bllgoodsinfo.GetList_gs2(a); if (Convert.ToInt32( ds.Tables[0].Rows[0][0].ToString().Trim()) !=0) { Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('该类有商品信息无法删除!');location.href='type_0.aspx'</script>"); } else { bllgoodsinfo.Delete_2(a); Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('删除成功!');location.href='type_0.aspx'</script>"); } //} } }
/// <summary> /// 得到一个对象实体 /// </summary> public TtNum1.Model.GoodSort2 GetModel(int Sort2_ID) { StringBuilder strSql=new StringBuilder(); strSql.Append("select top 1 "); strSql.Append(" Sort2_ID,Sort_name,GS_ID "); strSql.Append(" from GoodSort2 "); strSql.Append(" where Sort2_ID=" + Sort2_ID + ""); TtNum1.Model.GoodSort2 model=new TtNum1.Model.GoodSort2(); DataSet ds=DbHelperSQL.Query(strSql.ToString()); if(ds.Tables[0].Rows.Count>0) { if (ds.Tables[0].Rows[0]["Sort2_ID"] != null && ds.Tables[0].Rows[0]["Sort2_ID"].ToString() != "") { model.Sort2_ID = int.Parse(ds.Tables[0].Rows[0]["Sort2_ID"].ToString()); } if(ds.Tables[0].Rows[0]["Sort_name"]!=null && ds.Tables[0].Rows[0]["Sort_name"].ToString()!="") { model.Sort_name=ds.Tables[0].Rows[0]["Sort_name"].ToString(); } if(ds.Tables[0].Rows[0]["GS_ID"]!=null && ds.Tables[0].Rows[0]["GS_ID"].ToString()!="") { model.GS_ID=int.Parse(ds.Tables[0].Rows[0]["GS_ID"].ToString()); } return model; } else { return null; } }