R3 processor

This commit is contained in:
Michał Zieliński
2024-12-21 21:35:27 +01:00
parent dc3d4c19c3
commit 1fc00ac419
6 changed files with 264 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
using WebAPI.Models;
using System.Text.RegularExpressions;
using WebAPI.Models;
namespace DiunaBIWebAPI.dataProcessors;
@@ -172,4 +173,40 @@ public static class ProcessHelper
}
return codesList;
}
public static string? ExtractMonthFromLayerName(string layerName)
{
string pattern = @"L\d+-P-\d{4}/(\d{2})-";
var match = Regex.Match(layerName, pattern);
if (match.Success && match.Groups.Count > 1)
{
return match.Groups[1].Value;
}
return null;
}
public static string GetSheetName(int month, int year)
{
if (month < 1 || month > 12)
{
throw new ArgumentOutOfRangeException(nameof(month), "Month must be between 1 and 12.");
}
var polishMonths = new[]
{
"Styczen",
"Luty",
"Marzec",
"Kwiecien",
"Maj",
"Czerwiec",
"Lipiec",
"Sierpien",
"Wrzesien",
"Pazdziernik",
"Listopad",
"Grudzien"
};
var monthName = polishMonths[month - 1];
return $"{monthName}_{year}";
}
}