Morska FK2 Importer
This commit is contained in:
@@ -173,15 +173,37 @@ namespace WebAPI.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
string? type = importWorker.Records!.FirstOrDefault(x => x.Code == "ImportType")?.Desc1;
|
||||
if (type == null)
|
||||
{
|
||||
type = "Standard";
|
||||
}
|
||||
|
||||
if (type == "FK2")
|
||||
{
|
||||
MorskaFk2Importer importer = new MorskaFk2Importer(db, googleSheetValues, this);
|
||||
importer.import(importWorker);
|
||||
|
||||
logsController.AddEntry(new LogEntry
|
||||
{
|
||||
Title = $"{importWorker!.Name}, {importWorker.Id}",
|
||||
Type = LogEntryType.info,
|
||||
LogType = LogType.import,
|
||||
Message = "Success",
|
||||
CreatedAt = DateTime.UtcNow
|
||||
});
|
||||
return Ok();
|
||||
}
|
||||
|
||||
string? startDate = importWorker.Records!.FirstOrDefault(x => x.Code == "StartDate")?.Desc1;
|
||||
if (startDate == null)
|
||||
{
|
||||
throw new Exception("Year record nod found");
|
||||
throw new Exception("StartDate record nod found");
|
||||
}
|
||||
string? endDate = importWorker.Records!.Where(x => x.Code == "EndDate").First().Desc1;
|
||||
if (endDate == null)
|
||||
{
|
||||
throw new Exception("Year record nod found");
|
||||
throw new Exception("EndDate record nod found");
|
||||
}
|
||||
var startDateParsed = DateTime.ParseExact(startDate!, "yyyy.MM.dd", null);
|
||||
var endDateParsed = DateTime.ParseExact(endDate!, "yyyy.MM.dd", null);
|
||||
@@ -486,7 +508,7 @@ namespace WebAPI.Controllers
|
||||
Console.WriteLine($"DiunaLog: {message}");
|
||||
}
|
||||
}
|
||||
internal bool IsImportedLayerUpToDate(Layer importWorker)
|
||||
private bool IsImportedLayerUpToDate(Layer importWorker)
|
||||
{
|
||||
if (googleSheetValues is null)
|
||||
{
|
||||
@@ -532,7 +554,7 @@ namespace WebAPI.Controllers
|
||||
Record? record = newestLayer.Records!.Where(x => x.Code == data[0][i].ToString()).FirstOrDefault();
|
||||
if (record == null)
|
||||
{
|
||||
WriteToConsole("Code not foundin DiunaBI", data[0][i].ToString()!);
|
||||
WriteToConsole("Code not found in DiunaBI", data[0][i].ToString()!);
|
||||
isUpToDate = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user