Esempio n. 1
0
        private TableRow CreateFilmResultRow(mcl.Film film)
        {
            TableRow row = new TableRow();

            List <string> linkValues = new List <string> {
                avSV.TableValues.HyperLinkFilm, film.FilmID, film.FilmName
            };

            row.Cells.Add(CreateFilmInfoCell(avSV.TableValues.HyperLinkTemplate, linkValues));

            linkValues = new List <string> {
                avSV.TableValues.HyperLinkPerson, film.Directors[0].PersonID, film.Directors[0].PersonName
            };
            row.Cells.Add(CreateFilmInfoCell(avSV.TableValues.HyperLinkTemplate, linkValues));

            linkValues = new List <string> {
                avSV.TableValues.HyperLinkPerson, film.Actors[0].PersonID, film.Actors[0].PersonName
            };
            row.Cells.Add(CreateFilmInfoCell(avSV.TableValues.HyperLinkTemplate, linkValues));

            row.Cells.Add(CreateRatingCell(film.ImdbRating, film.RottenRating));
            row.Cells.Add(CreateFilmInfoCell(film.FilmYear, null));

            return(row);
        }
Esempio n. 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);
        }
Esempio n. 3
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);
            }
        }
Esempio n. 4
0
        private void CreateFilmsResultsTable(mcl.Film film)
        {
            TableRow row   = new TableRow();
            Table    table = (Table)Page.FindControl(avSV.TableValues.ResultsTable);

            CreateFilmResultsTableHeader();
            table.Rows.Add(CreateFilmResultRow(film));
            table.Visible = true;
        }
Esempio n. 5
0
 private void addDirector(mcl.Film film, DataRow row)
 {
     if (film.Directors.Any(item => item.PersonID == row.ItemArray[dict[avItems.DirectorID]].ToString()) == false)
     {
         mcl.Director director = new mcl.Director(row.ItemArray[dict[avItems.DirectorID]].ToString()
                                                  , row.ItemArray[dict[avItems.DirectorName]].ToString());
         film.Directors.Add(director);
     }
 }
Esempio n. 6
0
        private List <string> filmToString(mcl.Film film)//TODO get order from shared/dynamic method
        {
            List <string> fields = new List <string>
            {
                film.FilmID, film.FilmName, film.ImdbRating, film.Directors[0].PersonID, film.Directors[0].PersonName,
                film.Actors[0].PersonID, film.Actors[0].PersonName, film.FilmYear
            };

            return(fields);
        }
Esempio n. 7
0
 private mcl.Film getFilmFromCSV(CsvReader csv) // gets information from the film csv. it is used in the while loop if a director has been selected.
 {
     mcl.Director director = getDirectorFromCSV(csv);
     mcl.Actor    actor    = getActorFromCSV(csv);
     mcl.Film     film     = new mcl.Film(csv[csvMovies.FilmID]
                                          , csv[csvMovies.FilmName]
                                          , csv[csvMovies.ImdbRating]
                                          , csv[csvMovies.FilmYear]);
     film.Directors.Add(director); // if a film has been selected it also adds a director and an actor associated with that film.
     film.Actors.Add(actor);
     return(film);
 }
Esempio n. 8
0
 private mcl.Film getFilmFromCSV(CsvReader csv)
 {
     mcl.Director director = getDirectorFromCSV(csv);
     mcl.Actor    actor    = getActorFromCSV(csv);
     mcl.Film     film     = new mcl.Film(csv[csvMovies.FilmID]
                                          , csv[csvMovies.FilmName]
                                          , csv[csvMovies.ImdbRating]
                                          , csv[csvMovies.FilmYear]
                                          , csv[csvMovies.RottenRating]);
     film.Directors.Add(director);
     film.Actors.Add(actor);
     return(film);
 }
Esempio n. 9
0
        private mcl.Film getFilm(DataRow row)
        {
            mcl.Film film = new mcl.Film();

            film.FilmID     = row.ItemArray[dict[avItems.FilmID]].ToString();
            film.FilmName   = row.ItemArray[dict[avItems.FilmName]].ToString();
            film.FilmYear   = row.ItemArray[dict[avItems.FilmYear]].ToString();
            film.ImdbRating = row.ItemArray[dict[avItems.ImdbRating]].ToString();

            addActor(film, row);
            addDirector(film, row);

            return(film);
        }
Esempio n. 10
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.
        }
Esempio n. 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);
        }
Esempio n. 12
0
 private void selectionComplete(mcl.Film film)
 {
     CreateFilmsResultsTable(film);
     btnReset.Enabled = true;
 }