Exemple #1
0
        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;
            }
        }
Exemple #2
0
 //删除产品
 private void btnDeletePro_Click(object sender, EventArgs e)
 {
     if (dgvProductInfo.SelectedRows.Count > 0)
     {
         ProductInfoBLL bll = new ProductInfoBLL();
         int            id  = Convert.ToInt32(dgvProductInfo.SelectedRows[0].Cells[0].Value);
         //if (bll.DeleteProductInfo(id))
         //{
         //    MessageBox.Show("删除成功");
         //    LoadProductInfoByDelFlag(0);
         //}
         //else
         //{
         //    MessageBox.Show("删除失败");
         //}
         string msg = bll.DeleteProductInfo(id) ? "操作成功" : "操作失败";
         MessageBox.Show(msg);
         LoadProductInfoByDelFlag(0);
     }
     else
     {
         MessageBox.Show("请选择要操作的行");
     }
 }