Add Logic for EuroMillions Draw Status.
This commit is contained in:
50
lottery-co-uk-scraper/EuroMillions/DrawStatus.cs
Normal file
50
lottery-co-uk-scraper/EuroMillions/DrawStatus.cs
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
using HtmlAgilityPack;
|
||||||
|
using lottery_co_uk_scraper.core.Models;
|
||||||
|
using lottery_co_uk_scraper.Utilities;
|
||||||
|
|
||||||
|
namespace lottery_co_uk_scraper.EuroMillions
|
||||||
|
{
|
||||||
|
internal class DrawStatus
|
||||||
|
{
|
||||||
|
public static bool ProcessRollover(HtmlDocument doc, EurosResult eurosResult)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var rolloverElement = doc.DocumentNode.Descendants("span")
|
||||||
|
.FirstOrDefault(x => x.InnerText.Trim() == "Rollover");
|
||||||
|
bool rollover = rolloverElement != null;
|
||||||
|
|
||||||
|
if (rollover)
|
||||||
|
{
|
||||||
|
AssignDrawStatusToModelProperty(rollover, eurosResult);
|
||||||
|
Console.WriteLine("Rollover: " + rollover);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//ToDo: This isn't ideal how will i know if it fails.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AssignDrawStatusToModelProperty(bool status, EurosResult eurosResult)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
PropertyManager.SetProperty(nameof(eurosResult.Rollover), eurosResult, status);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user