예제 #1
0
        private void populateDropDownsWithFilteredData(string filmID, string directorID, string actorID, string filmYear
                                                       , string imdbRating, string rottenRating)
        {
            mcl.Films films = getFilms();
            mbl       bl1   = new mbl();

            mcl.Films tmp = bl1.GetFilmsSubset(filmID, directorID, actorID, filmYear, imdbRating, rottenRating, films);

            List <mcl.Actor>          actors    = (actorID == null) ? bl1.GetDistinctActorsFromFilms(tmp) : bl1.GetDistinctActor(tmp, actorID);
            List <mcl.Director>       directors = (directorID == null) ? bl1.GetDistinctDirectorsFromFilms(tmp) : bl1.GetDistinctDirector(tmp, directorID);
            List <mcl.SimplisticFilm> sFilms    = (filmID == null) ? bl1.GetDistinctSimplisticFilmsFromFilms(tmp) : tmp.GetDistinctSimplisticFilm(filmID);
            List <string>             filmYears = (filmYear == null) ? bl1.GetDistinctFilmYearFromFilms(tmp) :
                                                  tmp.GetDistinctFilmYear(filmYear);
            List <string> imdbRatings = (imdbRating == null) ? bl1.GetDistinctImdbRatingFromFilms(tmp) :
                                        tmp.GetDistinctImdbRating(imdbRating);
            List <string> rottenRatings = (rottenRating == null) ? bl1.GetDistinctRottenRatingFromFilms(tmp) :
                                          tmp.GetDistinctRottenRating(rottenRating);

            populateDropDowns(avSV.DropDownLists.UseBlankItem, sFilms, directors, actors, filmYears, imdbRatings, rottenRatings);

            if (isSelectionComplete(sFilms, actors, directors))
            {
                mcl.Film film = new mcl.Film(tmp.GetDistinctFilm(sFilms[0].FilmID), actors, directors);
                selectionComplete(film);
            }
        }
예제 #2
0
        public mcl.Films GetCsvData()
        {
            mcl.Films films = new mcl.Films();

            using (CsvReader csv = new CsvReader(new StreamReader(CsvPath.filmsCSV), true))
            {
                int fieldCount = csv.FieldCount;

                while (csv.ReadNextRecord())
                {
                    if (films.Any(item => item.FilmID == csv[csvMovies.FilmID]))
                    {
                        mcl.Film tmpFilm = films.Find(item => item.FilmID == csv[csvMovies.FilmID]);
                        if (tmpFilm.Directors.Any(item => item.PersonID == csv[csvMovies.DirectorID]) != true)
                        {
                            mcl.Director director = getDirectorFromCSV(csv);
                            tmpFilm.Directors.Add(director);
                        }
                        if (tmpFilm.Actors.Any(item => item.PersonID == csv[csvMovies.ActorID]) != true)
                        {
                            mcl.Actor actor = getActorFromCSV(csv);
                            tmpFilm.Actors.Add(actor);
                        }
                    }
                    else
                    {
                        mcl.Film film = getFilmFromCSV(csv);
                        films.Add(film);
                    }
                }
            }
            return(films);
        }
예제 #3
0
        public mcl.Films GetSQLData()
        {
            mcl.Films films = new mcl.Films();
            DataTable table = getFilmsTable();

            dict  = headerDict(table.Columns);
            films = dataTableToFilms(table);
            return(films);
        }
예제 #4
0
        public void UpdateAllFromS3()
        {
            downloadLatestFile();
            archiveLatestFile();

            CSVData dl = new CSVData();

            mcl.Films films = dl.GetCsvData();
            SQLData   dl2   = new SQLData();

            dl2.UpdateDBFromS3(films);
        }
예제 #5
0
        private void populateDropDownsWithOriginalData() // returns the original data selected.
        {
            using (mbl bl1 = new mbl())
            {
                mcl.Films films = getFilms();

                List <mcl.Director>       directors = bl1.GetDistinctDirectorsFromFilms(films);
                List <mcl.Actor>          actors    = bl1.GetDistinctActorsFromFilms(films);
                List <mcl.SimplisticFilm> sFilms    = bl1.GetDistinctSimplisticFilmsFromFilms(films);

                populateDropDowns(ddl.UseBlankItem, sFilms, directors, actors);
            }
        }
예제 #6
0
        private void populateDropDownsWithFilteredData(string filmID, string directorID, string actorID) //populates the drop down list with the filtered data.
        {
            mcl.Films films = getFilms();
            using (mbl bl1 = new mbl())
            {
                mcl.Films tmp = bl1.GetFilmsSubset(filmID, directorID, actorID, films);

                List <mcl.Actor>          actors    = (actorID == null) ? bl1.GetDistinctActorsFromFilms(tmp) : bl1.GetDistinctActor(tmp, actorID);
                List <mcl.Director>       directors = (directorID == null) ? bl1.GetDistinctDirectorsFromFilms(tmp) : bl1.GetDistinctDirector(tmp, directorID);
                List <mcl.SimplisticFilm> sFilms    = (filmID == null) ? bl1.GetDistinctSimplisticFilmsFromFilms(tmp) : tmp.GetDistinctSimplisticFilm(filmID);

                populateDropDowns(ddl.UseBlankItem, sFilms, directors, actors);
            }
        }
예제 #7
0
        //--------------------------------------------------------------------- CSV
        public mcl.Films GetCsvData(string CsvPath)
        {
            mcl.Films films = new mcl.Films();

            //-- FilmID = csv[0];
            //-- FilmName = csv[1];
            //-- ImdbRating = csv[2];
            //-- FilmYear = csv[7];
            //-- DirectorID = csv[3];
            //-- DirectorName = csv[4];
            //-- ActorID = csv[5];
            //-- ActorName = csv[6];

            using (CsvReader csv = new CsvReader(new StreamReader(CsvPath), true)) // looks up where the data is being held.
            {
                int fieldCount = csv.FieldCount;

                string[] headers = csv.GetFieldHeaders();
                while (csv.ReadNextRecord()) // while reading the data. This if else statement is checking if any of the dropdown fields have been selected. if one has been selected it pulls the data from that csv file and populates the drop down.
                {
                    if (films.Any(item => item.FilmID == csv[csvMovies.FilmID]))
                    {
                        mcl.Film tmpFilm = films.Find(item => item.FilmID == csv[csvMovies.FilmID]);
                        if (tmpFilm.Directors.Any(item => item.PersonID == csv[csvMovies.DirectorID]))
                        {
                        }
                        else
                        {
                            mcl.Director director = getDirectorFromCSV(csv);
                            tmpFilm.Directors.Add(director);
                        }
                        if (tmpFilm.Actors.Any(item => item.PersonID == csv[csvMovies.ActorID]))
                        {
                        }
                        else
                        {
                            mcl.Actor actor = getActorFromCSV(csv);
                            tmpFilm.Actors.Add(actor);
                        }
                    }
                    else
                    {
                        mcl.Film film = getFilmFromCSV(csv);
                        films.Add(film);
                    }
                }
            }
            return(films); // returns the results of the if, else statements above.
        }
예제 #8
0
        private void populateDropDownsWithOriginalData()
        {
            mbl bl1 = new mbl();

            mcl.Films films = getFilms();

            List <mcl.Director>       directors     = bl1.GetDistinctDirectorsFromFilms(films);
            List <mcl.Actor>          actors        = bl1.GetDistinctActorsFromFilms(films);
            List <mcl.SimplisticFilm> sFilms        = bl1.GetDistinctSimplisticFilmsFromFilms(films);
            List <string>             filmYears     = bl1.GetDistinctFilmYearFromFilms(films);
            List <string>             imdbRatings   = bl1.GetDistinctImdbRatingFromFilms(films);
            List <string>             rottenRatings = bl1.GetDistinctRottenRatingFromFilms(films);

            populateDropDowns(avSV.DropDownLists.UseBlankItem, sFilms, directors, actors, filmYears, imdbRatings, rottenRatings);
        }
예제 #9
0
        private mcl.Films getFilms()
        {
            mcl.Films films = new mcl.Films();

            if ((cache.UseCache) && (Cache[cache.FilmCacheName] != null))
            {
                films = Cache[cache.FilmCacheName] as mcl.Films;
            }
            else
            {
                mbl bl1 = new mbl();
                films = bl1.GetFilms(av.SystemSettings.DataAccessPoint.Current);
                if (cache.UseCache)
                {
                    Cache[cache.FilmCacheName] = films;
                }
            }

            return(films);
        }
예제 #10
0
        private mcl.Films getFilms() //
        {
            mcl.Films films = new mcl.Films();

            if ((cache.UseCache) && (Cache[cache.FilmCacheName] != null))
            {
                films = Cache[cache.FilmCacheName] as mcl.Films;
            }
            else
            {
                using (mbl bl1 = new mbl())
                {
                    films = bl1.GetFilms(av.CsvPaths.MoviesCSV);
                    if (cache.UseCache)
                    {
                        Cache[cache.FilmCacheName] = films;
                    }
                }
            }

            return(films);
        }
예제 #11
0
        private mcl.Films dataTableToFilms(DataTable table)
        {
            mcl.Films films = new mcl.Films();

            DataRow[] dr = table.Select();

            foreach (var row in dr)//TODO try with LINQ
            {
                mcl.Film film = new mcl.Film();
                if (films.Any(item => item.FilmID == row.ItemArray[dict[avItems.FilmID]].ToString()) == false)
                {
                    films.Add(getFilm(row));
                }
                else
                {
                    film = films.Find(item => item.FilmID == row.ItemArray[dict[avItems.FilmID]].ToString());
                    addActor(film, row);
                    addDirector(film, row);
                }
            }
            return(films);
        }
예제 #12
0
 public void UpdateDBFromS3(mcl.Films films)
 {
     for (int i = 0; i < films.Count; i++)
     {
         if (films[i].Directors.Count > 1)
         {
             UpdateCreateFilm(filmToString(films[i]));
             films[i].Directors.RemoveAt(0);
             i--;
         }
         else if (films[i].Actors.Count > 1)
         {
             UpdateCreateFilm(filmToString(films[i]));
             films[i].Actors.RemoveAt(0);
             i--;
         }
         else
         {
             UpdateCreateFilm(filmToString(films[i]));
         }
     }
 }
예제 #13
0
 public List <mcl.SimplisticFilm> GetDistinctSimplisticFilmsFromFilms(mcl.Films films)
 {
     return((films == null) ? null : films.ToListSimplisticFilm()); // if films equal null then use information from simplistic films and it will be ordered.
 }
예제 #14
0
 public List <string> GetDistinctImdbRating(mcl.Films films, string imdbRating)
 {
     return(films.GetDistinctImdbRating(imdbRating));
 }
예제 #15
0
 public mcl.Films GetFilmsSubset(string filmID, string directorID, string actorID, mcl.Films films)
 {
     return(films.GetFilmsFilteredSubset(filmID, directorID, actorID));
 }
예제 #16
0
        //-----------------------------------------------------------------------ImdbRating

        public List <string> GetDistinctImdbRatingFromFilms(mcl.Films films)
        {
            return((films == null) ? null : films.ToListDistinctImdbRating());
        }
예제 #17
0
 public List <string> GetDistinctFilmYear(mcl.Films films, string filmYear)
 {
     return(films.GetDistinctFilmYear(filmYear));
 }
예제 #18
0
        //---------------------------------------------------------------------FilmYear

        public List <string> GetDistinctFilmYearFromFilms(mcl.Films films)
        {
            return((films == null) ? null : films.ToListDistinctFilmYear());
        }
예제 #19
0
 public mcl.Films GetFilmsSubset(string filmID, string directorID, string actorID, string filmYear,
                                 string imdbRating, string rottenRating, mcl.Films films)
 {
     return(films.GetFilmsFilteredSubset(filmID, directorID, actorID, filmYear, imdbRating, rottenRating));
 }
예제 #20
0
        //--------------------------------------------------------------------- ACTORS

        public List <mcl.Actor> GetDistinctActorsFromFilms(mcl.Films films)
        {
            return((films == null) ? null : films.ToListDistinctActor());
        }
예제 #21
0
 public List <mcl.Director> GetDistinctDirector(mcl.Films films, string directorID)
 {
     return(films.GetDistinctDirector(directorID));
 }
예제 #22
0
 public List <string> GetDistinctRottenRating(mcl.Films films, string rottenRating)
 {
     return(films.GetDistinctRottenRating(rottenRating));
 }
예제 #23
0
 public List <mcl.Actor> GetDistinctActor(mcl.Films films, string actorID)
 {
     return(films.GetDistinctActor(actorID));
 }
예제 #24
0
 public List <mcl.SimplisticFilm> GetDistinctSimplisticFilmsFromFilms(mcl.Films films)
 {
     return((films == null) ? null : films.ToListSimplisticFilm());
 }