private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            if (cbProduct.SelectedItem != null)
            {
                //product ophalen uit ComboBox en opslaan in 'myProduct'
                product myProduct = (product)cbProduct.SelectedItem;
                //Prijs ophalen bij product
                pricehistory myPH = (from ph in db.pricehistories
                                     where ph.productId == myProduct.id
                                     /*&& ph.enddate == null*/
                                     select ph).FirstOrDefault();

                //Dingen opslaan in variable
                string   sPrice      = txtPrice.Text;
                double   iPrice      = Convert.ToDouble(sPrice);
                DateTime dtStartdate = dtStart.SelectedDate.Value;
                DateTime dtEnddate   = dtEnd.SelectedDate.Value;

                //myPH.enddate = dtDate;
                pricehistory myPrice = new pricehistory();
                //Variable invullen

                myPrice.productId = myProduct.id;
                myPrice.price     = (decimal)iPrice;
                myPrice.startdate = dtStartdate;
                myPrice.enddate   = dtEnddate;
                //Database klaarzetten en opslaan
                db.pricehistories.InsertOnSubmit(myPrice);
                db.SubmitChanges();
                //Refresh Datagrid
                SetData();
            }
        }
 private void detach_pricehistories(pricehistory entity)
 {
     this.SendPropertyChanging();
     entity.product = null;
 }
 partial void Updatepricehistory(pricehistory instance);
 partial void Deletepricehistory(pricehistory instance);
 partial void Insertpricehistory(pricehistory instance);