T3-SingleSource Layer name fix

This commit is contained in:
Michał Zieliński
2023-12-01 15:19:19 +01:00
parent e174a02b54
commit add95e3dfe

View File

@@ -29,16 +29,21 @@ namespace WebAPI.dataProcessors
{
int year = int.Parse(processWorker?.Records?.SingleOrDefault(x => x.Code == "Year")?.Desc1!);
int month = int.Parse(processWorker?.Records?.SingleOrDefault(x => x.Code == "Month")?.Desc1!);
string? source = processWorker?.Records?.SingleOrDefault(x => x.Code == "Source")?.Desc1;
if (source == null)
string? sourceLayer = processWorker?.Records?.SingleOrDefault(x => x.Code == "SourceLayer")?.Desc1;
if (sourceLayer == null)
{
throw new Exception("Source record not found");
throw new Exception("SourceLayer record not found");
}
Layer? sourceImportWorker = db.Layers.SingleOrDefault(x => x.Name == source);
Layer? sourceImportWorker = db.Layers.SingleOrDefault(x => x.Name == sourceLayer);
if (sourceImportWorker == null)
{
throw new Exception("SourceImportWorkerL layer not found");
}
string? source= processWorker?.Records?.SingleOrDefault(x => x.Code == "Source")?.Desc1;
if (sourceLayer == null)
{
throw new Exception("Source record not found");
}
Layer? processedLayer = db.Layers
.Where(x => x.ParentId == processWorker!.Id)