private void SaveSupplyItemButton_Click(object sender, EventArgs e) { foreach (DataGridViewRow row in SupplyItemGrid.Rows) { short order = (short)row.Cells[SupplyItemGrid_Order.Name].Value.AsShort(); using (var repository = new SupplyRepository()) { var supplyItem = repository.GetSupplyItem(supplyID, order); supplyItem.Quantity = (int)row.Cells[SupplyItemGrid_Quantity.Name].Value.AsInt(); repository.UpdateSupplyItem(supplyItem); repository.Commit(); } } ViewSupplyDetailTab(supplyID, true); }