Exemplo n.º 1
0
        public void Retrieve(int count)
        {
            var departments = _httpRetriever.RetrieveDepartments();

            _crewDao.InsertDepartments(departments);

            var genres = _httpRetriever.RetrieveGenres();

            _genresDao.InsertGenres(genres);

            var logins = InsertMembers();

            for (var id = 1; id < count; id++)
            {
                Console.WriteLine(id);
                try
                {
                    RetrieveAndInsertFilm(id);
                    foreach (var login in logins)
                    {
                        _reviewsDao.AddReview(login, RandomString(100), Random.Next(1, 10), id);
                    }
                    var cast = _httpRetriever.RetrieveCastFromFilm(id);
                    foreach (var c in cast)
                    {
                        var person = RetrievePerson(_httpRetriever, c.PersonId);
                        _personDao.InsertPerson(person);
                        _castDao.InsertCast(c);
                    }
                    var crew = _httpRetriever.RetrieveCrewFromFilm(id);
                    foreach (var c in crew)
                    {
                        var person = RetrievePerson(_httpRetriever, c.PersonId);
                        _personDao.InsertPerson(person);
                        _crewDao.InsertCrew(c);
                    }
                }
                catch (KeyNotFoundException)
                {
                }
            }
            _databaseConnection.Close();
        }
Exemplo n.º 2
0
        private void addButton_Click(object sender, EventArgs e)
        {
            var person = new Person(name.Text,
                                    (int)id.Value,
                                    noBirthDay.Checked?(DateTime?)null:birthDay.Value,
                                    noDeathDay.Checked?(DateTime?)null:deathDay.Value,
                                    biography.Text,
                                    gender.SelectedIndex,
                                    placeOfBirth.Text);

            _movieDao.InsertPerson(person);
            Close();
        }