Пример #1
0
        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();
            }
        }
Пример #2
0
 private void detach_pricehistories(pricehistory entity)
 {
     this.SendPropertyChanging();
     entity.product = null;
 }
Пример #3
0
 partial void Updatepricehistory(pricehistory instance);
Пример #4
0
 partial void Deletepricehistory(pricehistory instance);
Пример #5
0
 partial void Insertpricehistory(pricehistory instance);