spostato da IOB a datalayer controllo SE modalità DB/Redis

This commit is contained in:
Samuele E. Locatelli
2017-09-12 14:50:50 +02:00
parent fbddae613f
commit b8baa9f868
2 changed files with 28 additions and 35 deletions
+2 -25
View File
@@ -29,19 +29,8 @@ namespace MP_IO.Controllers
try
{
bool isEnabled = false;
// verifico se sia abilitato INSERT x una data macchina... con REDIS se abilitato
if (memLayer.ML.CRB("IOB_RedEnab"))
{
isEnabled = DataLayer.insEnab(idx);
}
// ...oppure dritto su DB
else
{
isEnabled = MapoDb.MapoDb.obj.insEnabled(idx);
}
// salvo risposta!
answ = isEnabled ? "OK" : "NO";
answ = DataLayer.insEnab(idx) ? "OK" : "NO";
}
catch (Exception exc)
{
@@ -66,19 +55,7 @@ namespace MP_IO.Controllers
Int32.TryParse(id.ToString(), out idx);
try
{
bool isEnabled = false;
// verifico se sia abilitato SignalLog x una data macchina... con REDIS se abilitato
if (memLayer.ML.CRB("IOB_RedEnab"))
{
isEnabled = DataLayer.sLogEnab(idx);
}
// ...oppure dritto su DB
else
{
isEnabled = MapoDb.MapoDb.obj.sLogEnabled(idx);
}
// salvo risposta!
answ = isEnabled ? "OK" : "NO";
answ = DataLayer.sLogEnab(idx) ? "OK" : "NO";
}
catch (Exception exc)
{
+26 -10
View File
@@ -555,7 +555,7 @@ namespace MapoDb
/// </summary>
/// <param name="idxMacchina"></param>
/// <returns></returns>
public static Dictionary<string,string> mDatiMacchine(int idxMacchina)
public static Dictionary<string, string> mDatiMacchine(int idxMacchina)
{
// hard coded dimensione vettore DatiMacchine
Dictionary<string, string> answ = new Dictionary<string, string>();
@@ -605,7 +605,7 @@ namespace MapoDb
answ.Add("MatrOpr", rigaMSFD.MatrOpr.ToString());
answ.Add("lastVal", rigaMSFD.lastVal);
answ.Add("TCBase", rigaMSFD.TempoCicloBase.ToString());
//...e SETUP
answ.Add("CodMacc", rigaMSFD.codmacchina);
answ.Add("IdxFamIn", rigaMSFD.IdxFamigliaIngresso.ToString());
@@ -728,12 +728,20 @@ namespace MapoDb
public static bool insEnab(int idxMacchina)
{
bool answ = false;
try
if (memLayer.ML.CRB("IOB_RedEnab"))
{
answ = Convert.ToBoolean(mDatiMacchinaVal(idxMacchina, "insEnabled"));
try
{
answ = Convert.ToBoolean(mDatiMacchinaVal(idxMacchina, "insEnabled"));
}
catch
{ }
}
// ...oppure dritto su DB
else
{
answ = MapoDb.obj.insEnabled(idxMacchina);
}
catch
{ }
return answ;
}
/// <summary>
@@ -744,12 +752,20 @@ namespace MapoDb
public static bool sLogEnab(int idxMacchina)
{
bool answ = false;
try
if (memLayer.ML.CRB("IOB_RedEnab"))
{
answ = Convert.ToBoolean(mDatiMacchinaVal(idxMacchina, "sLogEnabled"));
try
{
answ = Convert.ToBoolean(mDatiMacchinaVal(idxMacchina, "sLogEnabled"));
}
catch
{ }
}
// ...oppure dritto su DB
else
{
answ = MapoDb.obj.sLogEnabled(idxMacchina);
}
catch
{ }
return answ;
}