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 detach_pricehistories(pricehistory entity)
 {
     this.SendPropertyChanging();
     entity.product = null;
 }
 partial void Deletepricehistory(pricehistory instance);
 partial void Updatepricehistory(pricehistory instance);
 partial void Insertpricehistory(pricehistory instance);