|
|
|
@@ -1,4 +1,8 @@
|
|
|
|
|
using Microsoft.Extensions.Caching.Distributed;
|
|
|
|
|
using Core;
|
|
|
|
|
using Core.DTO;
|
|
|
|
|
using LiMan.DB.DBModels;
|
|
|
|
|
using Microsoft.AspNetCore.Identity.UI.Services;
|
|
|
|
|
using Microsoft.Extensions.Caching.Distributed;
|
|
|
|
|
using Microsoft.Extensions.Caching.Memory;
|
|
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
@@ -7,13 +11,8 @@ using NLog;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Microsoft.AspNetCore.Identity.UI.Services;
|
|
|
|
|
using Core;
|
|
|
|
|
using Core.DTO;
|
|
|
|
|
using LiMan.DB.DBModels;
|
|
|
|
|
|
|
|
|
|
namespace LiMan.UI.Data
|
|
|
|
|
{
|
|
|
|
@@ -41,12 +40,6 @@ namespace LiMan.UI.Data
|
|
|
|
|
|
|
|
|
|
#endregion Private Fields
|
|
|
|
|
|
|
|
|
|
#region Protected Fields
|
|
|
|
|
|
|
|
|
|
protected static string connStringBBM = "";
|
|
|
|
|
|
|
|
|
|
#endregion Protected Fields
|
|
|
|
|
|
|
|
|
|
#region Public Fields
|
|
|
|
|
|
|
|
|
|
public static GLS.Controllers.LicManController dbControllerGLS;
|
|
|
|
@@ -84,6 +77,16 @@ namespace LiMan.UI.Data
|
|
|
|
|
|
|
|
|
|
#region Private Methods
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Hash Redis contenente i dati MP di una specifico TYPE (es StatusMacchina, StateMachineIngressi, ...)
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="dataType"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
private static string mHash(string dataType)
|
|
|
|
|
{
|
|
|
|
|
return $"DATA:{dataType}";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private DistributedCacheEntryOptions cacheOpt(bool fastCache)
|
|
|
|
|
{
|
|
|
|
|
var numSecAbsExp = fastCache ? chAbsExp : chAbsExp * 10;
|
|
|
|
@@ -105,17 +108,6 @@ namespace LiMan.UI.Data
|
|
|
|
|
|
|
|
|
|
#region Internal Methods
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Effettua sblocco di una licenza impostando data veto a oggi
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="idxSubLic"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<bool> AttivazioneUnlock(int idxSubLic)
|
|
|
|
|
{
|
|
|
|
|
bool fatto = dbControllerNext.AttivazioniUnlock(idxSubLic);
|
|
|
|
|
await Task.Delay(1);
|
|
|
|
|
return fatto;
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Effettua sblocco di una licenza impostando data veto a oggi
|
|
|
|
|
/// </summary>
|
|
|
|
@@ -132,16 +124,6 @@ namespace LiMan.UI.Data
|
|
|
|
|
|
|
|
|
|
#region Public Methods
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Hash Redis contenente i dati MP di una specifico TYPE (es StatusMacchina, StateMachineIngressi, ...)
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="dataType"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static string mHash(string dataType)
|
|
|
|
|
{
|
|
|
|
|
return $"DATA:{dataType}";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<List<GLS.DatabaseModels.AnagApplicazioni>> ApplicazioniGLSGetAll()
|
|
|
|
|
{
|
|
|
|
|
List<GLS.DatabaseModels.AnagApplicazioni> dbResult = new List<GLS.DatabaseModels.AnagApplicazioni>();
|
|
|
|
@@ -224,6 +206,18 @@ namespace LiMan.UI.Data
|
|
|
|
|
return await Task.FromResult(done);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Effettua sblocco di una licenza impostando data veto a oggi
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="idxSubLic"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<bool> AttivazioneUnlock(int idxSubLic)
|
|
|
|
|
{
|
|
|
|
|
bool fatto = dbControllerNext.AttivazioniUnlock(idxSubLic);
|
|
|
|
|
await Task.Delay(1);
|
|
|
|
|
return fatto;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Recupera attivazioni data licenza
|
|
|
|
|
/// </summary>
|
|
|
|
@@ -252,6 +246,23 @@ namespace LiMan.UI.Data
|
|
|
|
|
dbControllerGLS.Dispose();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Elenco file registrati dato ticket id
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="idxTicket">Identificativo del ticket</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<List<FileAttachModel>> FileGetFilt(int idxTicket)
|
|
|
|
|
{
|
|
|
|
|
List<FileAttachModel> dbResult = new List<FileAttachModel>();
|
|
|
|
|
Stopwatch stopWatch = new Stopwatch();
|
|
|
|
|
stopWatch.Start();
|
|
|
|
|
dbResult = dbControllerNext.FileGetFilt(idxTicket);
|
|
|
|
|
stopWatch.Stop();
|
|
|
|
|
TimeSpan ts = stopWatch.Elapsed;
|
|
|
|
|
Log.Trace($"Effettuata lettura da DB per FileGetFilt: {ts.TotalMilliseconds} ms");
|
|
|
|
|
return await Task.FromResult(dbResult);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<List<GLS.DatabaseModels.AnagInstallazioni>> InstallazioniGLSGetAll()
|
|
|
|
|
{
|
|
|
|
|
List<GLS.DatabaseModels.AnagInstallazioni> dbResult = new List<GLS.DatabaseModels.AnagInstallazioni>();
|
|
|
|
@@ -540,24 +551,6 @@ namespace LiMan.UI.Data
|
|
|
|
|
return await Task.FromResult(dbResult);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Elenco file registrati dato ticket id
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="idxTicket">Identificativo del ticket</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<List<FileAttachModel>> FileGetFilt(int idxTicket)
|
|
|
|
|
{
|
|
|
|
|
List<FileAttachModel> dbResult = new List<FileAttachModel>();
|
|
|
|
|
Stopwatch stopWatch = new Stopwatch();
|
|
|
|
|
stopWatch.Start();
|
|
|
|
|
dbResult = dbControllerNext.FileGetFilt(idxTicket);
|
|
|
|
|
stopWatch.Stop();
|
|
|
|
|
TimeSpan ts = stopWatch.Elapsed;
|
|
|
|
|
Log.Trace($"Effettuata lettura da DB per FileGetFilt: {ts.TotalMilliseconds} ms");
|
|
|
|
|
return await Task.FromResult(dbResult);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<bool> LicenzeNextUpdate(DB.DBModels.LicenzaModel currItem)
|
|
|
|
|
{
|
|
|
|
|
bool done = false;
|
|
|
|
@@ -594,6 +587,59 @@ namespace LiMan.UI.Data
|
|
|
|
|
return answ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Recupera elenco Tickets filtrato
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="CurrFilter"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<List<TicketDTO>> TicketsGetAll()
|
|
|
|
|
{
|
|
|
|
|
Stopwatch stopWatch = new Stopwatch();
|
|
|
|
|
List<TicketDTO> dbResult = new List<TicketDTO>();
|
|
|
|
|
stopWatch.Start();
|
|
|
|
|
dbResult = dbControllerNext.TicketGetAll(false, 1000);
|
|
|
|
|
stopWatch.Stop();
|
|
|
|
|
TimeSpan ts = stopWatch.Elapsed;
|
|
|
|
|
Log.Trace($"Effettuata lettura da DB per TicketsGetAll: {ts.TotalMilliseconds} ms");
|
|
|
|
|
return await Task.FromResult(dbResult);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Recupera elenco Tickets filtrato
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="CurrFilter"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<List<TicketDTO>> TicketsGetFilt(SelectNext CurrFilter)
|
|
|
|
|
{
|
|
|
|
|
Stopwatch stopWatch = new Stopwatch();
|
|
|
|
|
List<TicketDTO> dbResult = new List<TicketDTO>();
|
|
|
|
|
stopWatch.Start();
|
|
|
|
|
dbResult = dbControllerNext.TicketGetFiltAllLic(CurrFilter.OnlyActive, Core.TipologiaTicket.ND, CurrFilter.ApplicazioneSel, CurrFilter.InstallazioneSel, 1000);
|
|
|
|
|
stopWatch.Stop();
|
|
|
|
|
TimeSpan ts = stopWatch.Elapsed;
|
|
|
|
|
Log.Trace($"Effettuata lettura da DB per TicketsGetFilt: {ts.TotalMilliseconds} ms");
|
|
|
|
|
return await Task.FromResult(dbResult);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Ricerca ticket filtrati
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="onlyOpen"></param>
|
|
|
|
|
/// <param name="CodApp"></param>
|
|
|
|
|
/// <param name="CodInst"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<List<TicketDTO>> TicketsGetFilt(bool onlyOpen, string CodApp, string CodInst)
|
|
|
|
|
{
|
|
|
|
|
Stopwatch stopWatch = new Stopwatch();
|
|
|
|
|
List<TicketDTO> dbResult = new List<TicketDTO>();
|
|
|
|
|
stopWatch.Start();
|
|
|
|
|
dbResult = dbControllerNext.TicketGetFilt(onlyOpen, CodApp, CodInst);
|
|
|
|
|
stopWatch.Stop();
|
|
|
|
|
TimeSpan ts = stopWatch.Elapsed;
|
|
|
|
|
Log.Trace($"Effettuata lettura da DB per TicketsGetFilt: {ts.TotalMilliseconds} ms");
|
|
|
|
|
return await Task.FromResult(dbResult);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Aggiornamentos tato ticket
|
|
|
|
|
/// </summary>
|
|
|
|
@@ -615,60 +661,6 @@ namespace LiMan.UI.Data
|
|
|
|
|
return await Task.FromResult(fatto);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Recupera elenco Tickets filtrato
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="CurrFilter"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<List<TicketDTO>> TicketsGetFilt(SelectNext CurrFilter)
|
|
|
|
|
{
|
|
|
|
|
Stopwatch stopWatch = new Stopwatch();
|
|
|
|
|
List<TicketDTO> dbResult = new List<TicketDTO>();
|
|
|
|
|
stopWatch.Start();
|
|
|
|
|
dbResult = dbControllerNext.TicketGetFiltAllLic(CurrFilter.OnlyActive, Core.TipologiaTicket.ND, CurrFilter.ApplicazioneSel, CurrFilter.InstallazioneSel, 1000);
|
|
|
|
|
stopWatch.Stop();
|
|
|
|
|
TimeSpan ts = stopWatch.Elapsed;
|
|
|
|
|
Log.Trace($"Effettuata lettura da DB per TicketsGetFilt: {ts.TotalMilliseconds} ms");
|
|
|
|
|
return await Task.FromResult(dbResult);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Recupera elenco Tickets filtrato
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="CurrFilter"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<List<TicketDTO>> TicketsGetAll()
|
|
|
|
|
{
|
|
|
|
|
Stopwatch stopWatch = new Stopwatch();
|
|
|
|
|
List<TicketDTO> dbResult = new List<TicketDTO>();
|
|
|
|
|
stopWatch.Start();
|
|
|
|
|
dbResult = dbControllerNext.TicketGetAll(false, 1000);
|
|
|
|
|
stopWatch.Stop();
|
|
|
|
|
TimeSpan ts = stopWatch.Elapsed;
|
|
|
|
|
Log.Trace($"Effettuata lettura da DB per TicketsGetAll: {ts.TotalMilliseconds} ms");
|
|
|
|
|
return await Task.FromResult(dbResult);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Ricerca ticket filtrati
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="onlyOpen"></param>
|
|
|
|
|
/// <param name="CodApp"></param>
|
|
|
|
|
/// <param name="CodInst"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<List<TicketDTO>> TicketsGetFilt(bool onlyOpen,string CodApp, string CodInst)
|
|
|
|
|
{
|
|
|
|
|
Stopwatch stopWatch = new Stopwatch();
|
|
|
|
|
List<TicketDTO> dbResult = new List<TicketDTO>();
|
|
|
|
|
stopWatch.Start();
|
|
|
|
|
dbResult = dbControllerNext.TicketGetFilt(onlyOpen,CodApp,CodInst);
|
|
|
|
|
stopWatch.Stop();
|
|
|
|
|
TimeSpan ts = stopWatch.Elapsed;
|
|
|
|
|
Log.Trace($"Effettuata lettura da DB per TicketsGetFilt: {ts.TotalMilliseconds} ms");
|
|
|
|
|
return await Task.FromResult(dbResult);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion Public Methods
|
|
|
|
|
}
|
|
|
|
|
}
|