private void DeleteStoredProcedure_OnClick(object sender, RoutedEventArgs e) { var model = (StoredProcedureStructViewModel)((MenuItem)sender).DataContext; string messageBoxText = "Do you want to delete procedure?"; string caption = "Delete"; MessageBoxButton button = MessageBoxButton.YesNo; MessageBoxImage icon = MessageBoxImage.Warning; var result = MessageBox.Show(messageBoxText, caption, button, icon); if (result == MessageBoxResult.Yes) { _storedProcedureAccessService.DeleteStoredProcedure(model.Database, model.ProcedureName, null); RefreshTree(); } }
private void Delete_Click(object sender, RoutedEventArgs e) { if (ProcedureList.SelectedItems.Count == 0) { return; } var item = (StoredProcedureViewModel)ProcedureList.SelectedItems[0]; string messageBoxText = "Do you want to delete procedure?"; string caption = "Delete"; MessageBoxButton button = MessageBoxButton.YesNo; MessageBoxImage icon = MessageBoxImage.Warning; var result = MessageBox.Show(messageBoxText, caption, button, icon); if (result == MessageBoxResult.Yes) { _storedProcedureAccessService.DeleteStoredProcedure(_database, item.ProcedureName, item.Owner); GetValue(); MainWindow.Refresh(); } }