private void btnPinvoer_Click(object sender, RoutedEventArgs e) { DateTime nu = new DateTime(); product p = new product(); p.name = txtProductnaam.Text; p.producttype = (producttype)cbType.SelectedItem; pricehistory ph = new pricehistory(); int prijs; int.TryParse(txtPrijs.Text, out prijs); ph.price = prijs; ph.startdate = DateTime.Now.Date; ph.product = p; db.products.InsertOnSubmit(p); db.pricehistories.InsertOnSubmit(ph); db.SubmitChanges(); dgProducten.ItemsSource = db.products; Producteninvoer pi = new Producteninvoer(); pi.Show(); this.Close(); MessageBox.Show("Het product " + " " + txtProductnaam.Text + " " + "is toegevoegd aan de database", "Gelukt!"); }
private void btnProducten_Click(object sender, RoutedEventArgs e) { Producteninvoer producten = new Producteninvoer(); producten.Show(); this.Close(); }