protected void btDelete_Click(object sender, EventArgs e) { ArrayList pkArray = null; ProductInfoBLL bll = null; try { bll = BLLFactory.CreateBLL <ProductInfoBLL>(); pkArray = GvHelper.GetPKValueByChk(this.GvList, 0, "cbxSelect", 0); foreach (object key in pkArray) { if (!bll.HasProducePlan(key.ToString())) { bll.DeleteProductInfo(new ProductInfo { PID = key.ToString() }); } else { ClientScript.RegisterStartupScript(this.GetType(), "myjs", "alert('选中的产品被产品计划使用过,不能被删除');", true); } } this.BindData(); } catch (Exception ex) { throw ex; } }