private void tbtnAdd_Click(object sender, EventArgs e) { ShipmentOrder shipmentOrder = new ShipmentOrder(); var frmShipmentOrderEdit = new ShipmentOrderEdit(shipmentOrder); shipmentOrder.ShipmentId = _shipment.Id; shipmentOrder.IsBinding = false; if (frmShipmentOrderEdit.ShowDialog() == DialogResult.OK) { _context.ShipmentOrders.Add(shipmentOrder); tblShipmentOrders.DataSource = _shipment.ShipmentOrders.ToList(); } //row["shipment_id"] =_shipment.id; }
private void tbtnEdit_Click(object sender, EventArgs e) { if (tblShipmentOrders.CurrentCell == null) { return; } ShipmentOrder shipmentOrder = _context.ShipmentOrders.Find(tblShipmentOrders.Rows[tblShipmentOrders.CurrentCell.RowIndex].Cells["colId"].Value); var frmShipmentOrderEdit = new ShipmentOrderEdit(shipmentOrder); frmShipmentOrderEdit.ShowDialog(); if (frmShipmentOrderEdit.DialogResult == DialogResult.Cancel) { return; } tblShipmentOrders.Refresh(); }