private void tlBtnDelete_Click(object sender, EventArgs e)
        {
            if (txtTradeCode.Text.Trim() == string.Empty) //判断是否选择了商品编号
            {
                MessageBox.Show("删除--库存商品数据--失败!", "错误提示!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            stockinfo.TradeCode = txtTradeCode.Text;  //记录商品编号
            int id = baseinfo.DeleteStock(stockinfo); //执行删除操作

            MessageBox.Show("删除--库存商品数据--成功!", "成功提示!", MessageBoxButtons.OK, MessageBoxIcon.Information);
            dgvStockList.DataSource = baseinfo.GetAllStock("tb_stock").Tables[0].DefaultView; //显示最新的库存商品信息
            SetdgvStockListHeadText();                                                        //设置DataGridView控件列标题
            clearText();                                                                      //清空文本框
        }
Example #2
0
 private void tlBtnDelete_Click(object sender, EventArgs e)
 {
     if (txtTradeCode.Text.Trim() == string.Empty)
     {
         MessageBox.Show("删除--库存商品数据--失败!", "错误提示!", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     stockinfo.TradeCode = txtTradeCode.Text;
     //执行删除
     try
     {
         int id = baseinfo.DeleteStock(stockinfo);
         MessageBox.Show("删除--库存商品数据--成功!", "成功提示!", MessageBoxButtons.OK, MessageBoxIcon.Information);
         dgvStockList.DataSource = baseinfo.GetAllStock("tb_stock").Tables[0].DefaultView;
         this.SetdgvStockListHeadText();
         this.clearText();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "错误提示!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }