Fix calcolo true/false ore lav OK

This commit is contained in:
Samuele Locatelli
2022-01-13 16:53:39 +01:00
parent 702a09deca
commit 61239955b0
+11 -1
View File
@@ -208,7 +208,17 @@ namespace GPW_Admin
public bool toBool(object valore)
{
bool answ = false;
bool.TryParse($"{valore}", out answ);
string strVal = $"{valore}";
// se è lungh 1 (0/1) converto 0=false, 1 = true...
if (strVal.Length == 1)
{
answ = strVal == "1" ? true : false;
}
else
{
// se è un valore testuale --> converisone boolean
bool.TryParse($"{valore}", out answ);
}
return answ;
}