private void RenameArtist(CustomForm.AutoCompleteDataEntry entry, string newName) { int id = int.Parse(entry.ValueMember.ToString()); Artist a; if (!(id > 0 && (a = new Artist(id)).ID > 0)) { return; } string type = string.IsNullOrEmpty(ArtistType) ? "artist" : ArtistType; if (newName == "") { // ask for a new name Dialogs.Inputbox input = new Dialogs.Inputbox( "Enter a new name for " + type + " " + a.GetName(Artist.NameFormats.First_Last), a.GetName(Artist.NameFormats.First_Last), false); if (input.ShowDialog() == DialogResult.OK) { newName = input.InputText; } else { return; } } a.Name = newName; a.Update(); UpdateCompletionSource(); SetTextAndSelect(a.GetName(Artist.NameFormats.Last_First)); SelectAll(); }
private void DeleteArtist(CustomForm.AutoCompleteDataEntry entry) { int id = int.Parse(entry.ValueMember.ToString()); if (id == 0) { return; } // ask for confirmation if (MessageBox.Show("Are you sure to delete the artist?\nThis is not reversible!", "Delete Artist", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) != DialogResult.Yes) { return; } Artist a = new Artist(id); a.Delete(); UpdateCompletionSource(); SetTextAndSelect(a.GetName(Artist.NameFormats.Last_First)); SelectAll(); }