private void DeleteDatabaseUser_OnClick(object sender, RoutedEventArgs e)
        {
            var              model          = (UserStructViewModel)((MenuItem)sender).DataContext;
            string           messageBoxText = "Do you want to delete database user?";
            string           caption        = "Delete";
            MessageBoxButton button         = MessageBoxButton.YesNo;
            MessageBoxImage  icon           = MessageBoxImage.Warning;
            var              result         = MessageBox.Show(messageBoxText, caption, button, icon);

            if (result == MessageBoxResult.Yes)
            {
                _databaseUserAccessService.DeleteDatabaseUser(model.Database, model.UserName);
                RefreshTree();
            }
        }
Example #2
0
        private void Delete_Click(object sender, RoutedEventArgs e)
        {
            if (UsersList.SelectedItems.Count == 0)
            {
                return;
            }
            var              item           = (UserViewModel)UsersList.SelectedItems[0];
            string           messageBoxText = "Do you want to delete database user?";
            string           caption        = "Delete";
            MessageBoxButton button         = MessageBoxButton.YesNo;
            MessageBoxImage  icon           = MessageBoxImage.Warning;
            var              result         = MessageBox.Show(messageBoxText, caption, button, icon);

            if (result == MessageBoxResult.Yes)
            {
                _databaseUserAccessService.DeleteDatabaseUser(_database, item.Name);
                GetValue();
                MainWindow.Refresh();
            }
        }