//DELETE BOOKMARK --> when clicking specific listbox item's button private void deleteBtnClick(object sender, RoutedEventArgs e) { try { Tour tour = (Tour)(sender as Button).DataContext; List <Object> values = new List <Object>(); List <string> names = new List <string>(); values.Add(tour.TourID); values.Add(username); names.Add("TourID"); names.Add("Username"); db.deleteRow("tblBookmarks", values, names); //delete from table using WHERE clause } catch (Exception ex) { MessageBox.Show(ex.Message); } displayBookmarks(); //refreshes ui }
//DELETES SELECTED CART OBJECT FROM DATABASE --> FOR SPECIFIED CUSTOMER private void DeleteButton_Click(object sender, RoutedEventArgs e) { try { Cart cartItem = (Cart)(sender as Button).DataContext; List <Object> values = new List <Object>(); List <string> names = new List <string>(); values.Add(cartItem.TourID); values.Add(username); names.Add("TourID"); names.Add("Username"); db.deleteRow("tblCart", values, names); //delete from table } catch (Exception ex) { MessageBox.Show("deleteBtn: " + ex.Message); } refreshCartItems(); //refreshes ui }