void ButtonNewClick(object sender, EventArgs e) { using (CustomerDiscountedItemForm f = new CustomerDiscountedItemForm()) { if (WorkbenchSingleton.AddDialog(f) == DialogResult.OK) { customer.AddDiscountedItem(f.CustomerDiscountedItem); } } }
void ButtonEditClick(object sender, EventArgs e) { if (listView1.SelectedItems.Count > 0) { CustomerDiscountedItem item = customer.DiscountedItems[listView1.SelectedItems[0].Index]; using (CustomerDiscountedItemForm f = new CustomerDiscountedItemForm(item)) { if (WorkbenchSingleton.AddDialog(f) == DialogResult.OK) { DiscountedItemsChanged(); } } } }