modifica IOB x gestione migliore errori in scrittura DB (si spera...)

This commit is contained in:
Samuele E. Locatelli
2017-05-22 13:00:35 +02:00
parent 4f4294f51e
commit ed019497b1
+33 -9
View File
@@ -30,13 +30,21 @@ namespace MP_IO.Controllers
{
int idx = 0;
Int32.TryParse(id.ToString(), out idx);
// verifico se sia abilitato INSERT x una data macchina
if (MapoDb.MapoDb.obj.insEnabled(idx))
try
{
answ = "OK";
// verifico se sia abilitato INSERT x una data macchina
if (MapoDb.MapoDb.obj.insEnabled(idx))
{
answ = "OK";
}
else
{
answ = "NO";
}
}
else
catch (Exception exc)
{
logger.lg.scriviLog(string.Format("Errore in enabled{0}{1}", Environment.NewLine, exc));
answ = "NO";
}
}
@@ -55,13 +63,21 @@ namespace MP_IO.Controllers
{
int idx = 0;
Int32.TryParse(id.ToString(), out idx);
// verifico se sia abilitato SignalLog x una data macchina
if (MapoDb.MapoDb.obj.sLogEnabled(idx))
try
{
answ = "OK";
// verifico se sia abilitato SignalLog x una data macchina
if (MapoDb.MapoDb.obj.sLogEnabled(idx))
{
answ = "OK";
}
else
{
answ = "NO";
}
}
else
catch (Exception exc)
{
logger.lg.scriviLog(string.Format("Errore in sLog{0}{1}", Environment.NewLine, exc));
answ = "NO";
}
}
@@ -78,7 +94,15 @@ namespace MP_IO.Controllers
{
logger.lg.scriviLog(string.Format("Valori letti:{0}idxMacchina: {1}{0}valore: {2}{0}dtEve: {3}{0}dtCurr: {4}{0}cnt: {5}", Environment.NewLine, id, valore, dtEve, dtCurr, cnt), tipoLog.INFO);
}
answ = DataLayer.processInput(id, valore, dtEve, dtCurr, cnt);
try
{
answ = DataLayer.processInput(id, valore, dtEve, dtCurr, cnt);
}
catch (Exception exc)
{
logger.lg.scriviLog(string.Format("Errore in input{0}{1}", Environment.NewLine, exc));
answ = "NO";
}
return answ;
}
}