/// <summary>
 /// Deletes a shelf from the database, as long as it doesn't have any bins on it with food in it
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void RowContMenuDelShelf_Click(object sender, RoutedEventArgs e)
 {
     if (sender != null)
     {
         ShelfInfo             selectedItem    = (ShelfInfo)dgridShelf.SelectedValue;
         List <InventoryEntry> matchingShelves = (from shelves in dbContext.GetTable <InventoryEntry>() //checks to see if there are any
                                                  where shelves.ShelfId == selectedItem.ShelfId         //shelves that have bins with food in them on it
                                                  select shelves).ToList();
         if (matchingShelves.Count != 0)
         {
             MessageBox.Show("There are inventory entries containing " + selectedItem.ShelfId + ". To prevent " +
                             "unintentional data loss please delete those entries before deleting this item.", "Unable to Delete", MessageBoxButton.OK);
         }
         else
         {
             allShelves.Remove(selectedItem); //Removes shelf from database and datagrid
             dgridShelf.ItemsSource = allShelves;
             dgridShelf.Items.Refresh();
             Shelf shelfToBeRemoved = (from shelves in dbContext.GetTable <Shelf>()
                                       where shelves.ShelfId == selectedItem.ShelfId
                                       select shelves).First();
             dbContext.Shelfs.DeleteOnSubmit(shelfToBeRemoved);
             dbContext.SubmitChanges();
         }
     }
 }
 partial void DeleteShelf(Shelf instance);
 partial void UpdateShelf(Shelf instance);
 partial void InsertShelf(Shelf instance);
 partial void DeleteShelf(Shelf instance);
 partial void UpdateShelf(Shelf instance);
 partial void InsertShelf(Shelf instance);