private void FilmsView_MouseClick(object sender, MouseEventArgs e) { if (FilmsView.SelectedIndices[0] != -1) { // MessageBox.Show(FilmsView.SelectedItems[0].Tag.ToString()); Film f = filmBase.films.Where(x => x.FilmId == (long)FilmsView.SelectedItems[0].Tag).ToArray()[0]; Photos ph = filmBase.getPhotoById(f.PhotoId); if (ph != null) { using (MemoryStream ms = new MemoryStream(ph.PhotoData.Length)) { ms.Write(ph.PhotoData, 0, ph.PhotoData.Length); pictureBox1.Image = Image.FromStream(ms); } } label_filmname.Text = f.FilmName; textBox1.Text = f.Description; label_director.Text = filmBase.directors.Where(x => x.DirectorId == f.DirectorId).Select(x => x.DirectorName).ToArray()[0]; label_genre.Text = filmBase.genres.Where(x => x.GenreId == f.GenreId).Select(x => x.GenreName).ToArray()[0]; label_year.Text = f.FilmYear.ToString(); label_rate.Text = f.Rating.ToString(); } }
private long SavePhotoToBase() { photo = new Photos(filename); return(form.filmBase.InsertPhoto(photo)); }