diff --git a/GPW_Admin/WebUserControls/mod_adminFasi.ascx b/GPW_Admin/WebUserControls/mod_adminFasi.ascx
index 45e4d3d..8519b33 100644
--- a/GPW_Admin/WebUserControls/mod_adminFasi.ascx
+++ b/GPW_Admin/WebUserControls/mod_adminFasi.ascx
@@ -34,7 +34,7 @@
-
+
@@ -187,7 +187,7 @@
-
+
diff --git a/GPW_Admin/WebUserControls/mod_adminFasi.ascx.cs b/GPW_Admin/WebUserControls/mod_adminFasi.ascx.cs
index 2a312cb..2f3610c 100644
--- a/GPW_Admin/WebUserControls/mod_adminFasi.ascx.cs
+++ b/GPW_Admin/WebUserControls/mod_adminFasi.ascx.cs
@@ -524,32 +524,56 @@ namespace GPW_Admin.WebUserControls
}
///
- /// determina se sia eliminabile il record (=non usato)
+ /// Determina se sia eliminabile il record (=non ha ore caricate ne fasi)
///
- ///
+ ///
+ ///
///
- public bool delEnabled(object idxObj)
+ public bool delEnabled(object _totOre, object _idxFase)
{
bool answ = isWritable();
// solo se ha diritti scrittura controllo
- if (idxObj != null)
+ if (answ && _totOre != null && _idxFase != null)
{
+ double numOre = 0;
+ _ = Double.TryParse($"{_totOre}", out numOre);
+ answ = (numOre == 0);
+ // se fosse true --> procedo con controllo fasi
if (answ)
{
- int trovati = 0;
int idxFase = 0;
- _ = int.TryParse(idxObj.ToString(), out idxFase);
- trovati = DataProxy.DP.taRA.getByFase(idxFase).Count;
- // controllo se ci sono record correlati...
- if (trovati > 0)
- {
- answ = false;
- }
+ _ = int.TryParse($"{_idxFase}", out idxFase);
+ answ = !hasChildObj(idxFase);
}
}
return answ;
}
+ ///
+ /// Determina se abbia child obj --> NON eliminabile
+ ///
+ ///
+ ///
+ public bool hasChildObj(int idxFase)
+ {
+ bool answ = false;
+ string redKey = memLayer.ML.redHash($"faseHasChildObj:{idxFase}");
+ // cerco inc ache redis...
+ string rawData = memLayer.ML.getRSV(redKey);
+ if (rawData == null)
+ {
+ int trovati = DataProxy.DP.taRA.getByFase(this.idxFase).Count;
+ answ = (trovati > 0);
+ memLayer.ML.setRSV(redKey, $"{answ}", 60 * 5);
+ }
+ else
+ {
+ bool.TryParse(rawData, out answ);
+ }
+ return answ;
+ }
+
+
///
/// effettua update controllo
///
diff --git a/GPW_Admin/WebUserControls/mod_adminProgetti.ascx.cs b/GPW_Admin/WebUserControls/mod_adminProgetti.ascx.cs
index 87a1553..82de875 100644
--- a/GPW_Admin/WebUserControls/mod_adminProgetti.ascx.cs
+++ b/GPW_Admin/WebUserControls/mod_adminProgetti.ascx.cs
@@ -634,7 +634,7 @@ namespace GPW_Admin.WebUserControls
{
bool answ = isWritable();
// solo se ha diritti scrittura controllo
- if (totOre != null && answ)
+ if (answ && totOre != null && idxProj !=null)
{
double numOre = 0;
_ = Double.TryParse($"{totOre}", out numOre);