private void btnAdd_Click(object sender, EventArgs e) { DetailForm detailForm = new DetailForm(new OrderDetails()); if (detailForm.ShowDialog() == DialogResult.OK) { currentOrder.AddGoods(detailForm.orderDetails); bdsOrderDetails.ResetBindings(false); } }
private void btnUpdate_Click(object sender, EventArgs e) { OrderDetails detail = bdsOrderDetails.Current as OrderDetails; if (detail == null) { MessageBox.Show("请选择一个明细项进行修改"); return; } DetailForm detailForm = new DetailForm(detail); if (detailForm.ShowDialog() == DialogResult.OK) { currentOrder.Goods.Remove(detail); currentOrder.Goods.Add(detailForm.orderDetails); bdsOrderDetails.ResetBindings(false); } }