Exemplo n.º 1
0
        //initiates extra Actor details ssearch
        private void lv_FilmCast_Click(object sender, EventArgs e)
        {
            var id = lv_FilmCast.SelectedItems[0].SubItems[2].Text.ToString();

            SelectedFilmDetailsPanel.Controls.Clear();
            var fb = new ActorDetails(_nhSession.Get <Person>(new Guid(id)).IMDBID)
            {
                Visible = true
            };

            SelectedFilmDetailsPanel.Controls.Add(fb);
            fb.Dock = DockStyle.Fill;
        }
Exemplo n.º 2
0
        //builds film list based on search string and selected actor
        private void ActorList_Click(object sender, EventArgs e)
        {
            var actor = (ListBoxItem)ActorList.SelectedItem;

            if (!Properties.Settings.Default.selectedFilmDetailsShow && actor.Text != "All")
            {
                var a  = _nhSession.Get <Person>(new Guid(actor.Id.ToString()));
                var ad = new ActorDetails(a.IMDBID);
                SelectedFilmDetailsPanel.Controls.Clear();
                SelectedFilmDetailsPanel.Controls.Add(ad);
                ad.Visible = true;
                ad.Dock    = DockStyle.Fill;
            }
            else if (Properties.Settings.Default.selectedFilmDetailsShow && ActorList.SelectedItem.ToString() == "All")
            {
            }
            var item = (ListBoxItem)ActorList.SelectedItem;

            if (item.Id == Guid.Empty)
            {
                buildFilm();
            }
            else
            {
                var films  = GetFilms();
                var person = (ListBoxItem)ActorList.SelectedItem;
                var ID     = person.Id;
                var genres =
                    films.Where(f => f.Cast.Any(r => r.Person.Id == ID)).SelectMany(f => f.Genre).OrderBy(o => o.Type).Select(
                        g => new ListBoxItem(g.Id, g.Type)).ToList();
                IList <ListBoxItem> gList = new List <ListBoxItem>();
                foreach (var listBoxItem in genres)
                {
                    var inc = false;
                    foreach (var boxItem in gList.Where(boxItem => listBoxItem.Id == boxItem.Id))
                    {
                        inc = true;
                    }
                    if (!inc)
                    {
                        gList.Add(listBoxItem);
                    }
                }
                var defaultListBoxItem = new[] { new ListBoxItem(Guid.Empty, "All") };
                GenreList.DataSource = defaultListBoxItem.Union(gList).ToList();

                var directors = films.Where(f => f.Cast.Any(r => r.Person.Id == ID)).SelectMany(x => x.Director).OrderBy(o => o.Name).Select(p => new ListBoxItem(p.Id, p.Name)).ToList();

                IList <ListBoxItem> dList = new List <ListBoxItem>();
                foreach (var listBoxItem in directors)
                {
                    var inc = false;
                    foreach (var boxItem in dList.Where(boxItem => listBoxItem.Id == boxItem.Id))
                    {
                        inc = true;
                    }
                    if (!inc)
                    {
                        dList.Add(listBoxItem);
                    }
                }
                DirectorList.DataSource = defaultListBoxItem.Union(dList).ToList();
                DGV_Films.DataSource    = films.Where(f => f.Cast.Any(r => r.Person.Id == ID)).Select(x => new { x.Id, x.Title, x.RunTime, ReleaseDate = x.ReleaseYear })
                                          .ToList();
                if (DGV_Films != null)
                {
                    DGV_Films.Columns["Id"].Visible = false;
                }
                var numFIlms = films.Where(x => x.Cast.Any(r => r.Person.Id == ID)).Count();
                var sumMins  = films.Where(x => x.Cast.Any(r => r.Person.Id == ID)).Sum(x => x.RunTime);
                FillLabel(numFIlms, sumMins);
            }
        }
Exemplo n.º 3
0
        //builds film list based on search string and selected actor
        private void ActorList_Click(object sender, EventArgs e)
        {
            var actor = (ListBoxItem)ActorList.SelectedItem;
            if(!Properties.Settings.Default.selectedFilmDetailsShow && actor.Text != "All")
            {
                var a = _nhSession.Get<Person>(new Guid(actor.Id.ToString()));
                var ad = new ActorDetails(a.IMDBID);
                SelectedFilmDetailsPanel.Controls.Clear();
                SelectedFilmDetailsPanel.Controls.Add(ad);
                ad.Visible = true;
                ad.Dock = DockStyle.Fill;
            }
            else if(Properties.Settings.Default.selectedFilmDetailsShow && ActorList.SelectedItem.ToString() == "All")
            {

            }
            var item = (ListBoxItem)ActorList.SelectedItem;
            if (item.Id == Guid.Empty)
            {
                buildFilm();
            }
            else
            {
                var films = GetFilms();
                var person = (ListBoxItem)ActorList.SelectedItem;
                var ID = person.Id;
                var genres =
                    films.Where(f => f.Cast.Any(r => r.Person.Id == ID)).SelectMany(f => f.Genre).OrderBy(o => o.Type).Select(
                        g => new ListBoxItem(g.Id, g.Type)).ToList();
                IList<ListBoxItem> gList = new List<ListBoxItem>();
                foreach (var listBoxItem in genres)
                {
                    var inc = false;
                    foreach (var boxItem in gList.Where(boxItem => listBoxItem.Id == boxItem.Id))
                    {
                        inc = true;
                    }
                    if (!inc)
                        gList.Add(listBoxItem);
                }
                var defaultListBoxItem = new[] { new ListBoxItem(Guid.Empty, "All") };
                GenreList.DataSource = defaultListBoxItem.Union(gList).ToList();

                var directors = films.Where(f => f.Cast.Any(r => r.Person.Id == ID)).SelectMany(x => x.Director).OrderBy(o => o.Name).Select(p => new ListBoxItem(p.Id, p.Name)).ToList();

                IList<ListBoxItem> dList = new List<ListBoxItem>();
                foreach (var listBoxItem in directors)
                {
                    var inc = false;
                    foreach (var boxItem in dList.Where(boxItem => listBoxItem.Id == boxItem.Id))
                    {
                        inc = true;
                    }
                    if (!inc)
                        dList.Add(listBoxItem);
                }
                DirectorList.DataSource = defaultListBoxItem.Union(dList).ToList();
                DGV_Films.DataSource = films.Where(f => f.Cast.Any(r => r.Person.Id == ID)).Select(x => new { x.Id, x.Title, x.RunTime, ReleaseDate = x.ReleaseYear })
                .ToList();
                if (DGV_Films != null)
                {
                    DGV_Films.Columns["Id"].Visible = false;
                }
                var numFIlms = films.Where(x => x.Cast.Any(r => r.Person.Id == ID)).Count();
                var sumMins = films.Where(x => x.Cast.Any(r => r.Person.Id == ID)).Sum(x => x.RunTime);
                FillLabel(numFIlms,sumMins);
            }
        }
Exemplo n.º 4
0
 //initiates extra Actor details ssearch
 private void lv_FilmCast_Click(object sender, EventArgs e)
 {
     var id = lv_FilmCast.SelectedItems[0].SubItems[2].Text.ToString();
     SelectedFilmDetailsPanel.Controls.Clear();
     var fb = new ActorDetails(_nhSession.Get<Person>(new Guid(id)).IMDBID) { Visible = true };
     SelectedFilmDetailsPanel.Controls.Add(fb);
     fb.Dock = DockStyle.Fill;
 }