public void deleteUser(string username) { try{ var nameRec = UserNamesSet.Find(username); if (nameRec != null) { if (nameRec.User.Scripts.Any()) { throw new Exception(mko.TraceHlp.FormatErrMsg(this, "deleteUser", "Name=", username, "Dem Benutzer sind noch Scripte zugeordnet")); } var user = nameRec.User; UserNamesSet.Remove(nameRec); UsersSet.Remove(user); } else { throw new System.Data.RowNotInTableException("Der zu löschende Benutzer " + username + " existiert nicht"); } } catch (Exception ex) { throw new Exception(mko.TraceHlp.FormatErrMsg(this, "deleteUser"), ex); } }
void clt_DestroyArticlesRelationWithUserCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e) { if (e.Error == null) { try { if (SelectedUser != null) { UsersSet.Remove(SelectedUser); SelectedUser = null; OnPropertyChanged("UsersSet"); } } catch (Exception ex) { Debug.WriteLine(ex.Message); } } else { Debug.WriteLine("Error deleteChannels : " + e.Error.StackTrace); } }