コード例 #1
0
        //public void DeleteCurrentBox(int currentboxID)
        //{
        //    DBAction.DeleteData delete = new DBAction.DeleteData();
        //    delete.DeleteBox(currentboxID);
        //    DisplayBoxesFromUser(currentuser.UserID);
        //}

        #endregion

        #region ActionOnPhoto

        private void btnDeletePhotoBoxes_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                int currentboxID = GetSelectedItemId();

                if (MessageBox.Show("Na pewno chcesz usunąć zdjęcie pudełka?", "Usuwanie",
                                    MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes)
                {
                    //DeleteBoxPhoto(currentboxID);
                    DBAction.DeleteData deleteboxphoto = new DBAction.DeleteData();
                    byte[] photo = deleteboxphoto.DeleteBoxPhoto(currentboxID);


                    //var currentboximage = (from box in database.Boxes
                    //                       where box.BoxID == currentboxID
                    //                       select box).SingleOrDefault();

                    //if (photo != null)
                    //{
                    //photo = null;
                    imageBoxes.Source = null;
                    database.SaveChanges();
                    //}
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Nie wybrano pudełka!");
            }
        }
コード例 #2
0
        private void btnDeleteBoxes_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                int currentboxID = GetSelectedItemId();

                if (MessageBox.Show("Na pewno chcesz usunąć pudełko z całą zawartością?", "Usuwanie",
                                    MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes)
                {
                    DBAction.DeleteData deletebox = new DBAction.DeleteData();
                    deletebox.DeleteBox(currentboxID);
                    DisplayBoxesFromUser(currentuser.UserID);
                    //DeleteCurrentBox(currentboxID);
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Nie wybrano pudełka!");
            }
        }