Aggiunta metodo GetIdlePeriod
This commit is contained in:
@@ -55,6 +55,22 @@ namespace MP.Data.Controllers
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
/// <summary>
|
||||
/// Restituisce l'anagrafica STATI per intero
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<AnagStatiModel>> AnagStatiGetAllAsync()
|
||||
{
|
||||
List<AnagStatiModel> dbResult = new List<AnagStatiModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = await dbCtx
|
||||
.DbSetAnagStati
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco tabella decodifica articoli / codice decimale
|
||||
@@ -612,18 +628,18 @@ namespace MP.Data.Controllers
|
||||
/// Elenco da tabella MappaStatoExplModel
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<MappaStatoExplModel> MseGetAll(int maxAge = 2000)
|
||||
public async Task<List<MappaStatoExplModel>> MseGetAllAsync(int maxAge = 2000)
|
||||
{
|
||||
List<MappaStatoExplModel> dbResult = new List<MappaStatoExplModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
var maxAgeSec = new SqlParameter("@maxAgeSec", maxAge);
|
||||
|
||||
dbResult = dbCtx
|
||||
.DbSetMSE
|
||||
.FromSqlRaw("EXEC stp_MSE_getData @maxAgeSec", maxAgeSec)
|
||||
.AsNoTracking()
|
||||
.ToList();
|
||||
dbResult = await dbCtx
|
||||
.DbSetMSE
|
||||
.FromSqlRaw("EXEC stp_MSE_getData @maxAgeSec", maxAgeSec)
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
@@ -320,6 +320,10 @@ namespace MP.Data.Services
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco da tabella MappaStatoExplModel
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<MappaStatoExplModel>> MseGetAll(bool forceDb = false)
|
||||
{
|
||||
Stopwatch sw = new Stopwatch();
|
||||
@@ -327,10 +331,10 @@ namespace MP.Data.Services
|
||||
sw.Start();
|
||||
List<MappaStatoExplModel>? result = new List<MappaStatoExplModel>();
|
||||
// cerco in _redisConn...
|
||||
RedisValue rawData = redisDb.StringGet(Constants.redisMseKey);
|
||||
RedisValue rawData = await redisDb.StringGetAsync(Constants.redisMseKey);
|
||||
if (rawData.HasValue && !forceDb)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<MappaStatoExplModel>>($"{rawData}");
|
||||
result = JsonConvert.DeserializeObject<List<MappaStatoExplModel>>($"{rawData}") ?? new();
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user