cambio gestione sessioni chiuse/aperte
This commit is contained in:
@@ -581,14 +581,23 @@ namespace MP.Data.Controllers
|
||||
/// <param name="FromDate"></param>
|
||||
/// <param name="ToDate"></param>
|
||||
/// <returns></returns>
|
||||
public List<InventorySessionModel> InventSessHistList(DateTime FromDate, DateTime ToDate)
|
||||
public List<InventorySessionModel> InventSessHistList()
|
||||
{
|
||||
List<InventorySessionModel> dbResult = new List<InventorySessionModel>();
|
||||
using (var dbCtx = new MoonPro_InveContext(_configuration))
|
||||
{
|
||||
#if false
|
||||
dbResult = dbCtx
|
||||
.DbInveSess
|
||||
.Where(x => x.DtStart >= FromDate && x.DtStart <= ToDate && x.DtEnd != null)
|
||||
.Include(m => m.AnagMagNav)
|
||||
.AsNoTracking()
|
||||
.OrderByDescending(x => x.DtStart)
|
||||
.ToList();
|
||||
#endif
|
||||
dbResult = dbCtx
|
||||
.DbInveSess
|
||||
.Where(x => x.DtStart >= FromDate && x.DtStart <= ToDate && x.DtEnd != null)
|
||||
.Where(x => x.Transferred)
|
||||
.Include(m => m.AnagMagNav)
|
||||
.AsNoTracking()
|
||||
.OrderByDescending(x => x.DtStart)
|
||||
@@ -608,7 +617,7 @@ namespace MP.Data.Controllers
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbInveSess
|
||||
.Where(x => x.DtEnd == null)
|
||||
.Where(x => (x.DtEnd == null) || !(x.Transferred))
|
||||
.Include(m => m.AnagMagNav)
|
||||
.AsNoTracking()
|
||||
.OrderByDescending(x => x.DtStart)
|
||||
|
||||
@@ -170,7 +170,7 @@ namespace MP.INVE.Components
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = MIDataservice.InventSessHistList(dtStart, dtEnd);
|
||||
SearchRecords = MIDataservice.InventSessHistList();
|
||||
}
|
||||
totalCount = SearchRecords.Count;
|
||||
elencoSessioni = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
|
||||
|
||||
@@ -595,14 +595,14 @@ namespace MP.INVE.Data
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<InventorySessionModel> InventSessHistList(DateTime dtStart, DateTime dtEnd)
|
||||
public List<InventorySessionModel> InventSessHistList()
|
||||
{
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
List<InventorySessionModel> result = new List<InventorySessionModel>();
|
||||
string source = "DB";
|
||||
// cerco in redis...
|
||||
RedisValue rawData = redisDb.StringGet($"{redisSessionHistList}:{dtStart:yyyyMMdd_HHmmss}:{dtEnd:yyyyMMdd_HHmmss}");
|
||||
RedisValue rawData = redisDb.StringGet($"{redisSessionHistList}");
|
||||
if (!string.IsNullOrEmpty($"{rawData}"))
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<InventorySessionModel>>($"{rawData}");
|
||||
@@ -610,7 +610,7 @@ namespace MP.INVE.Data
|
||||
}
|
||||
else
|
||||
{
|
||||
result = dbController.InventSessHistList(dtStart, dtEnd);
|
||||
result = dbController.InventSessHistList();
|
||||
// serializzo e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
redisDb.StringSetAsync(redisSessionHistList, rawData, getRandTOut(redisLongTimeCache));
|
||||
|
||||
Reference in New Issue
Block a user