public decimal getPrice(itemsinorder item, DateTime date) { foreach (pricehistory price in item.product.pricehistories) { if (date >= price.startdate && (date <= price.enddate || price.enddate == null)) { return(price.price); } } return(0); }
private void btnBinvoer_Click(object sender, RoutedEventArgs e) { var dateAndTime = DateTime.Now; var date = dateAndTime.Date; order o = new order(); itemsinorder iio = new itemsinorder(); iio.product = (product)cbProduct.SelectedItem; iio.amount = txtHoeveelheid.Text; iio.order = o; o.customer = (customer)cbKlant.SelectedItem; o.date = DateTime.Now.Date; db.itemsinorders.InsertOnSubmit(iio); db.orders.InsertOnSubmit(o); db.SubmitChanges(); dgItemsinorder.ItemsSource = db.itemsinorders; dgOrder.ItemsSource = db.orders; MessageBox.Show("De bestelling van" + " " + cbKlant.Text + " " + "is toegevoegd aan de database", "Gelukt!"); Bestellingsinvoer bi = new Bestellingsinvoer(); bi.Show(); this.Close(); MessageBoxResult m = MessageBox.Show("Wil je een factuur maken", "Factuur", MessageBoxButton.YesNo); if (m == MessageBoxResult.Yes) { Factuur f = new Factuur(); f.Show(); this.Close(); } }
private void detach_itemsinorders(itemsinorder entity) { this.SendPropertyChanging(); entity.product = null; }
private void attach_itemsinorders(itemsinorder entity) { this.SendPropertyChanging(); entity.order = this; }
partial void Deleteitemsinorder(itemsinorder instance);
partial void Updateitemsinorder(itemsinorder instance);
partial void Insertitemsinorder(itemsinorder instance);