diff --git a/.editorconfig b/.editorconfig
index a262d56..8f4e7be 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -29,3 +29,12 @@ dotnet_diagnostic.CA1044.severity = none
# CA1304: Specificare CultureInfo
dotnet_diagnostic.CA1304.severity = silent
+
+# CA1303: Non passare valori letterali come parametri localizzati
+dotnet_diagnostic.CA1303.severity = none
+
+# CA1030: Usare gli eventi dove appropriato
+dotnet_diagnostic.CA1030.severity = none
+
+# CA1056: Le proprietà Uri non devono essere stringhe
+dotnet_diagnostic.CA1056.severity = none
diff --git a/GPW_Admin/WebUserControls/mod_commAttivitaDesk.ascx.cs b/GPW_Admin/WebUserControls/mod_commAttivitaDesk.ascx.cs
index ed5ca9b..9ee0458 100644
--- a/GPW_Admin/WebUserControls/mod_commAttivitaDesk.ascx.cs
+++ b/GPW_Admin/WebUserControls/mod_commAttivitaDesk.ascx.cs
@@ -126,17 +126,20 @@ namespace GPW_Admin.WebUserControls
///
protected void imgClona_Click(object sender, ImageClickEventArgs e)
{
- ImageButton lbtn = (ImageButton)sender;
- int idxRa = 0;
- try
+ if (sender != null)
{
- idxRa = Convert.ToInt32(lbtn.CommandArgument);
+ ImageButton lbtn = (ImageButton)sender;
+ int idxRa = 0;
+ try
+ {
+ idxRa = Convert.ToInt32(lbtn.CommandArgument);
+ }
+ catch
+ { }
+ // chiamo clona!
+ DataProxy.DP.taRA.clonaRecord(idxRa);
+ updateControl();
}
- catch
- { }
- // chiamo clona!
- DataProxy.DP.taRA.clonaRecord(idxRa);
- updateControl();
}
///
/// fa update del controllo e chiama evento update esterno
@@ -227,26 +230,29 @@ namespace GPW_Admin.WebUserControls
///
protected void grView_RowDataBound(object sender, GridViewRowEventArgs e)
{
- // controllo la riga
- GridViewRow riga = e.Row;
- if (grView.EditIndex >= 0 || grView.ShowFooter)
+ if (e != null)
{
- try
+ // controllo la riga
+ GridViewRow riga = e.Row;
+ if (grView.EditIndex >= 0 || grView.ShowFooter)
{
- //pre-seleziono idx progetto x ods fase...
- DropDownList ddlProj_int = (DropDownList)riga.FindControl("ddlProgetto");
- if (idxProjSel >= 0 && (ddlProj_int != null))
+ try
{
- ddlProj_int.SelectedValue = idxProjSel.ToString();
- }
- DropDownList ddlFase_int = (DropDownList)riga.FindControl("ddlFase");
- if (idxFaseSel >= 0 && (ddlFase_int != null))
- {
- ddlFase_int.SelectedValue = idxFaseSel.ToString();
+ //pre-seleziono idx progetto x ods fase...
+ DropDownList ddlProj_int = (DropDownList)riga.FindControl("ddlProgetto");
+ if (idxProjSel >= 0 && (ddlProj_int != null))
+ {
+ ddlProj_int.SelectedValue = idxProjSel.ToString();
+ }
+ DropDownList ddlFase_int = (DropDownList)riga.FindControl("ddlFase");
+ if (idxFaseSel >= 0 && (ddlFase_int != null))
+ {
+ ddlFase_int.SelectedValue = idxFaseSel.ToString();
+ }
}
+ catch
+ { }
}
- catch
- { }
}
}
///
@@ -269,58 +275,61 @@ namespace GPW_Admin.WebUserControls
///
protected void ddlProgetto_SelectedIndexChanged(object sender, EventArgs e)
{
- // salvo in session idxProjSel!
- DropDownList ddlProj_int = (DropDownList)sender;
- idxProjSel = Convert.ToInt32(ddlProj_int.SelectedValue);
- // ricarico dati fasi
- odsFase.DataBind();
- // se in insert salvo orari e testo...
- DateTime inizio = DateTime.Now;
- DateTime fine = DateTime.Now;
- string descr = "";
- if (stato == statoControllo.insert)
+ if (sender != null)
{
- inizio = ((mod_dateTime)grView.FooterRow.FindControl("dtInizio")).valoreDateTime;
- fine = ((mod_dateTime)grView.FooterRow.FindControl("dtFine")).valoreDateTime;
- descr = ((TextBox)grView.FooterRow.FindControl("txtDescrizione")).Text;
- }
- else
- {
- // se è edit...
- int idx = grView.EditIndex;
- inizio = ((mod_dateTime)grView.Rows[idx].FindControl("dtInizio")).valoreDateTime;
- fine = ((mod_dateTime)grView.Rows[idx].FindControl("dtFine")).valoreDateTime;
- descr = ((TextBox)grView.Rows[idx].FindControl("txtDescrizione")).Text;
- }
- refreshControlli();
- // se in insert riporto orari e testo...
- if (stato == statoControllo.insert)
- {
- ((mod_dateTime)grView.FooterRow.FindControl("dtInizio")).valoreDateTime = inizio;
- ((mod_dateTime)grView.FooterRow.FindControl("dtFine")).valoreDateTime = fine;
- ((TextBox)grView.FooterRow.FindControl("txtDescrizione")).Text = descr;
- try
+ // salvo in session idxProjSel!
+ DropDownList ddlProj_int = (DropDownList)sender;
+ idxProjSel = Convert.ToInt32(ddlProj_int.SelectedValue);
+ // ricarico dati fasi
+ odsFase.DataBind();
+ // se in insert salvo orari e testo...
+ DateTime inizio = DateTime.Now;
+ DateTime fine = DateTime.Now;
+ string descr = "";
+ if (stato == statoControllo.insert)
{
- DropDownList ddlFase_int = (DropDownList)grView.FooterRow.FindControl("ddlFase");
- ddlFase_int.SelectedIndex = 1;
+ inizio = ((mod_dateTime)grView.FooterRow.FindControl("dtInizio")).valoreDateTime;
+ fine = ((mod_dateTime)grView.FooterRow.FindControl("dtFine")).valoreDateTime;
+ descr = ((TextBox)grView.FooterRow.FindControl("txtDescrizione")).Text;
}
- catch
- { }
- }
- else
- {
- // se è edit...
- int idx = grView.EditIndex;
- ((mod_dateTime)grView.Rows[idx].FindControl("dtInizio")).valoreDateTime = inizio;
- ((mod_dateTime)grView.Rows[idx].FindControl("dtFine")).valoreDateTime = fine;
- ((TextBox)grView.Rows[idx].FindControl("txtDescrizione")).Text = descr;
- try
+ else
{
- DropDownList ddlFase_int = (DropDownList)grView.Rows[idx].FindControl("ddlFase");
- ddlFase_int.SelectedIndex = 1;
+ // se è edit...
+ int idx = grView.EditIndex;
+ inizio = ((mod_dateTime)grView.Rows[idx].FindControl("dtInizio")).valoreDateTime;
+ fine = ((mod_dateTime)grView.Rows[idx].FindControl("dtFine")).valoreDateTime;
+ descr = ((TextBox)grView.Rows[idx].FindControl("txtDescrizione")).Text;
+ }
+ refreshControlli();
+ // se in insert riporto orari e testo...
+ if (stato == statoControllo.insert)
+ {
+ ((mod_dateTime)grView.FooterRow.FindControl("dtInizio")).valoreDateTime = inizio;
+ ((mod_dateTime)grView.FooterRow.FindControl("dtFine")).valoreDateTime = fine;
+ ((TextBox)grView.FooterRow.FindControl("txtDescrizione")).Text = descr;
+ try
+ {
+ DropDownList ddlFase_int = (DropDownList)grView.FooterRow.FindControl("ddlFase");
+ ddlFase_int.SelectedIndex = 1;
+ }
+ catch
+ { }
+ }
+ else
+ {
+ // se è edit...
+ int idx = grView.EditIndex;
+ ((mod_dateTime)grView.Rows[idx].FindControl("dtInizio")).valoreDateTime = inizio;
+ ((mod_dateTime)grView.Rows[idx].FindControl("dtFine")).valoreDateTime = fine;
+ ((TextBox)grView.Rows[idx].FindControl("txtDescrizione")).Text = descr;
+ try
+ {
+ DropDownList ddlFase_int = (DropDownList)grView.Rows[idx].FindControl("ddlFase");
+ ddlFase_int.SelectedIndex = 1;
+ }
+ catch
+ { }
}
- catch
- { }
}
}
///
@@ -358,19 +367,22 @@ namespace GPW_Admin.WebUserControls
///
protected void grView_RowCommand(object sender, GridViewCommandEventArgs e)
{
- switch (e.CommandName)
+ if (e != null)
{
- case "Cancel":
- stato = statoControllo.item;
- updateControl();
- break;
- case "Insert":
- doInsert();
- stato = statoControllo.item;
- updateControl();
- break;
- default:
- break;
+ switch (e.CommandName)
+ {
+ case "Cancel":
+ stato = statoControllo.item;
+ updateControl();
+ break;
+ case "Insert":
+ doInsert();
+ stato = statoControllo.item;
+ updateControl();
+ break;
+ default:
+ break;
+ }
}
}
diff --git a/GPW_Admin/WebUserControls/mod_dettaglioProgetto.ascx.cs b/GPW_Admin/WebUserControls/mod_dettaglioProgetto.ascx.cs
index d4568ad..c2fe9f5 100644
--- a/GPW_Admin/WebUserControls/mod_dettaglioProgetto.ascx.cs
+++ b/GPW_Admin/WebUserControls/mod_dettaglioProgetto.ascx.cs
@@ -89,13 +89,16 @@ namespace GPW_Admin.WebUserControls
///
protected void chkAttivo_CheckedChanged(object sender, EventArgs e)
{
- // chiamo update attivo/non attivo...
- CheckBox chkBox = (CheckBox)sender;
- DataProxy.DP.taAP.updateAttivo(chkBox.Checked, memLayer.ML.IntSessionObj("idxProgetto_sel"));
- fmView.DataBind();
- if (eh_nuovoValore != null)
+ if (sender != null)
{
- eh_nuovoValore(this, new EventArgs());
+ // chiamo update attivo/non attivo...
+ CheckBox chkBox = (CheckBox)sender;
+ DataProxy.DP.taAP.updateAttivo(chkBox.Checked, memLayer.ML.IntSessionObj("idxProgetto_sel"));
+ fmView.DataBind();
+ if (eh_nuovoValore != null)
+ {
+ eh_nuovoValore(this, new EventArgs());
+ }
}
}
///
diff --git a/GPW_Admin/WebUserControls/mod_filtro.ascx.cs b/GPW_Admin/WebUserControls/mod_filtro.ascx.cs
index f0a1ad5..994fc9a 100644
--- a/GPW_Admin/WebUserControls/mod_filtro.ascx.cs
+++ b/GPW_Admin/WebUserControls/mod_filtro.ascx.cs
@@ -296,7 +296,7 @@ public partial class mod_filtro : ApplicationUserControl
{
dlFilt.DataSource = _ods;
dlFilt.DataBind();
- if (_valore != "")
+ if (!string.IsNullOrEmpty(_valore))
{
dlFilt.SelectedValue = _valore;
diff --git a/GPW_Admin/WebUserControls/mod_gestCalendario.ascx.cs b/GPW_Admin/WebUserControls/mod_gestCalendario.ascx.cs
index 3e85d5e..ccfa8dd 100644
--- a/GPW_Admin/WebUserControls/mod_gestCalendario.ascx.cs
+++ b/GPW_Admin/WebUserControls/mod_gestCalendario.ascx.cs
@@ -9,125 +9,125 @@ using System.Web.UI.WebControls;
namespace GPW_Admin.WebUserControls
{
- public partial class mod_gestCalendario : System.Web.UI.UserControl
- {
+ public partial class mod_gestCalendario : System.Web.UI.UserControl
+ {
- ///
- /// effettua traduzione del lemma
- ///
- ///
- ///
- public string traduci(string lemma)
- {
- return user_std.UtSn.Traduci(lemma);
- }
- protected void Page_Load(object sender, EventArgs e)
- {
- grView.PageSize = utils.pageSize;
- if (!Page.IsPostBack)
- {
- anno = DateTime.Now.Year;
- intervalloDate currAnno = new intervalloDate
+ ///
+ /// effettua traduzione del lemma
+ ///
+ ///
+ ///
+ public string traduci(string lemma)
{
- inizio = DateTime.Today.AddYears(-2),
- fine = DateTime.Today.AddYears(1)
- };
- mod_periodoAnalisi.intervalloAnalisi = currAnno;
- lbtSetupYear.DataBind();
- DateTime oggi = DateTime.Today;
- inizioFerie = oggi.AddDays(1);
- fineFerie = oggi.AddDays(2);
- }
- }
- DateTime inizioFerie
- {
- get
- {
- DateTime answ = DateTime.Today;
- DateTime.TryParse(txtInizio.Text, out answ);
- return answ;
- }
- set
- {
- txtInizio.Text = value.ToString("yyyy-MM-dd");
- }
- }
- DateTime fineFerie
- {
- get
- {
- DateTime answ = DateTime.Today;
- DateTime.TryParse(txtFine.Text, out answ);
- return answ;
- }
- set
- {
- txtFine.Text = value.ToString("yyyy-MM-dd");
- }
- }
- ///
- /// Anno corrente
- ///
- protected int anno
- {
- get
- {
- int answ = 0;
- int.TryParse(txtAnno.Text, out answ);
- return answ;
- }
- set
- {
- txtAnno.Text = value.ToString();
- }
- }
- protected void lbtSetupYear_Click(object sender, EventArgs e)
- {
- setupFestAnno(anno);
- }
-
- private void setupFestAnno(int reqYear)
- {
- // recupero elenco festività
- List elencoFest = SteamWare.calendarMan.elencoFestAnno(reqYear);
- // inserisco 1:1
- if (elencoFest.Count > 0)
- {
- foreach (var item in elencoFest)
- {
- DataProxy.DP.taCFF.upsertQuery(item.when, "FEST", item.what);
+ return user_std.UtSn.Traduci(lemma);
}
- }
- doUpdate();
- }
-
- public void doUpdate()
- {
- // aggiorno!
- grView.DataBind();
- }
- protected void lbtShowFerie_Click(object sender, EventArgs e)
- {
- divInsFerie.Visible = !divInsFerie.Visible;
- }
-
- protected void lbtSave_Click(object sender, EventArgs e)
- {
- int numGG = (int)fineFerie.Subtract(inizioFerie).TotalDays;
- DateTime currDate = inizioFerie;
- int currYear = DateTime.Today.Year;
- // aggiungo ferie x periodo selezionato...
- for (int i = 0; i < numGG; i++)
- {
- var currDay = inizioFerie.AddDays(i).DayOfWeek;
- // controllo che NON SIA sabato/domenica...
- if (currDay != DayOfWeek.Saturday && currDay != DayOfWeek.Sunday)
+ protected void Page_Load(object sender, EventArgs e)
{
- DataProxy.DP.taCFF.upsertQuery(inizioFerie.AddDays(i), ddlCodGiustInsNew.SelectedValue, txtDescrizione.Text);
+ grView.PageSize = utils.pageSize;
+ if (!Page.IsPostBack)
+ {
+ anno = DateTime.Now.Year;
+ intervalloDate currAnno = new intervalloDate
+ {
+ inizio = DateTime.Today.AddYears(-2),
+ fine = DateTime.Today.AddYears(1)
+ };
+ mod_periodoAnalisi.intervalloAnalisi = currAnno;
+ lbtSetupYear.DataBind();
+ DateTime oggi = DateTime.Today;
+ inizioFerie = oggi.AddDays(1);
+ fineFerie = oggi.AddDays(2);
+ }
+ }
+ DateTime inizioFerie
+ {
+ get
+ {
+ DateTime answ = DateTime.Today;
+ _=DateTime.TryParse(txtInizio.Text, out answ);
+ return answ;
+ }
+ set
+ {
+ txtInizio.Text = value.ToString("yyyy-MM-dd");
+ }
+ }
+ DateTime fineFerie
+ {
+ get
+ {
+ DateTime answ = DateTime.Today;
+ _ = DateTime.TryParse(txtFine.Text, out answ);
+ return answ;
+ }
+ set
+ {
+ txtFine.Text = value.ToString("yyyy-MM-dd");
+ }
+ }
+ ///
+ /// Anno corrente
+ ///
+ protected int anno
+ {
+ get
+ {
+ int answ = 0;
+ _ = int.TryParse(txtAnno.Text, out answ);
+ return answ;
+ }
+ set
+ {
+ txtAnno.Text = value.ToString();
+ }
+ }
+ protected void lbtSetupYear_Click(object sender, EventArgs e)
+ {
+ setupFestAnno(anno);
+ }
+
+ private void setupFestAnno(int reqYear)
+ {
+ // recupero elenco festività
+ List elencoFest = SteamWare.calendarMan.elencoFestAnno(reqYear);
+ // inserisco 1:1
+ if (elencoFest.Count > 0)
+ {
+ foreach (var item in elencoFest)
+ {
+ DataProxy.DP.taCFF.upsertQuery(item.when, "FEST", item.what);
+ }
+ }
+ doUpdate();
+ }
+
+ public void doUpdate()
+ {
+ // aggiorno!
+ grView.DataBind();
+ }
+ protected void lbtShowFerie_Click(object sender, EventArgs e)
+ {
+ divInsFerie.Visible = !divInsFerie.Visible;
+ }
+
+ protected void lbtSave_Click(object sender, EventArgs e)
+ {
+ int numGG = (int)fineFerie.Subtract(inizioFerie).TotalDays;
+ DateTime currDate = inizioFerie;
+ int currYear = DateTime.Today.Year;
+ // aggiungo ferie x periodo selezionato...
+ for (int i = 0; i < numGG; i++)
+ {
+ var currDay = inizioFerie.AddDays(i).DayOfWeek;
+ // controllo che NON SIA sabato/domenica...
+ if (currDay != DayOfWeek.Saturday && currDay != DayOfWeek.Sunday)
+ {
+ DataProxy.DP.taCFF.upsertQuery(inizioFerie.AddDays(i), ddlCodGiustInsNew.SelectedValue, txtDescrizione.Text);
+ }
+ }
+ // rieseguo insert festività x anno del periodo...
+ setupFestAnno(inizioFerie.Year);
}
- }
- // rieseguo insert festività x anno del periodo...
- setupFestAnno(inizioFerie.Year);
}
- }
}
\ No newline at end of file
diff --git a/GPW_Admin/WebUserControls/mod_menuTop.ascx.cs b/GPW_Admin/WebUserControls/mod_menuTop.ascx.cs
index 986c8c7..de85e64 100644
--- a/GPW_Admin/WebUserControls/mod_menuTop.ascx.cs
+++ b/GPW_Admin/WebUserControls/mod_menuTop.ascx.cs
@@ -97,7 +97,7 @@ public partial class mod_menuTop : ApplicationUserControl
{
lnkShowHide.Text = user_std.UtSn.Traduci("lnkShowHide");
lblTitle.Text = user_std.UtSn.Traduci(SteamWare.memLayer.ML.confReadString("titleApp"));
- if (_titleString != "")
+ if (!string.IsNullOrEmpty(_titleString))
{
// traduzione di tutti i termini
lblMessUtente.Text = user_std.UtSn.Traduci(_titleString);
diff --git a/GPW_Admin/WebUserControls/mod_reviewTimbrature.ascx b/GPW_Admin/WebUserControls/mod_reviewTimbrature.ascx
index 6400c0c..a4fbe7b 100644
--- a/GPW_Admin/WebUserControls/mod_reviewTimbrature.ascx
+++ b/GPW_Admin/WebUserControls/mod_reviewTimbrature.ascx
@@ -151,7 +151,7 @@
-
+
diff --git a/GPW_Admin/WebUserControls/mod_ricercaGenerica.ascx.cs b/GPW_Admin/WebUserControls/mod_ricercaGenerica.ascx.cs
index 957a3b0..b1b6b49 100644
--- a/GPW_Admin/WebUserControls/mod_ricercaGenerica.ascx.cs
+++ b/GPW_Admin/WebUserControls/mod_ricercaGenerica.ascx.cs
@@ -19,8 +19,8 @@ public partial class mod_ricercaGenerica : ApplicationUserControl
#endregion
- # region area protected
-
+ #region area protected
+
protected override void Page_Load(object sender, EventArgs e)
{
base.Page_Load(sender, e);
@@ -88,7 +88,7 @@ public partial class mod_ricercaGenerica : ApplicationUserControl
///
public void updateText()
{
- if (SteamWare.memLayer.ML.StringSessionObj("valoreCercato") != "" && !Page.IsPostBack)
+ if (!string.IsNullOrEmpty(memLayer.ML.StringSessionObj("valoreCercato")) && !Page.IsPostBack)
{
testoRicerca = SteamWare.memLayer.ML.StringSessionObj("valoreCercato");
}
diff --git a/GPW_Barcode/WebUserControls/mod_bCodeTimb.ascx.cs b/GPW_Barcode/WebUserControls/mod_bCodeTimb.ascx.cs
index cf6b991..45c2e4c 100644
--- a/GPW_Barcode/WebUserControls/mod_bCodeTimb.ascx.cs
+++ b/GPW_Barcode/WebUserControls/mod_bCodeTimb.ascx.cs
@@ -215,7 +215,7 @@ namespace GPW.WebUserControls
///
private void checkBarcode()
{
- if (barcodeIn != "")
+ if (!string.IsNullOrEmpty(barcodeIn))
{
// mostro i buttons enabled
btnEntrata.Enabled = true;
diff --git a/GPW_Commesse/WebUserControls/mod_commAttivitaDesk.ascx.cs b/GPW_Commesse/WebUserControls/mod_commAttivitaDesk.ascx.cs
index 368253f..08df3a4 100644
--- a/GPW_Commesse/WebUserControls/mod_commAttivitaDesk.ascx.cs
+++ b/GPW_Commesse/WebUserControls/mod_commAttivitaDesk.ascx.cs
@@ -10,617 +10,617 @@ using System.Data;
namespace GPW_Commesse.WebUserControls
{
- public partial class mod_commAttivitaDesk : System.Web.UI.UserControl
- {
+ public partial class mod_commAttivitaDesk : System.Web.UI.UserControl
+ {
- #region area protected / private
+ #region area protected / private
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!Page.IsPostBack)
- {
- refreshControlli();
- pnlHeader.Visible = enableFull;
- lblTitle.Text = string.Format("{0:dddd dd/MM/yyyy}", valoreDateTime);
- }
- }
- ///
- /// minuti selezionati nel controllo radio in testa
- ///
- protected int minutiSel
- {
- get
- {
- return memLayer.ML.IntSessionObj("stdMinDurata");
- }
- set
- {
- memLayer.ML.setSessionVal("stdMinDurata", value);
- }
- }
- ///
- /// refresh dei controlli
- ///
- private void refreshControlli()
- {
- bool doDataBound = true;
- switch (stato)
- {
- case statoControllo.edit:
- doDataBound = true;
- break;
- case statoControllo.insert:
- grView.ShowFooter = true;
- grView.DataBind();
- // imposto arrotondato ad ora...
- DateTime inizio = valoreDateTime.Date.AddHours(DateTime.Now.Hour);
- // imposto durate standard!
- int minuti = minutiSel;
- if (minuti < 0)
- {
- minuti = 60;
- }
- // cerco ultimo valore inserito odierno (se c'è)
- try
- {
- DS_Applicazione.RegAttivitaDataTable tabRA = DataProxy.DP.taRA.getByDipData(idxDipCurr, inizio.Date, inizio.Date.AddDays(1));
- inizio = tabRA[tabRA.Rows.Count - 1].fine;
- }
- catch
- { }
- // cerco di impostare inizio/fine
- try
- {
- ((mod_dateTime)grView.FooterRow.FindControl("dtInizio")).valoreDateTime = inizio;
- ((mod_dateTime)grView.FooterRow.FindControl("dtFine")).valoreDateTime = inizio.AddMinutes(minuti);
- }
- catch
- { }
- doDataBound = false;
- break;
- case statoControllo.item:
- grView.ShowFooter = false;
- // cerco di impostare inizio/fine
- if (grView.EditIndex >= 0)
- {
- if (minutiSel > 0)
+ protected void Page_Load(object sender, EventArgs e)
+ {
+ if (!Page.IsPostBack)
{
- try
- {
- //salvo valori selezionati
- string descrizione = ((TextBox)grView.Rows[grView.EditIndex].FindControl("txtDescrizione")).Text;
- DateTime inizioEdit = ((mod_dateTime)grView.Rows[grView.EditIndex].FindControl("dtInizio")).valoreDateTime;
- grView.DataBind();
- // reimposto! con durata calcolata
- ((mod_dateTime)grView.Rows[grView.EditIndex].FindControl("dtInizio")).valoreDateTime = inizioEdit;
- ((mod_dateTime)grView.Rows[grView.EditIndex].FindControl("dtFine")).valoreDateTime = inizioEdit.AddMinutes(minutiSel);
- ((TextBox)grView.Rows[grView.EditIndex].FindControl("txtDescrizione")).Text = descrizione;
- // DISATTIVO COLLEGAMENTO A DATI...
- doDataBound = false;
- }
- catch
- { }
+ refreshControlli();
+ pnlHeader.Visible = enableFull;
+ lblTitle.Text = string.Format("{0:dddd dd/MM/yyyy}", valoreDateTime);
}
- }
- break;
- default:
- break;
- }
- if (doDataBound)
- {
- grView.DataBind();
- }
- }
- protected void lnkClona_Click(object sender, EventArgs e)
- {
- LinkButton lbtn = (LinkButton)sender;
- int idxRa = 0;
- try
- {
- idxRa = Convert.ToInt32(lbtn.CommandArgument);
- }
- catch
- { }
- // chiamo clona!
- DataProxy.DP.taRA.clonaRecord(idxRa);
- updateControl();
- }
- ///
- /// fa update del controllo e chiama evento update esterno
- ///
- private void updateControl()
- {
- grView.SelectedIndex = -1;
- refreshControlli();
- // sollevo evento nuovo valore...
- if (eh_nuovoValore != null)
- {
- eh_nuovoValore(this, new EventArgs());
- }
- }
- ///
- /// completato insert! aggiorno!
- ///
- ///
- ///
- protected void odsRA_Inserted(object sender, ObjectDataSourceStatusEventArgs e)
- {
- stato = statoControllo.item;
- refreshControlli();
- }
- ///
- /// effettuato update
- ///
- ///
- ///
- protected void grView_RowUpdated(object sender, GridViewUpdatedEventArgs e)
- {
- updateControl();
- }
- ///
- /// riga eliminata
- ///
- ///
- ///
- protected void grView_RowDeleted(object sender, GridViewDeletedEventArgs e)
- {
- updateControl();
- }
- ///
- /// recupera i dati di un nuovo record contenuti nel footer di un gridView;
- /// questi devono esses opportunamente nominati (es: txt{0}, dl{0}, ...)
- ///
- ///
- ///
- protected void doInsert()
- {
- //recupero la riga footer...
- int idxDip = DataProxy.idxDipendente;
- int idxFase = 0;
- DateTime inizio = DateTime.Now;
- DateTime fine = DateTime.Now;
- string descr = "";
- try
- {
- idxFase = Convert.ToInt32(((DropDownList)grView.FooterRow.FindControl("ddlFase")).SelectedValue);
- inizio = ((mod_dateTime)grView.FooterRow.FindControl("dtInizio")).valoreDateTime;
- fine = ((mod_dateTime)grView.FooterRow.FindControl("dtFine")).valoreDateTime;
- descr = ((TextBox)grView.FooterRow.FindControl("txtDescrizione")).Text;
- }
- catch
- { }
- DataProxy.DP.taRA.Insert(idxDip, idxFase, inizio, fine, descr, 0);
- }
- ///
- /// riga in edit
- ///
- ///
- ///
- protected void grView_RowEditing(object sender, GridViewEditEventArgs e)
- {
- grView.SelectedIndex = e.NewEditIndex;
- int idxRASel = Convert.ToInt32(grView.SelectedDataKey["idxRA"]);
- // salvo in sessione valori selezionati
- idxFaseSel = DataProxy.DP.taRA.getByKey(idxRASel)[0].idxFase;
- idxProjSel = idxPrjByFase(idxFaseSel);
- }
- ///
- /// riga popolata
- ///
- ///
- ///
- protected void grView_RowDataBound(object sender, GridViewRowEventArgs e)
- {
- // controllo la riga
- GridViewRow riga = e.Row;
- if (grView.EditIndex >= 0 || grView.ShowFooter)
- {
- try
- {
- //pre-seleziono idx progetto x ods fase...
- DropDownList ddlProj_int = (DropDownList)riga.FindControl("ddlProgetto");
- if (idxProjSel >= 0 && (ddlProj_int != null))
- {
- ddlProj_int.SelectedValue = idxProjSel.ToString();
- }
- DropDownList ddlFase_int = (DropDownList)riga.FindControl("ddlFase");
- if (idxFaseSel >= 0 && (ddlFase_int != null))
- {
- ddlFase_int.SelectedValue = idxFaseSel.ToString();
- }
}
- catch
- { }
- }
- }
- ///
- /// intercetto update!
- ///
- ///
- ///
- protected void odsRA_Updating(object sender, ObjectDataSourceMethodEventArgs e)
- {
- DropDownList ddlfase_int = (DropDownList)grView.Rows[grView.EditIndex].FindControl("ddlFase");
- e.InputParameters["idxFase"] = ddlfase_int.SelectedValue;
- }
- ///
- /// aggiorno ods fasi...
- ///
- ///
- ///
- protected void ddlProgetto_SelectedIndexChanged(object sender, EventArgs e)
- {
- // salvo in session idxProjSel!
- DropDownList ddlProj_int = (DropDownList)sender;
- idxProjSel = Convert.ToInt32(ddlProj_int.SelectedValue);
- // ricarico dati fasi
- odsFase.DataBind();
- // se in insert salvo orari e testo...
- DateTime inizio = DateTime.Now;
- DateTime fine = DateTime.Now;
- string descr = "";
- if (stato == statoControllo.insert)
- {
- inizio = ((mod_dateTime)grView.FooterRow.FindControl("dtInizio")).valoreDateTime;
- fine = ((mod_dateTime)grView.FooterRow.FindControl("dtFine")).valoreDateTime;
- descr = ((TextBox)grView.FooterRow.FindControl("txtDescrizione")).Text;
- }
- else
- {
- // se è edit...
- int idx = grView.EditIndex;
- inizio = ((mod_dateTime)grView.Rows[idx].FindControl("dtInizio")).valoreDateTime;
- fine = ((mod_dateTime)grView.Rows[idx].FindControl("dtFine")).valoreDateTime;
- descr = ((TextBox)grView.Rows[idx].FindControl("txtDescrizione")).Text;
- }
- refreshControlli();
- // se in insert riporto orari e testo...
- if (stato == statoControllo.insert)
- {
- ((mod_dateTime)grView.FooterRow.FindControl("dtInizio")).valoreDateTime = inizio;
- ((mod_dateTime)grView.FooterRow.FindControl("dtFine")).valoreDateTime = fine;
- ((TextBox)grView.FooterRow.FindControl("txtDescrizione")).Text = descr;
- try
+ ///
+ /// minuti selezionati nel controllo radio in testa
+ ///
+ protected int minutiSel
{
- DropDownList ddlFase_int = (DropDownList)grView.FooterRow.FindControl("ddlFase");
- ddlFase_int.SelectedIndex = 1;
+ get
+ {
+ return memLayer.ML.IntSessionObj("stdMinDurata");
+ }
+ set
+ {
+ memLayer.ML.setSessionVal("stdMinDurata", value);
+ }
}
- catch
- { }
- }
- else
- {
- // se è edit...
- int idx = grView.EditIndex;
- ((mod_dateTime)grView.Rows[idx].FindControl("dtInizio")).valoreDateTime = inizio;
- ((mod_dateTime)grView.Rows[idx].FindControl("dtFine")).valoreDateTime = fine;
- ((TextBox)grView.Rows[idx].FindControl("txtDescrizione")).Text = descr;
- try
+ ///
+ /// refresh dei controlli
+ ///
+ private void refreshControlli()
{
- DropDownList ddlFase_int = (DropDownList)grView.Rows[idx].FindControl("ddlFase");
- ddlFase_int.SelectedIndex = 1;
+ bool doDataBound = true;
+ switch (stato)
+ {
+ case statoControllo.edit:
+ doDataBound = true;
+ break;
+ case statoControllo.insert:
+ grView.ShowFooter = true;
+ grView.DataBind();
+ // imposto arrotondato ad ora...
+ DateTime inizio = valoreDateTime.Date.AddHours(DateTime.Now.Hour);
+ // imposto durate standard!
+ int minuti = minutiSel;
+ if (minuti < 0)
+ {
+ minuti = 60;
+ }
+ // cerco ultimo valore inserito odierno (se c'è)
+ try
+ {
+ DS_Applicazione.RegAttivitaDataTable tabRA = DataProxy.DP.taRA.getByDipData(idxDipCurr, inizio.Date, inizio.Date.AddDays(1));
+ inizio = tabRA[tabRA.Rows.Count - 1].fine;
+ }
+ catch
+ { }
+ // cerco di impostare inizio/fine
+ try
+ {
+ ((mod_dateTime)grView.FooterRow.FindControl("dtInizio")).valoreDateTime = inizio;
+ ((mod_dateTime)grView.FooterRow.FindControl("dtFine")).valoreDateTime = inizio.AddMinutes(minuti);
+ }
+ catch
+ { }
+ doDataBound = false;
+ break;
+ case statoControllo.item:
+ grView.ShowFooter = false;
+ // cerco di impostare inizio/fine
+ if (grView.EditIndex >= 0)
+ {
+ if (minutiSel > 0)
+ {
+ try
+ {
+ //salvo valori selezionati
+ string descrizione = ((TextBox)grView.Rows[grView.EditIndex].FindControl("txtDescrizione")).Text;
+ DateTime inizioEdit = ((mod_dateTime)grView.Rows[grView.EditIndex].FindControl("dtInizio")).valoreDateTime;
+ grView.DataBind();
+ // reimposto! con durata calcolata
+ ((mod_dateTime)grView.Rows[grView.EditIndex].FindControl("dtInizio")).valoreDateTime = inizioEdit;
+ ((mod_dateTime)grView.Rows[grView.EditIndex].FindControl("dtFine")).valoreDateTime = inizioEdit.AddMinutes(minutiSel);
+ ((TextBox)grView.Rows[grView.EditIndex].FindControl("txtDescrizione")).Text = descrizione;
+ // DISATTIVO COLLEGAMENTO A DATI...
+ doDataBound = false;
+ }
+ catch
+ { }
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ if (doDataBound)
+ {
+ grView.DataBind();
+ }
}
- catch
- { }
- }
- }
- ///
- /// progetto selezionato
- ///
- protected int idxProjSel
- {
- get
- {
- return memLayer.ML.IntSessionObj("idxProjSel");
- }
- set
- {
- memLayer.ML.setSessionVal("idxProjSel", value);
- }
- }
- ///
- /// fase selezionata
- ///
- protected int idxFaseSel
- {
- get
- {
- return memLayer.ML.IntSessionObj("idxFaseSel");
- }
- set
- {
- memLayer.ML.setSessionVal("idxFaseSel", value);
- }
- }
- ///
- /// generico comando riga
- ///
- ///
- ///
- protected void grView_RowCommand(object sender, GridViewCommandEventArgs e)
- {
- switch (e.CommandName)
- {
- case "Cancel":
- stato = statoControllo.item;
- updateControl();
- break;
- case "Insert":
- doInsert();
- stato = statoControllo.item;
- updateControl();
- break;
- default:
- break;
- }
- }
-
- #endregion
-
- #region area public
-
- ///
- /// idxDipendente selezionato (0=tutti)
- ///
- public int idxDipCurr
- {
- get
- {
- return memLayer.ML.IntSessionObj("idxDipCurr");
- }
- set
- {
- memLayer.ML.setSessionVal("idxDipCurr", value);
- }
- }
- ///
- /// progetto selezionato..
- ///
- public string idxProgetto
- {
- get
- {
- return idxProjSel.ToString();
- }
- }
- ///
- /// abilitato editing + nuovo + delete + clona
- ///
- public bool enableFull
- {
- get
- {
- bool answ = false;
- try
+ protected void lnkClona_Click(object sender, EventArgs e)
{
- answ = memLayer.ML.BoolSessionObj("enableEditComm");
+ LinkButton lbtn = (LinkButton)sender;
+ int idxRa = 0;
+ try
+ {
+ idxRa = Convert.ToInt32(lbtn.CommandArgument);
+ }
+ catch
+ { }
+ // chiamo clona!
+ DataProxy.DP.taRA.clonaRecord(idxRa);
+ updateControl();
}
- catch
- { }
- return answ;
- }
- set
- {
- memLayer.ML.setSessionVal("enableEditComm", value);
- }
- }
- ///
- /// stato attuale del controllo
- ///
- public statoControllo stato
- {
- get
- {
- statoControllo answ = statoControllo.item;
- try
+ ///
+ /// fa update del controllo e chiama evento update esterno
+ ///
+ private void updateControl()
{
- answ = (statoControllo)memLayer.ML.objSessionObj("statoControlloRA");
+ grView.SelectedIndex = -1;
+ refreshControlli();
+ // sollevo evento nuovo valore...
+ if (eh_nuovoValore != null)
+ {
+ eh_nuovoValore(this, new EventArgs());
+ }
}
- catch
- { }
- return answ;
- }
- set
- {
- memLayer.ML.setSessionVal("statoControlloRA", value);
- }
- }
- ///
- /// valore datetime selezionato!
- ///
- public DateTime valoreDateTime
- {
- get
- {
- DateTime answ = DateTime.Now;
- try
+ ///
+ /// completato insert! aggiorno!
+ ///
+ ///
+ ///
+ protected void odsRA_Inserted(object sender, ObjectDataSourceStatusEventArgs e)
{
- answ = Convert.ToDateTime(memLayer.ML.objSessionObj("dataRif"));
+ stato = statoControllo.item;
+ refreshControlli();
}
- catch
- { }
- return answ;
- }
- set
- {
- memLayer.ML.setSessionVal("dataRif", value);
- lblTitle.Text = string.Format("{0:dddd dd/MM/yyyy}", value);
- }
- }
- ///
- /// evento update valori
- ///
- public event EventHandler eh_nuovoValore;
- ///
- /// effettua traduzione del lemma
- ///
- ///
- ///
- public string traduci(string lemma)
- {
- return user_std.UtSn.Traduci(lemma);
- }
- ///
- /// aggiorna
- ///
- public void doUpdate()
- {
- refreshControlli();
- }
-
- ///
- /// calcola idxProgetto da idxFase
- ///
- ///
- ///
- public int idxPrjByFase(object idxFase)
- {
- int answ = 0;
- try
- {
- answ = DataProxy.DP.taAF.getByIdx(Convert.ToInt32(idxFase))[0].idxProgetto;
- }
- catch
- { }
- return answ;
- }
- ///
- /// sistemo eventuali "headers"
- ///
- ///
- ///
- protected void ddlFase_DataBound(object sender, EventArgs e)
- {
- // cerco eventuali controlli tipo "ancestor" e li disattivo!
- DropDownList ddlFase_int = (DropDownList)sender;
- ListItem li = new ListItem();
- while (li != null)
- {
- li = ddlFase_int.Items.FindByValue("0");
- try
+ ///
+ /// effettuato update
+ ///
+ ///
+ ///
+ protected void grView_RowUpdated(object sender, GridViewUpdatedEventArgs e)
{
- li.Attributes.Add("style", "color:gray;");
- li.Attributes.Add("disabled", "true");
- li.Value = "-1";
- li.Text = string.Format("[ {0} ]", li.Text);
+ updateControl();
}
- catch
- { }
- }
- try
- {
- ddlFase_int.SelectedIndex = 1;
- }
- catch
- { }
- }
- ///
- /// richiesta creazione nuovo record
- ///
- ///
- ///
- protected void btnNew_Click(object sender, EventArgs e)
- {
- createNew();
- }
-
- private void createNew()
- {
- if (grView.Rows.Count > 0)
- {
- // controllo: se ho righe mostro il footer...
- stato = statoControllo.insert;
- refreshControlli();
- }
- else
- {
- // default: inizia ora la dichiarazione
- double oraStart = DateTime.Now.Hour;
- int durataMinuti = memLayer.ML.IntSessionObj("stdMinDurata");
- // se c'è timbratura ingresso prendo quella come ora inizio...
- try
+ ///
+ /// riga eliminata
+ ///
+ ///
+ ///
+ protected void grView_RowDeleted(object sender, GridViewDeletedEventArgs e)
{
- DS_Applicazione.TimbratureRow riga = DataProxy.DP.taTimb.getByIdxDipPeriodo(DataProxy.idxDipendente, valoreDateTime, valoreDateTime.AddDays(1))[0];
- oraStart = Convert.ToDouble(riga.dataOra.Hour + riga.dataOra.Minute / 60);
+ updateControl();
}
- catch
- { }
- // altrimenti duplico ultima entry utente..
- DataProxy.DP.taRA.clonaLastRA_Utente(DataProxy.idxDipendente, valoreDateTime.AddHours(oraStart), durataMinuti);
- updateControl();
- }
- }
-
- ///
- /// richiesta creazione nuovo record
- ///
- ///
- ///
- protected void lnkNew_Click(object sender, EventArgs e)
- {
- createNew();
- }
- ///
- /// esegue ricerca progetto/fase x sovrascrivere
- ///
- ///
- ///
- protected void txtSearchFase_TextChanged(object sender, EventArgs e)
- {
-
- // recupero testo...
- string search = "";
- try
- {
- search = ((TextBox)sender).Text.Trim();
- }
- catch
- { }
- if (search != "")
- {
- // faccio ricerca x progetto e fase...
- GPW_data.DS_Utility.stp_VSProjFasi_searchDataTable tabRes = DataProxy.DP.taVSProjFasiSearch.GetData(search);
- if (tabRes.Rows.Count > 0)
+ ///
+ /// recupera i dati di un nuovo record contenuti nel footer di un gridView;
+ /// questi devono esses opportunamente nominati (es: txt{0}, dl{0}, ...)
+ ///
+ ///
+ ///
+ protected void doInsert()
{
- idxFaseSel = tabRes[0].idxFase;
- idxProjSel = tabRes[0].idxProgetto;
+ //recupero la riga footer...
+ int idxDip = DataProxy.idxDipendente;
+ int idxFase = 0;
+ DateTime inizio = DateTime.Now;
+ DateTime fine = DateTime.Now;
+ string descr = "";
+ try
+ {
+ idxFase = Convert.ToInt32(((DropDownList)grView.FooterRow.FindControl("ddlFase")).SelectedValue);
+ inizio = ((mod_dateTime)grView.FooterRow.FindControl("dtInizio")).valoreDateTime;
+ fine = ((mod_dateTime)grView.FooterRow.FindControl("dtFine")).valoreDateTime;
+ descr = ((TextBox)grView.FooterRow.FindControl("txtDescrizione")).Text;
+ }
+ catch
+ { }
+ DataProxy.DP.taRA.Insert(idxDip, idxFase, inizio, fine, descr, 0);
}
- }
- //stato = statoControllo.edit;
- //refreshControlli();
- //stato = statoControllo.item;
- //minutiSel = -1;
- refreshControlli();
+ ///
+ /// riga in edit
+ ///
+ ///
+ ///
+ protected void grView_RowEditing(object sender, GridViewEditEventArgs e)
+ {
+ grView.SelectedIndex = e.NewEditIndex;
+ int idxRASel = Convert.ToInt32(grView.SelectedDataKey["idxRA"]);
+ // salvo in sessione valori selezionati
+ idxFaseSel = DataProxy.DP.taRA.getByKey(idxRASel)[0].idxFase;
+ idxProjSel = idxPrjByFase(idxFaseSel);
+ }
+ ///
+ /// riga popolata
+ ///
+ ///
+ ///
+ protected void grView_RowDataBound(object sender, GridViewRowEventArgs e)
+ {
+ // controllo la riga
+ GridViewRow riga = e.Row;
+ if (grView.EditIndex >= 0 || grView.ShowFooter)
+ {
+ try
+ {
+ //pre-seleziono idx progetto x ods fase...
+ DropDownList ddlProj_int = (DropDownList)riga.FindControl("ddlProgetto");
+ if (idxProjSel >= 0 && (ddlProj_int != null))
+ {
+ ddlProj_int.SelectedValue = idxProjSel.ToString();
+ }
+ DropDownList ddlFase_int = (DropDownList)riga.FindControl("ddlFase");
+ if (idxFaseSel >= 0 && (ddlFase_int != null))
+ {
+ ddlFase_int.SelectedValue = idxFaseSel.ToString();
+ }
+ }
+ catch
+ { }
+ }
+ }
+ ///
+ /// intercetto update!
+ ///
+ ///
+ ///
+ protected void odsRA_Updating(object sender, ObjectDataSourceMethodEventArgs e)
+ {
+ DropDownList ddlfase_int = (DropDownList)grView.Rows[grView.EditIndex].FindControl("ddlFase");
+ e.InputParameters["idxFase"] = ddlfase_int.SelectedValue;
+ }
+ ///
+ /// aggiorno ods fasi...
+ ///
+ ///
+ ///
+ protected void ddlProgetto_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ // salvo in session idxProjSel!
+ DropDownList ddlProj_int = (DropDownList)sender;
+ idxProjSel = Convert.ToInt32(ddlProj_int.SelectedValue);
+ // ricarico dati fasi
+ odsFase.DataBind();
+ // se in insert salvo orari e testo...
+ DateTime inizio = DateTime.Now;
+ DateTime fine = DateTime.Now;
+ string descr = "";
+ if (stato == statoControllo.insert)
+ {
+ inizio = ((mod_dateTime)grView.FooterRow.FindControl("dtInizio")).valoreDateTime;
+ fine = ((mod_dateTime)grView.FooterRow.FindControl("dtFine")).valoreDateTime;
+ descr = ((TextBox)grView.FooterRow.FindControl("txtDescrizione")).Text;
+ }
+ else
+ {
+ // se è edit...
+ int idx = grView.EditIndex;
+ inizio = ((mod_dateTime)grView.Rows[idx].FindControl("dtInizio")).valoreDateTime;
+ fine = ((mod_dateTime)grView.Rows[idx].FindControl("dtFine")).valoreDateTime;
+ descr = ((TextBox)grView.Rows[idx].FindControl("txtDescrizione")).Text;
+ }
+ refreshControlli();
+ // se in insert riporto orari e testo...
+ if (stato == statoControllo.insert)
+ {
+ ((mod_dateTime)grView.FooterRow.FindControl("dtInizio")).valoreDateTime = inizio;
+ ((mod_dateTime)grView.FooterRow.FindControl("dtFine")).valoreDateTime = fine;
+ ((TextBox)grView.FooterRow.FindControl("txtDescrizione")).Text = descr;
+ try
+ {
+ DropDownList ddlFase_int = (DropDownList)grView.FooterRow.FindControl("ddlFase");
+ ddlFase_int.SelectedIndex = 1;
+ }
+ catch
+ { }
+ }
+ else
+ {
+ // se è edit...
+ int idx = grView.EditIndex;
+ ((mod_dateTime)grView.Rows[idx].FindControl("dtInizio")).valoreDateTime = inizio;
+ ((mod_dateTime)grView.Rows[idx].FindControl("dtFine")).valoreDateTime = fine;
+ ((TextBox)grView.Rows[idx].FindControl("txtDescrizione")).Text = descr;
+ try
+ {
+ DropDownList ddlFase_int = (DropDownList)grView.Rows[idx].FindControl("ddlFase");
+ ddlFase_int.SelectedIndex = 1;
+ }
+ catch
+ { }
+ }
+ }
+ ///
+ /// progetto selezionato
+ ///
+ protected int idxProjSel
+ {
+ get
+ {
+ return memLayer.ML.IntSessionObj("idxProjSel");
+ }
+ set
+ {
+ memLayer.ML.setSessionVal("idxProjSel", value);
+ }
+ }
+ ///
+ /// fase selezionata
+ ///
+ protected int idxFaseSel
+ {
+ get
+ {
+ return memLayer.ML.IntSessionObj("idxFaseSel");
+ }
+ set
+ {
+ memLayer.ML.setSessionVal("idxFaseSel", value);
+ }
+ }
+ ///
+ /// generico comando riga
+ ///
+ ///
+ ///
+ protected void grView_RowCommand(object sender, GridViewCommandEventArgs e)
+ {
+ switch (e.CommandName)
+ {
+ case "Cancel":
+ stato = statoControllo.item;
+ updateControl();
+ break;
+ case "Insert":
+ doInsert();
+ stato = statoControllo.item;
+ updateControl();
+ break;
+ default:
+ break;
+ }
+ }
+
+ #endregion
+
+ #region area public
+
+ ///
+ /// idxDipendente selezionato (0=tutti)
+ ///
+ public int idxDipCurr
+ {
+ get
+ {
+ return memLayer.ML.IntSessionObj("idxDipCurr");
+ }
+ set
+ {
+ memLayer.ML.setSessionVal("idxDipCurr", value);
+ }
+ }
+ ///
+ /// progetto selezionato..
+ ///
+ public string idxProgetto
+ {
+ get
+ {
+ return idxProjSel.ToString();
+ }
+ }
+ ///
+ /// abilitato editing + nuovo + delete + clona
+ ///
+ public bool enableFull
+ {
+ get
+ {
+ bool answ = false;
+ try
+ {
+ answ = memLayer.ML.BoolSessionObj("enableEditComm");
+ }
+ catch
+ { }
+ return answ;
+ }
+ set
+ {
+ memLayer.ML.setSessionVal("enableEditComm", value);
+ }
+ }
+ ///
+ /// stato attuale del controllo
+ ///
+ public statoControllo stato
+ {
+ get
+ {
+ statoControllo answ = statoControllo.item;
+ try
+ {
+ answ = (statoControllo)memLayer.ML.objSessionObj("statoControlloRA");
+ }
+ catch
+ { }
+ return answ;
+ }
+ set
+ {
+ memLayer.ML.setSessionVal("statoControlloRA", value);
+ }
+ }
+ ///
+ /// valore datetime selezionato!
+ ///
+ public DateTime valoreDateTime
+ {
+ get
+ {
+ DateTime answ = DateTime.Now;
+ try
+ {
+ answ = Convert.ToDateTime(memLayer.ML.objSessionObj("dataRif"));
+ }
+ catch
+ { }
+ return answ;
+ }
+ set
+ {
+ memLayer.ML.setSessionVal("dataRif", value);
+ lblTitle.Text = string.Format("{0:dddd dd/MM/yyyy}", value);
+ }
+ }
+ ///
+ /// evento update valori
+ ///
+ public event EventHandler eh_nuovoValore;
+ ///
+ /// effettua traduzione del lemma
+ ///
+ ///
+ ///
+ public string traduci(string lemma)
+ {
+ return user_std.UtSn.Traduci(lemma);
+ }
+ ///
+ /// aggiorna
+ ///
+ public void doUpdate()
+ {
+ refreshControlli();
+ }
+
+ ///
+ /// calcola idxProgetto da idxFase
+ ///
+ ///
+ ///
+ public int idxPrjByFase(object idxFase)
+ {
+ int answ = 0;
+ try
+ {
+ answ = DataProxy.DP.taAF.getByIdx(Convert.ToInt32(idxFase))[0].idxProgetto;
+ }
+ catch
+ { }
+ return answ;
+ }
+ ///
+ /// sistemo eventuali "headers"
+ ///
+ ///
+ ///
+ protected void ddlFase_DataBound(object sender, EventArgs e)
+ {
+ // cerco eventuali controlli tipo "ancestor" e li disattivo!
+ DropDownList ddlFase_int = (DropDownList)sender;
+ ListItem li = new ListItem();
+ while (li != null)
+ {
+ li = ddlFase_int.Items.FindByValue("0");
+ try
+ {
+ li.Attributes.Add("style", "color:gray;");
+ li.Attributes.Add("disabled", "true");
+ li.Value = "-1";
+ li.Text = string.Format("[ {0} ]", li.Text);
+ }
+ catch
+ { }
+ }
+ try
+ {
+ ddlFase_int.SelectedIndex = 1;
+ }
+ catch
+ { }
+ }
+ ///
+ /// richiesta creazione nuovo record
+ ///
+ ///
+ ///
+ protected void btnNew_Click(object sender, EventArgs e)
+ {
+ createNew();
+ }
+
+ private void createNew()
+ {
+ if (grView.Rows.Count > 0)
+ {
+ // controllo: se ho righe mostro il footer...
+ stato = statoControllo.insert;
+ refreshControlli();
+ }
+ else
+ {
+ // default: inizia ora la dichiarazione
+ double oraStart = DateTime.Now.Hour;
+ int durataMinuti = memLayer.ML.IntSessionObj("stdMinDurata");
+ // se c'è timbratura ingresso prendo quella come ora inizio...
+ try
+ {
+ DS_Applicazione.TimbratureRow riga = DataProxy.DP.taTimb.getByIdxDipPeriodo(DataProxy.idxDipendente, valoreDateTime, valoreDateTime.AddDays(1))[0];
+ oraStart = Convert.ToDouble(riga.dataOra.Hour + riga.dataOra.Minute / 60);
+ }
+ catch
+ { }
+ // altrimenti duplico ultima entry utente..
+ DataProxy.DP.taRA.clonaLastRA_Utente(DataProxy.idxDipendente, valoreDateTime.AddHours(oraStart), durataMinuti);
+ updateControl();
+ }
+ }
+
+ ///
+ /// richiesta creazione nuovo record
+ ///
+ ///
+ ///
+ protected void lnkNew_Click(object sender, EventArgs e)
+ {
+ createNew();
+ }
+ ///
+ /// esegue ricerca progetto/fase x sovrascrivere
+ ///
+ ///
+ ///
+ protected void txtSearchFase_TextChanged(object sender, EventArgs e)
+ {
+
+ // recupero testo...
+ string search = "";
+ try
+ {
+ search = ((TextBox)sender).Text.Trim();
+ }
+ catch
+ { }
+ if (!string.IsNullOrEmpty(search))
+ {
+ // faccio ricerca x progetto e fase...
+ GPW_data.DS_Utility.stp_VSProjFasi_searchDataTable tabRes = DataProxy.DP.taVSProjFasiSearch.GetData(search);
+ if (tabRes.Rows.Count > 0)
+ {
+ idxFaseSel = tabRes[0].idxFase;
+ idxProjSel = tabRes[0].idxProgetto;
+ }
+ }
+ //stato = statoControllo.edit;
+ //refreshControlli();
+ //stato = statoControllo.item;
+ //minutiSel = -1;
+ refreshControlli();
+ }
+
+
+ ///
+ /// formatta la durata in ore secondo web.config (centesimale/ore:min)
+ ///
+ ///
+ ///
+ public string formatDurata(object oreCent)
+ {
+ decimal ore = 0;
+ try
+ {
+ ore = Convert.ToDecimal(oreCent);
+ }
+ catch
+ { }
+ string answ = "";
+ if (memLayer.ML.confReadBool("reviewShowOreMin"))
+ {
+ answ = utils.formOreMin(ore);
+ }
+ else
+ {
+ answ = ore.ToString("0.00");
+ }
+ return answ;
+ }
+
+ #endregion
+
}
-
-
- ///
- /// formatta la durata in ore secondo web.config (centesimale/ore:min)
- ///
- ///
- ///
- public string formatDurata(object oreCent)
- {
- decimal ore = 0;
- try
- {
- ore = Convert.ToDecimal(oreCent);
- }
- catch
- { }
- string answ = "";
- if (memLayer.ML.confReadBool("reviewShowOreMin"))
- {
- answ = utils.formOreMin(ore);
- }
- else
- {
- answ = ore.ToString("0.00");
- }
- return answ;
- }
-
- #endregion
-
- }
}
\ No newline at end of file
diff --git a/GPW_Commesse/WebUserControls/mod_filtro.ascx.cs b/GPW_Commesse/WebUserControls/mod_filtro.ascx.cs
index f0a1ad5..994fc9a 100644
--- a/GPW_Commesse/WebUserControls/mod_filtro.ascx.cs
+++ b/GPW_Commesse/WebUserControls/mod_filtro.ascx.cs
@@ -296,7 +296,7 @@ public partial class mod_filtro : ApplicationUserControl
{
dlFilt.DataSource = _ods;
dlFilt.DataBind();
- if (_valore != "")
+ if (!string.IsNullOrEmpty(_valore))
{
dlFilt.SelectedValue = _valore;
diff --git a/GPW_Commesse/WebUserControls/mod_menuTop.ascx.cs b/GPW_Commesse/WebUserControls/mod_menuTop.ascx.cs
index 581ad20..5f1170f 100644
--- a/GPW_Commesse/WebUserControls/mod_menuTop.ascx.cs
+++ b/GPW_Commesse/WebUserControls/mod_menuTop.ascx.cs
@@ -97,7 +97,7 @@ public partial class mod_menuTop : ApplicationUserControl
{
lnkShowHide.Text = user_std.UtSn.Traduci("lnkShowHide");
lblTitle.Text = user_std.UtSn.Traduci(SteamWare.memLayer.ML.confReadString("titleApp"));
- if (_titleString != "")
+ if (!string.IsNullOrEmpty(_titleString))
{
// traduzione di tutti i termini
lblMessUtente.Text = user_std.UtSn.Traduci(_titleString);
diff --git a/GPW_Commesse/WebUserControls/mod_menuTopFull.ascx.cs b/GPW_Commesse/WebUserControls/mod_menuTopFull.ascx.cs
index 3a3d94a..90a6f99 100644
--- a/GPW_Commesse/WebUserControls/mod_menuTopFull.ascx.cs
+++ b/GPW_Commesse/WebUserControls/mod_menuTopFull.ascx.cs
@@ -41,7 +41,7 @@ namespace GPW_Commesse.WebUserControls
{
set
{
- if (value != "")
+ if (!string.IsNullOrEmpty(value))
{
memLayer.ML.setSessionVal("returnUrl", value);
lbHome.Visible = true;
diff --git a/GPW_Commesse/WebUserControls/mod_ricercaGenerica.ascx.cs b/GPW_Commesse/WebUserControls/mod_ricercaGenerica.ascx.cs
index fb623c7..b1b6b49 100644
--- a/GPW_Commesse/WebUserControls/mod_ricercaGenerica.ascx.cs
+++ b/GPW_Commesse/WebUserControls/mod_ricercaGenerica.ascx.cs
@@ -88,7 +88,7 @@ public partial class mod_ricercaGenerica : ApplicationUserControl
///
public void updateText()
{
- if (SteamWare.memLayer.ML.StringSessionObj("valoreCercato") != "" && !Page.IsPostBack)
+ if (!string.IsNullOrEmpty(memLayer.ML.StringSessionObj("valoreCercato")) && !Page.IsPostBack)
{
testoRicerca = SteamWare.memLayer.ML.StringSessionObj("valoreCercato");
}
diff --git a/GPW_Data/utils.cs b/GPW_Data/utils.cs
index 428f20f..d25d75e 100644
--- a/GPW_Data/utils.cs
+++ b/GPW_Data/utils.cs
@@ -7,352 +7,352 @@ using SteamWare;
namespace GPW_data
{
- public class utils
- {
- ///
- /// avvio oggetti utils
- ///
- protected utils()
+ public class utils
{
- }
- ///
- /// restituisce elenco clienti trasformato in dictionary
- ///
- ///
- protected Dictionary ricaricaElencoClienti()
- {
- Dictionary answ = new Dictionary();
- // recupero elenco clienti da dataproxy
- foreach (DS_Applicazione.AnagClientiRow riga in DataProxy.DP.taAnCli.GetData())
- {
- answ.Add(riga.idxCliente.ToString(), riga.RagSociale);
- }
- return answ;
- }
- ///
- /// singleton accesso metodo
- ///
- public static utils mng = new utils();
- ///
- /// dim pagina gridView in sessione
- ///
- public static int pageSize
- {
- get
- {
- int answ = 20;
- try
+ ///
+ /// avvio oggetti utils
+ ///
+ protected utils()
{
- answ = SteamWare.memLayer.ML.IntSessionObj("pageSize");
- if (answ <= 0) answ = 20;
}
- catch
- { }
- return answ;
- }
- set
- {
- SteamWare.memLayer.ML.setSessionVal("pageSize", value);
- }
- }
- ///
- /// oggetto elenco clienti organizzato come dizionario con chiave idxCliente e valore la ragione sociale
- ///
- public Dictionary elencoClienti
- {
- set
- {
- string redKey = memLayer.ML.redHash("elencoClienti");
- string rawData = JsonConvert.SerializeObject(value);
- memLayer.ML.setRSV(redKey, rawData, 60);
- }
- get
- {
- Dictionary answ = new Dictionary();
- string redKey = memLayer.ML.redHash("elencoClienti");
- string rawData = memLayer.ML.getRSV(redKey);
- if (!string.IsNullOrEmpty(rawData))
+ ///
+ /// restituisce elenco clienti trasformato in dictionary
+ ///
+ ///
+ protected Dictionary ricaricaElencoClienti()
{
- try
- {
- answ = JsonConvert.DeserializeObject>(rawData);
- }
- catch
- { }
+ Dictionary answ = new Dictionary();
+ // recupero elenco clienti da dataproxy
+ foreach (DS_Applicazione.AnagClientiRow riga in DataProxy.DP.taAnCli.GetData())
+ {
+ answ.Add(riga.idxCliente.ToString(), riga.RagSociale);
+ }
+ return answ;
}
- if (answ.Count == 0)
+ ///
+ /// singleton accesso metodo
+ ///
+ public static utils mng = new utils();
+ ///
+ /// dim pagina gridView in sessione
+ ///
+ public static int pageSize
{
- answ = ricaricaElencoClienti();
- elencoClienti = answ;
- }
- return answ;
- }
- }
- ///
- /// Effettua un insieme di controlli sulle anomalie delel timbrature/orari e invia le relative eventuali email
- ///
- ///
- public bool checkAnomalie()
- {
- bool answ = false;
- try
- {
- // log richiesta!
- logger.lg.scriviLog("Richiesto controllo anomalie!", tipoLog.INFO);
- /*******************************************************
- * controllo le varie anomalie delle timbrature:
- *
- * (A) mancate approvazioni --> admin
- * (B) entrate <> uscite --> admin, user
- * (C) mancata copertura orario --> admin
- *
- * (D) mancata copertura commesse (2 be done)
- *
- * recupero elenco dip interessati x le varie anomalie con stp_DipendentiAndAnomalie
- * e poi da timbrExpl recupero le singole istanze di record errori
- *
- *******************************************************/
-
- // setup valori base
- string fromEmail = memLayer.ML.confReadString("_fromEmail");
- string adminEmail = memLayer.ML.confReadString("adminAnomalieEmail");
- string adminContinuatoEmail = memLayer.ML.confReadString("adminContinuatoEmail");
- string adminOreLavEmail = memLayer.ML.confReadString("adminOreLavEmail");
- string oggettoEmail = "";
- string corpoEmail = "";
- DS_Applicazione.stp_DipendentiAndAnomalieDataTable tabDipAndAnom = new DS_Applicazione.stp_DipendentiAndAnomalieDataTable();
- DS_Applicazione.TimbratureExplDataTable tabTimbExpl = new DS_Applicazione.TimbratureExplDataTable();
- DS_Applicazione.TE_RA_ExplDataTable tabTimbRegAtt = new DS_Applicazione.TE_RA_ExplDataTable();
- DateTime adesso = DateTime.Now;
- int gg2Chk = memLayer.ML.confReadInt("gg2Chk");
- int gg2ChkCont = memLayer.ML.confReadInt("gg2ChkCont");
- int gg2ChkOreCaricate = memLayer.ML.confReadInt("gg2ChkOreCaricate");
-
- // (A) recupero mancate approvazioni, mando solo ad admin
- if (memLayer.ML.confReadBool("checkAnomAppr"))
- {
- tabTimbExpl = DataProxy.DP.taTimbExpl.getByDipAnomalia(0, adesso.AddDays(-gg2Chk), adesso.AddHours(1), true, false, false);
- // se ho trovato record...
- if (tabTimbExpl.Rows.Count > 0)
- {
- logger.lg.scriviLog("Trovate anomalie mancate approvazioni, invio email ad admin", tipoLog.INFO);
- oggettoEmail = "Anomalie GPW: Approvazione Timbrature";
- if (memLayer.ML.confReadBool("includeDirectUrl"))
+ get
{
- corpoEmail = string.Format("Risultano a sistema le seguenti anomalie:
timbrature da approvare
", memLayer.ML.confReadString("baseUrl"));
- }
- else
- {
- corpoEmail = "Risultano a sistema le seguenti anomalie: timbrature da approvare
";
- }
- corpoEmail += string.Format("{0}
", SteamwareStrings.charLine('-', 80));
- corpoEmail += "| -- DATA --\t| Dipendente
";
- corpoEmail += string.Format("{0}
", SteamwareStrings.charLine('-', 80));
- foreach (DS_Applicazione.TimbratureExplRow riga in tabTimbExpl)
- {
- corpoEmail += string.Format("| {0:yyyy.MM.dd ddd}\t| {1}
", riga.dataLav, riga.CognomeNome);
- }
- corpoEmail += SteamwareStrings.charLine('-', 80);
- gestEmail.geAuth.mandaEmail(fromEmail, adminEmail, oggettoEmail, corpoEmail);
- }
- }
-
- // (B) recupero errori entrate/uscite, mando ad admin + utenti
- if (memLayer.ML.confReadBool("checkAnomTimb"))
- {
- tabDipAndAnom = DataProxy.DP.taDipAnom.GetData(adesso.AddDays(-gg2Chk), adesso.AddHours(1), false, true, false);
- tabTimbExpl = DataProxy.DP.taTimbExpl.getByDipAnomalia(0, adesso.AddDays(-gg2Chk), adesso.AddHours(1), false, true, false);
- // se ho trovato record...
- if (tabTimbExpl.Rows.Count > 0)
- {
- logger.lg.scriviLog("Trovate anomalie timbrature IN/OUT non corrispondenti, invio email!", tipoLog.INFO);
- // mando email ad admin!
- oggettoEmail = "Anomalie GPW: Timbrature mancanti";
- if (memLayer.ML.confReadBool("includeDirectUrl"))
- {
- corpoEmail = string.Format("Risultano a sistema le seguenti anomalie:
timbrature mancanti / non corrispondenti
", memLayer.ML.confReadString("baseUrl"));
- }
- else
- {
- corpoEmail = "Risultano a sistema le seguenti anomalie: timbrature mancanti
";
- }
- corpoEmail += string.Format("{0}
", SteamwareStrings.charLine('-', 80));
- corpoEmail += "| -- DATA --\t| Dipendente
";
- corpoEmail += string.Format("{0}
", SteamwareStrings.charLine('-', 80));
- foreach (DS_Applicazione.TimbratureExplRow riga in tabTimbExpl)
- {
- corpoEmail += string.Format("| {0:yyyy.MM.dd ddd}\t| {1}
", riga.dataLav, riga.CognomeNome);
- }
- corpoEmail += SteamwareStrings.charLine('-', 80);
- gestEmail.geAuth.mandaEmail(fromEmail, adminEmail, oggettoEmail, corpoEmail);
-
- // re richiesto invio email utenti x warning entrate/uscrite
- if (memLayer.ML.confReadBool("sendEmailToUser"))
- {
- // mando singole email ai dipendenti SE C'è EMAIL!!!!
- foreach (DS_Applicazione.stp_DipendentiAndAnomalieRow rigaDip in tabDipAndAnom)
- {
- if (rigaDip.email != "")
+ int answ = 20;
+ try
{
- tabTimbExpl = DataProxy.DP.taTimbExpl.getByDipAnomalia(rigaDip.idxDipendente, adesso.AddDays(-gg2Chk), adesso.AddHours(1), false, true, false);
- // reimposto testo
- if (memLayer.ML.confReadBool("includeDirectUrl"))
- {
- corpoEmail = string.Format("Risultano a sistema le seguenti anomalie:
timbrature mancanti / non corrispondenti
", memLayer.ML.confReadString("baseUrl"));
- }
- else
- {
- corpoEmail = "Risultano a sistema le seguenti anomalie: timbrature mancanti / non corrispondenti
";
- }
- corpoEmail += string.Format("{0}
", SteamwareStrings.charLine('-', 80));
- corpoEmail += "| -- DATA --\t| -- Dipendente --
";
- corpoEmail += string.Format("{0}
", SteamwareStrings.charLine('-', 80));
- foreach (DS_Applicazione.TimbratureExplRow riga in tabTimbExpl)
- {
- corpoEmail += string.Format("| {0:yyyy.MM.dd ddd}\t| {1}
", riga.dataLav, riga.CognomeNome);
- }
- corpoEmail += SteamwareStrings.charLine('-', 80);
- gestEmail.geAuth.mandaEmail(fromEmail, rigaDip.email, oggettoEmail, corpoEmail);
+ answ = SteamWare.memLayer.ML.IntSessionObj("pageSize");
+ if (answ <= 0) answ = 20;
}
- }
+ catch
+ { }
+ return answ;
+ }
+ set
+ {
+ SteamWare.memLayer.ML.setSessionVal("pageSize", value);
}
- }
}
+ ///
+ /// oggetto elenco clienti organizzato come dizionario con chiave idxCliente e valore la ragione sociale
+ ///
+ public Dictionary elencoClienti
+ {
+ set
+ {
+ string redKey = memLayer.ML.redHash("elencoClienti");
+ string rawData = JsonConvert.SerializeObject(value);
+ memLayer.ML.setRSV(redKey, rawData, 60);
+ }
+ get
+ {
+ Dictionary answ = new Dictionary();
+ string redKey = memLayer.ML.redHash("elencoClienti");
+ string rawData = memLayer.ML.getRSV(redKey);
+ if (!string.IsNullOrEmpty(rawData))
+ {
+ try
+ {
+ answ = JsonConvert.DeserializeObject>(rawData);
+ }
+ catch
+ { }
+ }
+ if (answ.Count == 0)
+ {
+ answ = ricaricaElencoClienti();
+ elencoClienti = answ;
+ }
+ return answ;
+ }
+ }
+ ///
+ /// Effettua un insieme di controlli sulle anomalie delel timbrature/orari e invia le relative eventuali email
+ ///
+ ///
+ public bool checkAnomalie()
+ {
+ bool answ = false;
+ try
+ {
+ // log richiesta!
+ logger.lg.scriviLog("Richiesto controllo anomalie!", tipoLog.INFO);
+ /*******************************************************
+ * controllo le varie anomalie delle timbrature:
+ *
+ * (A) mancate approvazioni --> admin
+ * (B) entrate <> uscite --> admin, user
+ * (C) mancata copertura orario --> admin
+ *
+ * (D) mancata copertura commesse (2 be done)
+ *
+ * recupero elenco dip interessati x le varie anomalie con stp_DipendentiAndAnomalie
+ * e poi da timbrExpl recupero le singole istanze di record errori
+ *
+ *******************************************************/
- // (C) recupero errori mancata copertura orario, mando ad admin
- if (memLayer.ML.confReadBool("checkAnomOreLav"))
- {
- tabDipAndAnom = DataProxy.DP.taDipAnom.GetData(adesso.AddDays(-gg2Chk), adesso.AddHours(1), false, false, true);
- tabTimbExpl = DataProxy.DP.taTimbExpl.getByDipAnomalia(0, adesso.AddDays(-gg2Chk), adesso.AddHours(1), false, false, true);
- // se ho trovato record...
- if (tabTimbExpl.Rows.Count > 0)
- {
- logger.lg.scriviLog("Trovate anomalie copertura orario, invio email!", tipoLog.INFO);
- // mando email ad admin!
- oggettoEmail = "Anomalie GPW: Ore timbrate";
- if (memLayer.ML.confReadBool("includeDirectUrl"))
- {
- corpoEmail = string.Format("Risultano a sistema le seguenti anomalie:
Orario timbrato non suff a copertura standard
", memLayer.ML.confReadString("baseUrl"));
- }
- else
- {
- corpoEmail = "Risultano a sistema le seguenti anomalie: Orario timbrato non suff a copertura standard
";
- }
- corpoEmail += string.Format("{0}
", SteamwareStrings.charLine('-', 80));
- corpoEmail += "| -- DATA --\t| -- Dipendente --
";
- corpoEmail += string.Format("{0}
", SteamwareStrings.charLine('-', 80));
- foreach (DS_Applicazione.TimbratureExplRow riga in tabTimbExpl)
- {
- corpoEmail += string.Format("| {0:yyyy.MM.dd ddd}\t| {1}
", riga.dataLav, riga.CognomeNome);
- }
- corpoEmail += SteamwareStrings.charLine('-', 80);
- gestEmail.geAuth.mandaEmail(fromEmail, adminEmail, oggettoEmail, corpoEmail);
- }
- }
+ // setup valori base
+ string fromEmail = memLayer.ML.confReadString("_fromEmail");
+ string adminEmail = memLayer.ML.confReadString("adminAnomalieEmail");
+ string adminContinuatoEmail = memLayer.ML.confReadString("adminContinuatoEmail");
+ string adminOreLavEmail = memLayer.ML.confReadString("adminOreLavEmail");
+ string oggettoEmail = "";
+ string corpoEmail = "";
+ DS_Applicazione.stp_DipendentiAndAnomalieDataTable tabDipAndAnom = new DS_Applicazione.stp_DipendentiAndAnomalieDataTable();
+ DS_Applicazione.TimbratureExplDataTable tabTimbExpl = new DS_Applicazione.TimbratureExplDataTable();
+ DS_Applicazione.TE_RA_ExplDataTable tabTimbRegAtt = new DS_Applicazione.TE_RA_ExplDataTable();
+ DateTime adesso = DateTime.Now;
+ int gg2Chk = memLayer.ML.confReadInt("gg2Chk");
+ int gg2ChkCont = memLayer.ML.confReadInt("gg2ChkCont");
+ int gg2ChkOreCaricate = memLayer.ML.confReadInt("gg2ChkOreCaricate");
- // (D) recupero errori copertura ore lavorate / ore caricate a commessa...
- if (memLayer.ML.confReadBool("checkAnomOreLavComm"))
- {
- tabTimbRegAtt = DataProxy.DP.taTimbRegAtt.GetData(0, adesso.AddDays(-gg2ChkOreCaricate), adesso.AddHours(1), true, memLayer.ML.confReadInt("maxErrMin"), memLayer.ML.confReadInt("maxErrPlus"));
- // sulla tabella seleziono SE NON E' OK colonna okLavCom
- if (((DS_Applicazione.TE_RA_ExplRow[])tabTimbRegAtt.Select(" okLavCom = 0 ")).Length > 0)
- {
- logger.lg.scriviLog("Trovate anomalie ore lavorate / commesse caricate, invio email!", tipoLog.INFO);
- // mando email ad admin!
- oggettoEmail = "Anomalie GPW: Ore Caricate a commessa";
- if (memLayer.ML.confReadBool("includeDirectUrl"))
+ // (A) recupero mancate approvazioni, mando solo ad admin
+ if (memLayer.ML.confReadBool("checkAnomAppr"))
+ {
+ tabTimbExpl = DataProxy.DP.taTimbExpl.getByDipAnomalia(0, adesso.AddDays(-gg2Chk), adesso.AddHours(1), true, false, false);
+ // se ho trovato record...
+ if (tabTimbExpl.Rows.Count > 0)
+ {
+ logger.lg.scriviLog("Trovate anomalie mancate approvazioni, invio email ad admin", tipoLog.INFO);
+ oggettoEmail = "Anomalie GPW: Approvazione Timbrature";
+ if (memLayer.ML.confReadBool("includeDirectUrl"))
+ {
+ corpoEmail = string.Format("Risultano a sistema le seguenti anomalie:
timbrature da approvare
", memLayer.ML.confReadString("baseUrl"));
+ }
+ else
+ {
+ corpoEmail = "Risultano a sistema le seguenti anomalie: timbrature da approvare
";
+ }
+ corpoEmail += string.Format("{0}
", SteamwareStrings.charLine('-', 80));
+ corpoEmail += "| -- DATA --\t| Dipendente
";
+ corpoEmail += string.Format("{0}
", SteamwareStrings.charLine('-', 80));
+ foreach (DS_Applicazione.TimbratureExplRow riga in tabTimbExpl)
+ {
+ corpoEmail += string.Format("| {0:yyyy.MM.dd ddd}\t| {1}
", riga.dataLav, riga.CognomeNome);
+ }
+ corpoEmail += SteamwareStrings.charLine('-', 80);
+ gestEmail.geAuth.mandaEmail(fromEmail, adminEmail, oggettoEmail, corpoEmail);
+ }
+ }
+
+ // (B) recupero errori entrate/uscite, mando ad admin + utenti
+ if (memLayer.ML.confReadBool("checkAnomTimb"))
+ {
+ tabDipAndAnom = DataProxy.DP.taDipAnom.GetData(adesso.AddDays(-gg2Chk), adesso.AddHours(1), false, true, false);
+ tabTimbExpl = DataProxy.DP.taTimbExpl.getByDipAnomalia(0, adesso.AddDays(-gg2Chk), adesso.AddHours(1), false, true, false);
+ // se ho trovato record...
+ if (tabTimbExpl.Rows.Count > 0)
+ {
+ logger.lg.scriviLog("Trovate anomalie timbrature IN/OUT non corrispondenti, invio email!", tipoLog.INFO);
+ // mando email ad admin!
+ oggettoEmail = "Anomalie GPW: Timbrature mancanti";
+ if (memLayer.ML.confReadBool("includeDirectUrl"))
+ {
+ corpoEmail = string.Format("Risultano a sistema le seguenti anomalie:
timbrature mancanti / non corrispondenti
", memLayer.ML.confReadString("baseUrl"));
+ }
+ else
+ {
+ corpoEmail = "Risultano a sistema le seguenti anomalie: timbrature mancanti
";
+ }
+ corpoEmail += string.Format("{0}
", SteamwareStrings.charLine('-', 80));
+ corpoEmail += "| -- DATA --\t| Dipendente
";
+ corpoEmail += string.Format("{0}
", SteamwareStrings.charLine('-', 80));
+ foreach (DS_Applicazione.TimbratureExplRow riga in tabTimbExpl)
+ {
+ corpoEmail += string.Format("| {0:yyyy.MM.dd ddd}\t| {1}
", riga.dataLav, riga.CognomeNome);
+ }
+ corpoEmail += SteamwareStrings.charLine('-', 80);
+ gestEmail.geAuth.mandaEmail(fromEmail, adminEmail, oggettoEmail, corpoEmail);
+
+ // re richiesto invio email utenti x warning entrate/uscrite
+ if (memLayer.ML.confReadBool("sendEmailToUser"))
+ {
+ // mando singole email ai dipendenti SE C'è EMAIL!!!!
+ foreach (DS_Applicazione.stp_DipendentiAndAnomalieRow rigaDip in tabDipAndAnom)
+ {
+ if (!string.IsNullOrEmpty(rigaDip.email))
+ {
+ tabTimbExpl = DataProxy.DP.taTimbExpl.getByDipAnomalia(rigaDip.idxDipendente, adesso.AddDays(-gg2Chk), adesso.AddHours(1), false, true, false);
+ // reimposto testo
+ if (memLayer.ML.confReadBool("includeDirectUrl"))
+ {
+ corpoEmail = string.Format("Risultano a sistema le seguenti anomalie:
timbrature mancanti / non corrispondenti
", memLayer.ML.confReadString("baseUrl"));
+ }
+ else
+ {
+ corpoEmail = "Risultano a sistema le seguenti anomalie: timbrature mancanti / non corrispondenti
";
+ }
+ corpoEmail += string.Format("{0}
", SteamwareStrings.charLine('-', 80));
+ corpoEmail += "| -- DATA --\t| -- Dipendente --
";
+ corpoEmail += string.Format("{0}
", SteamwareStrings.charLine('-', 80));
+ foreach (DS_Applicazione.TimbratureExplRow riga in tabTimbExpl)
+ {
+ corpoEmail += string.Format("| {0:yyyy.MM.dd ddd}\t| {1}
", riga.dataLav, riga.CognomeNome);
+ }
+ corpoEmail += SteamwareStrings.charLine('-', 80);
+ gestEmail.geAuth.mandaEmail(fromEmail, rigaDip.email, oggettoEmail, corpoEmail);
+ }
+ }
+ }
+ }
+ }
+
+ // (C) recupero errori mancata copertura orario, mando ad admin
+ if (memLayer.ML.confReadBool("checkAnomOreLav"))
+ {
+ tabDipAndAnom = DataProxy.DP.taDipAnom.GetData(adesso.AddDays(-gg2Chk), adesso.AddHours(1), false, false, true);
+ tabTimbExpl = DataProxy.DP.taTimbExpl.getByDipAnomalia(0, adesso.AddDays(-gg2Chk), adesso.AddHours(1), false, false, true);
+ // se ho trovato record...
+ if (tabTimbExpl.Rows.Count > 0)
+ {
+ logger.lg.scriviLog("Trovate anomalie copertura orario, invio email!", tipoLog.INFO);
+ // mando email ad admin!
+ oggettoEmail = "Anomalie GPW: Ore timbrate";
+ if (memLayer.ML.confReadBool("includeDirectUrl"))
+ {
+ corpoEmail = string.Format("Risultano a sistema le seguenti anomalie:
Orario timbrato non suff a copertura standard
", memLayer.ML.confReadString("baseUrl"));
+ }
+ else
+ {
+ corpoEmail = "Risultano a sistema le seguenti anomalie: Orario timbrato non suff a copertura standard
";
+ }
+ corpoEmail += string.Format("{0}
", SteamwareStrings.charLine('-', 80));
+ corpoEmail += "| -- DATA --\t| -- Dipendente --
";
+ corpoEmail += string.Format("{0}
", SteamwareStrings.charLine('-', 80));
+ foreach (DS_Applicazione.TimbratureExplRow riga in tabTimbExpl)
+ {
+ corpoEmail += string.Format("| {0:yyyy.MM.dd ddd}\t| {1}
", riga.dataLav, riga.CognomeNome);
+ }
+ corpoEmail += SteamwareStrings.charLine('-', 80);
+ gestEmail.geAuth.mandaEmail(fromEmail, adminEmail, oggettoEmail, corpoEmail);
+ }
+ }
+
+ // (D) recupero errori copertura ore lavorate / ore caricate a commessa...
+ if (memLayer.ML.confReadBool("checkAnomOreLavComm"))
+ {
+ tabTimbRegAtt = DataProxy.DP.taTimbRegAtt.GetData(0, adesso.AddDays(-gg2ChkOreCaricate), adesso.AddHours(1), true, memLayer.ML.confReadInt("maxErrMin"), memLayer.ML.confReadInt("maxErrPlus"));
+ // sulla tabella seleziono SE NON E' OK colonna okLavCom
+ if (((DS_Applicazione.TE_RA_ExplRow[])tabTimbRegAtt.Select(" okLavCom = 0 ")).Length > 0)
+ {
+ logger.lg.scriviLog("Trovate anomalie ore lavorate / commesse caricate, invio email!", tipoLog.INFO);
+ // mando email ad admin!
+ oggettoEmail = "Anomalie GPW: Ore Caricate a commessa";
+ if (memLayer.ML.confReadBool("includeDirectUrl"))
+ {
+ corpoEmail = string.Format("Risultano a sistema le seguenti anomalie:
ore caricate a commessa non corrispondenti ad ore lavorate secondo range {1} min / {2} min
", memLayer.ML.confReadString("baseUrl"), memLayer.ML.confReadInt("maxErrMin"), memLayer.ML.confReadInt("maxErrPlus"));
+ }
+ else
+ {
+ corpoEmail = "Risultano a sistema le seguenti anomalie: ore caricate a commessa non corrispondenti ad ore lavorate
";
+ }
+ corpoEmail += string.Format("{0}
", SteamwareStrings.charLine('-', 80));
+ corpoEmail += "| -- DATA --\t| -- Dipendente --\t\t| Progetti
";
+ corpoEmail += string.Format("{0}
", SteamwareStrings.charLine('-', 80));
+ foreach (DS_Applicazione.TE_RA_ExplRow riga in (DS_Applicazione.TE_RA_ExplRow[])tabTimbRegAtt.Select(" okLavCom = 0 "))
+ {
+ corpoEmail += string.Format("| {0:yyyy.MM.dd ddd}\t| {1}\t| {2}
", riga.dataLav, riga.CognomeNome, riga.progetti);
+ }
+ corpoEmail += SteamwareStrings.charLine('-', 80);
+ gestEmail.geAuth.mandaEmail(fromEmail, adminOreLavEmail, oggettoEmail, corpoEmail);
+ }
+ }
+ // (E) cerco anomalie x orario continuato (no Pausa Pranzo, solo 1 IN, 1 OUT)
+ if (memLayer.ML.confReadBool("checkAnomContinuato"))
+ {
+ tabTimbExpl = DataProxy.DP.taTimbExpl.getContinuato(0, adesso.AddDays(-gg2ChkCont), adesso.AddHours(1));
+ // se ho trovato record...
+ if (tabTimbExpl.Rows.Count > 0)
+ {
+ logger.lg.scriviLog("Trovate anomalie orario continuato, invio email ad admin", tipoLog.INFO);
+ oggettoEmail = "Anomalie GPW: Orario Continuato";
+ if (memLayer.ML.confReadBool("includeDirectUrl"))
+ {
+ corpoEmail = string.Format("Risultano a sistema le seguenti anomalie:
orari continuati da approvare
", memLayer.ML.confReadString("baseUrl"));
+ }
+ else
+ {
+ corpoEmail = "Risultano a sistema le seguenti anomalie: orari continuati da approvare
";
+ }
+ corpoEmail += string.Format("{0}
", SteamwareStrings.charLine('-', 80));
+ corpoEmail += "| -- DATA --\t| Dipendente
";
+ corpoEmail += string.Format("{0}
", SteamwareStrings.charLine('-', 80));
+ foreach (DS_Applicazione.TimbratureExplRow riga in tabTimbExpl)
+ {
+ corpoEmail += string.Format("| {0:yyyy.MM.dd ddd}\t| {1}
", riga.dataLav, riga.CognomeNome);
+ }
+ corpoEmail += SteamwareStrings.charLine('-', 80);
+ gestEmail.geAuth.mandaEmail(fromEmail, adminContinuatoEmail, oggettoEmail, corpoEmail);
+ }
+ }
+ answ = true;
+ }
+ catch (Exception exc)
{
- corpoEmail = string.Format("Risultano a sistema le seguenti anomalie:
ore caricate a commessa non corrispondenti ad ore lavorate secondo range {1} min / {2} min
", memLayer.ML.confReadString("baseUrl"), memLayer.ML.confReadInt("maxErrMin"), memLayer.ML.confReadInt("maxErrPlus"));
+ logger.lg.scriviLog(string.Format("Errore in procedura check & invio email{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
+ answ = false;
+ }
+ //registro evento
+ DataProxy.DP.taRE.Insert(DateTime.Now, "checkAnomalie", "-");
+ return answ;
+ }
+ ///
+ /// Verifica ed eventualmente esegue gli script quotidiani tra cui il check anomalie
+ ///
+ ///
+ public bool dailyDuties()
+ {
+ bool answ = false;
+ if (memLayer.ML.confReadBool("enableDailyCheck"))
+ {
+ if (memLayer.ML.confReadInt("_logLevel") > 5) logger.lg.scriviLog("Richiesto Check Daily Duties", tipoLog.INFO);
+ int firstHour2Check = memLayer.ML.confReadInt("firstHour2Check");
+ // controllo sfasato di x ore come da we.config se ci sia già stato il check quotidiano anomalie (con relative email)
+ if (DataProxy.DP.taRE.getByDataEv("checkAnomalie", DateTime.Now.AddHours(-firstHour2Check).Date).Rows.Count == 0)
+ {
+ // chiamo check anomalie
+ checkAnomalie();
+ //registro evento
+ DataProxy.DP.taRE.Insert(DateTime.Now.AddHours(-firstHour2Check), "dailyDuties", "-");
+ }
}
else
{
- corpoEmail = "Risultano a sistema le seguenti anomalie: ore caricate a commessa non corrispondenti ad ore lavorate
";
+ if (memLayer.ML.confReadInt("_logLevel") > 5) logger.lg.scriviLog("DISABILITATO Check Daily Duties", tipoLog.INFO);
}
- corpoEmail += string.Format("{0}
", SteamwareStrings.charLine('-', 80));
- corpoEmail += "| -- DATA --\t| -- Dipendente --\t\t| Progetti
";
- corpoEmail += string.Format("{0}
", SteamwareStrings.charLine('-', 80));
- foreach (DS_Applicazione.TE_RA_ExplRow riga in (DS_Applicazione.TE_RA_ExplRow[])tabTimbRegAtt.Select(" okLavCom = 0 "))
- {
- corpoEmail += string.Format("| {0:yyyy.MM.dd ddd}\t| {1}\t| {2}
", riga.dataLav, riga.CognomeNome, riga.progetti);
- }
- corpoEmail += SteamwareStrings.charLine('-', 80);
- gestEmail.geAuth.mandaEmail(fromEmail, adminOreLavEmail, oggettoEmail, corpoEmail);
- }
+ return answ;
}
- // (E) cerco anomalie x orario continuato (no Pausa Pranzo, solo 1 IN, 1 OUT)
- if (memLayer.ML.confReadBool("checkAnomContinuato"))
+ ///
+ /// formatta le ore in ore:minuti
+ ///
+ /// ore centesimali (0,00)
+ ///
+ public static string formOreMin(decimal oreCent)
{
- tabTimbExpl = DataProxy.DP.taTimbExpl.getContinuato(0, adesso.AddDays(-gg2ChkCont), adesso.AddHours(1));
- // se ho trovato record...
- if (tabTimbExpl.Rows.Count > 0)
- {
- logger.lg.scriviLog("Trovate anomalie orario continuato, invio email ad admin", tipoLog.INFO);
- oggettoEmail = "Anomalie GPW: Orario Continuato";
- if (memLayer.ML.confReadBool("includeDirectUrl"))
- {
- corpoEmail = string.Format("Risultano a sistema le seguenti anomalie:
orari continuati da approvare
", memLayer.ML.confReadString("baseUrl"));
- }
- else
- {
- corpoEmail = "Risultano a sistema le seguenti anomalie: orari continuati da approvare
";
- }
- corpoEmail += string.Format("{0}
", SteamwareStrings.charLine('-', 80));
- corpoEmail += "| -- DATA --\t| Dipendente
";
- corpoEmail += string.Format("{0}
", SteamwareStrings.charLine('-', 80));
- foreach (DS_Applicazione.TimbratureExplRow riga in tabTimbExpl)
- {
- corpoEmail += string.Format("| {0:yyyy.MM.dd ddd}\t| {1}
", riga.dataLav, riga.CognomeNome);
- }
- corpoEmail += SteamwareStrings.charLine('-', 80);
- gestEmail.geAuth.mandaEmail(fromEmail, adminContinuatoEmail, oggettoEmail, corpoEmail);
- }
+ return string.Format("{0}:{1:00}", Math.Floor(oreCent), Math.Round((oreCent - Math.Floor(oreCent)) * 60));
}
- answ = true;
- }
- catch (Exception exc)
- {
- logger.lg.scriviLog(string.Format("Errore in procedura check & invio email{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
- answ = false;
- }
- //registro evento
- DataProxy.DP.taRE.Insert(DateTime.Now, "checkAnomalie", "-");
- return answ;
}
- ///
- /// Verifica ed eventualmente esegue gli script quotidiani tra cui il check anomalie
- ///
- ///
- public bool dailyDuties()
- {
- bool answ = false;
- if (memLayer.ML.confReadBool("enableDailyCheck"))
- {
- if (memLayer.ML.confReadInt("_logLevel") > 5) logger.lg.scriviLog("Richiesto Check Daily Duties", tipoLog.INFO);
- int firstHour2Check = memLayer.ML.confReadInt("firstHour2Check");
- // controllo sfasato di x ore come da we.config se ci sia già stato il check quotidiano anomalie (con relative email)
- if (DataProxy.DP.taRE.getByDataEv("checkAnomalie", DateTime.Now.AddHours(-firstHour2Check).Date).Rows.Count == 0)
- {
- // chiamo check anomalie
- checkAnomalie();
- //registro evento
- DataProxy.DP.taRE.Insert(DateTime.Now.AddHours(-firstHour2Check), "dailyDuties", "-");
- }
- }
- else
- {
- if (memLayer.ML.confReadInt("_logLevel") > 5) logger.lg.scriviLog("DISABILITATO Check Daily Duties", tipoLog.INFO);
- }
- return answ;
- }
- ///
- /// formatta le ore in ore:minuti
- ///
- /// ore centesimali (0,00)
- ///
- public static string formOreMin(decimal oreCent)
- {
- return string.Format("{0}:{1:00}", Math.Floor(oreCent), Math.Round((oreCent - Math.Floor(oreCent)) * 60));
- }
- }
}
diff --git a/GPW_Smart/ErrorPage.aspx.cs b/GPW_Smart/ErrorPage.aspx.cs
index 1432c22..848bd11 100644
--- a/GPW_Smart/ErrorPage.aspx.cs
+++ b/GPW_Smart/ErrorPage.aspx.cs
@@ -4,18 +4,18 @@ using System.Threading;
namespace GPW_Smart
{
- public partial class ErrorPage : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
+ public partial class ErrorPage : System.Web.UI.Page
{
- string currPage = user_std.pagCorrente != "" ? user_std.pagCorrente : "Default";
- string prevPage = user_std.pagPrecedente != "" ? user_std.pagPrecedente : "Default";
- string errorPageRedirect = memLayer.ML.confReadString("errorPageRedirect");
- memLayer.ML.setSessionVal("nextPage", currPage);
- memLayer.ML.setSessionVal("pagPrecedente", prevPage);
- logger.lg.scriviLog($"ErrorPage chiamata: currPage {currPage} | currPage: {currPage} --> Redirect a {errorPageRedirect}", tipoLog.INFO);
- Thread.Sleep(50);
- Response.Redirect(errorPageRedirect);
+ protected void Page_Load(object sender, EventArgs e)
+ {
+ string currPage = !string.IsNullOrEmpty(user_std.pagCorrente) ? user_std.pagCorrente : "Default";
+ string prevPage = !string.IsNullOrEmpty(user_std.pagPrecedente) ? user_std.pagPrecedente : "Default";
+ string errorPageRedirect = memLayer.ML.confReadString("errorPageRedirect");
+ memLayer.ML.setSessionVal("nextPage", currPage);
+ memLayer.ML.setSessionVal("pagPrecedente", prevPage);
+ logger.lg.scriviLog($"ErrorPage chiamata: currPage {currPage} | currPage: {currPage} --> Redirect a {errorPageRedirect}", tipoLog.INFO);
+ Thread.Sleep(50);
+ Response.Redirect(errorPageRedirect);
+ }
}
- }
}
\ No newline at end of file
diff --git a/GPW_Smart/Reset.aspx.cs b/GPW_Smart/Reset.aspx.cs
index 25ec140..677990a 100644
--- a/GPW_Smart/Reset.aspx.cs
+++ b/GPW_Smart/Reset.aspx.cs
@@ -3,115 +3,115 @@ using System;
namespace GPW_Smart
{
- public partial class Reset : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
+ public partial class Reset : System.Web.UI.Page
{
- string paginaPrec = user_std.pagPrecedente;
- string action = memLayer.ML.QSS("Action");
- string nextPage = memLayer.ML.StringSessionObj("nextPage");
- string testo = "";
- long recPrev = 0;
- long recPost = 0;
- if (action != "")
- {
- if (action.Contains("C"))
+ protected void Page_Load(object sender, EventArgs e)
{
- recPrev = Cache.Count;
- if (recPrev > 0)
- {
- try
+ string paginaPrec = user_std.pagPrecedente;
+ string action = memLayer.ML.QSS("Action");
+ string nextPage = memLayer.ML.StringSessionObj("nextPage");
+ string testo = "";
+ long recPrev = 0;
+ long recPost = 0;
+ if (!string.IsNullOrEmpty(action))
{
- // reset dati in cache...
- memLayer.ML.flushRegisteredCache();
- recPost = Cache.Count;
- testo += string.Format("
Reset Cache: {0} --> {1}", recPrev, recPost);
+ if (action.Contains("C"))
+ {
+ recPrev = Cache.Count;
+ if (recPrev > 0)
+ {
+ try
+ {
+ // reset dati in cache...
+ memLayer.ML.flushRegisteredCache();
+ recPost = Cache.Count;
+ testo += string.Format("
Reset Cache: {0} --> {1}", recPrev, recPost);
+ }
+ catch
+ { }
+ }
+ }
+ if (action.Contains("D"))
+ {
+ recPrev = memLayer.ML.numRecAppConf;
+ if (recPrev > 0)
+ {
+ try
+ {
+ // reset dati in cache x DbConfig...
+ memLayer.ML.resetAppConf();
+ recPost = memLayer.ML.numRecAppConf;
+ testo += string.Format("
Reset DB AppConf: {0} --> {1}", recPrev, recPost);
+ }
+ catch
+ { }
+ }
+ }
+ if (action.Contains("R"))
+ {
+ recPrev = memLayer.ML.numRecRedis;
+ if (recPrev > 0)
+ {
+ try
+ {
+ // reset dati in cache x DbConfig...
+ memLayer.ML.redFlushKey("**");
+ recPost = memLayer.ML.numRecRedis;
+ testo += string.Format("
Reset Redis: {0} --> {1}", recPrev, recPost);
+ }
+ catch
+ { }
+ }
+ }
+ if (action.Contains("S"))
+ {
+ recPrev = Session.Count;
+ if (recPrev > 0)
+ {
+ try
+ {
+ // reset dati in sessione...
+ Session.Clear();
+ recPost = Session.Count;
+ testo += string.Format("
Reset Sessione: {0} --> {1}", recPrev, recPost);
+ }
+ catch
+ { }
+ }
+ }
+ if (action.Contains("V"))
+ {
+ recPrev = DataWrap.DW.numRecVoc;
+ if (recPrev > 0)
+ {
+ try
+ {
+ // aggiorno vocabolario
+ DataWrap.DW.resetVocabolario();
+ recPost = DataWrap.DW.numRecVoc;
+ testo += string.Format("
Reset Vocabolario: {0} --> {1}", recPrev, recPost);
+ }
+ catch
+ { }
+ }
+ }
}
- catch
- { }
- }
- }
- if (action.Contains("D"))
- {
- recPrev = memLayer.ML.numRecAppConf;
- if (recPrev > 0)
- {
- try
+ lblOut.Text = testo;
+ if (!string.IsNullOrEmpty(nextPage))
{
- // reset dati in cache x DbConfig...
- memLayer.ML.resetAppConf();
- recPost = memLayer.ML.numRecAppConf;
- testo += string.Format("
Reset DB AppConf: {0} --> {1}", recPrev, recPost);
+ logger.lg.scriviLog(string.Format("Reset {0} OK: redirect a pag {1}", action, nextPage), tipoLog.INFO);
+ Response.Redirect(nextPage);
}
- catch
- { }
- }
- }
- if (action.Contains("R"))
- {
- recPrev = memLayer.ML.numRecRedis;
- if (recPrev > 0)
- {
- try
+ else if (!string.IsNullOrEmpty(paginaPrec))
{
- // reset dati in cache x DbConfig...
- memLayer.ML.redFlushKey("**");
- recPost = memLayer.ML.numRecRedis;
- testo += string.Format("
Reset Redis: {0} --> {1}", recPrev, recPost);
+ logger.lg.scriviLog(string.Format("Reset {0} OK: redirect a pag {1}", action, paginaPrec), tipoLog.INFO);
+ Response.Redirect(nextPage);
}
- catch
- { }
- }
- }
- if (action.Contains("S"))
- {
- recPrev = Session.Count;
- if (recPrev > 0)
- {
- try
+ else
{
- // reset dati in sessione...
- Session.Clear();
- recPost = Session.Count;
- testo += string.Format("
Reset Sessione: {0} --> {1}", recPrev, recPost);
+ logger.lg.scriviLog(string.Format("Reset {0} OK: redirect a pag {1}", action, "Default"), tipoLog.INFO);
+ Response.Redirect("Default");
}
- catch
- { }
- }
}
- if (action.Contains("V"))
- {
- recPrev = DataWrap.DW.numRecVoc;
- if (recPrev > 0)
- {
- try
- {
- // aggiorno vocabolario
- DataWrap.DW.resetVocabolario();
- recPost = DataWrap.DW.numRecVoc;
- testo += string.Format("
Reset Vocabolario: {0} --> {1}", recPrev, recPost);
- }
- catch
- { }
- }
- }
- }
- lblOut.Text = testo;
- if (nextPage != "")
- {
- logger.lg.scriviLog(string.Format("Reset {0} OK: redirect a pag {1}", action, nextPage), tipoLog.INFO);
- Response.Redirect(nextPage);
- }
- else if (paginaPrec != "")
- {
- logger.lg.scriviLog(string.Format("Reset {0} OK: redirect a pag {1}", action, paginaPrec), tipoLog.INFO);
- Response.Redirect(nextPage);
- }
- else
- {
- logger.lg.scriviLog(string.Format("Reset {0} OK: redirect a pag {1}", action, "Default"), tipoLog.INFO);
- Response.Redirect("Default");
- }
}
- }
}
\ No newline at end of file
diff --git a/GPW_Smart/WebUserControls/cmp_menuTop.ascx.cs b/GPW_Smart/WebUserControls/cmp_menuTop.ascx.cs
index 921e654..a341a86 100644
--- a/GPW_Smart/WebUserControls/cmp_menuTop.ascx.cs
+++ b/GPW_Smart/WebUserControls/cmp_menuTop.ascx.cs
@@ -6,231 +6,231 @@ using System.Web.UI;
namespace GPW_Smart.WebUserControls
{
- public partial class cmp_menuTop : System.Web.UI.UserControl
- {
- ///
- /// user agent corrente
- ///
- protected string userAgent = "";
- ///
- /// IP corrente
- ///
- protected string postazione_IP = "";
- ///
- /// gestione evento refresh
- ///
- public event EventHandler eh_doRefresh;
- protected bool _disableCheckCookie = false;
- public bool disableCheckCookie
+ public partial class cmp_menuTop : System.Web.UI.UserControl
{
- get
- {
- return _disableCheckCookie;
- }
- set
- {
- _disableCheckCookie = value;
- }
- }
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!Page.IsPostBack)
- {
- checkPages();
- searchVal = "";
- ulLinks.DataBind();
- }
- if (!disableCheckCookie)
- {
- // controllo se c'è utente in sessione.. SE NON disabilitato...
- checkUser();
- }
- // sistemo visualizzazione
- postazione_IP = Request.UserHostName;
- try
- {
- lblSwData.Text = memLayer.ML.StringSessionObj("cognomeNome");
- }
- catch
- {
- lblSwData.Text = "GPW";
- }
- }
- ///
- /// Verifica le pagine x capire se siano cambiate...
- ///
- private void checkPages()
- {
- if (nomePagina != user_std.pagCorrente)
- {
- user_std.pagPrecedente = user_std.pagCorrente != "" ? user_std.pagCorrente : nomePagina;
- user_std.pagCorrente = nomePagina;
- }
- }
-
- ///
- /// Nome pagina (parte finale url)
- ///
- public string nomePagina
- {
- get
- {
- return devicesAuthProxy.getPage(Request.Url).Replace(".aspx", "");
- }
- }
-
- ///
- /// verifica presenza utente autorizzato in sessione
- ///
- private void checkUser()
- {
- if (!memLayer.ML.isInSessionObject("idxDipendente"))
- {
- // controllo cookie device...
- checkAuthCookieGPW();
- }
- }
- ///
- /// verifica al presenza di un cookie VALIDO per autorizzare il device
- ///
- private void checkAuthCookieGPW()
- {
- try
- {
- HttpCookie cookie = Request.Cookies["AuthGPW"];
- if (cookie == null || string.IsNullOrEmpty(cookie.Value ))
+ ///
+ /// user agent corrente
+ ///
+ protected string userAgent = "";
+ ///
+ /// IP corrente
+ ///
+ protected string postazione_IP = "";
+ ///
+ /// gestione evento refresh
+ ///
+ public event EventHandler eh_doRefresh;
+ protected bool _disableCheckCookie = false;
+ public bool disableCheckCookie
{
- // rimando pagina x registrazione devices
- Response.Redirect("~/regNewDevice.aspx");
- }
- else
- {
- // ricavo utente da cookie...
- string devSecret = cookie.Value;
- DS_Applicazione.AnagDevicesRow device = null;
- // cerco il device...ogni dipendente può averne + di 1 registrato a suo nome...
- int idxDipendente = 0;
- try
- {
- device = DataProxy.DP.taAnagDev.getByDeviceSecret(devSecret)[0];
- idxDipendente = device.idxDipendente;
- }
- catch
- { }
- if (idxDipendente > 0)
- {
- // aggiorno descrizione (user agent) ed IP...
- userAgent = Request.UserAgent;
- postazione_IP = Request.UserHostName;
- // controllo IP e DeviceDescription x eventuale update
- if ((device.lastIPv4 != postazione_IP) || (device.Description != userAgent))
+ get
{
- // salvo ultimo "contatto" del device aggiornando descrizione ed IP
- DataProxy.DP.taAnagDev.updateIP(device.IdxDevice, DateTime.Now, postazione_IP, userAgent);
+ return _disableCheckCookie;
}
- // salvo in sessione utente
- memLayer.ML.setSessionVal("idxDipendente", idxDipendente);
- string CognomeNome = "";
- string email = "";
- string hashEmail = "";
+ set
+ {
+ _disableCheckCookie = value;
+ }
+ }
+ protected void Page_Load(object sender, EventArgs e)
+ {
+ if (!Page.IsPostBack)
+ {
+ checkPages();
+ searchVal = "";
+ ulLinks.DataBind();
+ }
+ if (!disableCheckCookie)
+ {
+ // controllo se c'è utente in sessione.. SE NON disabilitato...
+ checkUser();
+ }
+ // sistemo visualizzazione
+ postazione_IP = Request.UserHostName;
try
{
- DS_Applicazione.DipendentiRow rigaDip = DataProxy.DP.taDipendenti.getByIdx(idxDipendente)[0];
- CognomeNome = string.Format("{0} {1}", rigaDip.Cognome, rigaDip.Nome);
- email = rigaDip.email;
- hashEmail = SteamCrypto.getHashStringMD5(email);
+ lblSwData.Text = memLayer.ML.StringSessionObj("cognomeNome");
}
catch
- { }
- memLayer.ML.setSessionVal("cognomeNome", CognomeNome);
- memLayer.ML.setSessionVal("email", email);
- memLayer.ML.setSessionVal("hashEmail", hashEmail);
- }
- else
- {
- // svuoto cookie...
- memLayer.ML.emptyCookieVal("AuthGPW");
- // rimando pagina x registrazione devices
- Response.Redirect("~/regNewDevice.aspx");
- }
+ {
+ lblSwData.Text = "GPW";
+ }
+ }
+ ///
+ /// Verifica le pagine x capire se siano cambiate...
+ ///
+ private void checkPages()
+ {
+ if (nomePagina != user_std.pagCorrente)
+ {
+ user_std.pagPrecedente = !string.IsNullOrEmpty(user_std.pagCorrente) ? user_std.pagCorrente : nomePagina;
+ user_std.pagCorrente = nomePagina;
+ }
}
- }
- catch (Exception exc)
- {
- logger.lg.scriviLog(string.Format("Errore in checkAuthCookie:{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
- }
- }
- ///
- /// imposta visibilità search globale
- ///
- public bool showSearch
- {
- get
- {
- return divSearch.Visible;
- }
- set
- {
- divSearch.Visible = value;
- }
- }
- protected void txtSearch_TextChanged(object sender, EventArgs e)
- {
- doSearch();
- }
+ ///
+ /// Nome pagina (parte finale url)
+ ///
+ public string nomePagina
+ {
+ get
+ {
+ return devicesAuthProxy.getPage(Request.Url).Replace(".aspx", "");
+ }
+ }
- private void doSearch()
- {
- // se searchVal !=""
- if (searchVal != "")
- {
- memLayer.ML.setSessionVal("valoreSearch", searchVal);
- }
- else
- {
- memLayer.ML.emptySessionVal("valoreSearch");
- }
- // se qualcuno ascolta sollevo evento nuovo valore...
- if (eh_doRefresh != null)
- {
- eh_doRefresh(this, new EventArgs());
- }
- }
+ ///
+ /// verifica presenza utente autorizzato in sessione
+ ///
+ private void checkUser()
+ {
+ if (!memLayer.ML.isInSessionObject("idxDipendente"))
+ {
+ // controllo cookie device...
+ checkAuthCookieGPW();
+ }
+ }
+ ///
+ /// verifica al presenza di un cookie VALIDO per autorizzare il device
+ ///
+ private void checkAuthCookieGPW()
+ {
+ try
+ {
+ HttpCookie cookie = Request.Cookies["AuthGPW"];
+ if (cookie == null || string.IsNullOrEmpty(cookie.Value))
+ {
+ // rimando pagina x registrazione devices
+ Response.Redirect("~/regNewDevice.aspx");
+ }
+ else
+ {
+ // ricavo utente da cookie...
+ string devSecret = cookie.Value;
+ DS_Applicazione.AnagDevicesRow device = null;
+ // cerco il device...ogni dipendente può averne + di 1 registrato a suo nome...
+ int idxDipendente = 0;
+ try
+ {
+ device = DataProxy.DP.taAnagDev.getByDeviceSecret(devSecret)[0];
+ idxDipendente = device.idxDipendente;
+ }
+ catch
+ { }
+ if (idxDipendente > 0)
+ {
+ // aggiorno descrizione (user agent) ed IP...
+ userAgent = Request.UserAgent;
+ postazione_IP = Request.UserHostName;
+ // controllo IP e DeviceDescription x eventuale update
+ if ((device.lastIPv4 != postazione_IP) || (device.Description != userAgent))
+ {
+ // salvo ultimo "contatto" del device aggiornando descrizione ed IP
+ DataProxy.DP.taAnagDev.updateIP(device.IdxDevice, DateTime.Now, postazione_IP, userAgent);
+ }
+ // salvo in sessione utente
+ memLayer.ML.setSessionVal("idxDipendente", idxDipendente);
+ string CognomeNome = "";
+ string email = "";
+ string hashEmail = "";
+ try
+ {
+ DS_Applicazione.DipendentiRow rigaDip = DataProxy.DP.taDipendenti.getByIdx(idxDipendente)[0];
+ CognomeNome = string.Format("{0} {1}", rigaDip.Cognome, rigaDip.Nome);
+ email = rigaDip.email;
+ hashEmail = SteamCrypto.getHashStringMD5(email);
+ }
+ catch
+ { }
+ memLayer.ML.setSessionVal("cognomeNome", CognomeNome);
+ memLayer.ML.setSessionVal("email", email);
+ memLayer.ML.setSessionVal("hashEmail", hashEmail);
+ }
+ else
+ {
+ // svuoto cookie...
+ memLayer.ML.emptyCookieVal("AuthGPW");
+ // rimando pagina x registrazione devices
+ Response.Redirect("~/regNewDevice.aspx");
+ }
+ }
+ }
+ catch (Exception exc)
+ {
+ logger.lg.scriviLog(string.Format("Errore in checkAuthCookie:{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
+ }
+ }
+ ///
+ /// imposta visibilità search globale
+ ///
+ public bool showSearch
+ {
+ get
+ {
+ return divSearch.Visible;
+ }
+ set
+ {
+ divSearch.Visible = value;
+ }
+ }
- ///
- /// Valore ricerca attivo
- ///
- protected string searchVal
- {
- get
- {
- return txtSearch.Text.Trim();
- }
- set
- {
- txtSearch.Text = value.Trim();
- }
- }
+ protected void txtSearch_TextChanged(object sender, EventArgs e)
+ {
+ doSearch();
+ }
- protected void lbtSearch_Click(object sender, EventArgs e)
- {
- doSearch();
+ private void doSearch()
+ {
+ // se searchVal !=""
+ if (!string.IsNullOrEmpty(searchVal))
+ {
+ memLayer.ML.setSessionVal("valoreSearch", searchVal);
+ }
+ else
+ {
+ memLayer.ML.emptySessionVal("valoreSearch");
+ }
+ // se qualcuno ascolta sollevo evento nuovo valore...
+ if (eh_doRefresh != null)
+ {
+ eh_doRefresh(this, new EventArgs());
+ }
+ }
+
+ ///
+ /// Valore ricerca attivo
+ ///
+ protected string searchVal
+ {
+ get
+ {
+ return txtSearch.Text.Trim();
+ }
+ set
+ {
+ txtSearch.Text = value.Trim();
+ }
+ }
+
+ protected void lbtSearch_Click(object sender, EventArgs e)
+ {
+ doSearch();
+ }
+ ///
+ /// calcola SE aggiungere "active" alla pag corrente
+ ///
+ ///
+ ///
+ public string cssActive(string pageName)
+ {
+ string answ = "";
+ //if (pageName == PagCorrente())
+ if (pageName == nomePagina)
+ {
+ answ = "active";
+ }
+ return answ;
+ }
}
- ///
- /// calcola SE aggiungere "active" alla pag corrente
- ///
- ///
- ///
- public string cssActive(string pageName)
- {
- string answ = "";
- //if (pageName == PagCorrente())
- if (pageName == nomePagina)
- {
- answ = "active";
- }
- return answ;
- }
- }
}
\ No newline at end of file
diff --git a/GPW_Smart/WebUserControls/mod_commAttivita.ascx.cs b/GPW_Smart/WebUserControls/mod_commAttivita.ascx.cs
index 47bf634..157e9f0 100644
--- a/GPW_Smart/WebUserControls/mod_commAttivita.ascx.cs
+++ b/GPW_Smart/WebUserControls/mod_commAttivita.ascx.cs
@@ -7,303 +7,303 @@ using System.Web.UI.WebControls;
namespace GPW.WebUserControls
{
- public partial class mod_commAttivita : System.Web.UI.UserControl
- {
- ///
- /// Hash di base x ricerca CLIENTE da idxFase
- ///
- protected string rhCliByIF { get; set; }
- ///
- /// Hash di base x ricerca PROGETTO da idxFase
- ///
- protected string rhProjByIF { get; set; }
- ///
- /// Hash di base x ricerca IdxProgetto da idxFase
- ///
- protected string rhIPByIF { get; set; }
- ///
- /// Hash di base x ricerca FASE da idxFase
- ///
- protected string rhFaseByIF { get; set; }
-
-
-
- protected void Page_Load(object sender, EventArgs e)
+ public partial class mod_commAttivita : System.Web.UI.UserControl
{
- if (!Page.IsPostBack)
- {
- // controllo se ho una data selezionata da URL
- if (memLayer.ML.QSS("dataRif") != "")
+ ///
+ /// Hash di base x ricerca CLIENTE da idxFase
+ ///
+ protected string rhCliByIF { get; set; }
+ ///
+ /// Hash di base x ricerca PROGETTO da idxFase
+ ///
+ protected string rhProjByIF { get; set; }
+ ///
+ /// Hash di base x ricerca IdxProgetto da idxFase
+ ///
+ protected string rhIPByIF { get; set; }
+ ///
+ /// Hash di base x ricerca FASE da idxFase
+ ///
+ protected string rhFaseByIF { get; set; }
+
+
+
+ protected void Page_Load(object sender, EventArgs e)
{
- dataRif = memLayer.ML.QSD("dataRif");
+ if (!Page.IsPostBack)
+ {
+ // controllo se ho una data selezionata da URL
+ if (!string.IsNullOrEmpty(memLayer.ML.QSS("dataRif")))
+ {
+ dataRif = memLayer.ML.QSD("dataRif");
+ }
+ setupPage();
+ }
+ rhCliByIF = memLayer.ML.redHash("cliByIdxFase:");
+ rhIPByIF = memLayer.ML.redHash("idxProjByIdxFase:");
+ rhProjByIF = memLayer.ML.redHash("projByIdxFase:");
+ rhFaseByIF = memLayer.ML.redHash("faseByIdxFase:");
+ grView.DataBind();
}
- setupPage();
- }
- rhCliByIF = memLayer.ML.redHash("cliByIdxFase:");
- rhIPByIF = memLayer.ML.redHash("idxProjByIdxFase:");
- rhProjByIF = memLayer.ML.redHash("projByIdxFase:");
- rhFaseByIF = memLayer.ML.redHash("faseByIdxFase:");
- grView.DataBind();
- }
- ///
- /// pagina di return a fine editing
- ///
- public string returnPage
- {
- get
- {
- string answ = memLayer.ML.confReadString("baseUrl");
- try
+ ///
+ /// pagina di return a fine editing
+ ///
+ public string returnPage
{
- answ = memLayer.ML.StringSessionObj("returnPage");
+ get
+ {
+ string answ = memLayer.ML.confReadString("baseUrl");
+ try
+ {
+ answ = memLayer.ML.StringSessionObj("returnPage");
+ }
+ catch
+ { }
+ return answ;
+ }
+ set
+ {
+ memLayer.ML.setSessionVal("returnPage", value);
+ }
}
- catch
- { }
- return answ;
- }
- set
- {
- memLayer.ML.setSessionVal("returnPage", value);
- }
- }
- ///
- /// data riferimento (selezionata) da session
- ///
- public DateTime dataRif
- {
- get
- {
- DateTime answ = DateTime.Now;
- // cerco in session...
- if (memLayer.ML.isInSessionObject("dataRif"))
+ ///
+ /// data riferimento (selezionata) da session
+ ///
+ public DateTime dataRif
{
- try
- {
+ get
+ {
+ DateTime answ = DateTime.Now;
+ // cerco in session...
+ if (memLayer.ML.isInSessionObject("dataRif"))
+ {
+ try
+ {
- answ = Convert.ToDateTime(memLayer.ML.objSessionObj("dataRif"));
- }
- catch
- { }
+ answ = Convert.ToDateTime(memLayer.ML.objSessionObj("dataRif"));
+ }
+ catch
+ { }
+ }
+ // altrimenti cerco in URL e salvo in session...
+ else if (!string.IsNullOrEmpty(memLayer.ML.QSS("dataRif")))
+ {
+ answ = memLayer.ML.QSD("dataRif");
+ dataRif = answ;
+ }
+ // restituisco!
+ return answ;
+ }
+ set
+ {
+ memLayer.ML.setSessionVal("dataRif", value);
+ }
}
- // altrimenti cerco in URL e salvo in session...
- else if (memLayer.ML.QSS("dataRif") != "")
+ ///
+ /// imposta la pagina
+ ///
+ private void setupPage()
{
- answ = memLayer.ML.QSD("dataRif");
- dataRif = answ;
+ // salvo dataFrom/To x visualizzazione attivita
+ txtData.Text = dataRif.ToString("yyyy-MM-dd");
+ // recupero dati della commessa utente giornaliera...
+ try
+ {
+ int maxErrMinus = memLayer.ML.confReadInt("maxErrMinus");
+ int maxErrPlus = memLayer.ML.confReadInt("maxErrPlus");
+ DS_Applicazione.v_logCommUtRow rigaLog = DataProxy.DP.taLCU.getByIdxDipDate(memLayer.ML.IntSessionObj("idxDipendente"), dataRif, dataRif.AddDays(1), maxErrMinus, maxErrPlus)[0];
+ lblTotOreRA.Text = string.Format("{0:0.##} / {1:0.##} h", rigaLog.h_com, rigaLog.h_lav);
+ }
+ catch
+ {
+ lblTotOreRA.Text = "...";
+ }
+ memLayer.ML.setSessionVal("dataFromRA", dataRif.Date);
+ memLayer.ML.setSessionVal("dataToRA", dataRif.AddDays(1).Date);
+ }
+ ///
+ /// Cerca associazione idxProj <--> idxFase da cache o da Db
+ ///
+ ///
+ ///
+ protected int idxProjByIdxFase(int idxFase)
+ {
+ int idxPrj = 0;
+ string answ = memLayer.ML.getRSV($"{rhIPByIF}{idxFase}");
+ if (!string.IsNullOrEmpty(answ))
+ {
+ // cerco di convertire!
+ int.TryParse(answ, out idxPrj);
+ }
+ if (idxPrj == 0)
+ {
+ DS_Applicazione.AnagFasiRow fase = DataProxy.DP.taAF.getByIdxSmart(idxFase)[0];
+ idxPrj = Convert.ToInt32(fase.idxProgetto);
+ memLayer.ML.setRSV($"{rhIPByIF}{idxFase}", idxPrj.ToString(), memLayer.ML.CRI("shotTimeCache"));
+ }
+ return idxPrj;
}
- // restituisco!
- return answ;
- }
- set
- {
- memLayer.ML.setSessionVal("dataRif", value);
- }
- }
- ///
- /// imposta la pagina
- ///
- private void setupPage()
- {
- // salvo dataFrom/To x visualizzazione attivita
- txtData.Text = dataRif.ToString("yyyy-MM-dd");
- // recupero dati della commessa utente giornaliera...
- try
- {
- int maxErrMinus = memLayer.ML.confReadInt("maxErrMinus");
- int maxErrPlus = memLayer.ML.confReadInt("maxErrPlus");
- DS_Applicazione.v_logCommUtRow rigaLog = DataProxy.DP.taLCU.getByIdxDipDate(memLayer.ML.IntSessionObj("idxDipendente"), dataRif, dataRif.AddDays(1), maxErrMinus, maxErrPlus)[0];
- lblTotOreRA.Text = string.Format("{0:0.##} / {1:0.##} h", rigaLog.h_com, rigaLog.h_lav);
- }
- catch
- {
- lblTotOreRA.Text = "...";
- }
- memLayer.ML.setSessionVal("dataFromRA", dataRif.Date);
- memLayer.ML.setSessionVal("dataToRA", dataRif.AddDays(1).Date);
- }
- ///
- /// Cerca associazione idxProj <--> idxFase da cache o da Db
- ///
- ///
- ///
- protected int idxProjByIdxFase(int idxFase)
- {
- int idxPrj = 0;
- string answ = memLayer.ML.getRSV($"{rhIPByIF}{idxFase}");
- if (!string.IsNullOrEmpty(answ))
- {
- // cerco di convertire!
- int.TryParse(answ, out idxPrj);
- }
- if (idxPrj == 0)
- {
- DS_Applicazione.AnagFasiRow fase = DataProxy.DP.taAF.getByIdxSmart(idxFase)[0];
- idxPrj = Convert.ToInt32(fase.idxProgetto);
- memLayer.ML.setRSV($"{rhIPByIF}{idxFase}", idxPrj.ToString(), memLayer.ML.CRI("shotTimeCache"));
- }
- return idxPrj;
- }
- ///
- /// recupera cliente da idxFase
- ///
- ///
- ///
- public string cliByIdxFase(object _idxFase)
- {
- string answ = "";
- int idxFase = 0;
- int.TryParse(_idxFase.ToString(), out idxFase);
- answ = memLayer.ML.getRSV($"{rhCliByIF}{idxFase}");
- if (string.IsNullOrEmpty(answ))
- {
- answ = getCliByDb(idxFase);
- memLayer.ML.setRSV($"{rhCliByIF}{idxFase}", answ, memLayer.ML.CRI("shotTimeCache"));
- }
- return answ;
- }
- ///
- /// Cerca dati cliente da idxFase su DB
- ///
- ///
- ///
- private string getCliByDb(int idxFase)
- {
- string answ = "";
- try
- {
- int idxPrj = idxProjByIdxFase(idxFase);
- DS_Applicazione.AnagProgettiRow progetto = DataProxy.DP.taAP.getByIdxProjSmart(idxPrj)[0];
- answ = DataProxy.DP.taAnCli.getByIdx(progetto.idxCliente)[0].RagSociale;
- }
- catch
- { }
- return answ;
- }
+ ///
+ /// recupera cliente da idxFase
+ ///
+ ///
+ ///
+ public string cliByIdxFase(object _idxFase)
+ {
+ string answ = "";
+ int idxFase = 0;
+ int.TryParse(_idxFase.ToString(), out idxFase);
+ answ = memLayer.ML.getRSV($"{rhCliByIF}{idxFase}");
+ if (string.IsNullOrEmpty(answ))
+ {
+ answ = getCliByDb(idxFase);
+ memLayer.ML.setRSV($"{rhCliByIF}{idxFase}", answ, memLayer.ML.CRI("shotTimeCache"));
+ }
+ return answ;
+ }
+ ///
+ /// Cerca dati cliente da idxFase su DB
+ ///
+ ///
+ ///
+ private string getCliByDb(int idxFase)
+ {
+ string answ = "";
+ try
+ {
+ int idxPrj = idxProjByIdxFase(idxFase);
+ DS_Applicazione.AnagProgettiRow progetto = DataProxy.DP.taAP.getByIdxProjSmart(idxPrj)[0];
+ answ = DataProxy.DP.taAnCli.getByIdx(progetto.idxCliente)[0].RagSociale;
+ }
+ catch
+ { }
+ return answ;
+ }
- ///
- /// recupera progetto da idxFase
- ///
- ///
- ///
- public string prjByIdxFase(object _idxFase)
- {
- string answ = "";
- int idxFase = 0;
- int.TryParse(_idxFase.ToString(), out idxFase);
- answ = memLayer.ML.getRSV($"{rhProjByIF}{idxFase}");
- if (string.IsNullOrEmpty(answ))
- {
- answ = getProjByDb(idxFase);
- memLayer.ML.setRSV($"{rhProjByIF}{idxFase}", answ, memLayer.ML.CRI("shotTimeCache"));
- }
- return answ;
- }
- ///
- /// Cerca dati progetto da idxFase su DB
- ///
- ///
- ///
- private string getProjByDb(int idxFase)
- {
- string answ = "";
- try
- {
- int idxPrj = idxProjByIdxFase(idxFase);
- DS_Applicazione.AnagProgettiRow progetto = DataProxy.DP.taAP.getByIdxProjSmart(idxPrj)[0];
- answ = progetto.nomeProj;
- }
- catch
- { }
- return answ;
- }
+ ///
+ /// recupera progetto da idxFase
+ ///
+ ///
+ ///
+ public string prjByIdxFase(object _idxFase)
+ {
+ string answ = "";
+ int idxFase = 0;
+ int.TryParse(_idxFase.ToString(), out idxFase);
+ answ = memLayer.ML.getRSV($"{rhProjByIF}{idxFase}");
+ if (string.IsNullOrEmpty(answ))
+ {
+ answ = getProjByDb(idxFase);
+ memLayer.ML.setRSV($"{rhProjByIF}{idxFase}", answ, memLayer.ML.CRI("shotTimeCache"));
+ }
+ return answ;
+ }
+ ///
+ /// Cerca dati progetto da idxFase su DB
+ ///
+ ///
+ ///
+ private string getProjByDb(int idxFase)
+ {
+ string answ = "";
+ try
+ {
+ int idxPrj = idxProjByIdxFase(idxFase);
+ DS_Applicazione.AnagProgettiRow progetto = DataProxy.DP.taAP.getByIdxProjSmart(idxPrj)[0];
+ answ = progetto.nomeProj;
+ }
+ catch
+ { }
+ return answ;
+ }
- ///
- /// recupera descrizione e nome fase da idxFase
- ///
- ///
- ///
- public string faseByIdx(object _idxFase)
- {
- string answ = "";
- int idxFase = 0;
- int.TryParse(_idxFase.ToString(), out idxFase);
- answ = memLayer.ML.getRSV($"{rhFaseByIF}{idxFase}");
- if (string.IsNullOrEmpty(answ))
- {
- answ = getFaseByDb(idxFase);
- memLayer.ML.setRSV($"{rhFaseByIF}{idxFase}", answ, memLayer.ML.CRI("shotTimeCache"));
- }
- return answ;
- }
- ///
- /// Cerca dati fase da idxFase su DB
- ///
- ///
- ///
- private string getFaseByDb(int idxFase)
- {
- string answ = "";
- try
- {
- DS_Applicazione.AnagFasiRow fase = DataProxy.DP.taAF.getByIdxSmart(idxFase)[0];
- answ = string.Format("{0} ({1})", fase.nomeFase, fase.descrizioneFase);
- }
- catch
- { }
- return answ;
- }
+ ///
+ /// recupera descrizione e nome fase da idxFase
+ ///
+ ///
+ ///
+ public string faseByIdx(object _idxFase)
+ {
+ string answ = "";
+ int idxFase = 0;
+ int.TryParse(_idxFase.ToString(), out idxFase);
+ answ = memLayer.ML.getRSV($"{rhFaseByIF}{idxFase}");
+ if (string.IsNullOrEmpty(answ))
+ {
+ answ = getFaseByDb(idxFase);
+ memLayer.ML.setRSV($"{rhFaseByIF}{idxFase}", answ, memLayer.ML.CRI("shotTimeCache"));
+ }
+ return answ;
+ }
+ ///
+ /// Cerca dati fase da idxFase su DB
+ ///
+ ///
+ ///
+ private string getFaseByDb(int idxFase)
+ {
+ string answ = "";
+ try
+ {
+ DS_Applicazione.AnagFasiRow fase = DataProxy.DP.taAF.getByIdxSmart(idxFase)[0];
+ answ = string.Format("{0} ({1})", fase.nomeFase, fase.descrizioneFase);
+ }
+ catch
+ { }
+ return answ;
+ }
- ///
- /// rimanda ad edit
- ///
- ///
- ///
- protected void lnkEdit_Click(object sender, EventArgs e)
- {
- // salvo
- LinkButton lbtn = (LinkButton)sender;
- memLayer.ML.setSessionVal("idxRASel", lbtn.CommandArgument);
- // redirect!
- Response.Redirect("attivitaIns.aspx");
- }
- ///
- /// rimanda ad edit
- ///
- ///
- ///
- protected void lnkClona_Click(object sender, EventArgs e)
- {
- // salvo
- LinkButton lbtn = (LinkButton)sender;
- int idxRa = 0;
- try
- {
- idxRa = Convert.ToInt32(lbtn.CommandArgument);
- }
- catch
- { }
- // chiamo clona!
- DataProxy.DP.taRA.clonaRecord(idxRa);
- //update!
- setupPage();
- grView.DataBind();
- }
- protected void lnkCreateNew_Click(object sender, EventArgs e)
- {
- memLayer.ML.emptySessionVal("idxRASel");
- // redirect!
- Response.Redirect("attivitaIns.aspx");
- }
+ ///
+ /// rimanda ad edit
+ ///
+ ///
+ ///
+ protected void lnkEdit_Click(object sender, EventArgs e)
+ {
+ // salvo
+ LinkButton lbtn = (LinkButton)sender;
+ memLayer.ML.setSessionVal("idxRASel", lbtn.CommandArgument);
+ // redirect!
+ Response.Redirect("attivitaIns.aspx");
+ }
+ ///
+ /// rimanda ad edit
+ ///
+ ///
+ ///
+ protected void lnkClona_Click(object sender, EventArgs e)
+ {
+ // salvo
+ LinkButton lbtn = (LinkButton)sender;
+ int idxRa = 0;
+ try
+ {
+ idxRa = Convert.ToInt32(lbtn.CommandArgument);
+ }
+ catch
+ { }
+ // chiamo clona!
+ DataProxy.DP.taRA.clonaRecord(idxRa);
+ //update!
+ setupPage();
+ grView.DataBind();
+ }
+ protected void lnkCreateNew_Click(object sender, EventArgs e)
+ {
+ memLayer.ML.emptySessionVal("idxRASel");
+ // redirect!
+ Response.Redirect("attivitaIns.aspx");
+ }
- protected void txtData_TextChanged(object sender, EventArgs e)
- {
- DateTime newData = DateTime.Today;
- DateTime.TryParse(txtData.Text, out newData);
- dataRif = newData;
- setupPage();
- grView.DataBind();
+ protected void txtData_TextChanged(object sender, EventArgs e)
+ {
+ DateTime newData = DateTime.Today;
+ DateTime.TryParse(txtData.Text, out newData);
+ dataRif = newData;
+ setupPage();
+ grView.DataBind();
+ }
}
- }
}
\ No newline at end of file
diff --git a/GPW_Smart/WebUserControls/mod_enrollByEmail.ascx.cs b/GPW_Smart/WebUserControls/mod_enrollByEmail.ascx.cs
index 55a6069..ea06ba5 100644
--- a/GPW_Smart/WebUserControls/mod_enrollByEmail.ascx.cs
+++ b/GPW_Smart/WebUserControls/mod_enrollByEmail.ascx.cs
@@ -31,7 +31,7 @@ namespace GPW.WebUserControls
}
catch
{ }
- if (destinatario != "" && idxDipendente > 0)
+ if (!string.IsNullOrEmpty(destinatario) && idxDipendente > 0)
{
// invio email...
fatto = DataProxy.DP.sendUserAuthEmail(destinatario, UserAuthKey, idxDipendente);
diff --git a/GPW_Smart/WebUserControls/mod_enrollByJumperAuthKey.ascx.cs b/GPW_Smart/WebUserControls/mod_enrollByJumperAuthKey.ascx.cs
index 71621e8..8d3184f 100644
--- a/GPW_Smart/WebUserControls/mod_enrollByJumperAuthKey.ascx.cs
+++ b/GPW_Smart/WebUserControls/mod_enrollByJumperAuthKey.ascx.cs
@@ -37,7 +37,7 @@ namespace GPW.WebUserControls
catch
{ }
// se ci sono i dati effettua tentativo di AutoEnroll del device
- if (idxDipendente > 0 && UserAuthKey != "")
+ if (idxDipendente > 0 && !string.IsNullOrEmpty(UserAuthKey))
{
DeviceName = Request.UserHostName;
IPv4 = Request.UserHostName;
diff --git a/GPW_Smart/WebUserControls/mod_sendAuthToEmail.ascx.cs b/GPW_Smart/WebUserControls/mod_sendAuthToEmail.ascx.cs
index 0775a6f..f6dfd32 100644
--- a/GPW_Smart/WebUserControls/mod_sendAuthToEmail.ascx.cs
+++ b/GPW_Smart/WebUserControls/mod_sendAuthToEmail.ascx.cs
@@ -44,7 +44,7 @@ namespace GPW.WebUserControls
catch
{ }
// se ho trovato un email...
- if (destinatario != "" && idxDipendente > 0)
+ if (!string.IsNullOrEmpty(destinatario) && idxDipendente > 0)
{
DataProxy.DP.sendUserAuthEmail(destinatario, UserAuthKey, idxDipendente);
}