private void btnDeleteItems_Click(object sender, RoutedEventArgs e) { try { int currentitemID = GetSelectedItemId(); if (MessageBox.Show("Na pewno chcesz usunąć przedmiot?", "Usuwanie", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes) { DBAction.DeleteData deleteitem = new DBAction.DeleteData(); deleteitem.DeleteItem(currentitemID); DisplayItemsFromBox(currentinfo.BoxID); } } catch { MessageBox.Show("Nie wybrano przedmiotu!"); } }
private void btnChooseBoxesList_Click(object sender, RoutedEventArgs e) { try { currentitem.BoxID = GetSelectedItemId(); DBAction.AddData addcurrentitem = new DBAction.AddData(); addcurrentitem.AddItemWhileTransfer(currentitem.BoxID); DBAction.DeleteData deletetransfer = new DBAction.DeleteData(); deletetransfer.DeleteWhileTransferItem(currentitem.ItemID); MessageBox.Show("Przedmiot został przeniesiony"); this.Close(); } catch (Exception) { MessageBox.Show("Nie wybrano pudełka!"); } }
private void btnDeletePhotoItems_Click(object sender, RoutedEventArgs e) { try { int currentitemID = GetSelectedItemId(); if (MessageBox.Show("Na pewno chcesz usunąć zdjęcie przedmiotu?", "Usuwanie", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes) { //var currentimage = (from stu in database.Items // where stu.ItemId == currentitemID // select stu).SingleOrDefault(); DBAction.DeleteData deletecurrentimage = new DBAction.DeleteData(); byte[] photo = deletecurrentimage.DeleteItemPhoto(currentitemID); //Items item = new Items(); imageItems.Source = null; } } catch (Exception) { MessageBox.Show("Nie wybrano przedmiotu!"); } }