Compare commits

...

2 Commits

6 changed files with 673 additions and 94 deletions

View File

@@ -30,56 +30,56 @@
public int DrawnBonusBall { get; set; }
public decimal TotalMatched2 { get; set; }
public int TotalMatched2 { get; set; }
public decimal Matched2Prize { get; set; }
public int Matched2Prize { get; set; }
public decimal Matched2PrizeFund { get; set; }
public int Matched2PrizeFund { get; set; }
public decimal Matched2RolldownPrize { get; set; }
public int Matched2RolldownPrize { get; set; }
public decimal TotalMatched3 { get; set; }
public int TotalMatched3 { get; set; }
public decimal Matched3Prize { get; set; }
public int Matched3Prize { get; set; }
public decimal Matched3PrizeFund { get; set; }
public int Matched3PrizeFund { get; set; }
public decimal Matched3RolldownPrize { get; set; }
public int Matched3RolldownPrize { get; set; }
public decimal TotalMatched4 { get; set; }
public int TotalMatched4 { get; set; }
public decimal Matched4Prize { get; set; }
public int Matched4Prize { get; set; }
public decimal Matched4PrizeFund { get; set; }
public int Matched4PrizeFund { get; set; }
public decimal Matched4RolldownPrize { get; set; }
public int Matched4RolldownPrize { get; set; }
public decimal TotalMatched5 { get; set; }
public int TotalMatched5 { get; set; }
public decimal Matched5Prize { get; set; }
public int Matched5Prize { get; set; }
public decimal Matched5PrizeFund { get; set; }
public int Matched5PrizeFund { get; set; }
public decimal TotalMatched5PlusBonus { get; set; }
public int TotalMatched5PlusBonus { get; set; }
public decimal Matched5RolldownPrize { get; set; }
public int Matched5RolldownPrize { get; set; }
public decimal Matched5PlusBonusPrize { get; set; }
public int Matched5PlusBonusPrize { get; set; }
public decimal Matched5PlusBonusPrizeFund { get; set; }
public int Matched5PlusBonusPrizeFund { get; set; }
public decimal Matched5PlusBonusRolldownPrize { get; set; }
public int Matched5PlusBonusRolldownPrize { get; set; }
public decimal TotalMatched6 { get; set; }
public int TotalMatched6 { get; set; }
public decimal Matched6Prize { get; set; }
public int Matched6Prize { get; set; }
public decimal Matched6PrizeFund { get; set; }
public int Matched6PrizeFund { get; set; }
public decimal Matched6RolldownPrize { get; set; }
public int Matched6RolldownPrize { get; set; }
public int TotalWinners { get; set; }
public decimal TotalPrizeFund {get; set;}
public int TotalPrizeFund {get; set;}
}
}

View File

@@ -0,0 +1,161 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using lottery_co_uk_scraper.data;
#nullable disable
namespace lottery_co_uk_scraper.data.Migrations
{
[DbContext(typeof(LotteryContext))]
[Migration("20240207225800_ChangeFromDecimalToInt")]
partial class ChangeFromDecimalToInt
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.1")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("lottery_co_uk_scraper.core.Models.LottoResult", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("BallSetUsed")
.HasColumnType("int");
b.Property<DateOnly>("DrawDate")
.HasColumnType("date");
b.Property<int>("DrawNumber")
.HasColumnType("int");
b.Property<int>("DrawnBall1")
.HasColumnType("int");
b.Property<int>("DrawnBall2")
.HasColumnType("int");
b.Property<int>("DrawnBall3")
.HasColumnType("int");
b.Property<int>("DrawnBall4")
.HasColumnType("int");
b.Property<int>("DrawnBall5")
.HasColumnType("int");
b.Property<int>("DrawnBall6")
.HasColumnType("int");
b.Property<int>("DrawnBonusBall")
.HasColumnType("int");
b.Property<string>("MachineUsed")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("Matched2Prize")
.HasColumnType("int");
b.Property<int>("Matched2PrizeFund")
.HasColumnType("int");
b.Property<int>("Matched2RolldownPrize")
.HasColumnType("int");
b.Property<int>("Matched3Prize")
.HasColumnType("int");
b.Property<int>("Matched3PrizeFund")
.HasColumnType("int");
b.Property<int>("Matched3RolldownPrize")
.HasColumnType("int");
b.Property<int>("Matched4Prize")
.HasColumnType("int");
b.Property<int>("Matched4PrizeFund")
.HasColumnType("int");
b.Property<int>("Matched4RolldownPrize")
.HasColumnType("int");
b.Property<int>("Matched5PlusBonusPrize")
.HasColumnType("int");
b.Property<int>("Matched5PlusBonusPrizeFund")
.HasColumnType("int");
b.Property<int>("Matched5PlusBonusRolldownPrize")
.HasColumnType("int");
b.Property<int>("Matched5Prize")
.HasColumnType("int");
b.Property<int>("Matched5PrizeFund")
.HasColumnType("int");
b.Property<int>("Matched5RolldownPrize")
.HasColumnType("int");
b.Property<int>("Matched6Prize")
.HasColumnType("int");
b.Property<int>("Matched6PrizeFund")
.HasColumnType("int");
b.Property<int>("Matched6RolldownPrize")
.HasColumnType("int");
b.Property<bool>("Rolldown")
.HasColumnType("bit");
b.Property<bool>("Rollover")
.HasColumnType("bit");
b.Property<int>("TotalMatched2")
.HasColumnType("int");
b.Property<int>("TotalMatched3")
.HasColumnType("int");
b.Property<int>("TotalMatched4")
.HasColumnType("int");
b.Property<int>("TotalMatched5")
.HasColumnType("int");
b.Property<int>("TotalMatched5PlusBonus")
.HasColumnType("int");
b.Property<int>("TotalMatched6")
.HasColumnType("int");
b.Property<int>("TotalPrizeFund")
.HasColumnType("int");
b.Property<int>("TotalWinners")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("LottoResults");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,418 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace lottery_co_uk_scraper.data.Migrations
{
/// <inheritdoc />
public partial class ChangeFromDecimalToInt : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<int>(
name: "TotalPrizeFund",
table: "LottoResults",
type: "int",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,2)");
migrationBuilder.AlterColumn<int>(
name: "TotalMatched6",
table: "LottoResults",
type: "int",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,2)");
migrationBuilder.AlterColumn<int>(
name: "TotalMatched5PlusBonus",
table: "LottoResults",
type: "int",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,2)");
migrationBuilder.AlterColumn<int>(
name: "TotalMatched5",
table: "LottoResults",
type: "int",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,2)");
migrationBuilder.AlterColumn<int>(
name: "TotalMatched4",
table: "LottoResults",
type: "int",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,2)");
migrationBuilder.AlterColumn<int>(
name: "TotalMatched3",
table: "LottoResults",
type: "int",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,2)");
migrationBuilder.AlterColumn<int>(
name: "TotalMatched2",
table: "LottoResults",
type: "int",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,2)");
migrationBuilder.AlterColumn<int>(
name: "Matched6RolldownPrize",
table: "LottoResults",
type: "int",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,2)");
migrationBuilder.AlterColumn<int>(
name: "Matched6PrizeFund",
table: "LottoResults",
type: "int",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,2)");
migrationBuilder.AlterColumn<int>(
name: "Matched6Prize",
table: "LottoResults",
type: "int",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,2)");
migrationBuilder.AlterColumn<int>(
name: "Matched5RolldownPrize",
table: "LottoResults",
type: "int",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,2)");
migrationBuilder.AlterColumn<int>(
name: "Matched5PrizeFund",
table: "LottoResults",
type: "int",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,2)");
migrationBuilder.AlterColumn<int>(
name: "Matched5Prize",
table: "LottoResults",
type: "int",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,2)");
migrationBuilder.AlterColumn<int>(
name: "Matched5PlusBonusRolldownPrize",
table: "LottoResults",
type: "int",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,2)");
migrationBuilder.AlterColumn<int>(
name: "Matched5PlusBonusPrizeFund",
table: "LottoResults",
type: "int",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,2)");
migrationBuilder.AlterColumn<int>(
name: "Matched5PlusBonusPrize",
table: "LottoResults",
type: "int",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,2)");
migrationBuilder.AlterColumn<int>(
name: "Matched4RolldownPrize",
table: "LottoResults",
type: "int",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,2)");
migrationBuilder.AlterColumn<int>(
name: "Matched4PrizeFund",
table: "LottoResults",
type: "int",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,2)");
migrationBuilder.AlterColumn<int>(
name: "Matched4Prize",
table: "LottoResults",
type: "int",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,2)");
migrationBuilder.AlterColumn<int>(
name: "Matched3RolldownPrize",
table: "LottoResults",
type: "int",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,2)");
migrationBuilder.AlterColumn<int>(
name: "Matched3PrizeFund",
table: "LottoResults",
type: "int",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,2)");
migrationBuilder.AlterColumn<int>(
name: "Matched3Prize",
table: "LottoResults",
type: "int",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,2)");
migrationBuilder.AlterColumn<int>(
name: "Matched2RolldownPrize",
table: "LottoResults",
type: "int",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,2)");
migrationBuilder.AlterColumn<int>(
name: "Matched2PrizeFund",
table: "LottoResults",
type: "int",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,2)");
migrationBuilder.AlterColumn<int>(
name: "Matched2Prize",
table: "LottoResults",
type: "int",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,2)");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<decimal>(
name: "TotalPrizeFund",
table: "LottoResults",
type: "decimal(18,2)",
nullable: false,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AlterColumn<decimal>(
name: "TotalMatched6",
table: "LottoResults",
type: "decimal(18,2)",
nullable: false,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AlterColumn<decimal>(
name: "TotalMatched5PlusBonus",
table: "LottoResults",
type: "decimal(18,2)",
nullable: false,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AlterColumn<decimal>(
name: "TotalMatched5",
table: "LottoResults",
type: "decimal(18,2)",
nullable: false,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AlterColumn<decimal>(
name: "TotalMatched4",
table: "LottoResults",
type: "decimal(18,2)",
nullable: false,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AlterColumn<decimal>(
name: "TotalMatched3",
table: "LottoResults",
type: "decimal(18,2)",
nullable: false,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AlterColumn<decimal>(
name: "TotalMatched2",
table: "LottoResults",
type: "decimal(18,2)",
nullable: false,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AlterColumn<decimal>(
name: "Matched6RolldownPrize",
table: "LottoResults",
type: "decimal(18,2)",
nullable: false,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AlterColumn<decimal>(
name: "Matched6PrizeFund",
table: "LottoResults",
type: "decimal(18,2)",
nullable: false,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AlterColumn<decimal>(
name: "Matched6Prize",
table: "LottoResults",
type: "decimal(18,2)",
nullable: false,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AlterColumn<decimal>(
name: "Matched5RolldownPrize",
table: "LottoResults",
type: "decimal(18,2)",
nullable: false,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AlterColumn<decimal>(
name: "Matched5PrizeFund",
table: "LottoResults",
type: "decimal(18,2)",
nullable: false,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AlterColumn<decimal>(
name: "Matched5Prize",
table: "LottoResults",
type: "decimal(18,2)",
nullable: false,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AlterColumn<decimal>(
name: "Matched5PlusBonusRolldownPrize",
table: "LottoResults",
type: "decimal(18,2)",
nullable: false,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AlterColumn<decimal>(
name: "Matched5PlusBonusPrizeFund",
table: "LottoResults",
type: "decimal(18,2)",
nullable: false,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AlterColumn<decimal>(
name: "Matched5PlusBonusPrize",
table: "LottoResults",
type: "decimal(18,2)",
nullable: false,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AlterColumn<decimal>(
name: "Matched4RolldownPrize",
table: "LottoResults",
type: "decimal(18,2)",
nullable: false,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AlterColumn<decimal>(
name: "Matched4PrizeFund",
table: "LottoResults",
type: "decimal(18,2)",
nullable: false,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AlterColumn<decimal>(
name: "Matched4Prize",
table: "LottoResults",
type: "decimal(18,2)",
nullable: false,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AlterColumn<decimal>(
name: "Matched3RolldownPrize",
table: "LottoResults",
type: "decimal(18,2)",
nullable: false,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AlterColumn<decimal>(
name: "Matched3PrizeFund",
table: "LottoResults",
type: "decimal(18,2)",
nullable: false,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AlterColumn<decimal>(
name: "Matched3Prize",
table: "LottoResults",
type: "decimal(18,2)",
nullable: false,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AlterColumn<decimal>(
name: "Matched2RolldownPrize",
table: "LottoResults",
type: "decimal(18,2)",
nullable: false,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AlterColumn<decimal>(
name: "Matched2PrizeFund",
table: "LottoResults",
type: "decimal(18,2)",
nullable: false,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AlterColumn<decimal>(
name: "Matched2Prize",
table: "LottoResults",
type: "decimal(18,2)",
nullable: false,
oldClrType: typeof(int),
oldType: "int");
}
}
}

View File

@@ -64,59 +64,59 @@ namespace lottery_co_uk_scraper.data.Migrations
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<decimal>("Matched2Prize")
.HasColumnType("decimal(18,2)");
b.Property<int>("Matched2Prize")
.HasColumnType("int");
b.Property<decimal>("Matched2PrizeFund")
.HasColumnType("decimal(18,2)");
b.Property<int>("Matched2PrizeFund")
.HasColumnType("int");
b.Property<decimal>("Matched2RolldownPrize")
.HasColumnType("decimal(18,2)");
b.Property<int>("Matched2RolldownPrize")
.HasColumnType("int");
b.Property<decimal>("Matched3Prize")
.HasColumnType("decimal(18,2)");
b.Property<int>("Matched3Prize")
.HasColumnType("int");
b.Property<decimal>("Matched3PrizeFund")
.HasColumnType("decimal(18,2)");
b.Property<int>("Matched3PrizeFund")
.HasColumnType("int");
b.Property<decimal>("Matched3RolldownPrize")
.HasColumnType("decimal(18,2)");
b.Property<int>("Matched3RolldownPrize")
.HasColumnType("int");
b.Property<decimal>("Matched4Prize")
.HasColumnType("decimal(18,2)");
b.Property<int>("Matched4Prize")
.HasColumnType("int");
b.Property<decimal>("Matched4PrizeFund")
.HasColumnType("decimal(18,2)");
b.Property<int>("Matched4PrizeFund")
.HasColumnType("int");
b.Property<decimal>("Matched4RolldownPrize")
.HasColumnType("decimal(18,2)");
b.Property<int>("Matched4RolldownPrize")
.HasColumnType("int");
b.Property<decimal>("Matched5PlusBonusPrize")
.HasColumnType("decimal(18,2)");
b.Property<int>("Matched5PlusBonusPrize")
.HasColumnType("int");
b.Property<decimal>("Matched5PlusBonusPrizeFund")
.HasColumnType("decimal(18,2)");
b.Property<int>("Matched5PlusBonusPrizeFund")
.HasColumnType("int");
b.Property<decimal>("Matched5PlusBonusRolldownPrize")
.HasColumnType("decimal(18,2)");
b.Property<int>("Matched5PlusBonusRolldownPrize")
.HasColumnType("int");
b.Property<decimal>("Matched5Prize")
.HasColumnType("decimal(18,2)");
b.Property<int>("Matched5Prize")
.HasColumnType("int");
b.Property<decimal>("Matched5PrizeFund")
.HasColumnType("decimal(18,2)");
b.Property<int>("Matched5PrizeFund")
.HasColumnType("int");
b.Property<decimal>("Matched5RolldownPrize")
.HasColumnType("decimal(18,2)");
b.Property<int>("Matched5RolldownPrize")
.HasColumnType("int");
b.Property<decimal>("Matched6Prize")
.HasColumnType("decimal(18,2)");
b.Property<int>("Matched6Prize")
.HasColumnType("int");
b.Property<decimal>("Matched6PrizeFund")
.HasColumnType("decimal(18,2)");
b.Property<int>("Matched6PrizeFund")
.HasColumnType("int");
b.Property<decimal>("Matched6RolldownPrize")
.HasColumnType("decimal(18,2)");
b.Property<int>("Matched6RolldownPrize")
.HasColumnType("int");
b.Property<bool>("Rolldown")
.HasColumnType("bit");
@@ -124,26 +124,26 @@ namespace lottery_co_uk_scraper.data.Migrations
b.Property<bool>("Rollover")
.HasColumnType("bit");
b.Property<decimal>("TotalMatched2")
.HasColumnType("decimal(18,2)");
b.Property<int>("TotalMatched2")
.HasColumnType("int");
b.Property<decimal>("TotalMatched3")
.HasColumnType("decimal(18,2)");
b.Property<int>("TotalMatched3")
.HasColumnType("int");
b.Property<decimal>("TotalMatched4")
.HasColumnType("decimal(18,2)");
b.Property<int>("TotalMatched4")
.HasColumnType("int");
b.Property<decimal>("TotalMatched5")
.HasColumnType("decimal(18,2)");
b.Property<int>("TotalMatched5")
.HasColumnType("int");
b.Property<decimal>("TotalMatched5PlusBonus")
.HasColumnType("decimal(18,2)");
b.Property<int>("TotalMatched5PlusBonus")
.HasColumnType("int");
b.Property<decimal>("TotalMatched6")
.HasColumnType("decimal(18,2)");
b.Property<int>("TotalMatched6")
.HasColumnType("int");
b.Property<decimal>("TotalPrizeFund")
.HasColumnType("decimal(18,2)");
b.Property<int>("TotalPrizeFund")
.HasColumnType("int");
b.Property<int>("TotalWinners")
.HasColumnType("int");

View File

@@ -93,7 +93,7 @@ namespace lottery_co_uk_scraper.NationalLottery
}
}
public static void AssignValueToModelProperty(string sectionTitle, string propertyName, string columnTitle, decimal value, LottoResult lottoResult)
public static void AssignValueToModelProperty(string sectionTitle, string propertyName, string columnTitle, int value, LottoResult lottoResult)
{
switch (sectionTitle)
{
@@ -220,7 +220,7 @@ namespace lottery_co_uk_scraper.NationalLottery
}
}
public static void AssignValueToModelProperty2(string sectionTitle, string propertyName, string columnTitle, decimal value, decimal rolloverPrizePerWinner, LottoResult lottoResult)
public static void AssignValueToModelProperty2(string sectionTitle, string propertyName, string columnTitle, int value, int rolloverPrizePerWinner, LottoResult lottoResult)
{
switch (sectionTitle)
{
@@ -378,14 +378,14 @@ namespace lottery_co_uk_scraper.NationalLottery
{
string prizeText = prizePerWinnerNode.InnerText.Trim().Replace("&pound;", "").Replace(",", "");
decimal prizePerWinner;
int prizePerWinner;
if (prizeText == "Free Ticket")
{
// Set a specific value when the text is "Free Ticket"
prizePerWinner = 99999999999M;
prizePerWinner = 999999999;
}
else if (decimal.TryParse(prizeText, NumberStyles.Currency, CultureInfo.InvariantCulture, out decimal parsedPrize))
else if (int.TryParse(prizeText, NumberStyles.Currency, CultureInfo.InvariantCulture, out int parsedPrize))
{
prizePerWinner = parsedPrize;
}
@@ -402,15 +402,15 @@ namespace lottery_co_uk_scraper.NationalLottery
ParseWinnerPrizeAmount(sectionTitle, columnTitle, prizePerWinner, lottoResult);
}
public static void ParseWinnerPrizeAmount(string sectionTitle, string columnTitle, decimal prizePerWinner, LottoResult lottoResult)
public static void ParseWinnerPrizeAmount(string sectionTitle, string columnTitle, int prizePerWinner, LottoResult lottoResult)
{
AssignValueToModelProperty(sectionTitle, LotteryTableRow.Match2, columnTitle, prizePerWinner, lottoResult);
}
public static void ProcessRolldownWinnerPrizeAmount(string sectionTitle, HtmlNode prizePerWinnerNode, LottoResult lottoResult)
{
decimal regularPrizePerWinner = 0;
decimal rolldownPrizePerWinner = 0;
int regularPrizePerWinner = 0;
int rolldownPrizePerWinner = 0;
string prizeText = prizePerWinnerNode.InnerHtml.Trim().Replace(",", "");
@@ -420,7 +420,7 @@ namespace lottery_co_uk_scraper.NationalLottery
var textNodes = htmlDoc.DocumentNode.DescendantsAndSelf().Where(n => n.NodeType == HtmlNodeType.Text);
var numericValues = textNodes.SelectMany(n => Regex.Matches(n.InnerHtml, @"(\d+)").Cast<Match>())
.Select(match => decimal.Parse(match.Groups[1].Value))
.Select(match => int.Parse(match.Groups[1].Value))
.ToList();
if (numericValues.Count >= 1)
@@ -439,7 +439,7 @@ namespace lottery_co_uk_scraper.NationalLottery
}
else if (prizeText == "Free Ticket")
{
regularPrizePerWinner = 99999999999M;
regularPrizePerWinner = 999999999;
}
else
{
@@ -456,7 +456,7 @@ namespace lottery_co_uk_scraper.NationalLottery
ParseWinnerRolloverPrizeAmount(sectionTitle, columnTitle, regularPrizePerWinner, rolldownPrizePerWinner, lottoResult);
}
public static void ParseWinnerRolloverPrizeAmount(string sectionTitle, string columnTitle, decimal value, decimal rolldownPrizePerWinne, LottoResult lottoResult)
public static void ParseWinnerRolloverPrizeAmount(string sectionTitle, string columnTitle, int value, int rolldownPrizePerWinne, LottoResult lottoResult)
{
AssignValueToModelProperty2(sectionTitle, LotteryTableRow.Match2, columnTitle, value, rolldownPrizePerWinne, lottoResult);
}
@@ -465,14 +465,14 @@ namespace lottery_co_uk_scraper.NationalLottery
{
string prizeFundText = prizeFundNode.InnerText.Trim().Replace("&pound;", "").Replace(",", "");
decimal prizeFund;
int prizeFund;
if (prizeFundText == "-")
{
// Set a specific value when the text is "-"
prizeFund = 99999999999M; // or any other appropriate value
prizeFund = 999999999; // or any other appropriate value
}
else if (decimal.TryParse(prizeFundText, NumberStyles.Currency, CultureInfo.InvariantCulture, out decimal parsedPrizeFund))
else if (int.TryParse(prizeFundText, NumberStyles.Currency, CultureInfo.InvariantCulture, out int parsedPrizeFund))
{
prizeFund = parsedPrizeFund;
}
@@ -489,7 +489,7 @@ namespace lottery_co_uk_scraper.NationalLottery
Console.WriteLine($"Prize fund ({sectionTitle}): {prizeFund}");
}
public static void ParsePrizeFundAmount(string sectionTitle, string columnTitle, decimal prizeFundNode, LottoResult lottoResult)
public static void ParsePrizeFundAmount(string sectionTitle, string columnTitle, int prizeFundNode, LottoResult lottoResult)
{
AssignValueToModelProperty(sectionTitle, LotteryTableRow.Match2, columnTitle, prizeFundNode, lottoResult);
}
@@ -508,7 +508,7 @@ namespace lottery_co_uk_scraper.NationalLottery
}
}
public static void ParseTotalWinners(string sectionTitle, string columnTitle, decimal winnersNode, LottoResult lottoResult)
public static void ParseTotalWinners(string sectionTitle, string columnTitle, int winnersNode, LottoResult lottoResult)
{
AssignValueToModelProperty(sectionTitle, columnTitle, LotteryTableRow.Total, winnersNode, lottoResult);
}
@@ -516,7 +516,7 @@ namespace lottery_co_uk_scraper.NationalLottery
public static void ProcessTotalPrizeFund(string sectionTitle, string columnTitle, HtmlNode totalPrizeFundNode, LottoResult lottoResult)
{
// ToDo: Why is this not used
if (decimal.TryParse(totalPrizeFundNode.InnerText.Trim().Replace("&pound;", "").Replace(",", ""), NumberStyles.Currency, CultureInfo.InvariantCulture, out decimal totalPrizeFund))
if (int.TryParse(totalPrizeFundNode.InnerText.Trim().Replace("&pound;", "").Replace(",", ""), NumberStyles.Currency, CultureInfo.InvariantCulture, out int totalPrizeFund))
{
ParseTotalPrizeFund(sectionTitle, columnTitle, totalPrizeFund, lottoResult);
Console.WriteLine($"Total prize fund ({sectionTitle}): {totalPrizeFund}");
@@ -527,7 +527,7 @@ namespace lottery_co_uk_scraper.NationalLottery
}
}
public static void ParseTotalPrizeFund(string sectionTitle, string columnTitle, decimal winnersNode, LottoResult lottoResult)
public static void ParseTotalPrizeFund(string sectionTitle, string columnTitle, int winnersNode, LottoResult lottoResult)
{
AssignValueToModelProperty(sectionTitle, columnTitle, LotteryTableRow.Total, winnersNode, lottoResult);
}

View File

@@ -40,7 +40,7 @@ namespace lottery_co_uk_scraper.NationalLottery
}
finally
{
client.Dispose();
//client.Dispose();
}
}