657 lines
23 KiB
C#
657 lines
23 KiB
C#
using Microsoft.Data.SqlClient;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.Extensions.Configuration;
|
|
using MP.Data.DatabaseModels;
|
|
using NLog;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace MP.Data.Controllers
|
|
{
|
|
public class MpSpecController : IDisposable
|
|
{
|
|
#region Public Constructors
|
|
|
|
public MpSpecController(IConfiguration configuration)
|
|
{
|
|
_configuration = configuration;
|
|
Log.Info("Avviata classe MpSpecController");
|
|
}
|
|
|
|
#endregion Public Constructors
|
|
|
|
#region Public Methods
|
|
|
|
/// <summary>
|
|
/// Elenco Gruppi tipo Azienda
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public List<AnagGruppi> AnagGruppiAziende()
|
|
{
|
|
return AnagGruppiGetTipo("AZIENDA");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Elenco Gruppi tipo Fasi
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public List<AnagGruppi> AnagGruppiFase()
|
|
{
|
|
return AnagGruppiGetTipo("FASE");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Elenco Gruppi
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public List<AnagGruppi> AnagGruppiGetAll()
|
|
{
|
|
List<AnagGruppi> dbResult = new List<AnagGruppi>();
|
|
using (var dbCtx = new MoonProContext(_configuration))
|
|
{
|
|
dbResult = dbCtx
|
|
.DbSetAnagGruppi
|
|
.AsNoTracking()
|
|
.OrderBy(x => x.CodGruppo)
|
|
.ToList();
|
|
}
|
|
return dbResult;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gruppi x tipo
|
|
/// </summary>
|
|
/// <param name="tipoGruppo"></param>
|
|
/// <returns></returns>
|
|
public List<AnagGruppi> AnagGruppiGetTipo(string tipoGruppo)
|
|
{
|
|
List<AnagGruppi> dbResult = new List<AnagGruppi>();
|
|
using (var dbCtx = new MoonProContext(_configuration))
|
|
{
|
|
dbResult = dbCtx
|
|
.DbSetAnagGruppi
|
|
.Where(x => x.TipoGruppo == tipoGruppo)
|
|
.AsNoTracking()
|
|
.OrderBy(x => x.CodGruppo)
|
|
.ToList();
|
|
}
|
|
return dbResult;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Elenco valori ammessi x Stati commessa (es Yacht Baglietto)
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public List<ListValues> AnagStatiComm()
|
|
{
|
|
return ListValuesFilt("PODL", "StatoComm");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Elenco valori ammessi x Tipo articoli
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public List<ListValues> AnagTipoArtLV()
|
|
{
|
|
return ListValuesFilt("AnagArticoli", "Tipo");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Eliminazione Record
|
|
/// </summary>
|
|
/// <param name="currRec"></param>
|
|
/// <returns></returns>
|
|
public async Task<bool> ArticoliDeleteRecord(AnagArticoli currRec)
|
|
{
|
|
bool fatto = false;
|
|
using (var dbCtx = new MoonProContext(_configuration))
|
|
{
|
|
try
|
|
{
|
|
var currVal = dbCtx
|
|
.DbSetArticoli
|
|
.Where(x => x.CodArticolo == currRec.CodArticolo)
|
|
.FirstOrDefault();
|
|
dbCtx
|
|
.DbSetArticoli
|
|
.Remove(currVal);
|
|
await dbCtx.SaveChangesAsync();
|
|
fatto = true;
|
|
}
|
|
catch (Exception exc)
|
|
{
|
|
Log.Error($"Eccezione durante ArticoliDeleteRecord{Environment.NewLine}{exc}");
|
|
}
|
|
}
|
|
return fatto;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Elenco tabella Articoli da filtro
|
|
/// </summary>
|
|
/// <param name="numRecord"></param>
|
|
/// <param name="searchVal"></param>
|
|
/// <returns></returns>
|
|
public List<AnagArticoli> ArticoliGetSearch(int numRecord, string searchVal = "")
|
|
{
|
|
List<AnagArticoli> dbResult = new List<AnagArticoli>();
|
|
using (var dbCtx = new MoonProContext(_configuration))
|
|
{
|
|
dbResult = dbCtx
|
|
.DbSetArticoli
|
|
.AsNoTracking()
|
|
.Where(x => x.CodArticolo.Contains(searchVal) || x.DescArticolo.Contains(searchVal) || x.Disegno.Contains(searchVal) || string.IsNullOrEmpty(searchVal))
|
|
.OrderBy(x => x.CodArticolo)
|
|
.Take(numRecord)
|
|
.ToList();
|
|
}
|
|
return dbResult;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Elenco tabella Articoli da filtro
|
|
/// </summary>
|
|
/// <param name="numRecord"></param>
|
|
/// <param name="azienda"></param>
|
|
/// <param name="searchVal"></param>
|
|
/// <returns></returns>
|
|
public List<AnagArticoli> ArticoliGetSearch(int numRecord, string azienda = "*", string searchVal = "")
|
|
{
|
|
List<AnagArticoli> dbResult = new List<AnagArticoli>();
|
|
using (var dbCtx = new MoonProContext(_configuration))
|
|
{
|
|
dbResult = dbCtx
|
|
.DbSetArticoli
|
|
.AsNoTracking()
|
|
.Where(x => (x.Azienda == azienda || azienda == "*") && (x.CodArticolo.Contains(searchVal) || x.DescArticolo.Contains(searchVal) || x.Disegno.Contains(searchVal) || string.IsNullOrEmpty(searchVal)))
|
|
.OrderBy(x => x.CodArticolo)
|
|
.Take(numRecord)
|
|
.ToList();
|
|
}
|
|
return dbResult;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Elenco tabella Articoli IMPIEGATI (da stored stp_ART_getUsed)
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public List<AnagArticoli> ArticoliGetUsed()
|
|
{
|
|
List<AnagArticoli> dbResult = new List<AnagArticoli>();
|
|
using (var dbCtx = new MoonProContext(_configuration))
|
|
{
|
|
dbResult = dbCtx
|
|
.DbSetArticoli
|
|
.FromSqlRaw("EXEC stp_ART_getUsed")
|
|
.AsNoTracking()
|
|
.ToList();
|
|
}
|
|
return dbResult;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Update Record
|
|
/// </summary>
|
|
/// <param name="currRec"></param>
|
|
/// <returns></returns>
|
|
public async Task<bool> ArticoliUpdateRecord(AnagArticoli editRec)
|
|
{
|
|
bool fatto = false;
|
|
using (var dbCtx = new MoonProContext(_configuration))
|
|
{
|
|
try
|
|
{
|
|
var currRec = dbCtx
|
|
.DbSetArticoli
|
|
.Where(x => x.CodArticolo == editRec.CodArticolo)
|
|
.FirstOrDefault();
|
|
if (currRec != null)
|
|
{
|
|
currRec.Disegno = editRec.Disegno;
|
|
currRec.DescArticolo = editRec.DescArticolo;
|
|
currRec.Tipo = editRec.Tipo;
|
|
currRec.Azienda = editRec.Azienda;
|
|
dbCtx.Entry(currRec).State = EntityState.Modified;
|
|
}
|
|
else
|
|
{
|
|
dbCtx
|
|
.DbSetArticoli
|
|
.Add(editRec);
|
|
}
|
|
await dbCtx.SaveChangesAsync();
|
|
fatto = true;
|
|
}
|
|
catch (Exception exc)
|
|
{
|
|
Log.Error($"Eccezione durante ArticoliUpdateRecord{Environment.NewLine}{exc}");
|
|
}
|
|
}
|
|
return fatto;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Elenco da tabella Config
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public List<ConfigModel> ConfigGetAll()
|
|
{
|
|
List<ConfigModel> dbResult = new List<ConfigModel>();
|
|
using (var dbCtx = new MoonProContext(_configuration))
|
|
{
|
|
dbResult = dbCtx
|
|
.DbSetConfig
|
|
.AsNoTracking()
|
|
.OrderBy(x => x.Chiave)
|
|
.ToList();
|
|
}
|
|
return dbResult;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Update record config
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public bool ConfigUpdate(ConfigModel updRec)
|
|
{
|
|
bool fatto = false;
|
|
ConfigModel dbResult = new ConfigModel();
|
|
using (var dbCtx = new MoonProContext(_configuration))
|
|
{
|
|
dbResult = dbCtx
|
|
.DbSetConfig
|
|
.Where(x => x.Chiave == updRec.Chiave)
|
|
.FirstOrDefault();
|
|
if (dbResult != null)
|
|
{
|
|
dbResult.Valore = updRec.Valore;
|
|
dbCtx.SaveChanges();
|
|
fatto = true;
|
|
}
|
|
}
|
|
return fatto;
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// Eliminazione di un dossier
|
|
/// </summary>
|
|
/// <param name="currRec">record dossier da eliminare</param>
|
|
/// <returns></returns>
|
|
public async Task<bool> DossiersDeleteRecord(Dossiers currRec)
|
|
{
|
|
bool answ = false;
|
|
using (var dbCtx = new MoonProContext(_configuration))
|
|
{
|
|
try
|
|
{
|
|
var currVal = dbCtx
|
|
.DbSetDossiers
|
|
.Where(x => x.IdxDossier == currRec.IdxDossier)
|
|
.FirstOrDefault();
|
|
dbCtx
|
|
.DbSetDossiers
|
|
.Remove(currVal);
|
|
await dbCtx.SaveChangesAsync();
|
|
answ = true;
|
|
}
|
|
catch (Exception exc)
|
|
{
|
|
Log.Error($"Eccezione durante DossiersDeleteRecord{Environment.NewLine}{exc}");
|
|
}
|
|
}
|
|
return answ;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Elenco ultimi n record DOssiers (che contengono ad esempio "salvataggi" di FLuxLog) dato
|
|
/// macchina (ordinato x data registrazione)
|
|
/// </summary>
|
|
/// <param name="IdxMacchina">* = tutte, altrimenti solo x una data macchina</param>
|
|
/// <param name="DtRef">Data di riferimento (Massima) per estrazioen records</param>
|
|
/// <param name="MaxRec">numero massimo record da restituire</param>
|
|
/// <returns></returns>
|
|
public List<Dossiers> DossiersGetLastFilt(string IdxMacchina, DateTime DtRef, int MaxRec)
|
|
{
|
|
List<Dossiers> dbResult = new List<Dossiers>();
|
|
using (var dbCtx = new MoonProContext(_configuration))
|
|
{
|
|
dbResult = dbCtx
|
|
.DbSetDossiers
|
|
.AsNoTracking()
|
|
.Where(x => (IdxMacchina == "*" || x.IdxMacchina == IdxMacchina) && x.DtRif <= DtRef)
|
|
.OrderByDescending(x => x.DtRif)
|
|
.Take(MaxRec)
|
|
.ToList();
|
|
}
|
|
return dbResult;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Effettua salvataggio snapshot parametri (con stored) + svuota eventuale cache redis
|
|
/// </summary>
|
|
/// <param name="idxMacchina">macchina</param>
|
|
/// <param name="maxSec">Num massimo secondi per recuperare dati correnti</param>
|
|
/// <param name="dtRif">DataOra riferimento x cui prendere valori antecedenti</param>
|
|
public bool DossiersTakeParamsSnapshot(string idxMacchina, int maxSec, DateTime dtRif)
|
|
{
|
|
bool answ = false;
|
|
using (var dbCtx = new MoonProContext(_configuration))
|
|
{
|
|
var pIdxMacchina = new SqlParameter("@IdxMacchina", idxMacchina);
|
|
var pMaxSec = new SqlParameter("@MaxSec", maxSec);
|
|
var pDtRif = new SqlParameter("@DtRif", dtRif);
|
|
|
|
var dbResult = dbCtx
|
|
.Database
|
|
.ExecuteSqlRaw("EXEC stp_FL_TakeSnapshot @IdxMacchina,@MaxSec,@DtRif", pIdxMacchina, pMaxSec, pDtRif);
|
|
answ = true;
|
|
}
|
|
return answ;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Elenco valori link (x home e navMenu laterale)
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public List<LinkMenu> ElencoLink()
|
|
{
|
|
return ListLinkFilt("SpecLink");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Elenco ultimi n record flux log dato macchina e flusso (ordinato x data registrazione)
|
|
/// </summary>
|
|
/// <param name="DtMax">Data massima (recupera eventi antecedenti)</param>
|
|
/// <param name="IdxMacchina">* = tutte, altrimenti solo x una data macchina</param>
|
|
/// <param name="CodFlux">*=tutti, altrimenti solo selezionato</param>
|
|
/// <param name="MaxRec">numero massimo record da restituire</param>
|
|
/// <returns></returns>
|
|
public List<FluxLog> FluxLogGetLastFilt(DateTime DtMax, string IdxMacchina, string CodFlux, int MaxRec)
|
|
{
|
|
List<FluxLog> dbResult = new List<FluxLog>();
|
|
using (var dbCtx = new MoonProContext(_configuration))
|
|
{
|
|
dbResult = dbCtx
|
|
.DbSetFluxLog
|
|
.AsNoTracking()
|
|
.Where(x => (x.dtEvento <= DtMax) && (IdxMacchina == "*" || x.IdxMacchina == IdxMacchina) && (CodFlux == "*" || x.CodFlux == CodFlux))
|
|
.OrderByDescending(x => x.dtEvento)
|
|
.Take(MaxRec)
|
|
.ToList();
|
|
}
|
|
return dbResult;
|
|
}
|
|
|
|
public List<LinkMenu> ListLinkFilt(string tipoLink)
|
|
{
|
|
List<LinkMenu> dbResult = new List<LinkMenu>();
|
|
using (var dbCtx = new MoonProContext(_configuration))
|
|
{
|
|
dbResult = dbCtx
|
|
.DbSetLinkMenu
|
|
.Where(x => x.TipoLink == tipoLink)
|
|
.AsNoTracking()
|
|
.OrderBy(x => x.ordine)
|
|
.ToList();
|
|
}
|
|
return dbResult;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Elenco ODL filtrati x stato, articolo, KeyRich (che contiene stato)
|
|
/// </summary>
|
|
/// <param name="inCorso">Stato ODL: true=in corso/completato</param>
|
|
/// <param name="codArt">Cod articolo</param>
|
|
/// <param name="keyRichPart">KeyRich (parziale) da cercare (es cod stato x yacht)</param>
|
|
/// <returns></returns>
|
|
public List<ODLModel> ListODLFilt(bool inCorso, string codArt, string keyRichPart)
|
|
{
|
|
List<ODLModel> dbResult = new List<ODLModel>();
|
|
using (var dbCtx = new MoonProContext(_configuration))
|
|
{
|
|
dbResult = dbCtx
|
|
.DbSetODL
|
|
.Where(x => ((inCorso && x.DataFine == null) || (!inCorso && x.DataFine != null)) && (x.KeyRichiesta.Contains(keyRichPart) || keyRichPart == "*") && (codArt == "*" || x.CodArticolo.Contains(codArt)))
|
|
.AsNoTracking()
|
|
.OrderBy(x => x.IdxOdl)
|
|
.ToList();
|
|
}
|
|
return dbResult;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Elenco PODL non avviati filtrati x articolo, KeyRich (che contiene stato)
|
|
/// </summary>
|
|
/// <param name="codArt">Cod articolo</param>
|
|
/// <param name="keyRichPart">KeyRich (parziale) da cercare (es cod stato x yacht)</param>
|
|
/// <returns></returns>
|
|
public List<PODLModel> ListPODLFilt(string codArt, string keyRichPart)
|
|
{
|
|
List<PODLModel> dbResult = new List<PODLModel>();
|
|
using (var dbCtx = new MoonProContext(_configuration))
|
|
{
|
|
dbResult = dbCtx
|
|
.DbSetPODL
|
|
.Where(x => (x.IdxOdl == 0) && (x.KeyRichiesta.Contains(keyRichPart) || keyRichPart == "*") && (codArt == "*" || x.CodArticolo.Contains(codArt)))
|
|
.AsNoTracking()
|
|
.OrderBy(x => x.InsertDate)
|
|
.ToList();
|
|
}
|
|
return dbResult;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Elenco valori ammessi x tabella/colonna
|
|
/// </summary>
|
|
/// <param name="tabName"></param>
|
|
/// <param name="fieldName"></param>
|
|
/// <returns></returns>
|
|
public List<ListValues> ListValuesFilt(string tabName, string fieldName)
|
|
{
|
|
List<ListValues> dbResult = new List<ListValues>();
|
|
using (var dbCtx = new MoonProContext(_configuration))
|
|
{
|
|
dbResult = dbCtx
|
|
.DbSetListValues
|
|
.Where(x => x.TableName == tabName && x.FieldName == fieldName)
|
|
.AsNoTracking()
|
|
.OrderBy(x => x.ordinal)
|
|
.ToList();
|
|
}
|
|
return dbResult;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Elenco da tabella Macchine
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public List<Macchine> MacchineGetAll()
|
|
{
|
|
List<Macchine> dbResult = new List<Macchine>();
|
|
using (var dbCtx = new MoonProContext(_configuration))
|
|
{
|
|
dbResult = dbCtx
|
|
.DbSetMacchine
|
|
.AsNoTracking()
|
|
.OrderBy(x => x.IdxMacchina)
|
|
.ToList();
|
|
}
|
|
return dbResult;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Elenco id Macchine che abbiano dati FLuxLog
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public List<string> MacchineWithFlux()
|
|
{
|
|
List<string> dbResult = new List<string>();
|
|
using (var dbCtx = new MoonProContext(_configuration))
|
|
{
|
|
dbResult = dbCtx
|
|
.DbSetFluxLog
|
|
.AsNoTracking()
|
|
.Select(i => i.IdxMacchina)
|
|
.Distinct()
|
|
.ToList();
|
|
}
|
|
return dbResult;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Elenco da tabella MappaStatoExpl
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public List<MappaStatoExpl> MseGetAll(int maxAge = 2000)
|
|
{
|
|
List<MappaStatoExpl> dbResult = new List<MappaStatoExpl>();
|
|
using (var dbCtx = new MoonProContext(_configuration))
|
|
{
|
|
var maxAgeSec = new SqlParameter("@maxAgeSec", maxAge);
|
|
|
|
dbResult = dbCtx
|
|
.DbSetMSE
|
|
.FromSqlRaw("EXEC stp_MSE_getData @maxAgeSec", maxAgeSec)
|
|
.AsNoTracking()
|
|
.ToList();
|
|
}
|
|
return dbResult;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Elenco parametri validi x una data macchina
|
|
/// </summary>
|
|
/// <param name="IdxMacchina"></param>
|
|
/// <returns></returns>
|
|
public List<string> ParametriGetFilt(string IdxMacchina)
|
|
{
|
|
List<string> dbResult = new List<string>();
|
|
using (var dbCtx = new MoonProContext(_configuration))
|
|
{
|
|
dbResult = dbCtx
|
|
.DbSetFluxLog
|
|
.AsNoTracking()
|
|
.Where(x => (IdxMacchina == "*" || x.IdxMacchina == IdxMacchina))
|
|
.Select(i => i.CodFlux)
|
|
.Distinct()
|
|
.ToList();
|
|
}
|
|
return dbResult;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Eliminazione Record
|
|
/// </summary>
|
|
/// <param name="currRec"></param>
|
|
/// <returns></returns>
|
|
public async Task<bool> PODLDeleteRecord(PODLModel currRec)
|
|
{
|
|
bool fatto = false;
|
|
using (var dbCtx = new MoonProContext(_configuration))
|
|
{
|
|
try
|
|
{
|
|
var currVal = dbCtx
|
|
.DbSetPODL
|
|
.Where(x => x.IdxPromessa == currRec.IdxPromessa)
|
|
.FirstOrDefault();
|
|
dbCtx
|
|
.DbSetPODL
|
|
.Remove(currVal);
|
|
await dbCtx.SaveChangesAsync();
|
|
fatto = true;
|
|
}
|
|
catch (Exception exc)
|
|
{
|
|
Log.Error($"Eccezione durante PODLDeleteRecord{Environment.NewLine}{exc}");
|
|
}
|
|
}
|
|
return fatto;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Update Record
|
|
/// </summary>
|
|
/// <param name="currRec"></param>
|
|
/// <returns></returns>
|
|
public async Task<bool> PODLUpdateRecord(PODLModel editRec)
|
|
{
|
|
bool fatto = false;
|
|
using (var dbCtx = new MoonProContext(_configuration))
|
|
{
|
|
try
|
|
{
|
|
var currRec = dbCtx
|
|
.DbSetPODL
|
|
.Where(x => x.IdxPromessa == editRec.IdxPromessa)
|
|
.FirstOrDefault();
|
|
if (currRec != null)
|
|
{
|
|
currRec.CodGruppo = editRec.CodGruppo;
|
|
currRec.CodArticolo = editRec.CodArticolo;
|
|
currRec.IdxMacchina = editRec.IdxMacchina;
|
|
currRec.KeyBCode = editRec.KeyBCode;
|
|
currRec.KeyRichiesta = editRec.KeyRichiesta;
|
|
currRec.NumPezzi = editRec.NumPezzi;
|
|
currRec.Tcassegnato = editRec.Tcassegnato;
|
|
dbCtx.Entry(currRec).State = EntityState.Modified;
|
|
}
|
|
else
|
|
{
|
|
dbCtx
|
|
.DbSetPODL
|
|
.Add(editRec);
|
|
}
|
|
await dbCtx.SaveChangesAsync();
|
|
fatto = true;
|
|
}
|
|
catch (Exception exc)
|
|
{
|
|
Log.Error($"Eccezione durante PODLUpdateRecord{Environment.NewLine}{exc}");
|
|
}
|
|
}
|
|
return fatto;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Annulla modifiche su una specifica entity (cancel update)
|
|
/// </summary>
|
|
/// <param name="item"></param>
|
|
/// <returns></returns>
|
|
public bool RollBackEntity(object item)
|
|
{
|
|
bool answ = false;
|
|
using (var dbCtx = new MoonProContext(_configuration))
|
|
{
|
|
try
|
|
{
|
|
if (dbCtx.Entry(item).State == Microsoft.EntityFrameworkCore.EntityState.Deleted || dbCtx.Entry(item).State == Microsoft.EntityFrameworkCore.EntityState.Modified)
|
|
{
|
|
dbCtx.Entry(item).Reload();
|
|
}
|
|
}
|
|
catch (Exception exc)
|
|
{
|
|
Log.Error($"Eccezione in rollBackEntity{Environment.NewLine}{exc}");
|
|
}
|
|
}
|
|
return answ;
|
|
}
|
|
|
|
#endregion Public Methods
|
|
|
|
#region Private Fields
|
|
|
|
private static IConfiguration _configuration;
|
|
|
|
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
|
|
|
#endregion Private Fields
|
|
}
|
|
} |