-
\ No newline at end of file
diff --git a/GPW_Admin/WebUserControls/mod_filtro.ascx.cs b/GPW_Admin/WebUserControls/mod_filtro.ascx.cs
index 994fc9a..8b94dfc 100644
--- a/GPW_Admin/WebUserControls/mod_filtro.ascx.cs
+++ b/GPW_Admin/WebUserControls/mod_filtro.ascx.cs
@@ -12,19 +12,85 @@ using SteamWare;
public partial class mod_filtro : ApplicationUserControl
{
+ #region Protected Fields
+
+ protected bool _changeCheckEnabled = true;
+
+ protected bool _changeCheckVisible = true;
+
+ protected bool _changeSelEnabled = true;
+
protected string _css;
+
+ protected SteamWare.tipoVistaMod _modo = SteamWare.tipoVistaMod.editing;
+
protected ObjectDataSource _ods;
+
+ protected string _where = "";
+
+ ///
+ /// nome variabile x salvataggio filtro
+ ///
+ protected string nomeFiltro = $"valFiltro_";
+
+ ///
+ /// nome variabile x salvataggio stato SHOW ALL
+ ///
+ protected string showAll = $"_showAll_";
+
+ ///
+ /// nome variabile x salvataggio stato filtro
+ ///
+ protected string showFiltro = $"_showFiltered_";
+
+ #endregion Protected Fields
+
+ #region Public Events
+
+ public event EventHandler eh_selValore;
+
+ #endregion Public Events
+
+ #region Protected Properties
+
+ protected string _showAll
+ {
+ get
+ {
+ return memLayer.ML.StringSessionObj($"_showAll_{this.UniqueID}");
+ }
+ set
+ {
+ memLayer.ML.setSessionVal($"_showAll_{this.UniqueID}", value);
+ traduciObj();
+ }
+ }
+
+ protected string _showFiltered
+ {
+ get
+ {
+ return memLayer.ML.StringSessionObj(showFiltro);
+ }
+ set
+ {
+ memLayer.ML.setSessionVal(showFiltro, value);
+ traduciObj();
+ }
+ }
+
protected string _valore
{
get
{
- return memLayer.ML.StringSessionObj(string.Format("valFiltro_{0}", this.ID));
+ return memLayer.ML.StringSessionObj(nomeFiltro);
}
set
{
- memLayer.ML.setSessionVal(string.Format("valFiltro_{0}", this.ID), value, false);
+ memLayer.ML.setSessionVal(nomeFiltro, value, false);
}
}
+
///
/// calcola se ci sia in sessione il valore del filtro
///
@@ -35,149 +101,80 @@ public partial class mod_filtro : ApplicationUserControl
bool answ = false;
try
{
- memLayer.ML.isInSessionObject(string.Format("valFiltro_{0}", this.ID));
+ memLayer.ML.isInSessionObject(nomeFiltro);
}
catch
{ }
return answ;
}
}
- protected bool _changeCheckEnabled = true;
- protected bool _changeCheckVisible = true;
- protected bool _changeSelEnabled = true;
- protected string _where = "";
- protected string _showFiltered
- {
- get
- {
- return memLayer.ML.StringSessionObj(string.Format("_showFiltered_{0}", this.ID));
- }
- set
- {
- memLayer.ML.setSessionVal(string.Format("_showFiltered_{0}", this.ID), value);
- traduciObj();
- }
- }
- protected string _showAll
- {
- get
- {
- return memLayer.ML.StringSessionObj(string.Format("_showAll_{0}", this.ID));
- }
- set
- {
- memLayer.ML.setSessionVal(string.Format("_showAll_{0}", this.ID), value);
- traduciObj();
- }
- }
- protected override void OnInit(EventArgs e)
+ #endregion Protected Properties
+
+ #region Public Properties
+
+ ///
+ /// determina se sia possibile (de)selezionare il check di filtraggio, altrimenti sempre attivo
+ ///
+ public bool changeCheckEnabled
{
- base.OnInit(e);
- if (!Page.IsPostBack)
+ get
{
- if (string.IsNullOrEmpty(_showFiltered)) _showFiltered = "mostraSoloSelez";
- if (string.IsNullOrEmpty(_showAll)) _showAll = "mostraTutti";
+ return _changeCheckEnabled;
+ }
+ set
+ {
+ _changeCheckEnabled = value;
+ updateChk();
}
}
///
- /// traduzione oggetti
+ /// determina se sia possibile visibile il check di filtraggio
///
- protected override void traduciObj()
- {
- if (_changeCheckVisible)
- {
- if (!chkFilt.Checked)
- {
- chkFilt.Text = traduci(_showFiltered);
- }
- else
- {
- chkFilt.Text = traduci(_showAll);
- }
- }
- }
- ///
- /// get/set messaggio di attivazione filtraggio
- ///
- public string filterChekText
+ public bool changeCheckVisible
{
get
{
- return _showFiltered;
+ return _changeCheckVisible;
}
set
{
- _showFiltered = value;
+ _changeCheckVisible = value;
+ updateChkLbl();
}
}
+
///
- /// get/set messaggio di disattivazione filtraggio
+ /// determina se sia possibile modificare la selezione
///
- public string filterUnchekText
+ public bool changeSelEnabled
{
get
{
- return _showAll;
+ return _changeSelEnabled;
}
set
{
- _showAll = value;
+ _changeSelEnabled = value;
+ updateSel();
}
}
- protected void chkFilt_CheckedChanged(object sender, EventArgs e)
- {
- // cambio modalità visualizzazione del filtro...
- dlFilt.Visible = !dlFilt.Visible;
- raiseSelEvent();
- }
- protected void raiseSelEvent()
+ ///
+ /// get/set per la larghezza della combo dropdown
+ ///
+ public int comboWidth
{
- if (!dlFilt.Visible)
+ get
{
- memLayer.ML.setSessionVal(string.Format("valFiltro_{0}", this.ID), "", false);
+ return Convert.ToInt32(dlFilt.Width);
}
- else
+ set
{
- _valore = dlFilt.SelectedValue;
- }
- if (eh_selValore != null)
- {
- eh_selValore(this, new EventArgs());
+ dlFilt.Width = value;
}
}
- protected void updateChk()
- {
- chkFilt.Enabled = _changeCheckEnabled;
- if (!_changeCheckEnabled)
- {
- chkFilt.Checked = true;
- dlFilt.Visible = true;
- }
- }
- protected void updateSel()
- {
- dlFilt.Enabled = _changeSelEnabled;
- }
- protected void updateChkLbl()
- {
- chkFilt.Visible = _changeCheckVisible;
- }
- protected override void bindControlli()
- {
- updateChk();
- fixValore();
- where.Text = _where;
- traduciObj();
- }
- protected SteamWare.tipoVistaMod _modo = SteamWare.tipoVistaMod.editing;
- protected void dlFilt_SelectedIndexChanged(object sender, EventArgs e)
- {
- raiseSelEvent();
- }
-
///
/// condizione where per ridurre elementi mostrati in selettore
@@ -195,171 +192,50 @@ public partial class mod_filtro : ApplicationUserControl
}
///
- /// fornisce il valore scelto o "*" se nulla selezionato
+ /// css applicato agli elementi del controllo
///
- public string valore
+ public string css
{
get
{
- string answ = "*";
- if (chkFilt.Checked)
- {
- answ = dlFilt.SelectedValue;
- }
- return answ;
+ return _css;
}
set
{
- _valore = value;
- //fixValore();
+ _css = value;
}
}
///
- /// primo valore di una chiave multicampo
+ /// get/set messaggio di attivazione filtraggio
///
- public string val_1
+ public string filterChekText
{
get
{
- string answ = "";
- if (chkFilt.Checked)
- {
- try
- {
- string[] _dataKey = dlFilt.SelectedValue.Split('#');
- answ = _dataKey[0];
- }
- catch
- { }
- }
- else
- {
- answ = "*";
- }
- return answ;
- }
- }
- ///
- /// secondo valore di una chiave multicampo
- ///
- public string val_2
- {
- get
- {
- string answ = "";
- if (chkFilt.Checked)
- {
- try
- {
- string[] _dataKey = dlFilt.SelectedValue.Split('#');
- answ = _dataKey[1];
- }
- catch
- { }
- }
- else
- {
- answ = "*";
- }
- return answ;
- }
- }
- ///
- /// fornisce il valore scelto o "0" se nulla selezionato o non valido
- ///
- public int valoreInt
- {
- get
- {
- int answ = -1;
- try
- {
- if (chkFilt.Checked)
- {
- answ = Convert.ToInt32(dlFilt.SelectedValue);
- }
- }
- catch
- { }
- return answ;
- }
- }
- ///
- /// sistema visualizzazione
- ///
- protected void fixValore()
- {
- if (_ods != null)
- {
- try
- {
- dlFilt.DataSource = _ods;
- dlFilt.DataBind();
- if (!string.IsNullOrEmpty(_valore))
- {
-
- dlFilt.SelectedValue = _valore;
- dlFilt.Visible = true;
- chkFilt.Checked = true;
- }
- }
- catch (Exception exc)
- {
- logger.lg.scriviLog(string.Format("Eccezione:{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
- dlFilt.SelectedIndex = 0;
- }
- }
- }
-
-
- public event EventHandler eh_selValore;
-
- ///
- /// determina se sia possibile (de)selezionare il check di filtraggio, altrimenti sempre attivo
- ///
- public bool changeCheckEnabled
- {
- get
- {
- return _changeCheckEnabled;
+ return _showFiltered;
}
set
{
- _changeCheckEnabled = value;
- updateChk();
+ _showFiltered = value;
}
}
+
///
- /// determina se sia possibile modificare la selezione
+ /// get/set messaggio di disattivazione filtraggio
///
- public bool changeSelEnabled
+ public string filterUnchekText
{
get
{
- return _changeSelEnabled;
+ return _showAll;
}
set
{
- _changeSelEnabled = value;
- updateSel();
- }
- }
- ///
- /// determina se sia possibile visibile il check di filtraggio
- ///
- public bool changeCheckVisible
- {
- get
- {
- return _changeCheckVisible;
- }
- set
- {
- _changeCheckVisible = value;
- updateChkLbl();
+ _showAll = value;
}
}
+
///
/// get/set della checkbox
///
@@ -389,22 +265,248 @@ public partial class mod_filtro : ApplicationUserControl
set
{
_ods = value;
+ reselFirst();
}
}
+
///
- /// css applicato agli elementi del controllo
+ /// primo valore di una chiave multicampo
///
- public string css
+ public string val_1
{
get
{
- return _css;
+ string answ = "";
+ if (chkFilt.Checked)
+ {
+ try
+ {
+ string[] _dataKey = dlFilt.SelectedValue.Split('#');
+ answ = _dataKey[0];
+ }
+ catch
+ { }
+ }
+ else
+ {
+ answ = "*";
+ }
+ return answ;
+ }
+ }
+
+ ///
+ /// secondo valore di una chiave multicampo
+ ///
+ public string val_2
+ {
+ get
+ {
+ string answ = "";
+ if (chkFilt.Checked)
+ {
+ try
+ {
+ string[] _dataKey = dlFilt.SelectedValue.Split('#');
+ answ = _dataKey[1];
+ }
+ catch
+ { }
+ }
+ else
+ {
+ answ = "*";
+ }
+ return answ;
+ }
+ }
+
+ ///
+ /// fornisce il valore scelto o "*" se nulla selezionato
+ ///
+ public string valore
+ {
+ get
+ {
+ string answ = "*";
+ if (chkFilt.Checked)
+ {
+ answ = dlFilt.SelectedValue;
+ }
+ return answ;
}
set
{
- _css = value;
+ _valore = value;
}
}
+
+ ///
+ /// fornisce il valore scelto o "0" se nulla selezionato o non valido
+ ///
+ public int valoreInt
+ {
+ get
+ {
+ int answ = -1;
+ try
+ {
+ if (chkFilt.Checked)
+ {
+ answ = Convert.ToInt32(dlFilt.SelectedValue);
+ }
+ }
+ catch
+ { }
+ return answ;
+ }
+ }
+
+ #endregion Public Properties
+
+ #region Protected Methods
+
+ protected override void bindControlli()
+ {
+ updateChk();
+ fixValore();
+ where.Text = _where;
+ traduciObj();
+ }
+
+ protected void chkFilt_CheckedChanged(object sender, EventArgs e)
+ {
+ // cambio modalità visualizzazione del filtro...
+ dlFilt.Visible = !dlFilt.Visible;
+ raiseSelEvent();
+ }
+
+ protected void dlFilt_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ raiseSelEvent();
+ }
+
+ ///
+ /// sistema visualizzazione
+ ///
+ protected void fixValore()
+ {
+ if (_ods != null)
+ {
+ try
+ {
+ dlFilt.DataSource = _ods;
+ dlFilt.DataBind();
+ if (!string.IsNullOrEmpty(_valore))
+ {
+ dlFilt.SelectedValue = _valore;
+ dlFilt.Visible = true;
+ chkFilt.Checked = true;
+ }
+ }
+ catch (Exception exc)
+ {
+ logger.lg.scriviLog($"Eccezione:{Environment.NewLine}{exc}", tipoLog.EXCEPTION);
+ dlFilt.SelectedIndex = 0;
+ }
+ }
+ }
+
+ protected override void OnInit(EventArgs e)
+ {
+ base.OnInit(e);
+ if (!Page.IsPostBack)
+ {
+ if (string.IsNullOrEmpty(_showFiltered)) _showFiltered = "mostraSoloSelez";
+ if (string.IsNullOrEmpty(_showAll)) _showAll = "mostraTutti";
+ }
+ }
+
+ protected override void Page_Load(object sender, EventArgs e)
+ {
+ if (!Page.IsPostBack)
+ {
+ nomeFiltro = $"valFiltro_{this.UniqueID}";
+ showFiltro = $"_showFiltered_{this.UniqueID}";
+ }
+ base.Page_Load(sender, e);
+ }
+
+ protected void raiseSelEvent()
+ {
+ if (!dlFilt.Visible)
+ {
+ memLayer.ML.setSessionVal(nomeFiltro, "", false);
+ }
+ else
+ {
+ _valore = dlFilt.SelectedValue;
+ }
+ if (eh_selValore != null)
+ {
+ eh_selValore(this, new EventArgs());
+ }
+ }
+
+ ///
+ /// traduzione oggetti
+ ///
+ protected override void traduciObj()
+ {
+ if (_changeCheckVisible)
+ {
+ if (!chkFilt.Checked)
+ {
+ chkFilt.Text = traduci(_showFiltered);
+ }
+ else
+ {
+ chkFilt.Text = traduci(_showAll);
+ }
+ }
+ }
+
+ protected void updateChk()
+ {
+ chkFilt.Enabled = _changeCheckEnabled;
+ if (!_changeCheckEnabled)
+ {
+ chkFilt.Checked = true;
+ dlFilt.Visible = true;
+ }
+ }
+
+ protected void updateChkLbl()
+ {
+ chkFilt.Visible = _changeCheckVisible;
+ }
+
+ protected void updateSel()
+ {
+ dlFilt.Enabled = _changeSelEnabled;
+ }
+
+ #endregion Protected Methods
+
+ #region Public Methods
+
+ ///
+ /// resetta e seleziona primo valore
+ ///
+ public void reselFirst()
+ {
+ try
+ {
+ dlFilt.DataBind();
+ bindControlli();
+ dlFilt.SelectedIndex = 0;
+ }
+ catch(Exception exc)
+ {
+ logger.lg.scriviLog($"Eccezione:{Environment.NewLine}{exc}", tipoLog.EXCEPTION);
+ }
+ }
+
///
/// resetta il controllo (un-checked)
///
@@ -412,35 +514,8 @@ public partial class mod_filtro : ApplicationUserControl
{
chkFilt.Checked = false;
dlFilt.Visible = false;
- memLayer.ML.emptySessionVal(string.Format("valFiltro_{0}", this.ID));
- }
- ///
- /// resetta e seleziona primo valore
- ///
- public void reselFirst()
- {
- dlFilt.DataBind();
- bindControlli();
- try
- {
- dlFilt.SelectedIndex = 0;
- }
- catch
- { }
- }
- ///
- /// get/set per la larghezza della combo dropdown
- ///
- public int comboWidth
- {
- get
- {
- return Convert.ToInt32(dlFilt.Width);
- }
- set
- {
- dlFilt.Width = value;
- }
+ memLayer.ML.emptySessionVal(nomeFiltro);
}
+ #endregion Public Methods
}
\ No newline at end of file
diff --git a/GPW_Admin/WebUserControls/mod_filtro.ascx.designer.cs b/GPW_Admin/WebUserControls/mod_filtro.ascx.designer.cs
index f4cb510..dde8c97 100644
--- a/GPW_Admin/WebUserControls/mod_filtro.ascx.designer.cs
+++ b/GPW_Admin/WebUserControls/mod_filtro.ascx.designer.cs
@@ -1,40 +1,41 @@
//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
+//
+// Codice generato da uno strumento.
//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
+// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se
+// il codice viene rigenerato.
+//
//------------------------------------------------------------------------------
-public partial class mod_filtro {
-
+public partial class mod_filtro
+{
+
///
- /// chkFilt control.
+ /// Controllo chkFilt.
///
///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
+ /// Campo generato automaticamente.
+ /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
///
protected global::System.Web.UI.WebControls.CheckBox chkFilt;
-
+
///
- /// dlFilt control.
+ /// Controllo dlFilt.
///
///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
+ /// Campo generato automaticamente.
+ /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
///
protected global::AjaxControlToolkit.ComboBox dlFilt;
-
+
///
- /// where control.
+ /// Controllo where.
///
///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
+ /// Campo generato automaticamente.
+ /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
///
protected global::System.Web.UI.WebControls.Label where;
}