Refactor code to .NET8

This commit is contained in:
Michał Zieliski
2024-06-18 22:24:04 +02:00
parent c54b9b0e00
commit 3485ab26b0
10 changed files with 21 additions and 21 deletions

View File

@@ -31,7 +31,7 @@ public class T1R1Processor
{
var year = int.Parse(processWorker.Records?.SingleOrDefault(x => x.Code == "Year")?.Desc1!);
var sources = processWorker.Records?.Where(x => x.Code == "Source").ToList();
if (!sources!.Any())
if (sources!.Count == 0)
{
throw new Exception("Source record not found");
}
@@ -71,7 +71,7 @@ public class T1R1Processor
var dataSources = new List<Layer>();
foreach (var source in sources!)
foreach (var source in sources)
{
for (var month = 1; month <= DateTime.UtcNow.Month; month++)
{

View File

@@ -23,7 +23,7 @@ public class T3MultiSourceCopySelectedCodesProcessor
var year = int.Parse(processWorker.Records?.SingleOrDefault(x => x.Code == "Year")?.Desc1!);
var month = int.Parse(processWorker.Records?.SingleOrDefault(x => x.Code == "Month")?.Desc1!);
var sources = processWorker.Records?.Where(x => x.Code == "Source").ToList();
if (!sources!.Any())
if (sources!.Count == 0)
{
throw new Exception("Source record not found");
}
@@ -62,7 +62,7 @@ public class T3MultiSourceCopySelectedCodesProcessor
processedLayer.ModifiedById = Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D");
processedLayer.ModifiedAt = DateTime.UtcNow;
var dataSources = sources!.Select(source => _db.Layers.Where(x => x.Type == LayerType.Processed && !x.IsDeleted && x.Name != null && x.Name.Contains($"{year}/{month}-{source.Desc1}-T3"))
var dataSources = sources.Select(source => _db.Layers.Where(x => x.Type == LayerType.Processed && !x.IsDeleted && x.Name != null && x.Name.Contains($"{year}/{month}-{source.Desc1}-T3"))
.Include(x => x.Records)
.FirstOrDefault())
.OfType<Layer>()

View File

@@ -27,7 +27,7 @@ public class T3MultiSourceSummaryProcessor
var year = int.Parse(processWorker.Records?.SingleOrDefault(x => x.Code == "Year")?.Desc1!);
var month = int.Parse(processWorker.Records?.SingleOrDefault(x => x.Code == "Month")?.Desc1!);
var sources = processWorker.Records?.Where(x => x.Code == "Source").ToList();
if (!sources!.Any())
if (sources!.Count == 0)
{
throw new Exception("Source record not found");
}
@@ -61,7 +61,7 @@ public class T3MultiSourceSummaryProcessor
var newRecords = new List<Record>();
var dataSources = sources!.Select(source => _db.Layers.Where(x => x.Type == LayerType.Processed && !x.IsDeleted && x.Name != null && x.Name.Contains($"{year}/{month}-{source.Desc1}-T3"))
var dataSources = sources.Select(source => _db.Layers.Where(x => x.Type == LayerType.Processed && !x.IsDeleted && x.Name != null && x.Name.Contains($"{year}/{month}-{source.Desc1}-T3"))
.Include(x => x.Records)
.FirstOrDefault())
.OfType<Layer>()
@@ -98,7 +98,7 @@ public class T3MultiSourceSummaryProcessor
// Dynamic Codes
var dynamicCodes = processWorker.Records?.Where(x => x.Code == "DynamicCode").ToList();
if (dynamicCodes != null && dynamicCodes.Any())
if (dynamicCodes != null && dynamicCodes.Count != 0)
{
foreach (var dynamicCode in dynamicCodes)
{

View File

@@ -26,7 +26,7 @@ public class T3MultiSourceYearSummaryProcessor
{
var year = int.Parse(processWorker.Records?.SingleOrDefault(x => x.Code == "Year")?.Desc1!);
var sources = processWorker.Records?.Where(x => x.Code == "Source").ToList();
if (!sources!.Any())
if (sources!.Count == 0)
{
throw new Exception("Source record not found");
}
@@ -60,7 +60,7 @@ public class T3MultiSourceYearSummaryProcessor
var newRecords = new List<Record>();
var dataSources = sources!.Select(source => _db.Layers.Where(x => x.Type == LayerType.Processed && !x.IsDeleted && x.Name != null && x.Name.Contains($"{year}/13-{source.Desc1}-T3"))
var dataSources = sources.Select(source => _db.Layers.Where(x => x.Type == LayerType.Processed && !x.IsDeleted && x.Name != null && x.Name.Contains($"{year}/13-{source.Desc1}-T3"))
.Include(x => x.Records)
.FirstOrDefault())
.OfType<Layer>()
@@ -120,7 +120,7 @@ public class T3MultiSourceYearSummaryProcessor
// Dynamic Codes
var dynamicCodes = processWorker.Records?.Where(x => x.Code == "DynamicCode").ToList();
if (dynamicCodes != null && dynamicCodes.Any())
if (dynamicCodes != null && dynamicCodes.Count != 0)
{
foreach (var dynamicCode in dynamicCodes)
{

View File

@@ -26,7 +26,7 @@ public class T4R2Processor
{
var year = int.Parse(processWorker.Records?.SingleOrDefault(x => x.Code == "Year")?.Desc1!);
var sources = processWorker.Records?.Where(x => x.Code == "Source").ToList();
if (!sources!.Any())
if (sources!.Count == 0)
{
throw new Exception("Source record not found");
}
@@ -68,7 +68,7 @@ public class T4R2Processor
var newRecords = new List<Record>();
foreach (var source in sources!)
foreach (var source in sources)
{
var rawSourceCodes = processWorker.Records?.SingleOrDefault(x => x.Code == $"Codes-{source.Desc1}")
?.Desc1;