/// <summary> /// Event handler for new button click /// </summary> private void btnNew_Click(object sender, System.EventArgs e) { _salesManagementDataModel = _salesManagementService.AddEmptySalesManagement(); UpdateDataModels(); UpdateSalesManagementForm(DataState.WriteToUI); _parentForm.UpdateDataGridView(); }
private void productOverviewContextMenuStrip_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { // if (_selectedRowID == -1) return; if (dataGridViewProductOverview.CurrentCell == null) { return; } _selectedRowID = (int)dataGridViewProductOverview.CurrentCell.OwningRow.Cells["SalesManagementID"].Value; _selectedColumnName = dataGridViewProductOverview.CurrentCell.OwningColumn.HeaderText; var salesManagementDataRow = _salesManagementService.GetSalesManagementById(_selectedRowID); var salesManagementDataModel = _salesManagementService.ConvertToDataModel(salesManagementDataRow); switch (e.ClickedItem.Name) { case "addProductOverviewToolStripMenuItem": var salesManagementID = _salesManagementService.AddEmptySalesManagement(); UpdateDataGridView(); break; case "editProductOverviewToolStripMenuItem": var activeTab = _columnNameToTabIndex[_selectedColumnName]; var frmSalesManagement = new frmSalesManagement(this, salesManagementDataModel, activeTab); frmSalesManagement.Show(); break; case "deleteProductOverviewToolStripMenuItem": _salesManagementService.DeleteSalesManagementByID(_selectedRowID); UpdateDataGridView(); break; } }