This commit is contained in:
Samuele Locatelli
2023-10-06 15:49:13 +02:00
5 changed files with 22 additions and 16 deletions
+9 -4
View File
@@ -6,6 +6,7 @@ using NLog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace MP.Data.Controllers
{
@@ -27,15 +28,19 @@ namespace MP.Data.Controllers
/// Restituisce l'anagrafica EVENTI per intero
/// </summary>
/// <returns></returns>
public List<AnagEventiModel> AnagEventiGetAll()
public List<AnagEventiModel> AnagEventiGetAll(string IdxMac)
{
List<AnagEventiModel> dbResult = new List<AnagEventiModel>();
using (var dbCtx = new MoonProContext(_configuration))
{
var IdxMacch = new SqlParameter("@idxMacchina", IdxMac);
dbResult = dbCtx
.DbSetAnagEventi
.AsNoTracking()
.ToList();
.DbSetAnagEventi
.FromSqlRaw("exec dbo.stp_vseb_getByIdxMacchinaFull @idxMacchina", IdxMacch)
.AsNoTracking()
.AsEnumerable()
.ToList();
}
return dbResult;
}
+1 -5
View File
@@ -13,12 +13,8 @@ namespace MP.Data.DatabaseModels
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int IdxTipo { get; set; } = 0;
public string Nome { get; set; } = "";
public string TabAzione { get; set; } = "";
public string Azione { get; set; } = "";
public string KeyEvento { get; set; } = "";
public string Label { get; set; } = "";
public bool EventoTablet { get; set; } = true;
public string NoteEvento { get; set; } = "";
public string CssClass { get; set; } = "";
public string Icon { get; set; } = "";
}
+2 -2
View File
@@ -106,7 +106,7 @@ namespace MP.Data.Services
sw.Start();
List<AnagEventiModel>? result = new List<AnagEventiModel>();
// cerco in redis...
string currKey = $"{redisBaseKey}:AnagEventi";
string currKey = $"{redisBaseKey}:AnagEventi:{IdxMacch}";
RedisValue rawData = await redisDb.StringGetAsync(currKey);
if (!string.IsNullOrEmpty($"{rawData}"))
{
@@ -115,7 +115,7 @@ namespace MP.Data.Services
}
else
{
result = dbTabController.AnagEventiGetAll();
result = dbTabController.AnagEventiGetAll(IdxMacch);
// serializzp e salvo...
rawData = JsonConvert.SerializeObject(result);
await redisDb.StringSetAsync(currKey, rawData, LongCache);