private void Edit(OrderInventory item) { using (OrderInventoryForm form = new OrderInventoryForm(_model, item, false)) { if (form.ShowDialog() != DialogResult.OK) item.RejectChanges(); else SetAllTotal(); } }
private void _btnAdd_Click(object sender, EventArgs e) { OrderInventory item = TypeAccessor<OrderInventory>.CreateInstanceEx(); item.SequenceId = objectBinder.List.Count + 1; item.InventoryQuantity = 1; item.InventoryDate = _date.Value.Date; if (objectBinder.List.Count > 0) item.InventoryDate = ((GridItem)objectBinder.List[objectBinder.List.Count - 1]).Item.InventoryDate; using (OrderInventoryForm form = new OrderInventoryForm(_model, item, true)) { if (form.ShowDialog() == DialogResult.OK) { item.AcceptChanges(); objectBinder.List.Add(new GridItem(item, GetInventoryName(item.InventoryId))); SetAllTotal(); } } }