private void DeleteUserPB_Click(object sender, RoutedEventArgs e) { DataRecord record = (DataRecord)userXamDataGrid.ActiveRecord; if (record == null) { return; } if (record != null) { UserSimple user = (UserSimple)record.DataItem; string MsgStr = "Are you sure that you want to DELETE User: "******" " + user.Lastname + "?"; MessageBoxResult result = MessageBox.Show(MsgStr, "Delete Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No); if (result == MessageBoxResult.Yes) { WaveguideDB wgDB = new WaveguideDB(); bool success = wgDB.RemoveUserFromUserProjectTable(user.UserID); if (success) { success = wgDB.DeleteUser(user.UserID); if (success) { UserVM.Refresh(); } } } } }