private void OnButtonAddClick(object sender, EventArgs e) { var item = new SaleItems(); var dialog = new FormSaleItemDialog(item, _unitOfWork); DialogResult result = dialog.ShowDialog(); if (result != DialogResult.OK) { return; } _sale.SaleItems.Add(item); UpdateListView(item, ListViewAction.Add, Constant.IndexNone); }
private void OnButtonEditClick(object sender, EventArgs e) { if (lvSaleItems.SelectedItems.Count != 1) { MessageBox.Show("Please select one sale item.", Constant.StoreAppName); return; } SaleItems item = (SaleItems)lvSaleItems.SelectedItems[0].Tag; var dialog = new FormSaleItemDialog(item, _unitOfWork); DialogResult result = dialog.ShowDialog(); if (result != DialogResult.OK) { return; } UpdateListView(item, ListViewAction.Update, lvSaleItems.SelectedItems[0].Index); }