SPEC:
- aggiunta pagina operatori - completato fix
This commit is contained in:
@@ -19,11 +19,15 @@ namespace MP.Data.Controllers
|
||||
public MpStatsController(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
string connStr = _configuration.GetConnectionString("MP.Stats");
|
||||
options = new DbContextOptionsBuilder<MoonPro_STATSContext>()
|
||||
.UseSqlServer(connStr)
|
||||
.Options;
|
||||
Log.Info("Avviata classe MpStatsController");
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
private DbContextOptions<MoonPro_STATSContext> options;
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
@@ -33,13 +37,10 @@ namespace MP.Data.Controllers
|
||||
public List<AzioniUL> ActionsGetAll()
|
||||
{
|
||||
List<AzioniUL> dbResult = new List<AzioniUL>();
|
||||
using (var dbCtx = new MoonPro_STATSContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
using var dbCtx = new MoonPro_STATSContext(options);
|
||||
return dbCtx
|
||||
.DbSetAzioniUL
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -49,13 +50,10 @@ namespace MP.Data.Controllers
|
||||
public List<AnagFLTransModel> AnagFLTransGetAll()
|
||||
{
|
||||
List<AnagFLTransModel> dbResult = new List<AnagFLTransModel>();
|
||||
using (var dbCtx = new MoonPro_STATSContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetAnagFLTrans
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
using var dbCtx = new MoonPro_STATSContext(options);
|
||||
return dbCtx
|
||||
.DbSetAnagFLTrans
|
||||
.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -67,7 +65,7 @@ namespace MP.Data.Controllers
|
||||
public List<StatsAnagArticoli> ArticoliGetSearch(int numRecord, string searchVal = "")
|
||||
{
|
||||
List<StatsAnagArticoli> dbResult = new List<StatsAnagArticoli>();
|
||||
using (var dbCtx = new MoonPro_STATSContext(_configuration))
|
||||
using (var dbCtx = new MoonPro_STATSContext(options))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetArticoli
|
||||
@@ -88,7 +86,7 @@ namespace MP.Data.Controllers
|
||||
public List<StatsODL> CommesseGetSearch(int numRecord, string searchVal = "")
|
||||
{
|
||||
List<StatsODL> dbResult = new List<StatsODL>();
|
||||
using (var dbCtx = new MoonPro_STATSContext(_configuration))
|
||||
using (var dbCtx = new MoonPro_STATSContext(options))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetODL
|
||||
@@ -107,7 +105,7 @@ namespace MP.Data.Controllers
|
||||
public List<ConfigModel> ConfigGetAll()
|
||||
{
|
||||
List<ConfigModel> dbResult = new List<ConfigModel>();
|
||||
using (var dbCtx = new MoonPro_STATSContext(_configuration))
|
||||
using (var dbCtx = new MoonPro_STATSContext(options))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetConfig
|
||||
@@ -133,7 +131,7 @@ namespace MP.Data.Controllers
|
||||
public List<FLModel> FluxLogRawData(string IdxMacchina, DateTime DtStart, DateTime DtEnd, string fluxType)
|
||||
{
|
||||
List<FLModel> dbResult = new List<FLModel>();
|
||||
using (var dbCtx = new MoonPro_STATSContext(_configuration))
|
||||
using (var dbCtx = new MoonPro_STATSContext(options))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetFL
|
||||
@@ -153,7 +151,7 @@ namespace MP.Data.Controllers
|
||||
public List<string> FluxTypeList()
|
||||
{
|
||||
List<string> dbResult = new List<string>();
|
||||
using (var dbCtx = new MoonPro_STATSContext(_configuration))
|
||||
using (var dbCtx = new MoonPro_STATSContext(options))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetFL
|
||||
@@ -172,7 +170,7 @@ namespace MP.Data.Controllers
|
||||
public List<MacchineStatModel> MacchineEnergy()
|
||||
{
|
||||
List<MacchineStatModel> dbResult = new List<MacchineStatModel>();
|
||||
using (var dbCtx = new MoonPro_STATSContext(_configuration))
|
||||
using (var dbCtx = new MoonPro_STATSContext(options))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetMaccStat
|
||||
@@ -188,7 +186,7 @@ namespace MP.Data.Controllers
|
||||
public List<MacchineModel> MacchineGetAll()
|
||||
{
|
||||
List<MacchineModel> dbResult = new List<MacchineModel>();
|
||||
using (var dbCtx = new MoonPro_STATSContext(_configuration))
|
||||
using (var dbCtx = new MoonPro_STATSContext(options))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetMacchine
|
||||
@@ -204,7 +202,7 @@ namespace MP.Data.Controllers
|
||||
public async Task<List<MaccEnergyCheckModel>> MacchineEnergyCheckGetAllAsync()
|
||||
{
|
||||
List<MaccEnergyCheckModel> dbResult = new List<MaccEnergyCheckModel>();
|
||||
using (var dbCtx = new MoonPro_STATSContext(_configuration))
|
||||
using (var dbCtx = new MoonPro_STATSContext(options))
|
||||
{
|
||||
dbResult = await dbCtx
|
||||
.DbSetMacchineCheck
|
||||
@@ -222,7 +220,7 @@ namespace MP.Data.Controllers
|
||||
public bool RollBackEntity(object item)
|
||||
{
|
||||
bool answ = false;
|
||||
using (var dbCtx = new MoonPro_STATSContext(_configuration))
|
||||
using (var dbCtx = new MoonPro_STATSContext(options))
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -248,7 +246,7 @@ namespace MP.Data.Controllers
|
||||
public List<ResControlli> StatControlliGetAll(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo)
|
||||
{
|
||||
List<ResControlli> dbResult = new List<ResControlli>();
|
||||
using (var dbCtx = new MoonPro_STATSContext(_configuration))
|
||||
using (var dbCtx = new MoonPro_STATSContext(options))
|
||||
{
|
||||
var dataFrom = new SqlParameter("@dataFrom", DataStart);
|
||||
var dataTo = new SqlParameter("@dataTo", DataEnd);
|
||||
@@ -280,7 +278,7 @@ namespace MP.Data.Controllers
|
||||
public List<DdbTurni> StatDdbGetAll(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo, int FirstRecord, int NumRecord)
|
||||
{
|
||||
List<DdbTurni> dbResult = new List<DdbTurni>();
|
||||
using (var dbCtx = new MoonPro_STATSContext(_configuration))
|
||||
using (var dbCtx = new MoonPro_STATSContext(options))
|
||||
{
|
||||
var dataFrom = new SqlParameter("@dataFrom", DataStart);
|
||||
var dataTo = new SqlParameter("@dataTo", DataEnd);
|
||||
@@ -312,7 +310,7 @@ namespace MP.Data.Controllers
|
||||
public int StatDdbGetCount(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo)
|
||||
{
|
||||
int numResult = 0;
|
||||
using (var dbCtx = new MoonPro_STATSContext(_configuration))
|
||||
using (var dbCtx = new MoonPro_STATSContext(options))
|
||||
{
|
||||
numResult = dbCtx
|
||||
.DbSetDdbTurni
|
||||
@@ -335,7 +333,7 @@ namespace MP.Data.Controllers
|
||||
public List<OdlEnergyModel> StatOdlEnergyGetFilt(string IdxMacchina, DateTime DtStart, DateTime DtEnd, int IdxODL, string KeyRichiesta, string CodArticolo)
|
||||
{
|
||||
List<OdlEnergyModel> dbResult = new List<OdlEnergyModel>();
|
||||
using (var dbCtx = new MoonPro_STATSContext(_configuration))
|
||||
using (var dbCtx = new MoonPro_STATSContext(options))
|
||||
{
|
||||
var dataFrom = new SqlParameter("@dataFrom", DtStart);
|
||||
var dataTo = new SqlParameter("@dataTo", DtEnd);
|
||||
@@ -361,7 +359,7 @@ namespace MP.Data.Controllers
|
||||
public List<StatsODL> StatOdlGetAll(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo)
|
||||
{
|
||||
List<StatsODL> dbResult = new List<StatsODL>();
|
||||
using (var dbCtx = new MoonPro_STATSContext(_configuration))
|
||||
using (var dbCtx = new MoonPro_STATSContext(options))
|
||||
{
|
||||
var dataFrom = new SqlParameter("@dataFrom", DataStart);
|
||||
var dataTo = new SqlParameter("@dataTo", DataEnd);
|
||||
@@ -389,7 +387,7 @@ namespace MP.Data.Controllers
|
||||
public List<ResScarti> StatScartiGetAll(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo)
|
||||
{
|
||||
List<ResScarti> dbResult = new List<ResScarti>();
|
||||
using (var dbCtx = new MoonPro_STATSContext(_configuration))
|
||||
using (var dbCtx = new MoonPro_STATSContext(options))
|
||||
{
|
||||
var dataFrom = new SqlParameter("@dataFrom", DataStart);
|
||||
var dataTo = new SqlParameter("@dataTo", DataEnd);
|
||||
@@ -417,7 +415,7 @@ namespace MP.Data.Controllers
|
||||
public List<TurniOee> StatTurniOeeGetAll(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo)
|
||||
{
|
||||
List<TurniOee> dbResult = new List<TurniOee>();
|
||||
using (var dbCtx = new MoonPro_STATSContext(_configuration))
|
||||
using (var dbCtx = new MoonPro_STATSContext(options))
|
||||
{
|
||||
var dataFrom = new SqlParameter("@dataFrom", DataStart);
|
||||
var dataTo = new SqlParameter("@dataTo", DataEnd);
|
||||
@@ -443,7 +441,7 @@ namespace MP.Data.Controllers
|
||||
public List<UserActionLog> StatUserLogGetAll(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo)
|
||||
{
|
||||
List<UserActionLog> dbResult = new List<UserActionLog>();
|
||||
using (var dbCtx = new MoonPro_STATSContext(_configuration))
|
||||
using (var dbCtx = new MoonPro_STATSContext(options))
|
||||
{
|
||||
var dataFrom = new SqlParameter("@dataFrom", DataStart);
|
||||
var dataTo = new SqlParameter("@dataTo", DataEnd);
|
||||
@@ -467,7 +465,7 @@ namespace MP.Data.Controllers
|
||||
public List<VocabolarioModel> VocabolarioGetAll()
|
||||
{
|
||||
List<VocabolarioModel> dbResult = new List<VocabolarioModel>();
|
||||
using (var dbCtx = new MoonPro_STATSContext(_configuration))
|
||||
using (var dbCtx = new MoonPro_STATSContext(options))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetVocabolario
|
||||
|
||||
Reference in New Issue
Block a user