completato incapsulamento condizionale metodi che creano o meno NUOVI TA (in caso di singleton)

condizionale alla variabile web.config di disable_singleton
This commit is contained in:
Samuele E. Locatelli
2017-07-11 20:01:53 +02:00
parent 7060421407
commit c4f776c768
2 changed files with 58 additions and 24 deletions
+3 -1
View File
@@ -402,7 +402,6 @@ namespace MapoDb
string answ = "";
DateTime dataOraEvento = DateTime.Now;
DateTime dtEvento, dtCorrente;
MapoDb connDb = new MapoDb();
// controllo: se ho valori dt x evento e orario DIVERSI per acquisitore IOB calcolo dataOraEvento corretto
if (dtEve != dtCurr)
{
@@ -450,8 +449,11 @@ namespace MapoDb
}
catch
{ }
// 2017.07.11 se richiesto di NON usare singleton... riporto FUORI la gestione NUOVO oggetto
if (memLayer.ML.CRB("disable_singleton"))
{
// instanzio un nuovo oggetto MapoDb
MapoDb connDb = new MapoDb();
if (idxMacc > 0 && connDb.sLogEnabled(idxMacc))
{
connDb.saveSigLog(idxMacchina, valore, dataOraEvento, contatore);
+55 -23
View File
@@ -124,8 +124,12 @@ namespace MapoDb
{
if (!memLayer.ML.CRB("disable_verificaIdxMacchina"))
{
taMacchine = new DS_applicazioneTableAdapters.MacchineTableAdapter();
taMSM = new DS_applicazioneTableAdapters.MicroStatoMacchinaTableAdapter();
// 2017.07.11 se richiesto di NON usare singleton... riporto FUORI la gestione NUOVO oggetto
if (!memLayer.ML.CRB("disable_singleton"))
{
taMacchine = new DS_applicazioneTableAdapters.MacchineTableAdapter();
taMSM = new DS_applicazioneTableAdapters.MicroStatoMacchinaTableAdapter();
}
// verifico esistenza macchina
if (taMacchine.GetByIdx(IdxMacchina).Rows.Count == 0)
{
@@ -151,9 +155,13 @@ namespace MapoDb
private void checkCambiaStato(tipoInputEvento tipoInput, string IdxMacchina, int IdxTipo, string CodArticolo, string Value, int MatrOpr, string pallet)
{
DS_applicazione.TransizioneStatiRow rigaTransStati;
// 2017.06.09 forzo init x errori "sovrapposizioni"
taTranSt = new DS_applicazioneTableAdapters.TransizioneStatiTableAdapter();
taDiario = new DS_applicazioneTableAdapters.DiarioDiBordoTableAdapter();
// 2017.07.11 se richiesto di NON usare singleton... riporto FUORI la gestione NUOVO oggetto
if (!memLayer.ML.CRB("disable_singleton"))
{
// 2017.06.09 forzo init x errori "sovrapposizioni"
taTranSt = new DS_applicazioneTableAdapters.TransizioneStatiTableAdapter();
taDiario = new DS_applicazioneTableAdapters.DiarioDiBordoTableAdapter();
}
switch (tipoInput)
{
case tipoInputEvento.barcode:
@@ -344,9 +352,12 @@ namespace MapoDb
public inputComando scriviRigaEvento(string IdxMacchina, int IdxTipo, string CodArticolo, string Value, int MatrOpr, string pallet, DateTime eventTime, DateTime currentTime)
{
int inserito = 0;
// 2017.07.11 riporto FUORI la gestione NUOVO oggetto
//// 2017.06.09 forzo init x errori "sovrapposizioni"
//taEvList = new DS_applicazioneTableAdapters.EventListTableAdapter();
// 2017.07.11 se richiesto di NON usare singleton... riporto FUORI la gestione NUOVO oggetto
if (!memLayer.ML.CRB("disable_singleton"))
{
// 2017.06.09 forzo init x errori "sovrapposizioni"
taEvList = new DS_applicazioneTableAdapters.EventListTableAdapter();
}
try
{
// verifico se esista la macchina altrimenti la creo...
@@ -428,8 +439,12 @@ namespace MapoDb
bool answ = false;
try
{
//2017.06.09 forzo inizializzazione oggetto..
taDatiMacch = new DS_applicazioneTableAdapters.DatiMacchineTableAdapter();
// 2017.07.11 se richiesto di NON usare singleton... riporto FUORI la gestione NUOVO oggetto
if (!memLayer.ML.CRB("disable_singleton"))
{
//2017.06.09 forzo inizializzazione oggetto..
taDatiMacch = new DS_applicazioneTableAdapters.DatiMacchineTableAdapter();
}
answ = ((DS_applicazione.DatiMacchineRow)taDatiMacch.GetByIdx(idxMacchina)[0]).sLogEnabled;
}
catch
@@ -453,8 +468,12 @@ namespace MapoDb
}
catch
{ }
// 2017.06.09 forzo init x errori "sovrapposizioni"
DataLayer.obj.taSigLog = new DS_applicazioneTableAdapters.SignalLogTableAdapter();
// 2017.07.11 se richiesto di NON usare singleton... riporto FUORI la gestione NUOVO oggetto
if (!memLayer.ML.CRB("disable_singleton"))
{
// 2017.06.09 forzo init x errori "sovrapposizioni"
DataLayer.obj.taSigLog = new DS_applicazioneTableAdapters.SignalLogTableAdapter();
}
DataLayer.obj.taSigLog.Insert(DateTime.Now, idxMacchina, valore, dtEve, cont);
}
/// <summary>
@@ -481,9 +500,12 @@ namespace MapoDb
// recupero CodArticolo corretto
try
{
// 2017.07.11 riporto FUORI la gestione NUOVO oggetto
//// 2017.07.10 forzo init x errori "sovrapposizioni"
//taDatiMacchine = new DS_ProdTempiTableAdapters.DatiMacchineTableAdapter();
// 2017.07.11 se richiesto di NON usare singleton... riporto FUORI la gestione NUOVO oggetto
if (!memLayer.ML.CRB("disable_singleton"))
{
// 2017.07.10 forzo init x errori "sovrapposizioni"
taDatiMacchine = new DS_ProdTempiTableAdapters.DatiMacchineTableAdapter();
}
CodArticolo = taDatiMacchine.getByIdx(Convert.ToInt32(idxMacchina))[0].CodArticolo_A;
}
catch (Exception exc)
@@ -495,9 +517,12 @@ namespace MapoDb
int? valINT = 0;
try
{
// 2017.07.11 riporto FUORI la gestione NUOVO oggetto
//// 2017.06.09 forzo init x errori "sovrapposizioni"
//taTransIngr = new DS_applicazioneTableAdapters.TransizioneIngressiTableAdapter();
// 2017.07.11 se richiesto di NON usare singleton... riporto FUORI la gestione NUOVO oggetto
if (!memLayer.ML.CRB("disable_singleton"))
{
// 2017.06.09 forzo init x errori "sovrapposizioni"
taTransIngr = new DS_applicazioneTableAdapters.TransizioneIngressiTableAdapter();
}
valINT = int.Parse(valore, System.Globalization.NumberStyles.HexNumber);
TabTransIn = taTransIngr.getByIdxMacchinaValore(idxMacchina, valINT);
if (TabTransIn.Rows.Count > 0)
@@ -519,9 +544,12 @@ namespace MapoDb
{
logger.lg.scriviLog(string.Format("[ChkMiSt_6a] - Salvo Update Microstato:{0}macchina: {1} | valore seriale: {2} | next micro stato: {3}", Environment.NewLine, idxMacchina, valINT, rigaTransIn.next_IdxMicroStato), tipoLog.INFO);
}
// 2017.07.11 riporto FUORI la gestione NUOVO oggetto
//// 2017.06.09 forzo init x errori "sovrapposizioni"
//taMSM = new DS_applicazioneTableAdapters.MicroStatoMacchinaTableAdapter();
// 2017.07.11 se richiesto di NON usare singleton... riporto FUORI la gestione NUOVO oggetto
if (!memLayer.ML.CRB("disable_singleton"))
{
// 2017.06.09 forzo init x errori "sovrapposizioni"
taMSM = new DS_applicazioneTableAdapters.MicroStatoMacchinaTableAdapter();
}
// salvo nuovo microstato...
taMSM.updateQuery(rigaTransIn.next_IdxMicroStato, dtEve, valore, idxMacchina);
// controllo se c'è evento
@@ -1339,8 +1367,12 @@ namespace MapoDb
{
logger.lg.scriviLog(string.Format("Scrittura keep alive! IdxMacchina:{0} | oraMacchina:{1}", IdxMacchina, oraMacchina));
}
// 2017.06.09 forzo init x errori "sovrapposizioni"
taKeepAlive = new DS_applicazioneTableAdapters.KeepAliveTableAdapter();
// 2017.07.11 se richiesto di NON usare singleton... riporto FUORI la gestione NUOVO oggetto
if (!memLayer.ML.CRB("disable_singleton"))
{
// 2017.06.09 forzo init x errori "sovrapposizioni"
taKeepAlive = new DS_applicazioneTableAdapters.KeepAliveTableAdapter();
}
taKeepAlive.UpdateQueryNoStartTime(DateTime.Now, oraMacchina, IdxMacchina);
}
catch (Exception exc)