private Person GetPerson(long personID) { DataTable result = Person_SP.GetByID(personID); Person person = new Person(9999999999, "Fake", "", ""); person.FetchSinglePerson(result); return(person); }
public void FixHTTPPersons() { LOGGER.GenerateSilent("Fixing persons with http url."); Person[] httpPersons = this.GetHTTPPersons(); foreach (Person item in httpPersons) { bool isActor = false; bool isDirector = false; Person_SP.GetTypeByID(item.PersonID, out isActor, out isDirector); string validIMDbLink = item.IMDBLink.Replace("http:", "https:"); Person[] validPersons = this.GetPersonByIMDbLink(validIMDbLink); int length = validPersons.Length; if (length == 0) { this.UpdatePersonIMDbLink(item.PersonID, validIMDbLink); } else if (length == 1) { Person validPerson = validPersons[0]; bool validIsActor = false; bool validIsDirector = false; Person_SP.GetTypeByID(validPerson.PersonID, out validIsActor, out validIsDirector); if (isActor && !validIsActor) { AccessDatabase.Insert(QueryRepository.Actor_Insert, "@PersonID", validPerson.PersonID); } if (isDirector && !validIsDirector) { AccessDatabase.Insert(QueryRepository.Director_Insert, "@PersonID", validPerson.PersonID); } this.UpdateMovieActors(item.PersonID, validPerson.PersonID); this.UpdateMovieDirectors(item.PersonID, validPerson.PersonID); this.DeletePerson(item.PersonID); } else { LOGGER.GenerateSilent("There is more than one match for person." + Environment.NewLine + item.FullName + Environment.NewLine + item.PersonID + Environment.NewLine + item.IMDBLink); } } LOGGER.GenerateSilent("Finished fixing persons with http url."); }
private Person[] GetPersonByIMDbLink(string imdbLink) { DataTable result = Person_SP.GetByIMDBLink(imdbLink); return(Person.FetchAllPerson(result)); }