Esempio n. 1
0
        internal void ShowContributors(Role role)
        {
            AbstractPersonRepository     pRepo  = _personRepository;
            AbstractFilmPersonRepository fpRepo = _filmPersonRepository;
            List <Guid>   ids   = fpRepo.ListPersonIdsForilmIdAndRole(CurrentFilm.Id, role);
            List <string> names = new List <string>();

            foreach (Guid id in ids)
            {
                Person p = pRepo.GetById(id);
                names.Add(p.FullName);
            }
            if (names.Count > 0)
            {
                StringChooser chooser = new StringChooser(names);
                chooser.Show();
            }
            else
            {
                string[] contribkind = { "contributors", "actors", "composers", "directors", "scriptwriters" };

                string kind = contribkind[(int)role];

                ReportIt("There are (as yet) no " + kind + " defined for this film");
            }
        }
Esempio n. 2
0
 public FilmListViewModel(MainWindow view)
 {
     _mainView              = view;
     _countryRepository     = view.CountryRepository;
     _filmCountryRepository = view.FilmCountryRepository;
     _filmPersonRepository  = view.FilmPersonRepository;
     _filmRepository        = view.FilmRepository;
     _locationRepository    = view.LocationRepository;
     _personRepository      = view.PersonRepository;
     Films       = new ObservableCollection <Film>(_filmRepository.List());
     CurrentFilm = _filmRepository.List().FirstOrDefault();
 }
        private List <Person> GetContributors(Role role)
        {
            List <Person> result = new List <Person>();
            AbstractFilmPersonRepository fpRepo = _view.FilmPersonRepository;
            AbstractPersonRepository     pRepo  = _view.PersonRepository;
            List <Guid> ids = fpRepo.ListPersonIdsForilmIdAndRole(Film.Id, role);

            foreach (Guid id in ids)
            {
                Person p = pRepo.GetById(id);
                result.Add(p);
            }
            return(result);
        }
Esempio n. 4
0
        private bool CheckForMissingInfo()
        {
            bool result = true;
            Guid id     = CurrentFilm.Id;
            AbstractFilmPersonRepository  fpRepo = _filmPersonRepository;
            AbstractFilmCountryRepository fcRepo = _filmCountryRepository;
            List <Guid> ids        = fpRepo.ListPersonIdsForilmIdAndRole(id, Role.Actor);
            int         actorCount = ids.Count;

            ids = fpRepo.ListPersonIdsForilmIdAndRole(id, Role.Composer);
            int composerCount = ids.Count;

            ids = fpRepo.ListPersonIdsForilmIdAndRole(id, Role.Director);
            int directorCount = ids.Count;

            ids = fcRepo.ListCountryIdsForFilmId(id);
            int countryCount = ids.Count;

            if (actorCount == 0)
            {
                ReportIt(CurrentFilm.Title + " has no actors.");
                result = false;
            }
            if (composerCount == 0)
            {
                ReportIt(CurrentFilm.Title + " has no composers.");
                result = false;
            }
            if (directorCount == 0)
            {
                ReportIt(CurrentFilm.Title + " has no directors.");
                result = false;
            }
            if (countryCount == 0)
            {
                ReportIt(CurrentFilm.Title + " has no countries.");
                result = false;
            }
            if (CurrentFilm.Location == null)
            {
                ReportIt(CurrentFilm.Title + "has no location");
                result = false;
            }
            return(result);
        }
Esempio n. 5
0
        internal void ShowContributions(Role role)
        {
            AbstractFilmPersonRepository fpRepo = _filmPersonRepository;
            AbstractFilmRepository       fRepo  = _filmRepository;
            List <Guid>   ids    = fpRepo.ListFilmIdsForPersonIdAndRole(CurrentPerson.Id, role);
            List <string> titles = new List <string>();

            foreach (Guid id in ids)
            {
                Film f = fRepo.GetById(id);
                titles.Add(f.Title);
            }
            if (titles.Count > 0)
            {
                StringChooser chooser = new StringChooser(titles);
                chooser.ShowDialog();
            }
            else
            {
                string[] actions = { " contributes to", " acts in", " composes for", " directs" };
                string   action  = actions[(int)role];
                ReportIt("As yet " + CurrentPerson.FullName + action + " no film");
            }
        }