예제 #1
0
        void FİlmleriListVieweDoldur()
        {
            lstFilm.Items.Clear();
            foreach (Film f in FilmServices.GetAllFilmService())
            {
                ListViewItem    lvi      = new ListViewItem();
                List <Category> kategori = new List <Category>();

                string ad = null;
                kategori = f.Category.ToList();

                lvi.Text = f.FilmName;
                lvi.SubItems.Add(f.ReleaseDate.Year.ToString());

                foreach (Category item in kategori)
                {
                    ad += item.CategoryName + " ";
                }
                lvi.SubItems.Add(ad);
                lvi.Tag = f;

                lstFilm.Items.Add(lvi);
            }
        }
예제 #2
0
 //Kategori seçili , ülke seçili
 public void filmFiltrele()
 {
     if (string.IsNullOrEmpty(txtOyuncu.Text) && !string.IsNullOrEmpty(txtYonetmen.Text))
     {
         films = _filmServices.GetAllFilmService().ToList()
                 .Where(f => f.Category.Any(any => any.CategoryID == Convert.ToInt16(cbKategori.SelectedValue)))
                 .Where(f => f.Country.Any(any => any.CountryID == Convert.ToInt16(cbUlke.SelectedValue)))
                 .Where(f => f.Director.Any(any => any.DirectorName.ToLower().Contains(txtYonetmen.Text.ToLower())) || f.Director.Any(any => any.DirectorSurname.ToLower().Contains(txtYonetmen.Text.ToLower())))
                 .ToList();
     }
     else if (string.IsNullOrEmpty(txtYonetmen.Text) && !string.IsNullOrEmpty(txtOyuncu.Text))
     {
         films = _filmServices.GetAllFilmService().ToList()
                 .Where(f => f.Category.Any(any => any.CategoryID == Convert.ToInt16(cbKategori.SelectedValue)))
                 .Where(f => f.Country.Any(any => any.CountryID == Convert.ToInt16(cbUlke.SelectedValue)))
                 .Where(f => f.Actor.Any(any => any.ActorName.ToLower().Contains(txtOyuncu.Text.ToLower())) || f.Actor.Any(any => any.ActorSurname.ToLower().Contains(txtOyuncu.Text.ToLower())))
                 .ToList();
     }
     else if (string.IsNullOrEmpty(txtOyuncu.Text) && string.IsNullOrEmpty(txtYonetmen.Text))
     {
         films = _filmServices.GetAllFilmService().ToList()
                 .Where(f => f.Category.Any(any => any.CategoryID == Convert.ToInt16(cbKategori.SelectedValue)))
                 .Where(f => f.Country.Any(any => any.CountryID == Convert.ToInt16(cbUlke.SelectedValue)))
                 .ToList();
     }
     else
     {
         films = _filmServices.GetAllFilmService().ToList()
                 .Where(f => f.Category.Any(any => any.CategoryID == Convert.ToInt16(cbKategori.SelectedValue)))
                 .Where(f => f.Country.Any(any => any.CountryID == Convert.ToInt16(cbUlke.SelectedValue)))
                 .Where(f => f.Actor.Any(any => any.ActorName.ToLower().Contains(txtOyuncu.Text.ToLower())) || f.Actor.Any(any => any.ActorSurname.ToLower().Contains(txtOyuncu.Text.ToLower())))
                 .Where(f => f.Director.Any(any => any.DirectorName.ToLower().Contains(txtYonetmen.Text.ToLower())) || f.Director.Any(any => any.DirectorSurname.ToLower().Contains(txtYonetmen.Text.ToLower())))
                 .ToList();
     }
 }
예제 #3
0
        private void btnFiltre_Click(object sender, EventArgs e)
        {
            ltvDetaylıAra.Items.Clear();
            List <Film> films = null;

            if (string.IsNullOrEmpty(txtOyuncu.Text) && !string.IsNullOrEmpty(txtYonetmen.Text))
            {
                films = _filmServices.GetAllFilmService().ToList()
                        .Where(f => f.Category.Any(any => any.CategoryID == Convert.ToInt16(cbKategori.SelectedValue)))
                        .Where(f => f.Country.Any(any => any.CountryID == Convert.ToInt16(cbUlke.SelectedValue)))
                        .Where(f => f.Director.Any(any => any.DirectorName.ToLower().Contains(txtYonetmen.Text.ToLower())) || f.Director.Any(any => any.DirectorSurname.ToLower().Contains(txtYonetmen.Text.ToLower())))
                        .ToList();
            }
            else if (string.IsNullOrEmpty(txtYonetmen.Text) && !string.IsNullOrEmpty(txtOyuncu.Text))
            {
                films = _filmServices.GetAllFilmService().ToList()
                        .Where(f => f.Category.Any(any => any.CategoryID == Convert.ToInt16(cbKategori.SelectedValue)))
                        .Where(f => f.Country.Any(any => any.CountryID == Convert.ToInt16(cbUlke.SelectedValue)))
                        .Where(f => f.Actor.Any(any => any.ActorName.ToLower().Contains(txtOyuncu.Text.ToLower())) || f.Actor.Any(any => any.ActorSurname.ToLower().Contains(txtOyuncu.Text.ToLower())))
                        .ToList();
            }
            else if (string.IsNullOrEmpty(txtOyuncu.Text) && string.IsNullOrEmpty(txtYonetmen.Text))
            {
                films = _filmServices.GetAllFilmService().ToList()
                        .Where(f => f.Category.Any(any => any.CategoryID == Convert.ToInt16(cbKategori.SelectedValue)))
                        .Where(f => f.Country.Any(any => any.CountryID == Convert.ToInt16(cbUlke.SelectedValue)))
                        .ToList();
            }
            else
            {
                films = _filmServices.GetAllFilmService().ToList()
                        .Where(f => f.Category.Any(any => any.CategoryID == Convert.ToInt16(cbKategori.SelectedValue)))
                        .Where(f => f.Country.Any(any => any.CountryID == Convert.ToInt16(cbUlke.SelectedValue)))
                        .Where(f => f.Actor.Any(any => any.ActorName.ToLower().Contains(txtOyuncu.Text.ToLower())) || f.Actor.Any(any => any.ActorSurname.ToLower().Contains(txtOyuncu.Text.ToLower())))
                        .Where(f => f.Director.Any(any => any.DirectorName.ToLower().Contains(txtYonetmen.Text.ToLower())) || f.Director.Any(any => any.DirectorSurname.ToLower().Contains(txtYonetmen.Text.ToLower())))
                        .ToList();
            }

            List <FilmFiltreDTO> tablo = (from film in films
                                          join rating in _ratingService.GetAllRatingService()
                                          on film.FilmID
                                          equals rating.FilmID
                                          group rating by rating.Film.FilmName
                                          into filmGrup
                                          select new FilmFiltreDTO
            {
                FilmID = filmGrup.FirstOrDefault().FilmID,
                FilmName = filmGrup.Key,
                Point = filmGrup.Average(x => x.Point),
                Category = filmGrup.FirstOrDefault().Film.Category.FirstOrDefault().CategoryName
            }).ToList();



            foreach (FilmFiltreDTO film in tablo)
            {
                ListViewItem lvi = new ListViewItem();
                lvi.Text = film.FilmName;
                lvi.SubItems.Add(film.Category);
                lvi.SubItems.Add(film.Point.ToString());
                lvi.Tag = film;
                ltvDetaylıAra.Items.Add(lvi);
            }
        }