Exemple #1
0
 public bool Execute()
 {
     try
     {
         Result = new InvoerItemScrape(Parameters).Execute();
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }
Exemple #2
0
        public InvoerItemGetResult ConvertToResult(string html)
        {
            HtmlDocument htmlDocument = new HtmlDocument();

            htmlDocument.LoadHtml(html);
            var node = htmlDocument.DocumentNode;

            var selectNode = node.Descendants("select").FirstOrDefault(c => c.Attributes["id"]?.Value == "payment_by");

            var optionNodes = selectNode?.Descendants("option") ?? new List <HtmlNode>();

            var result = new InvoerItemGetResult();

            foreach (var option in optionNodes)
            {
                var person = new InvoerItemPerson();
                person.Id   = option.Attributes["value"]?.Value;
                person.Name = option?.NextSibling?.InnerText;
                result.Persons.Add(person);
            }

            return(result);
        }