diff --git a/GPW_Admin/WebUserControls/mod_reviewTimbrature.ascx b/GPW_Admin/WebUserControls/mod_reviewTimbrature.ascx index a1f43ee..bb93e51 100644 --- a/GPW_Admin/WebUserControls/mod_reviewTimbrature.ascx +++ b/GPW_Admin/WebUserControls/mod_reviewTimbrature.ascx @@ -136,8 +136,8 @@
- - + +
diff --git a/GPW_Commesse/BaseUserControl.cs b/GPW_Commesse/BaseUserControl.cs index 62ce9ea..7fcc2d1 100644 --- a/GPW_Commesse/BaseUserControl.cs +++ b/GPW_Commesse/BaseUserControl.cs @@ -12,47 +12,21 @@ namespace GPW_Commesse { public class BaseUserControl : System.Web.UI.UserControl { + #region Public Events + /// /// Evento cancel /// public event EventHandler ehCancel; + /// /// Evento save /// public event EventHandler ehSave; - /// - /// Sollevo evento cancel - /// - protected void raiseCancel() - { - if (ehCancel != null) - { - ehCancel(this, new EventArgs()); - } - } - /// - /// Sollevo evento save - /// - protected void raiseSave() - { - if (ehSave != null) - { - ehSave(this, new EventArgs()); - } - } - /// - /// Verifica se il valore sia > 0 - /// - /// - /// - public bool gtZero(object _valore) - { - bool answ = false; - decimal valore = 0; - decimal.TryParse(_valore.ToString(), out valore); - answ = valore > 0; - return answ; - } + + #endregion Public Events + + #region Protected Properties /// /// idxDipendente in sessione @@ -69,5 +43,87 @@ namespace GPW_Commesse } } + #endregion Protected Properties + + #region Protected Methods + + /// + /// Sollevo evento cancel + /// + protected void raiseCancel() + { + if (ehCancel != null) + { + ehCancel(this, new EventArgs()); + } + } + + /// + /// Sollevo evento save + /// + protected void raiseSave() + { + if (ehSave != null) + { + ehSave(this, new EventArgs()); + } + } + + #endregion Protected Methods + + #region Public Methods + + /// + /// Verifica se il valore sia > limitValue + /// + /// + /// + /// + /// + public bool betweenVal(object _valore, double minVal, double maxVal) + { + bool answ = false; + if (_valore != null) + { + double valore = 0; + _ = double.TryParse(_valore.ToString(), out valore); + answ = valore <= maxVal && valore >= minVal; + } + return answ; + } + + /// + /// Verifica se il valore sia > limitValue + /// + /// + /// + /// + public bool gtVal(object _valore, double maxVal) + { + bool answ = false; + if (_valore != null) + { + double valore = 0; + _ = double.TryParse(_valore.ToString(), out valore); + answ = valore > maxVal; + } + return answ; + } + + /// + /// Verifica se il valore sia > 0 + /// + /// + /// + public bool gtZero(object _valore) + { + bool answ = false; + decimal valore = 0; + decimal.TryParse(_valore.ToString(), out valore); + answ = valore > 0; + return answ; + } + + #endregion Public Methods } } \ No newline at end of file diff --git a/GPW_Commesse/WebUserControls/mod_commUtLog.ascx b/GPW_Commesse/WebUserControls/mod_commUtLog.ascx index f8bdcfd..393a579 100644 --- a/GPW_Commesse/WebUserControls/mod_commUtLog.ascx +++ b/GPW_Commesse/WebUserControls/mod_commUtLog.ascx @@ -99,7 +99,7 @@
- +
diff --git a/GPW_Smart/BaseUserControl.cs b/GPW_Smart/BaseUserControl.cs index 42d5e18..2d4498f 100644 --- a/GPW_Smart/BaseUserControl.cs +++ b/GPW_Smart/BaseUserControl.cs @@ -9,91 +9,8 @@ namespace GPW_Smart { public class BaseUserControl : System.Web.UI.UserControl { - public string hashEmail - { - get - { - return memLayer.ML.StringSessionObj("hashEmail"); - } - } - public string email - { - get - { - return memLayer.ML.StringSessionObj("email"); - } - } - public string cognomeNome - { - get - { - return memLayer.ML.StringSessionObj("cognomeNome"); - } - } - public string IP - { - get - { - return Request.UserHostName; - } - } + #region Protected Properties - public int numColEU - { - get - { - return memLayer.ML.IntSessionObj("numColEU"); - } - set - { - memLayer.ML.setSessionVal("numColEU", value); - } - } - public int numRowTimb - { - get - { - return memLayer.ML.IntSessionObj("numRowTimb"); - } - set - { - memLayer.ML.setSessionVal("numRowTimb", value); - } - } - public bool abilitaAll - { - get - { - bool answ = false; - try - { - string rawData = memLayer.ML.getRSV("abilitaAll"); - bool.TryParse(rawData, out answ); - } - catch - { } - return answ; - } - set - { - int ttlSec = value ? memLayer.ML.CRI("ttlAbilitaAll") : 0; - memLayer.ML.setRSV("abilitaAll", value.ToString(), ttlSec); - } - } - public string textSize - { - get - { - string answ=memLayer.ML.StringSessionObj("textSize"); - if (string.IsNullOrEmpty(answ)) - answ = "1.2em"; - return answ; - } - set - { - memLayer.ML.setSessionVal("textSize", value); - } - } /// /// idx dipendente loggato /// @@ -115,5 +32,153 @@ namespace GPW_Smart memLayer.ML.setSessionVal("IdxDipendente", value.ToString()); } } + + #endregion Protected Properties + + #region Public Properties + + public bool abilitaAll + { + get + { + bool answ = false; + try + { + string rawData = memLayer.ML.getRSV("abilitaAll"); + bool.TryParse(rawData, out answ); + } + catch + { } + return answ; + } + set + { + int ttlSec = value ? memLayer.ML.CRI("ttlAbilitaAll") : 0; + memLayer.ML.setRSV("abilitaAll", value.ToString(), ttlSec); + } + } + + public string cognomeNome + { + get + { + return memLayer.ML.StringSessionObj("cognomeNome"); + } + } + + public string email + { + get + { + return memLayer.ML.StringSessionObj("email"); + } + } + + public string hashEmail + { + get + { + return memLayer.ML.StringSessionObj("hashEmail"); + } + } + + public string IP + { + get + { + return Request.UserHostName; + } + } + + public int numColEU + { + get + { + return memLayer.ML.IntSessionObj("numColEU"); + } + set + { + memLayer.ML.setSessionVal("numColEU", value); + } + } + + public int numRowTimb + { + get + { + return memLayer.ML.IntSessionObj("numRowTimb"); + } + set + { + memLayer.ML.setSessionVal("numRowTimb", value); + } + } + + public string textSize + { + get + { + string answ = memLayer.ML.StringSessionObj("textSize"); + if (string.IsNullOrEmpty(answ)) + answ = "1.2em"; + return answ; + } + set + { + memLayer.ML.setSessionVal("textSize", value); + } + } + + #endregion Public Properties + + #region Public Methods + + /// + /// Verifica se il valore sia > limitValue + /// + /// + /// + /// + /// + public bool betweenVal(object _valore, double minVal, double maxVal) + { + bool answ = false; + if (_valore != null) + { + double valore = 0; + _ = double.TryParse(_valore.ToString(), out valore); + answ = valore <= maxVal && valore >= minVal; + } + return answ; + } + + /// + /// Verifica se il valore sia > limitValue + /// + /// + /// + /// + public bool gtVal(object _valore, double maxVal) + { + bool answ = false; + if (_valore != null) + { + double valore = 0; + _ = double.TryParse(_valore.ToString(), out valore); + answ = valore > maxVal; + } + return answ; + } + + public bool gtZero(object _valore) + { + bool answ = false; + decimal valore = 0; + decimal.TryParse(_valore.ToString(), out valore); + answ = valore > 0; + return answ; + } + + #endregion Public Methods } } \ No newline at end of file diff --git a/GPW_Smart/WebUserControls/mod_timbrature.ascx b/GPW_Smart/WebUserControls/mod_timbrature.ascx index 44c60db..ce3c33d 100644 --- a/GPW_Smart/WebUserControls/mod_timbrature.ascx +++ b/GPW_Smart/WebUserControls/mod_timbrature.ascx @@ -12,7 +12,7 @@ -
+
@@ -68,7 +68,7 @@ - +
@@ -85,4 +85,4 @@
-
+ \ No newline at end of file diff --git a/GPW_Smart/WebUserControls/mod_timbrature.ascx.cs b/GPW_Smart/WebUserControls/mod_timbrature.ascx.cs index 597c4ca..cdb692c 100644 --- a/GPW_Smart/WebUserControls/mod_timbrature.ascx.cs +++ b/GPW_Smart/WebUserControls/mod_timbrature.ascx.cs @@ -9,6 +9,8 @@ namespace GPW.WebUserControls { public partial class mod_timbrature : BaseUserControl { + #region Protected Properties + protected bool forceButtons { get @@ -20,60 +22,10 @@ namespace GPW.WebUserControls abilitaAll = !(value); } } - protected void Page_Load(object sender, EventArgs e) - { - if (!Page.IsPostBack) - { - // verifico se ci sia un numero di righe selezionate altrimenti lo imposto... - if (!memLayer.ML.isInSessionObject("numColEU")) numColEU = 2; - if (!memLayer.ML.isInSessionObject("numRowTimb")) numRowTimb = 10; - memLayer.ML.setSessionVal("dataRif", DateTime.Today); - } - setButtons(); - fixFont(); - } - private void fixFont() - { - divTable.Style.Clear(); - divTable.Style.Add("font-size", textSize); - } + #endregion Protected Properties - /// - /// fix buttons button - /// - private void setButtons() - { - // controllo SE voglio inibire i buttons... - if (forceButtons) - { - // controllo se il prox comando DOVREBBE essere entrata o uscita - bool nextIsEntrata = true; - // controllo dipendente - if (IdxDipendente > 0) - { - // ricavo ultima timbratura.. - nextIsEntrata = timbratrice.nextIsEntrata(IdxDipendente); - // di conseguenza cambio abilitazione ad un buttons - if (nextIsEntrata) - { - fixBtnInOut(true, false); - } - else - { - fixBtnInOut(false, true); - } - } - else - { - fixBtnInOut(false, false); - } - } - else - { - fixBtnInOut(true, true); - } - } + #region Private Methods private void fixBtnInOut(bool showIn, bool showOut) { @@ -83,41 +35,12 @@ namespace GPW.WebUserControls lbtUscita.CssClass = showOut ? "btn btn-success btn-block" : "btn btn-outline-success disabled btn-block"; } - /// - /// timbro entrata... - /// - /// - /// - protected void lbtEntrata_Click(object sender, EventArgs e) + private void fixFont() { - bool isEntrata = true; - registraTimbratura(isEntrata); - } - /// - /// uscita... - /// - /// - /// - protected void lbtUscita_Click(object sender, EventArgs e) - { - bool isEntrata = false; - registraTimbratura(isEntrata); - } - /// - /// Aggiorno visualizzazione - /// - public void doUpdate() - { - setButtons(); - grView.DataBind(); - } - /// - /// update elenco ultime timbrature - /// - private void updateTimbrature() - { - // aggiorno datagrid + divTable.Style.Clear(); + divTable.Style.Add("font-size", textSize); } + /// /// registro timbratura /// @@ -164,22 +87,53 @@ namespace GPW.WebUserControls } /// - /// inverte valore booleano + /// fix buttons button /// - /// - /// - public bool invBool(object valore) + private void setButtons() { - bool answ = true; - try + // controllo SE voglio inibire i buttons... + if (forceButtons) { - answ = !Convert.ToBoolean(valore); + // controllo se il prox comando DOVREBBE essere entrata o uscita + bool nextIsEntrata = true; + // controllo dipendente + if (IdxDipendente > 0) + { + // ricavo ultima timbratura.. + nextIsEntrata = timbratrice.nextIsEntrata(IdxDipendente); + // di conseguenza cambio abilitazione ad un buttons + if (nextIsEntrata) + { + fixBtnInOut(true, false); + } + else + { + fixBtnInOut(false, true); + } + } + else + { + fixBtnInOut(false, false); + } + } + else + { + fixBtnInOut(true, true); } - catch - { } - return answ; } + /// + /// update elenco ultime timbrature + /// + private void updateTimbrature() + { + // aggiorno datagrid + } + + #endregion Private Methods + + #region Protected Methods + protected void grView_RowCreated(object sender, GridViewRowEventArgs e) { int maxNum = e.Row.Cells.Count - 2; @@ -205,15 +159,6 @@ namespace GPW.WebUserControls Response.Redirect($"Progetti?dataRif={dataRif:yyyy-MM-dd}"); } - public bool gtZero(object _valore) - { - bool answ = false; - decimal valore = 0; - decimal.TryParse(_valore.ToString(), out valore); - answ = valore > 0; - return answ; - } - protected void lbShowTemp_Click(object sender, EventArgs e) { // recupero data di riferimento @@ -231,5 +176,72 @@ namespace GPW.WebUserControls catch { } } + + /// + /// timbro entrata... + /// + /// + /// + protected void lbtEntrata_Click(object sender, EventArgs e) + { + bool isEntrata = true; + registraTimbratura(isEntrata); + } + + /// + /// uscita... + /// + /// + /// + protected void lbtUscita_Click(object sender, EventArgs e) + { + bool isEntrata = false; + registraTimbratura(isEntrata); + } + + protected void Page_Load(object sender, EventArgs e) + { + if (!Page.IsPostBack) + { + // verifico se ci sia un numero di righe selezionate altrimenti lo imposto... + if (!memLayer.ML.isInSessionObject("numColEU")) numColEU = 2; + if (!memLayer.ML.isInSessionObject("numRowTimb")) numRowTimb = 10; + memLayer.ML.setSessionVal("dataRif", DateTime.Today); + } + setButtons(); + fixFont(); + } + + #endregion Protected Methods + + #region Public Methods + + /// + /// Aggiorno visualizzazione + /// + public void doUpdate() + { + setButtons(); + grView.DataBind(); + } + + /// + /// inverte valore booleano + /// + /// + /// + public bool invBool(object valore) + { + bool answ = true; + try + { + answ = !Convert.ToBoolean(valore); + } + catch + { } + return answ; + } + + #endregion Public Methods } } \ No newline at end of file