CodeMaid + inizio fix conf string const x SPEC

This commit is contained in:
Samuele Locatelli
2023-02-15 19:37:50 +01:00
parent 2fffbf5bb8
commit 221a39ceaf
5 changed files with 58 additions and 59 deletions
+54 -55
View File
@@ -71,54 +71,10 @@ namespace MP.SPEC.Data
#endregion Public Properties
/// <summary>
/// Init ricetta
/// </summary>
/// <param name="confPath"></param>
/// <param name="idxPODL"></param>
/// <param name="CalcArgs"></param>
/// <returns></returns>
public RecipeModel InitRecipe(string confPath, int idxPODL, Dictionary<string, string> CalcArgs)
{
return mongoController.InitRecipe(confPath, idxPODL, CalcArgs);
}
/// <summary>
/// Salva ricetta su MongoDB
/// </summary>
/// <param name="currRecord"></param>
/// <returns></returns>
public async Task<bool> RecipeSetByPODL(RecipeModel currRecord)
{
bool answ = false;
answ = await mongoController.RecipeSetByPODL(currRecord);
return answ;
}
/// <summary>
/// Ricerca ricetta su MongoDB dato PODL
/// </summary>
/// <param name="idxPODL"></param>
/// <returns></returns>
public async Task<RecipeModel?> RecipeGetByPODL(int idxPODL)
{
RecipeModel? result = null;
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string readType = "MongoDB";
result = await mongoController.RecipeGetByPODL(idxPODL);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"RecipeGetByPODL | Read from {readType}: {ts.TotalMilliseconds}ms");
return result;
}
public string CalcRecipe(RecipeModel currRecipe)
{
return mongoController.CalcRecipe(currRecipe);
}
#region Public Methods
/// <summary>
/// Recupera eventuali azioni richieste
/// </summary>
@@ -129,7 +85,7 @@ namespace MP.SPEC.Data
stopWatch.Start();
DisplayAction? result = null;
// cerco in redis...
RedisValue rawData = await redisDb.StringGetAsync(redisActionReq);
RedisValue rawData = await redisDb.StringGetAsync(Utils.redisActionReq);
if (!string.IsNullOrEmpty($"{rawData}"))
{
result = JsonConvert.DeserializeObject<DisplayAction>($"{rawData}");
@@ -157,8 +113,7 @@ namespace MP.SPEC.Data
// cerco in redis...
string rawData = JsonConvert.SerializeObject(act2save);
// invio broadcast + salvo in redis
BroadastMsgPipe.saveAndSendMessage(redisActionReq, rawData);
//await redisDb.StringSetAsync(redisActionReq, rawData);
BroadastMsgPipe.saveAndSendMessage(Utils.redisActionReq, rawData);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"ActionSetReq REDIS send to broadcast + Write cache: {ts.TotalMilliseconds}ms");
@@ -171,7 +126,7 @@ namespace MP.SPEC.Data
stopWatch.Start();
List<ListValues>? result = new List<ListValues>();
// cerco in redis...
RedisValue rawData = await redisDb.StringGetAsync(redisStatoCom);
RedisValue rawData = await redisDb.StringGetAsync(Utils.redisStatoCom);
if (!string.IsNullOrEmpty($"{rawData}"))
{
result = JsonConvert.DeserializeObject<List<ListValues>>($"{rawData}");
@@ -184,7 +139,7 @@ namespace MP.SPEC.Data
result = await Task.FromResult(dbController.AnagStatiComm());
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
await redisDb.StringSetAsync(redisStatoCom, rawData, getRandTOut(redisLongTimeCache));
await redisDb.StringSetAsync(Utils.redisStatoCom, rawData, getRandTOut(redisLongTimeCache));
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"AnagStatiComm Read from DB: {ts.TotalMilliseconds}ms");
@@ -390,6 +345,11 @@ namespace MP.SPEC.Data
return answ;
}
public string CalcRecipe(RecipeModel currRecipe)
{
return mongoController.CalcRecipe(currRecipe);
}
public async Task<List<ConfigModel>> ConfigGetAll()
{
Stopwatch stopWatch = new Stopwatch();
@@ -755,6 +715,18 @@ namespace MP.SPEC.Data
return outVal;
}
/// <summary>
/// Init ricetta
/// </summary>
/// <param name="confPath"></param>
/// <param name="idxPODL"></param>
/// <param name="CalcArgs"></param>
/// <returns></returns>
public RecipeModel InitRecipe(string confPath, int idxPODL, Dictionary<string, string> CalcArgs)
{
return mongoController.InitRecipe(confPath, idxPODL, CalcArgs);
}
/// <summary>
/// </summary>
/// <param name="IdxOdl">id odl da cercare</param>
@@ -1357,6 +1329,36 @@ namespace MP.SPEC.Data
return dbResult;
}
/// <summary>
/// Ricerca ricetta su MongoDB dato PODL
/// </summary>
/// <param name="idxPODL"></param>
/// <returns></returns>
public async Task<RecipeModel?> RecipeGetByPODL(int idxPODL)
{
RecipeModel? result = null;
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string readType = "MongoDB";
result = await mongoController.RecipeGetByPODL(idxPODL);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"RecipeGetByPODL | Read from {readType}: {ts.TotalMilliseconds}ms");
return result;
}
/// <summary>
/// Salva ricetta su MongoDB
/// </summary>
/// <param name="currRecord"></param>
/// <returns></returns>
public async Task<bool> RecipeSetByPODL(RecipeModel currRecord)
{
bool answ = false;
answ = await mongoController.RecipeSetByPODL(currRecord);
return answ;
}
/// <summary>
/// Statistiche ODL calcolate (da stored stp_STAT_ODL)
/// </summary>
@@ -1544,14 +1546,11 @@ namespace MP.SPEC.Data
private const string redisPOdlByOdl = redisXdlData + "POdlByOdl";
private const string redisPOdlByPOdl = redisXdlData + "POdlByPOdl";
private const string redisPOdlList = redisXdlData + "POdlList";
private const string redisRecipeConf = redisBaseAddrSpec + "Cache:Recipe:Conf";
private const string redisStatoCom = redisBaseAddrSpec + "Cache:StatoCom";
private const string redisTipoArt = redisBaseAddrSpec + "Cache:TipoArt";
private const string redisVocabolario = redisBaseAddrSpec + "Cache:Vocabolario";
private const string redisXdlData = redisBaseAddrSpec + "Cache:XDL:";
private const string redisRecipeConf = redisBaseAddrSpec + "Cache:Recipe:Conf";
private static IConfiguration _configuration = null!;
private static ILogger<MpDataService> _logger = null!;
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.SPEC</RootNamespace>
<Version>6.16.2302.1419</Version>
<Version>6.16.2302.1519</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 6.16.2302.1419</h4>
<h4>Versione: 6.16.2302.1519</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2302.1419
6.16.2302.1519
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2302.1419</version>
<version>6.16.2302.1519</version>
<url>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/MP.SPEC.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>