Пример #1
0
 private void FillAuthor(string originalUrl, HtmlDocument htmlDocument)
 {
     if (htmlDocument != null)
     {
         HtmlNode vCard = htmlDocument.DocumentNode.SelectSingleNode("//table[@class=\"infobox vcard\"]");
         if (vCard == null)
         {
             vCard = htmlDocument.DocumentNode.SelectSingleNode("//table[@class=\"infobox\"]");
         }
         authorData = new AuthorData(originalUrl, htmlDocument, vCard);
         if (IfAuthorDataDoesntContainData(authorData))
         {
             authorData = null;
         }
     }
 }
Пример #2
0
        private bool IfAuthorDataDoesntContainData(AuthorData authorData)
        {
            if (authorData.AuthorImage == null && string.IsNullOrEmpty(authorData.Biography) && authorData.BornDate == null && authorData.DeathDate == null)
            {
                return(true);
            }
            int linesCount = authorData.Biography.Split('\n').Length;

            if (linesCount > 2)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Пример #3
0
 private void UpdateAuthorResources(Entities context, Author author, AuthorData authorData)
 {
     string sql = string.Empty;
     if (!string.IsNullOrEmpty(authorData.Biography))
     {
         author.Biography = authorData.Biography;
         author.NameFromWiki = authorData.NameFromWiki;
         author.Photo = authorData.AuthorImage;
         author.PhotoUpdated = DateTime.Now;
         if (authorData.BornDate > new DateTime(1753, 1, 1))
         {
             author.BirthDate = authorData.BornDate;
         }
         if (authorData.DeathDate > new DateTime(1753, 1, 1))
         {
             author.DeathDate = authorData.DeathDate;
         }
         author.SourceUrl = authorData.OriginalUrl;
         author.FromWiki = true;
     }
 }
Пример #4
0
        private void UpdateAuthorResources(Entities context, Author author, AuthorData authorData)
        {
            string sql = string.Empty;

            if (!string.IsNullOrEmpty(authorData.Biography))
            {
                author.Biography    = authorData.Biography;
                author.NameFromWiki = authorData.NameFromWiki;
                author.Photo        = authorData.AuthorImage;
                author.PhotoUpdated = DateTime.Now;
                if (authorData.BornDate > new DateTime(1753, 1, 1))
                {
                    author.BirthDate = authorData.BornDate;
                }
                if (authorData.DeathDate > new DateTime(1753, 1, 1))
                {
                    author.DeathDate = authorData.DeathDate;
                }
                author.SourceUrl = authorData.OriginalUrl;
                author.FromWiki  = true;
            }
        }