Beispiel #1
0
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            var drank = new Dranken();

            drank.NAAM  = txtNaam.Text;
            drank.SOORT = txtSoort.Text;
            drank.PRIJS = txtPrijs.Text;
            db.Drankens.InsertOnSubmit(drank);
            db.SubmitChanges();

            dgDranken.ItemsSource = db.Drankens.ToList();
        }
Beispiel #2
0
 private void btnDelete_Click(object sender, RoutedEventArgs e)
 {
     {
         DataClasses1DataContext dr = new DataClasses1DataContext();
         Dranken DrDelete           = dgDranken.SelectedItem as Dranken;
         var     drankie            = (from Dranken in dr.Drankens
                                       where Dranken.ID == DrDelete.ID
                                       select Dranken).Single();
         dr.Drankens.DeleteOnSubmit(drankie);
         dr.SubmitChanges();
         dgDranken.ItemsSource = db.Drankens.ToList();
     }
 }
Beispiel #3
0
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            {
                DataClasses1DataContext dr = new DataClasses1DataContext();
                Dranken DrDelete           = dgDrank.SelectedItem as Dranken;
                var     drankie            = (from Dranken in dr.Drankens
                                              where Dranken.ID == DrDelete.ID
                                              select Dranken).Single();
                dr.Drankens.DeleteOnSubmit(drankie);
                dr.SubmitChanges();
                dgDrank.ItemsSource = db.Drankens.ToList();

                string ID   = txtID.Text;
                var    show = db.Drankens.Where(p => Convert.ToString(p.ID).Contains(ID));
                dgDrank.ItemsSource = show;
            }
        }
 partial void DeleteDranken(Dranken instance);
 partial void UpdateDranken(Dranken instance);
 partial void InsertDranken(Dranken instance);