void ComboBoxSelectNameSelectedIndexChanged(object sender, EventArgs e) { NamePuffer puf = (NamePuffer)comboBoxSelectName.SelectedItem; Media tmp = database.getMediaById(puf.ID); if (tmp.Cover == null) { pictureBoxImage.Image = defaultImage; } else { pictureBoxImage.Image = tmp.Cover; } comboBoxKA.SelectedItem = tmp.KA; textBoxRating.Text = tmp.Rating + ""; if (purpose == Purpose.deleteMovie) { Detail last = tmp.LatestDetail; comboBoxLanguage.SelectedItem = last.ViewLanguage; textBoxLastSeenEpisode.Text = last.LastSeenEpisode + ""; textBoxLastSeenSeason.Text = last.LastSeenSeason + ""; checkBoxSeasonFinished.Checked = last.LastSeenSeasonFinished; comboBoxAktivStatus.SelectedItem = last.AktivStatus; } aktMedia = tmp; }
public List <NamePuffer> getAllNames() { List <NamePuffer> ret = new List <NamePuffer>(); using (SQLiteConnection connection = new SQLiteConnection(connectionString)) { try { connection.Open(); using (SQLiteCommand command = new SQLiteCommand("SELECT m.id, m.name, d.count FROM Media m, (SELECT mediaid, COUNT(mediaid) as count FROM Details GROUP BY mediaid) d WHERE m.id = d.mediaid AND count < 2 ORDER BY m.name", connection)) { using (SQLiteDataReader reader = command.ExecuteReader()) { while (reader.Read()) { NamePuffer tmp = new NamePuffer(); tmp.ID = reader.GetInt32(0); tmp.Name = reader.GetString(1); ret.Add(tmp); } } } } catch (Exception ex) { MessageBox.Show("Database.getAllNames: " + ex); } } return(ret); }