diff --git a/GPW_Barcode/Barcode.aspx.cs b/GPW_Barcode/Barcode.aspx.cs index 71a669f..27a8ba4 100644 --- a/GPW_Barcode/Barcode.aspx.cs +++ b/GPW_Barcode/Barcode.aspx.cs @@ -8,14 +8,14 @@ using GPW_data; namespace GPW_Barcode { - public partial class Barcode : System.Web.UI.Page + public partial class Barcode : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) { - protected void Page_Load(object sender, EventArgs e) - { - if (!Page.IsPostBack) - { - utils.mng.dailyDuties(); - } - } + if (!Page.IsPostBack) + { + utils.mng.dailyDuties(); + } } + } } \ No newline at end of file diff --git a/GPW_Barcode/WebUserControls/mod_bCodeTimb.ascx b/GPW_Barcode/WebUserControls/mod_bCodeTimb.ascx index 6982b38..ec40f66 100644 --- a/GPW_Barcode/WebUserControls/mod_bCodeTimb.ascx +++ b/GPW_Barcode/WebUserControls/mod_bCodeTimb.ascx @@ -1,168 +1,137 @@ <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="mod_bCodeTimb.ascx.cs" Inherits="GPW.WebUserControls.mod_bCodeTimb" %> -<% if (false) - { %> - -<% } %> + -
-
-
-
- -
-
- -
-   -
-
- -
- -
-
+
+
+
+
+
-
-
- -
-
- -
+
+ +
+  
-
- - - -
-
- - - -
-
-
- -
- -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - <%----%> - - - - - - - -
+ +
+
- <%--
- - -
- -
-
- -
- - -
-
-
--%> - <%--
-
-
-
-
    -
  • -
  • :
  • -
  • -
  • :
  • -
  • -
-
-
--%> +
+
+
+ +
+
+ +
+
+
+
+ + + +
+
+ + + +
+
+
+ +
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
+
+
diff --git a/GPW_Barcode/WebUserControls/mod_bCodeTimb.ascx.cs b/GPW_Barcode/WebUserControls/mod_bCodeTimb.ascx.cs index 6df9935..ba7c34b 100644 --- a/GPW_Barcode/WebUserControls/mod_bCodeTimb.ascx.cs +++ b/GPW_Barcode/WebUserControls/mod_bCodeTimb.ascx.cs @@ -9,480 +9,465 @@ using GPW_data; namespace GPW.WebUserControls { - public partial class mod_bCodeTimb : System.Web.UI.UserControl + public partial class mod_bCodeTimb : System.Web.UI.UserControl + { + /// + /// salva il dato se il prox sia entrata... + /// + protected bool nextIsEntrata { - /// - /// salva il dato se il prox sia entrata... - /// - protected bool nextIsEntrata + get + { + return memLayer.ML.BoolSessionObj("nextIsEntrata"); + } + set + { + memLayer.ML.setSessionVal("nextIsEntrata", value); + } + } + /// + /// dataora associata all'evento scansioen BCode + /// + protected DateTime orarioBCode + { + get + { + return (DateTime)memLayer.ML.objSessionObj("dataOraBCode"); + } + set + { + memLayer.ML.setSessionVal("dataOraBCode", value); + } + } + /// + /// indica i secondi di countdown rimasti x auto-commit + /// + protected int countDown + { + get + { + return memLayer.ML.IntSessionObj("countDownBCode"); + } + set + { + memLayer.ML.setSessionVal("countDownBCode", value); + } + } + /// + /// pagina corrente + /// + protected string paginaCorrente + { + get + { + string answ = ""; + Uri MyUrl = Request.Url; + string delimStr = "/"; + char[] delimiter = delimStr.ToCharArray(); + string[] finalUrl = MyUrl.LocalPath.ToString().Split(delimiter); + int n = finalUrl.Length; + answ = finalUrl[n - 1].ToString(); + return answ; + } + } + /// + /// prox messaggio utente (da mostrare) + /// + protected string nextUsrMsg + { + get + { + string answ = ""; + try { - get - { - return memLayer.ML.BoolSessionObj("nextIsEntrata"); - } - set - { - memLayer.ML.setSessionVal("nextIsEntrata", value); - } + answ = memLayer.ML.StringSessionObj("nextUsrMsg"); } - /// - /// dataora associata all'evento scansioen BCode - /// - protected DateTime orarioBCode + catch + { } + if (answ == "") { - get - { - return (DateTime)memLayer.ML.objSessionObj("dataOraBCode"); - } - set - { - memLayer.ML.setSessionVal("dataOraBCode", value); - } - } - /// - /// indica i secondi di countdown rimasti x auto-commit - /// - protected int countDown - { - get - { - return memLayer.ML.IntSessionObj("countDownBCode"); - } - set - { - memLayer.ML.setSessionVal("countDownBCode", value); - } - } - /// - /// pagina corrente - /// - protected string paginaCorrente - { - get - { - string answ = ""; - Uri MyUrl = Request.Url; - string delimStr = "/"; - char[] delimiter = delimStr.ToCharArray(); - string[] finalUrl = MyUrl.LocalPath.ToString().Split(delimiter); - int n = finalUrl.Length; - answ = finalUrl[n - 1].ToString(); - return answ; - } - } - /// - /// prox messaggio utente (da mostrare) - /// - protected string nextUsrMsg - { - get - { - string answ = ""; - try - { - answ = memLayer.ML.StringSessionObj("nextUsrMsg"); - } - catch - { } - if (answ == "") - { - answ = "...waiting..."; - } - return answ; - } - set - { - memLayer.ML.setSessionVal("nextUsrMsg", value); - } + answ = "...waiting..."; } + return answ; + } + set + { + memLayer.ML.setSessionVal("nextUsrMsg", value); + } + } - /// - /// caricamento pagina - /// - /// - /// - protected void Page_Load(object sender, EventArgs e) + /// + /// caricamento pagina + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + chekIpPostazione(); + if (!Page.IsPostBack) + { + DataProxy.idxDipendente = -1; + bool visibile = false; + setCtrlState(visibile); + checkBarcode(); + } + timerConf.Tick += new EventHandler(timerConf_Tick); + lblDipendenteAttivo.Text = nextUsrMsg; + txtBarcode.Focus(); + } + /// + /// verifica IP della postazione chiamante, se non è tra quelli permessi (o non è indicato "*") rimanda a pagina precedente... + /// + private void chekIpPostazione() + { + // recupero IP + string IPv4 = Request.UserHostName; + // controllo se IP locale = approvata... + if (!memLayer.ML.confReadString("ipv4StazBCode").Contains(IPv4) && memLayer.ML.confReadString("ipv4StazBCode") != "*") + { + Response.Redirect("~/Default.aspx"); + } + } + /// + /// allo scadere del timer controllo countdown! + /// + /// + /// + void timerConf_Tick(object sender, EventArgs e) + { + contatorePag = 0; + if (countDown > 1) + { + countDown = countDown - 1; + lblCountDown.Text = countDown.ToString(); + txtBarcode.Focus(); + } + else + { + // salvo operazione di default! + registraTimbratura(nextIsEntrata); + // reset visualizzazione + setCtrlState(false); + timerConf.Enabled = false; + // reset valori + Response.Redirect(paginaCorrente); + } + } + /// + /// imposta lo stato visibile dei controlli + /// + /// + private void setCtrlState(bool visibile) + { + pnlTimer.Visible = visibile; + //imgRun.Visible = visibile; + if (DataProxy.idxDipendente > 0) + { + grView.Visible = true; + } + else + { + grView.Visible = visibile; + } + } + /// + /// verifica in che stato debbano essere i buttons (se barcode utente valido) + /// + private void checkButtons() + { + // controllo se il prox comando DOVREBBE essere entrata o uscita + nextIsEntrata = true; + // controllo dipendente + if (DataProxy.idxDipendente > 0) + { + // ricavo ultima timbratura.. + nextIsEntrata = timbratrice.nextIsEntrata(DataProxy.idxDipendente); + string tipoTimb = "uscita"; + // di conseguenza cambio abilitazione ad un buttons + if (nextIsEntrata) { - chekIpPostazione(); - if (!Page.IsPostBack) - { - DataProxy.idxDipendente = -1; - bool visibile = false; - setCtrlState(visibile); - checkBarcode(); - } - timerConf.Tick += new EventHandler(timerConf_Tick); -#if false - timerClock.Tick += new EventHandler(timerClock_Tick); -#endif - lblDipendenteAttivo.Text = nextUsrMsg; - txtBarcode.Focus(); + btnEntrata.CssClass = "btnPreferred"; + btnUscita.CssClass = "btnStd"; + tipoTimb = "ENTRATA"; } -#if false - /// - /// timer x update orario indicato - /// - /// - /// - void timerClock_Tick(object sender, EventArgs e) + else { - DateTime adesso = DateTime.Now; - lblData.Text = string.Format("{0:ddd} {0:dd/MM/yyyy}", adesso); - lblRTC.Text = string.Format("{0:HH:mm}", adesso); - } -#endif - /// - /// verifica IP della postazione chiamante, se non è tra quelli permessi (o non è indicato "*") rimanda a pagina precedente... - /// - private void chekIpPostazione() - { - // recupero IP - string IPv4 = Request.UserHostName; - // controllo se IP locale = approvata... - if (!memLayer.ML.confReadString("ipv4StazBCode").Contains(IPv4) && memLayer.ML.confReadString("ipv4StazBCode") != "*") - { - Response.Redirect("~/Default.aspx"); - } + btnEntrata.CssClass = "btnStd"; + btnUscita.CssClass = "btnPreferred"; + tipoTimb = "USCITA"; } - /// - /// allo scadere del timer controllo countdown! - /// - /// - /// - void timerConf_Tick(object sender, EventArgs e) - { - contatorePag = 0; - if (countDown > 1) - { - countDown = countDown - 1; - lblCountDown.Text = countDown.ToString(); - txtBarcode.Focus(); - } - else - { - // salvo operazione di default! - registraTimbratura(nextIsEntrata); - // reset visualizzazione - setCtrlState(false); - timerConf.Enabled = false; - // reset valori - Response.Redirect(paginaCorrente); - } - } - /// - /// imposta lo stato visibile dei controlli - /// - /// - private void setCtrlState(bool visibile) - { - pnlTimer.Visible = visibile; - //imgRun.Visible = visibile; - if (DataProxy.idxDipendente > 0) - { - grView.Visible = true; - } - else - { - grView.Visible = visibile; - } - } - /// - /// verifica in che stato debbano essere i buttons (se barcode utente valido) - /// - private void checkButtons() - { - // controllo se il prox comando DOVREBBE essere entrata o uscita - nextIsEntrata = true; - // controllo dipendente - if (DataProxy.idxDipendente > 0) - { - // ricavo ultima timbratura.. - nextIsEntrata = timbratrice.nextIsEntrata(DataProxy.idxDipendente); - string tipoTimb = "uscita"; - // di conseguenza cambio abilitazione ad un buttons - if (nextIsEntrata) - { - btnEntrata.CssClass = "btnPreferred"; - btnUscita.CssClass = "btnStd"; - tipoTimb = "ENTRATA"; - } - else - { - btnEntrata.CssClass = "btnStd"; - btnUscita.CssClass = "btnPreferred"; - tipoTimb = "USCITA"; - } - lblNextTimbr.Text = string.Format("Allo scadere del timer verrà registrata una timbratura di {0}", tipoTimb); + lblNextTimbr.Text = string.Format("Allo scadere del timer verrà registrata una timbratura di {0}", tipoTimb); - } - else - { - btnEntrata.CssClass = "btnStd"; - btnUscita.CssClass = "btnStd"; - lblNextTimbr.Text = ""; - } - } + } + else + { + btnEntrata.CssClass = "btnStd"; + btnUscita.CssClass = "btnStd"; + lblNextTimbr.Text = ""; + } + } - /// - /// controlla se ci sia un barcode valido, tra: - /// - idxDipendente (INT, eventuale padding di zero...) - /// - matr dipendente - /// - cf dipendente - /// - private void checkBarcode() + /// + /// controlla se ci sia un barcode valido, tra: + /// - idxDipendente (INT, eventuale padding di zero...) + /// - matr dipendente + /// - cf dipendente + /// + private void checkBarcode() + { + if (barcodeIn != "") + { + // mostro i buttons enabled + btnEntrata.Enabled = true; + btnUscita.Enabled = true; + lblMessaggi.Text = "Barcode"; + + switch (tipoBCode) { - if (barcodeIn != "") - { - // mostro i buttons enabled - btnEntrata.Enabled = true; - btnUscita.Enabled = true; - lblMessaggi.Text = "Barcode"; - switch (tipoBCode) - { - case tipoCodiceBarcode.idxDipendente: - // calcolo idxOperatore... - int idxOper = 0; - try - { - idxOper = Convert.ToInt32(barcodeIn.ToLowerInvariant().Replace("idx", "")); - } - catch - { } - // controllo esista il codice idxDipendente scansionato - if (DataProxy.DP.taDipendenti.getByIdx(idxOper).Rows.Count == 0) - { - setCtrlState(false); - DataProxy.idxDipendente = 0; - orarioBCode = DateTime.Now; - timerConf.Enabled = false; - nextUsrMsg = "...waiting..."; - lblMessaggi.Text += " - codice non valido / non trovato."; - pnlAll.CssClass = "stileComandoKo"; - } - else - { - setCtrlState(true); - DataProxy.idxDipendente = idxOper; - orarioBCode = DateTime.Now; - DS_Applicazione.DipendentiRow rigaDip = DataProxy.DP.taDipendenti.getByIdx(idxOper)[0]; - nextUsrMsg = string.Format("{0} {1} - {2: HH:mm:ss}", rigaDip.Cognome, rigaDip.Nome, orarioBCode); - lblMessaggi.Text += " - impostato dipendente!"; - pnlAll.CssClass = "stileComandoOk"; - // faccio partire countdown - countDown = SteamWare.memLayer.ML.confReadInt("secTimeoutBCode"); - lblCountDown.Text = countDown.ToString(); - timerConf.Enabled = true; - } - txtBarcode.Focus(); - break; - case tipoCodiceBarcode.matrDipendente: - // fare!!! - txtBarcode.Focus(); - break; - case tipoCodiceBarcode.cfDipendente: - // fare!!! - txtBarcode.Focus(); - break; - case tipoCodiceBarcode.Comando: - // procedo SOLO se ho cod dipendente - if (DataProxy.DP.taDipendenti.getByIdx(DataProxy.idxDipendente).Rows.Count > 0) - { - timerConf.Enabled = false; - setCtrlState(false); - } - nextUsrMsg = "...waiting..."; - // controlla se sia entra/esci (IN/OUT) - if (barcodeIn.ToUpperInvariant() == "CMDIN") - { - // registro ingresso! - registraTimbratura(true); - Response.Redirect(paginaCorrente); - } - else if (barcodeIn.ToUpperInvariant() == "CMDOUT") - { - // registro uscita! - registraTimbratura(false); - Response.Redirect(paginaCorrente); - } - //else if (barcodeIn.ToUpperInvariant() == "CMD") - //{ - // Response.Redirect(paginaCorrente); - //} - //DataProxy.idxDipendente = -1; - txtBarcode.Focus(); - break; - default: - txtBarcode.Focus(); - break; - } - barcodeIn = ""; - } - else - { - lblMessaggi.Text = "...attesa barcode..."; - } - grView.DataBind(); - checkButtons(); - txtBarcode.Focus(); - } - - /// - /// valore barcode - /// - public string barcodeIn - { - get - { - return txtBarcode.Text.Trim(); - } - set - { - txtBarcode.Text = value; - } - } - /// - /// salvo entrata - /// - /// - /// - protected void btnEntrata_Click(object sender, EventArgs e) - { - // salvo entrata... - registraTimbratura(true); - Response.Redirect(paginaCorrente); - } - /// - /// salvo uscita - /// - /// - /// - protected void btnUscita_Click(object sender, EventArgs e) - { - // salvo uscita - registraTimbratura(false); - Response.Redirect(paginaCorrente); - } - /// - /// registro timbratura - /// - /// - /// - private void registraTimbratura(bool isEntrata) - { - // salvo evento entrata... - string IPv4 = Request.UserHostName; - // auto-approvazione da web.config - bool approvata = memLayer.ML.confReadBool("barcodeAutoApprove"); - if (DataProxy.idxDipendente > 0) - { - string CognomeNome = ""; - if (memLayer.ML.confReadBool("showNameAfterCmd")) - { - CognomeNome = DataProxy.DP.CognomeNomeByIdx(DataProxy.idxDipendente); - } - if (nextIsEntrata) - { - nextUsrMsg = string.Format("{1} ENTRATA {0:HH:mm:ss}", orarioBCode, CognomeNome); - } - else - { - nextUsrMsg = string.Format("{1} USCITA {0:HH:mm:ss}", orarioBCode, CognomeNome); - } - timbratrice.registraTimbratura(DataProxy.idxDipendente, orarioBCode, isEntrata, IPv4, "Web", approvata); - //aggiorno timbrature visualizzate - setButtons(); - grView.DataBind(); - } - else - { - lblMessaggi.Text = "IdxDipendente non trovato! timbratura impossibile"; - pnlAll.CssClass = "stileComandoND"; - } - } - /// - /// imposta i buttons secondo i valori in sessione... - /// - private void setButtons() - { - // mostrare e abilitare secondo condizioni al contorno - } - /// - /// decodifica il tipo barcode acquisito - /// - public tipoCodiceBarcode tipoBCode - { - get - { - tipoCodiceBarcode answ = tipoCodiceBarcode.ND; - // controllo non si tratti di un comando... - string preCmd = memLayer.ML.confReadString("prefComandi"); - if (barcodeIn.StartsWith(preCmd, StringComparison.InvariantCultureIgnoreCase)) - { - answ = tipoCodiceBarcode.Comando; - } - // controllo se sia un codice "idx" - else if (barcodeIn.StartsWith("idx", StringComparison.InvariantCultureIgnoreCase)) - { - answ = tipoCodiceBarcode.idxDipendente; - } - // controllo se sia un codice "matr" - else if (barcodeIn.StartsWith("matr", StringComparison.InvariantCultureIgnoreCase)) - { - answ = tipoCodiceBarcode.matrDipendente; - } - // controllo se sia un codice "cf" - else if (barcodeIn.StartsWith("cf", StringComparison.InvariantCultureIgnoreCase)) - { - answ = tipoCodiceBarcode.cfDipendente; - } - return answ; - } - } - /// - /// inverte valore booleano - /// - /// - /// - public bool invBool(object valore) - { - bool answ = true; + case tipoCodiceBarcode.idxDipendente: + // calcolo idxOperatore... + int idxOper = 0; try { - answ = !Convert.ToBoolean(valore); + idxOper = Convert.ToInt32(barcodeIn.ToLowerInvariant().Replace("idx", "")); } catch { } - return answ; - } - /// - /// evento cambio testo - /// - /// - /// - protected void txtBarcode_TextChanged(object sender, EventArgs e) - { - // solo se ho ALMENO 3 char... - if (barcodeIn.Length >= 3) + // controllo esista il codice idxDipendente scansionato + if (DataProxy.DP.taDipendenti.getByIdx(idxOper).Rows.Count == 0) { - contatorePag = 0; - checkBarcode(); + setCtrlState(false); + DataProxy.idxDipendente = 0; + orarioBCode = DateTime.Now; + timerConf.Enabled = false; + nextUsrMsg = "...waiting..."; + lblMessaggi.Text += " - codice non valido / non trovato."; + pnlAll.CssClass = "stileComandoKo"; } - } - - /// - /// variabile che conta numero di refresh parziali prima di fare reload completo - /// - protected int contatorePag - { - get + else { - return memLayer.ML.IntSessionObj("numChiamatePaginaBCode"); + setCtrlState(true); + DataProxy.idxDipendente = idxOper; + orarioBCode = DateTime.Now; + DS_Applicazione.DipendentiRow rigaDip = DataProxy.DP.taDipendenti.getByIdx(idxOper)[0]; + nextUsrMsg = string.Format("{0} {1} - {2: HH:mm:ss}", rigaDip.Cognome, rigaDip.Nome, orarioBCode); + lblMessaggi.Text += " - impostato dipendente!"; + pnlAll.CssClass = "stileComandoOk"; + // faccio partire countdown + countDown = SteamWare.memLayer.ML.confReadInt("secTimeoutBCode"); + lblCountDown.Text = countDown.ToString(); + timerConf.Enabled = true; } - set + txtBarcode.Focus(); + break; + case tipoCodiceBarcode.matrDipendente: + // fare!!! + txtBarcode.Focus(); + break; + case tipoCodiceBarcode.cfDipendente: + // fare!!! + txtBarcode.Focus(); + break; + case tipoCodiceBarcode.Comando: + // procedo SOLO se ho cod dipendente + if (DataProxy.DP.taDipendenti.getByIdx(DataProxy.idxDipendente).Rows.Count > 0) { - memLayer.ML.setSessionVal("numChiamatePaginaBCode", value); + timerConf.Enabled = false; + setCtrlState(false); } + nextUsrMsg = "...waiting..."; + // controlla se sia entra/esci (IN/OUT) + if (barcodeIn.ToUpperInvariant() == "CMDIN") + { + // registro ingresso! + registraTimbratura(true); + Response.Redirect(paginaCorrente); + } + else if (barcodeIn.ToUpperInvariant() == "CMDOUT") + { + // registro uscita! + registraTimbratura(false); + Response.Redirect(paginaCorrente); + } + //else if (barcodeIn.ToUpperInvariant() == "CMD") + //{ + // Response.Redirect(paginaCorrente); + //} + //DataProxy.idxDipendente = -1; + txtBarcode.Focus(); + break; + default: + txtBarcode.Focus(); + break; } - + barcodeIn = ""; + } + else + { + lblMessaggi.Text = "...attesa barcode..."; + } + grView.DataBind(); + checkButtons(); + txtBarcode.Focus(); } + + /// + /// valore barcode + /// + public string barcodeIn + { + get + { + return txtBarcode.Text.Trim(); + } + set + { + txtBarcode.Text = value; + } + } + /// + /// salvo entrata + /// + /// + /// + protected void btnEntrata_Click(object sender, EventArgs e) + { + // salvo entrata... + registraTimbratura(true); + Response.Redirect(paginaCorrente); + } + /// + /// salvo uscita + /// + /// + /// + protected void btnUscita_Click(object sender, EventArgs e) + { + // salvo uscita + registraTimbratura(false); + Response.Redirect(paginaCorrente); + } + /// + /// registro timbratura + /// + /// + /// + private void registraTimbratura(bool isEntrata) + { + // salvo evento entrata... + string IPv4 = Request.UserHostName; + // auto-approvazione da web.config + bool approvata = memLayer.ML.confReadBool("barcodeAutoApprove"); + if (DataProxy.idxDipendente > 0) + { + string CognomeNome = ""; + if (memLayer.ML.confReadBool("showNameAfterCmd")) + { + CognomeNome = DataProxy.DP.CognomeNomeByIdx(DataProxy.idxDipendente); + } + if (nextIsEntrata) + { + nextUsrMsg = string.Format("{1} ENTRATA {0:HH:mm:ss}", orarioBCode, CognomeNome); + } + else + { + nextUsrMsg = string.Format("{1} USCITA {0:HH:mm:ss}", orarioBCode, CognomeNome); + } + timbratrice.registraTimbratura(DataProxy.idxDipendente, orarioBCode, isEntrata, IPv4, "Web", approvata); + //aggiorno timbrature visualizzate + setButtons(); + grView.DataBind(); + } + else + { + lblMessaggi.Text = "IdxDipendente non trovato! timbratura impossibile"; + pnlAll.CssClass = "stileComandoND"; + } + } + /// + /// imposta i buttons secondo i valori in sessione... + /// + private void setButtons() + { + // mostrare e abilitare secondo condizioni al contorno + } + /// + /// decodifica il tipo barcode acquisito + /// + public tipoCodiceBarcode tipoBCode + { + get + { + tipoCodiceBarcode answ = tipoCodiceBarcode.ND; + // controllo non si tratti di un comando... + string preCmd = memLayer.ML.confReadString("prefComandi"); + if (barcodeIn.StartsWith(preCmd, StringComparison.InvariantCultureIgnoreCase)) + { + answ = tipoCodiceBarcode.Comando; + } + // controllo se sia un codice "idx" + else if (barcodeIn.StartsWith("idx", StringComparison.InvariantCultureIgnoreCase)) + { + answ = tipoCodiceBarcode.idxDipendente; + } + // controllo se sia un codice "matr" + else if (barcodeIn.StartsWith("matr", StringComparison.InvariantCultureIgnoreCase)) + { + answ = tipoCodiceBarcode.matrDipendente; + } + // controllo se sia un codice "cf" + else if (barcodeIn.StartsWith("cf", StringComparison.InvariantCultureIgnoreCase)) + { + answ = tipoCodiceBarcode.cfDipendente; + } + return answ; + } + } + /// + /// inverte valore booleano + /// + /// + /// + public bool invBool(object valore) + { + bool answ = true; + try + { + answ = !Convert.ToBoolean(valore); + } + catch + { } + return answ; + } + /// + /// evento cambio testo + /// + /// + /// + protected void txtBarcode_TextChanged(object sender, EventArgs e) + { + // solo se ho ALMENO 3 char... + if (barcodeIn.Length >= 3) + { + contatorePag = 0; + checkBarcode(); + } + } + + /// + /// variabile che conta numero di refresh parziali prima di fare reload completo + /// + protected int contatorePag + { + get + { + return memLayer.ML.IntSessionObj("numChiamatePaginaBCode"); + } + set + { + memLayer.ML.setSessionVal("numChiamatePaginaBCode", value); + } + } + + } } \ No newline at end of file diff --git a/GPW_Barcode/WebUserControls/mod_bCodeTimb.ascx.designer.cs b/GPW_Barcode/WebUserControls/mod_bCodeTimb.ascx.designer.cs index ffa68fb..17e1597 100644 --- a/GPW_Barcode/WebUserControls/mod_bCodeTimb.ascx.designer.cs +++ b/GPW_Barcode/WebUserControls/mod_bCodeTimb.ascx.designer.cs @@ -1,195 +1,197 @@ //------------------------------------------------------------------------------ -// -// 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. +// //------------------------------------------------------------------------------ -namespace GPW.WebUserControls { - - - public partial class mod_bCodeTimb { - - /// - /// pnlAll control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel pnlAll; - - /// - /// lblPostazione control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblPostazione; - - /// - /// lblPrinter control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblPrinter; - - /// - /// lblCurrentPage control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblCurrentPage; - - /// - /// hlMenu control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.HyperLink hlMenu; - - /// - /// lblDipendenteAttivo control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblDipendenteAttivo; - - /// - /// lblMessaggi control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblMessaggi; - - /// - /// pnlBtnIn control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel pnlBtnIn; - - /// - /// btnEntrata control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button btnEntrata; - - /// - /// PaneOut control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel PaneOut; - - /// - /// btnUscita control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button btnUscita; - - /// - /// lblBarcode control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblBarcode; - - /// - /// txtBarcode control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.TextBox txtBarcode; - - /// - /// grView control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.GridView grView; - - /// - /// ods control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.ObjectDataSource ods; - - /// - /// UpdatePanel1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.UpdatePanel UpdatePanel1; - - /// - /// pnlTimer control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel pnlTimer; - - /// - /// lblNextTimbr control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblNextTimbr; - - /// - /// lblCountDown control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblCountDown; - - /// - /// timerConf control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.Timer timerConf; - } +namespace GPW.WebUserControls +{ + + + public partial class mod_bCodeTimb + { + + /// + /// Controllo pnlAll. + /// + /// + /// 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.Panel pnlAll; + + /// + /// Controllo lblPostazione. + /// + /// + /// 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 lblPostazione; + + /// + /// Controllo lblPrinter. + /// + /// + /// 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 lblPrinter; + + /// + /// Controllo lblCurrentPage. + /// + /// + /// 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 lblCurrentPage; + + /// + /// Controllo hlMenu. + /// + /// + /// 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.HyperLink hlMenu; + + /// + /// Controllo lblDipendenteAttivo. + /// + /// + /// 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 lblDipendenteAttivo; + + /// + /// Controllo lblMessaggi. + /// + /// + /// 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 lblMessaggi; + + /// + /// Controllo pnlBtnIn. + /// + /// + /// 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.Panel pnlBtnIn; + + /// + /// Controllo btnEntrata. + /// + /// + /// 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.Button btnEntrata; + + /// + /// Controllo PaneOut. + /// + /// + /// 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.Panel PaneOut; + + /// + /// Controllo btnUscita. + /// + /// + /// 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.Button btnUscita; + + /// + /// Controllo lblBarcode. + /// + /// + /// 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 lblBarcode; + + /// + /// Controllo txtBarcode. + /// + /// + /// 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.TextBox txtBarcode; + + /// + /// Controllo grView. + /// + /// + /// 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.GridView grView; + + /// + /// Controllo ods. + /// + /// + /// 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.ObjectDataSource ods; + + /// + /// Controllo UpdatePanel1. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::System.Web.UI.UpdatePanel UpdatePanel1; + + /// + /// Controllo pnlTimer. + /// + /// + /// 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.Panel pnlTimer; + + /// + /// Controllo lblNextTimbr. + /// + /// + /// 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 lblNextTimbr; + + /// + /// Controllo lblCountDown. + /// + /// + /// 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 lblCountDown; + + /// + /// Controllo timerConf. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::System.Web.UI.Timer timerConf; + } } diff --git a/GPW_Data/packages.config b/GPW_Data/packages.config new file mode 100644 index 0000000..7c08031 --- /dev/null +++ b/GPW_Data/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/GPW_Data/utils.cs b/GPW_Data/utils.cs index 4a41dd6..7849d6e 100644 --- a/GPW_Data/utils.cs +++ b/GPW_Data/utils.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using Newtonsoft.Json; using SteamWare; namespace GPW_data @@ -13,23 +14,43 @@ namespace GPW_data /// protected utils() { - setupElencoClienti(); +#if false + setupElencoClienti(); +#endif } +#if false /// /// setup delle tabella elencoClienti /// protected void setupElencoClienti() { - if (memLayer.ML.isInCacheObject("elencoClienti")) + string redKey = memLayer.ML.redHash("elencoClienti"); + try { - elencoClienti = (Dictionary)memLayer.ML.objCacheObj("elencoClienti"); + string rawData = memLayer.ML.getRSV(redKey); + if (string.IsNullOrEmpty(rawData)) + { + + } + else + { + elencoClienti = ricaricaElencoClienti(); + + } + if (memLayer.ML.isInCacheObject("elencoClienti")) + { + elencoClienti = (Dictionary)memLayer.ML.objCacheObj("elencoClienti"); + } + else + { + elencoClienti = ricaricaElencoClienti(); + memLayer.ML.setCacheVal("elencoClienti", elencoClienti, false); + } } - else - { - elencoClienti = ricaricaElencoClienti(); - memLayer.ML.setCacheVal("elencoClienti", elencoClienti, false); - } - } + catch + { } + } +#endif /// /// restituisce elenco clienti trasformato in dictionary /// @@ -73,7 +94,36 @@ namespace GPW_data /// /// oggetto elenco clienti organizzato come dizionario con chiave idxCliente e valore la ragione sociale /// - public Dictionary elencoClienti; + 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 /// diff --git a/GPW_data/App.config b/GPW_data/App.config index 5a84d9e..3fa543e 100644 --- a/GPW_data/App.config +++ b/GPW_data/App.config @@ -21,7 +21,7 @@ - + @@ -31,6 +31,22 @@ + + + + + + + + + + + + + + + + diff --git a/GPW_data/GPW_data.csproj b/GPW_data/GPW_data.csproj index ca43fcb..da8c0f0 100644 --- a/GPW_data/GPW_data.csproj +++ b/GPW_data/GPW_data.csproj @@ -34,6 +34,9 @@ false + + ..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll + @@ -109,6 +112,7 @@ DS_Utility.xsd + SettingsSingleFileGenerator Settings.Designer.cs diff --git a/Jenkinsfile b/Jenkinsfile index 0ae2fa7..136ca36 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,7 +14,7 @@ pipeline { /* calcolo numero versione... diverso x branch MASTER/DEVELOP */ script { - withEnv(['NEXT_BUILD_NUMBER=4091']) { + withEnv(['NEXT_BUILD_NUMBER=4093']) { // env.versionNumber = VersionNumber(versionNumberString : '2.6.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true) env.versionNumber = VersionNumber(versionNumberString : '2.6.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}') env.APP_NAME = 'GPW'