private void btnAddProdukt_Click(object sender, EventArgs e) { string namn = newProduktNametxt.Text; string delID = tbDelProduktID.Text; var kategori = comboBox1.GetItemText(comboBox1.SelectedItem); var grupp = comboBox2.GetItemText(comboBox2.SelectedItem); string produktID = businessManager.SkapaID(delID, grupp); var avdelning = comboBox3.GetItemText(comboBox3.SelectedItem); if (businessManager.CheckAvdelning(comboBox3.Text) == true) { businessManager.AddProdukt(produktID, namn, kategori, grupp, avdelning); } else { businessManager.CreateAvdelning(avdelning); businessManager.AddProdukt(produktID, namn, kategori, grupp, avdelning); } if (System.Windows.Forms.Application.OpenForms["frmProdukter"] != null) { (System.Windows.Forms.Application.OpenForms["frmProdukter"] as frmProdukter).RefreshProdukter(); } comboBox1.SelectedIndex = -1; comboBox2.SelectedIndex = -1; comboBox3.SelectedIndex = -1; newProduktNametxt.Clear(); tbDelProduktID.Clear(); MessageBox.Show("Produkt skapad"); }