Rimozione metodi sync x SPEC
This commit is contained in:
@@ -115,22 +115,22 @@ namespace MP.SPEC.Components.ProdKit
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnInitialized()
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
numRecord = 5;
|
||||
// gestione di base dei KIT
|
||||
string rawVal = MDService.ConfigTryGet("OptAdmKitEnabled");
|
||||
string rawVal = await MDService.ConfigTryGetAsync("OptAdmKitEnabled");
|
||||
if (!string.IsNullOrEmpty(rawVal))
|
||||
{
|
||||
bool.TryParse(rawVal, out OptAdmKitEnabled);
|
||||
}
|
||||
// conf variabili decodifica
|
||||
regExp_KO = MDService.ConfigTryGet("regExp_KO");
|
||||
regExp_OK = MDService.ConfigTryGet("regExp_OK");
|
||||
regExp_KitStart = MDService.ConfigTryGet("regExp_KitStart");
|
||||
regExp_KitSave = MDService.ConfigTryGet("regExp_KitSave");
|
||||
regExp_KO = await MDService.ConfigTryGetAsync("regExp_KO");
|
||||
regExp_OK = await MDService.ConfigTryGetAsync("regExp_OK");
|
||||
regExp_KitStart = await MDService.ConfigTryGetAsync("regExp_KitStart");
|
||||
regExp_KitSave = await MDService.ConfigTryGetAsync("regExp_KitSave");
|
||||
// altre variabili
|
||||
rawVal = MDService.ConfigTryGet("SPEC_nArtSearch");
|
||||
rawVal = await MDService.ConfigTryGetAsync("SPEC_nArtSearch");
|
||||
if (!string.IsNullOrEmpty(rawVal))
|
||||
{
|
||||
int.TryParse(rawVal, out minChar);
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace MP.SPEC.Components.ProdKit
|
||||
isLoading = false;
|
||||
if (string.IsNullOrEmpty(padCodXdl))
|
||||
{
|
||||
padCodXdl = MDService.ConfigTryGet("padCodXdl");
|
||||
padCodXdl = await MDService.ConfigTryGetAsync("padCodXdl");
|
||||
}
|
||||
currPodlRec = null;
|
||||
// recupero user...
|
||||
|
||||
@@ -123,23 +123,22 @@ namespace MP.SPEC.Components
|
||||
EditRecord = null;
|
||||
await ResetDataAsync();
|
||||
}
|
||||
|
||||
protected override void OnInitialized()
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
numRecord = 10;
|
||||
// gestione di base dei KIT
|
||||
string rawVal = MDService.ConfigTryGet("OptAdmKitEnabled");
|
||||
string rawVal = await MDService.ConfigTryGetAsync("OptAdmKitEnabled");
|
||||
if (!string.IsNullOrEmpty(rawVal))
|
||||
{
|
||||
bool.TryParse(rawVal, out OptAdmKitEnabled);
|
||||
}
|
||||
// conf variabili decodifica
|
||||
regExp_KO = MDService.ConfigTryGet("regExp_KO");
|
||||
regExp_OK = MDService.ConfigTryGet("regExp_OK");
|
||||
regExp_KitStart = MDService.ConfigTryGet("regExp_KitStart");
|
||||
regExp_KitSave = MDService.ConfigTryGet("regExp_KitSave");
|
||||
regExp_KO = await MDService.ConfigTryGetAsync("regExp_KO");
|
||||
regExp_OK = await MDService.ConfigTryGetAsync("regExp_OK");
|
||||
regExp_KitStart = await MDService.ConfigTryGetAsync("regExp_KitStart");
|
||||
regExp_KitSave = await MDService.ConfigTryGetAsync("regExp_KitSave");
|
||||
// altre variabili
|
||||
rawVal = MDService.ConfigTryGet("SPEC_nArtSearch");
|
||||
rawVal = await MDService.ConfigTryGetAsync("SPEC_nArtSearch");
|
||||
if (!string.IsNullOrEmpty(rawVal))
|
||||
{
|
||||
int.TryParse(rawVal, out minChar);
|
||||
|
||||
@@ -441,40 +441,6 @@ namespace MP.SPEC.Data
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupero tab config in modalità Sincrona
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<ConfigModel> ConfigGetAll()
|
||||
{
|
||||
using var activity = ActivitySource.StartActivity("ConfigGetAll");
|
||||
string source = "REDIS";
|
||||
List<ConfigModel>? result = new List<ConfigModel>();
|
||||
// cerco in redis...
|
||||
RedisValue rawData = redisDb.StringGet($"{Utils.redisConfKey}_sync");
|
||||
if (!string.IsNullOrEmpty($"{rawData}"))
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<ConfigModel>>($"{rawData}");
|
||||
}
|
||||
else
|
||||
{
|
||||
source = "DB";
|
||||
result = dbController.ConfigGetAll();
|
||||
// serializzo e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
redisDb.StringSet($"{Utils.redisConfKey}_sync", rawData, getRandTOut(redisLongTimeCache));
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<ConfigModel>();
|
||||
}
|
||||
activity?.SetTag("data.source", source);
|
||||
activity?.SetTag("result.count", result.Count);
|
||||
activity?.Stop();
|
||||
LogTrace($"ConfigGetAll Read from {source}: {activity?.Duration.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupero tab config in modalità Asincrona
|
||||
/// </summary>
|
||||
@@ -504,29 +470,6 @@ namespace MP.SPEC.Data
|
||||
LogTrace($"ConfigResetCacheAsync Read from {source}: {activity?.Duration.TotalMilliseconds}ms");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce valore della stringa (SE disponibile)
|
||||
/// </summary>
|
||||
/// <param name="keyName"></param>
|
||||
/// <returns></returns>
|
||||
public string ConfigTryGet(string keyName)
|
||||
{
|
||||
using var activity = ActivitySource.StartActivity("ConfigTryGet");
|
||||
string source = "MEMORY";
|
||||
|
||||
EnsureConfigLoaded();
|
||||
|
||||
_configData.TryGetValue(keyName, out var value);
|
||||
|
||||
activity?.SetTag("data.source", source);
|
||||
activity?.Stop();
|
||||
if (activity?.Duration.TotalMilliseconds > slowLogThresh)
|
||||
{
|
||||
LogTrace($"ConfigTryGet | {keyName} | {source} | {activity?.Duration.TotalMilliseconds}ms");
|
||||
}
|
||||
return value ?? "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce valore della stringa (SE disponibile) - modalità async
|
||||
/// </summary>
|
||||
@@ -2608,18 +2551,6 @@ namespace MP.SPEC.Data
|
||||
}
|
||||
}
|
||||
|
||||
private void EnsureConfigLoaded()
|
||||
{
|
||||
if (_configData.Count == 0)
|
||||
{
|
||||
var list = ConfigGetAll();
|
||||
|
||||
_configData = list
|
||||
.GroupBy(x => x.Chiave)
|
||||
.ToDictionary(g => g.Key, g => g.First().Valore);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task EnsureConfigLoadedAsync()
|
||||
{
|
||||
if (_configData.Count == 0)
|
||||
|
||||
@@ -196,30 +196,30 @@ namespace MP.SPEC.Pages
|
||||
await ResetDataAsync();
|
||||
}
|
||||
|
||||
protected override void OnInitialized()
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
numRecord = 10;
|
||||
string rawVal = MDService.ConfigTryGet("SPEC_nArtSearch");
|
||||
string rawVal = await MDService.ConfigTryGetAsync("SPEC_nArtSearch");
|
||||
if (!string.IsNullOrEmpty(rawVal))
|
||||
{
|
||||
int.TryParse(rawVal, out minChar);
|
||||
}
|
||||
rawVal = MDService.ConfigTryGet("AZIENDA");
|
||||
rawVal = await MDService.ConfigTryGetAsync("AZIENDA");
|
||||
if (!string.IsNullOrEmpty(rawVal))
|
||||
{
|
||||
CodAzienda = rawVal;
|
||||
}
|
||||
rawVal = MDService.ConfigTryGet("SPEC_Kit_enabCount");
|
||||
rawVal = await MDService.ConfigTryGetAsync("SPEC_Kit_enabCount");
|
||||
if (!string.IsNullOrEmpty(rawVal))
|
||||
{
|
||||
bool.TryParse(rawVal, out enabKitCount);
|
||||
}
|
||||
rawVal = MDService.ConfigTryGet("SPEC_Kit_enabSearch");
|
||||
rawVal = await MDService.ConfigTryGetAsync("SPEC_Kit_enabSearch");
|
||||
if (!string.IsNullOrEmpty(rawVal))
|
||||
{
|
||||
bool.TryParse(rawVal, out enabKitSearch);
|
||||
}
|
||||
rawVal = MDService.ConfigTryGet("SPEC_Kit_enabFreeCodArt");
|
||||
rawVal = await MDService.ConfigTryGetAsync("SPEC_Kit_enabFreeCodArt");
|
||||
if (!string.IsNullOrEmpty(rawVal))
|
||||
{
|
||||
bool.TryParse(rawVal, out enabFreeCodArt);
|
||||
|
||||
@@ -146,22 +146,22 @@ namespace MP.SPEC.Pages
|
||||
await ResetDataAsync();
|
||||
}
|
||||
|
||||
protected override void OnInitialized()
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
numRecord = 10;
|
||||
// gestione di base dei KIT
|
||||
string rawVal = MDService.ConfigTryGet("OptAdmKitEnabled");
|
||||
string rawVal = await MDService.ConfigTryGetAsync("OptAdmKitEnabled");
|
||||
if (!string.IsNullOrEmpty(rawVal))
|
||||
{
|
||||
bool.TryParse(rawVal, out OptAdmKitEnabled);
|
||||
}
|
||||
// conf variabili decodifica
|
||||
regExp_KO = MDService.ConfigTryGet("regExp_KO");
|
||||
regExp_OK = MDService.ConfigTryGet("regExp_OK");
|
||||
regExp_KitStart = MDService.ConfigTryGet("regExp_KitStart");
|
||||
regExp_KitSave = MDService.ConfigTryGet("regExp_KitSave");
|
||||
regExp_KO = await MDService.ConfigTryGetAsync("regExp_KO");
|
||||
regExp_OK = await MDService.ConfigTryGetAsync("regExp_OK");
|
||||
regExp_KitStart = await MDService.ConfigTryGetAsync("regExp_KitStart");
|
||||
regExp_KitSave = await MDService.ConfigTryGetAsync("regExp_KitSave");
|
||||
// altre variabili
|
||||
rawVal = MDService.ConfigTryGet("SPEC_nArtSearch");
|
||||
rawVal = await MDService.ConfigTryGetAsync("SPEC_nArtSearch");
|
||||
if (!string.IsNullOrEmpty(rawVal))
|
||||
{
|
||||
int.TryParse(rawVal, out minChar);
|
||||
|
||||
Reference in New Issue
Block a user