private void toolStripButtonAdd_Click(object sender, EventArgs e) { FormGoodElement dlg = new FormGoodElement(); dlg.m_GoodsItem = m_GoodsItem; if (dlg.ShowDialog() == DialogResult.OK) { if (CGlobalInstance.Instance.DbAdaHelper.AddGoodsDetail(m_GoodsItem.GoodsID, dlg.GoodsMaterialID, dlg.Number)) { ShowGoodsDetail(); } else { MessageBox.Show("添加失败!"); } } dlg.Dispose(); }
private void toolStripButtonMod_Click(object sender, EventArgs e) { if (dgvMain.CurrentRow != null) { int GoodsDetailID = Convert.ToInt32(dgvMain.CurrentRow.Cells["ColumnGoodsDetailID"].Value); FormGoodElement dlg = new FormGoodElement(); dlg.m_GoodsItem = m_GoodsItem; if (dlg.ShowDialog() == DialogResult.OK) { if (CGlobalInstance.Instance.DbAdaHelper.UpdateGoodsDetail(GoodsDetailID, dlg.GoodsMaterialID, dlg.Number)) { ShowGoodsDetail(); } else { MessageBox.Show("修改失败!"); } } dlg.Dispose(); } }