Esempio n. 1
0
        private void DeleteCommandBinding_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            List <ActivityResult> deletedResults = null;

            if (selectedActivity != null)
            {
                ActivityResult activityResult = selectedActivity;

                BDDAccess bddAccess = new BDDAccess();

                if (bddAccess.Connect())
                {
                    bddAccess.DeleteResult(activityResult);
                }

                if (!string.IsNullOrEmpty(bddAccess.Information))
                {
                    MessageBox.Show(bddAccess.Information, new AssemblyInformations(Assembly.GetExecutingAssembly().GetName().Name).Product, MessageBoxButton.OK, bddAccess.MessageBoxImage, MessageBoxResult.OK);
                }
            }
            else if (ResultsListView.SelectedIndex != -1)
            {
                deletedResults = new List <ActivityResult>();

                foreach (ActivityResult activityResult in ResultsListView.SelectedItems)
                {
                    deletedResults.Add(activityResult);
                }

                BDDAccess bddAccess = new BDDAccess();

                if (bddAccess.Connect())
                {
                    bddAccess.DeleteResults(deletedResults);
                }

                if (!string.IsNullOrEmpty(bddAccess.Information))
                {
                    MessageBox.Show(bddAccess.Information, new AssemblyInformations(Assembly.GetExecutingAssembly().GetName().Name).Product, MessageBoxButton.OK, bddAccess.MessageBoxImage, MessageBoxResult.OK);
                }
            }

            selectedActivity = null;
        }