Exemplo n.º 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();
            }
        }
Exemplo n.º 2
0
 private void detach_pricehistories(pricehistory entity)
 {
     this.SendPropertyChanging();
     entity.product = null;
 }
Exemplo n.º 3
0
 partial void Updatepricehistory(pricehistory instance);
Exemplo n.º 4
0
 partial void Deletepricehistory(pricehistory instance);
Exemplo n.º 5
0
 partial void Insertpricehistory(pricehistory instance);