Esempio n. 1
0
        private void DeleteProjectPB_Click(object sender, RoutedEventArgs e)
        {
            DataRecord record = (DataRecord)projectXamDataGrid.ActiveRecord;

            if (record == null)
            {
                return;
            }


            if (record != null)
            {
                ProjectSimple project = (ProjectSimple)record.DataItem;

                string MsgStr = "Are you sure that you want to DELETE Project: " + project.Description + "?";

                MessageBoxResult result =
                    MessageBox.Show(MsgStr, "Delete Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No);
                if (result == MessageBoxResult.Yes)
                {
                    WaveguideDB wgDB    = new WaveguideDB();
                    bool        success = wgDB.RemoveProjectFromUserProjectTable(project.ProjectID);
                    if (success)
                    {
                        success = wgDB.DeleteProject(project.ProjectID);
                        if (success)
                        {
                            ProjectVM.Refresh();
                        }
                    }
                }
            }
        }