Esempio n. 1
0
 private void buttonDelete_Click(object sender, EventArgs e)
 {
     if (dataGridViewGoodsList.SelectedRows.Count > 0)
     {
         if (DialogResult.Yes ==
             MessageBox.Show("删除该商品将无法恢复,确定要删除吗?",
                             "请注意",
                             MessageBoxButtons.YesNo,
                             MessageBoxIcon.Warning,
                             MessageBoxDefaultButton.Button2))
         {
             MaterialManager mm = new MaterialManager();
             //GoodsListDAO goodsDAO = new GoodsListDAO();
             bool influenceRow = mm.DeleteFake(
                 dataGridViewGoodsList.SelectedRows[0].Cells["gID"].Value.ToString());
             if (influenceRow)
             {
                 dataTableAllMaterial             = mm.GetList("").Tables[0];
                 dataGridViewGoodsList.DataSource = dataTableAllMaterial;
                 MessageBox.Show("删除指定商品成功");
             }
             else
             {
                 MessageBox.Show("删除失败");
             }
         }
     }
     else
     {
         MessageBox.Show("请选择要删除的行");
     }
 }