Add Initial Logic for EuroMillions Draw Code.
This commit is contained in:
42
lottery-co-uk-scraper/EuroMillions/DrawCode.cs
Normal file
42
lottery-co-uk-scraper/EuroMillions/DrawCode.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using HtmlAgilityPack;
|
||||
using lottery_co_uk_scraper.core.Models;
|
||||
using lottery_co_uk_scraper.Utilities;
|
||||
|
||||
namespace lottery_co_uk_scraper.EuroMillions
|
||||
{
|
||||
internal class DrawCode
|
||||
{
|
||||
public static List<string> ProcessMillionaireMaker(HtmlDocument doc, EurosResult eurosResult)
|
||||
{
|
||||
try
|
||||
{
|
||||
var raffleNumbers = new List<string>();
|
||||
|
||||
foreach (var span in doc.DocumentNode.Descendants("span"))
|
||||
{
|
||||
var classAttribute = span.GetAttributeValue("class", "");
|
||||
|
||||
if (classAttribute.Contains("millionaire") && classAttribute.Contains("raffle"))
|
||||
{
|
||||
raffleNumbers.Add(span.InnerText.Trim());
|
||||
}
|
||||
}
|
||||
|
||||
AssignMillionaireMakerToModelProperty(nameof(eurosResult.MillionaireMakerCode), raffleNumbers, eurosResult);
|
||||
|
||||
return raffleNumbers;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void AssignMillionaireMakerToModelProperty(string propertyName, List<string> raffleNumbers, EurosResult eurosResult)
|
||||
{
|
||||
PropertyManager.SetProperty(propertyName, eurosResult, raffleNumbers);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user