diff --git a/GPW_Admin/BasePage.cs b/GPW_Admin/BasePage.cs new file mode 100644 index 0000000..7955bbf --- /dev/null +++ b/GPW_Admin/BasePage.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using SteamWare; + +namespace GPW_Admin +{ + public class BasePage : System.Web.UI.Page + { + void Page_Init(object sender, EventArgs e) + { + ViewStateUserKey = Session.SessionID; + } + + /// + /// effettua traduzione del lemma + /// + /// + /// + public string traduci(string lemma) + { + return user_std.UtSn.Traduci(lemma); + } + } +} \ No newline at end of file diff --git a/GPW_Admin/BaseUserControl.cs b/GPW_Admin/BaseUserControl.cs index 017983b..a43a0d4 100644 --- a/GPW_Admin/BaseUserControl.cs +++ b/GPW_Admin/BaseUserControl.cs @@ -31,9 +31,12 @@ namespace GPW_Admin public bool gtZero(object _valore) { bool answ = false; + if(_valore!=null) + { decimal valore = 0; - decimal.TryParse(_valore.ToString(), out valore); + _ = decimal.TryParse(_valore.ToString(), out valore); answ = valore > 0; + } return answ; } /// @@ -45,9 +48,12 @@ namespace GPW_Admin public bool gtVal(object _valore, double maxVal) { bool answ = false; - double valore = 0; - double.TryParse(_valore.ToString(), out valore); - answ = valore > maxVal; + if (_valore != null) + { + double valore = 0; + _ = double.TryParse(_valore.ToString(), out valore); + answ = valore > maxVal; + } return answ; } /// @@ -59,9 +65,12 @@ namespace GPW_Admin public bool ltVal(object _valore, double minVal) { bool answ = false; - double valore = 0; - double.TryParse(_valore.ToString(), out valore); - answ = valore < minVal; + if (_valore != null) + { + double valore = 0; + _ = double.TryParse(_valore.ToString(), out valore); + answ = valore < minVal; + } return answ; } /// @@ -74,9 +83,12 @@ namespace GPW_Admin public bool betweenVal(object _valore, double minVal, double maxVal) { bool answ = false; - double valore = 0; - double.TryParse(_valore.ToString(), out valore); - answ = valore <= maxVal && valore >= minVal; + if (_valore != null) + { + double valore = 0; + _ = double.TryParse(_valore.ToString(), out valore); + answ = valore <= maxVal && valore >= minVal; + } return answ; } } diff --git a/GPW_Admin/Default.aspx b/GPW_Admin/Default.aspx index f238aa5..adbbe43 100644 --- a/GPW_Admin/Default.aspx +++ b/GPW_Admin/Default.aspx @@ -1,4 +1,4 @@ -<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="GPW.AdminArea.Default" %> +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="GPW_Admin.Default" %> diff --git a/GPW_Admin/Default.aspx.cs b/GPW_Admin/Default.aspx.cs index 2f748f4..4ddb39e 100644 --- a/GPW_Admin/Default.aspx.cs +++ b/GPW_Admin/Default.aspx.cs @@ -1,9 +1,9 @@ using SteamWare; using System; -namespace GPW.AdminArea +namespace GPW_Admin { - public partial class Default : System.Web.UI.Page + public partial class Default : BasePage { protected void Page_Load(object sender, EventArgs e) { diff --git a/GPW_Admin/Default.aspx.designer.cs b/GPW_Admin/Default.aspx.designer.cs index 6845710..d30ace5 100644 --- a/GPW_Admin/Default.aspx.designer.cs +++ b/GPW_Admin/Default.aspx.designer.cs @@ -1,13 +1,13 @@ //------------------------------------------------------------------------------ -// -// 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.AdminArea +namespace GPW_Admin { @@ -15,11 +15,11 @@ namespace GPW.AdminArea { /// - /// form1 control. + /// Controllo form1. /// /// - /// 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.HtmlControls.HtmlForm form1; } diff --git a/GPW_Admin/ExportCommesse.aspx.cs b/GPW_Admin/ExportCommesse.aspx.cs index aad17ef..d145187 100644 --- a/GPW_Admin/ExportCommesse.aspx.cs +++ b/GPW_Admin/ExportCommesse.aspx.cs @@ -10,7 +10,7 @@ using SteamWare; namespace GPW_Admin { - public partial class ExportCommesse : System.Web.UI.Page + public partial class ExportCommesse : BasePage { public override void VerifyRenderingInServerForm(Control control) { @@ -72,8 +72,11 @@ namespace GPW_Admin Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.ContentType = "application/vnd.xls"; System.IO.StringWriter stringWrite = new System.IO.StringWriter(); - System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite); - grView.RenderControl(htmlWrite); + using ( + HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite)) + { + grView.RenderControl(htmlWrite); + } Response.Write(stringWrite.ToString()); Response.End(); } @@ -101,15 +104,6 @@ namespace GPW_Admin } } /// - /// effettua traduzione del lemma - /// - /// - /// - public string traduci(string lemma) - { - return user_std.UtSn.Traduci(lemma); - } - /// /// restituisce info se utente sia admin (vedi web.config x ruolo...) /// public bool userIsAdmin diff --git a/GPW_Admin/ExportTimbZucchetti.aspx.cs b/GPW_Admin/ExportTimbZucchetti.aspx.cs index e766b7f..6d3d3ac 100644 --- a/GPW_Admin/ExportTimbZucchetti.aspx.cs +++ b/GPW_Admin/ExportTimbZucchetti.aspx.cs @@ -11,7 +11,7 @@ using SteamWare; namespace GPW_Admin { - public partial class ExportTimbZucchetti : System.Web.UI.Page + public partial class ExportTimbZucchetti : BasePage { protected DateTime inizio; protected DateTime fine; @@ -41,7 +41,7 @@ namespace GPW_Admin idxDipendente = memLayer.ML.IntSessionObj("idxDip_sel"); if (idxDipendente == -1) idxDipendente = 0; codTimbra = memLayer.ML.confReadString("codTimbra"); - if (codTimbra == "") + if (string.IsNullOrEmpty(codTimbra)) { codTimbra = "90"; // timbratrice 90: da web.config } diff --git a/GPW_Admin/GPW_Admin.csproj b/GPW_Admin/GPW_Admin.csproj index c5e51f4..efb4439 100644 --- a/GPW_Admin/GPW_Admin.csproj +++ b/GPW_Admin/GPW_Admin.csproj @@ -29,7 +29,7 @@ - 3.7 + 3.9 true @@ -659,6 +659,9 @@ + + ASPXCodeBehind + ASPXCodeBehind @@ -728,6 +731,7 @@ Global.asax + infoPage.aspx ASPXCodeBehind @@ -799,7 +803,6 @@ unauthorized.aspx - AjaxSearch.master ASPXCodeBehind diff --git a/GPW_Admin/GlobalSuppressions.cs b/GPW_Admin/GlobalSuppressions.cs new file mode 100644 index 0000000..76cd624 --- /dev/null +++ b/GPW_Admin/GlobalSuppressions.cs @@ -0,0 +1,15 @@ +// This file is used by Code Analysis to maintain SuppressMessage +// attributes that are applied to this project. +// Project-level suppressions either have no target or are given +// a specific target and scoped to a namespace, type, member, etc. + +using System.Diagnostics.CodeAnalysis; + +[assembly: SuppressMessage("Design", "CA1062:Convalidare gli argomenti di metodi pubblici", Justification = "", Scope = "member", Target = "~M:GPW_Admin.BundleConfig.RegisterBundles(System.Web.Optimization.BundleCollection)")] +[assembly: SuppressMessage("Design", "CA1052:I tipi che contengono membri static devono Static o NotInheritable", Justification = "", Scope = "type", Target = "~T:GPW_Admin.BundleConfig")] +[assembly: SuppressMessage("Naming", "CA1716:Gli identificatori non devono corrispondere a parole chiave", Justification = "", Scope = "type", Target = "~T:GPW_Admin.Default")] +[assembly: SuppressMessage("Design", "CA1051:Non dichiarare campi di istanza visibili", Justification = "", Scope = "member", Target = "~F:GPW_Admin.ExportTimbZucchetti.inizio")] +[assembly: SuppressMessage("Design", "CA1051:Non dichiarare campi di istanza visibili", Justification = "", Scope = "member", Target = "~F:GPW_Admin.ExportTimbZucchetti.fine")] +[assembly: SuppressMessage("Design", "CA1051:Non dichiarare campi di istanza visibili", Justification = "", Scope = "member", Target = "~F:GPW_Admin.ExportTimbZucchetti.idxDipendente")] +[assembly: SuppressMessage("Naming", "CA1716:Gli identificatori non devono corrispondere a parole chiave", Justification = "", Scope = "type", Target = "~T:GPW_Admin.Global")] +[assembly: SuppressMessage("Globalization", "CA1303:Non passare valori letterali come parametri localizzati", Justification = "", Scope = "member", Target = "~M:GPW_Admin.infoPage.setupPanels(System.Boolean)")] diff --git a/GPW_Admin/WS/autoComplete.asmx.cs b/GPW_Admin/WS/autoComplete.asmx.cs index 437658d..b3f21e4 100644 --- a/GPW_Admin/WS/autoComplete.asmx.cs +++ b/GPW_Admin/WS/autoComplete.asmx.cs @@ -31,8 +31,8 @@ namespace GPW.WS [WebMethod] - public CascadingDropDownNameValue[] GetClienti(string knownCategoryValues, string category) - { + public CascadingDropDownNameValue[] GetClienti(string knownCategoryValues) + { if (knownCategoryValues is null) { throw new ArgumentNullException(nameof(knownCategoryValues)); @@ -50,8 +50,8 @@ namespace GPW.WS } [WebMethod] - public CascadingDropDownNameValue[] GetProgettiByCli(string knownCategoryValues, string category) - { + public CascadingDropDownNameValue[] GetProgettiByCli(string knownCategoryValues) + { StringDictionary kv = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues); int idxCliente; if (!kv.ContainsKey("clienti") || !Int32.TryParse(kv["clienti"], out idxCliente)) @@ -69,8 +69,8 @@ namespace GPW.WS return values.ToArray(); } [WebMethod] - public CascadingDropDownNameValue[] GetFasiByProgetti(string knownCategoryValues, string category) - { + public CascadingDropDownNameValue[] GetFasiByProgetti(string knownCategoryValues) + { StringDictionary kv = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues); int idxCliente; if (!kv.ContainsKey("clienti") || !Int32.TryParse(kv["clienti"], out idxCliente)) diff --git a/GPW_Admin/Web.config b/GPW_Admin/Web.config index d8df0ac..f9f39e7 100644 --- a/GPW_Admin/Web.config +++ b/GPW_Admin/Web.config @@ -49,9 +49,6 @@ - - - diff --git a/GPW_Admin/WebMasterPages/AjaxSimple.master b/GPW_Admin/WebMasterPages/AjaxSimple.master index 60574ee..f897ac5 100644 --- a/GPW_Admin/WebMasterPages/AjaxSimple.master +++ b/GPW_Admin/WebMasterPages/AjaxSimple.master @@ -26,8 +26,6 @@
- <%-- - --%>
diff --git a/GPW_Admin/WebUserControls/mod_adminClienti.ascx.cs b/GPW_Admin/WebUserControls/mod_adminClienti.ascx.cs index e9aead3..b4e3aae 100644 --- a/GPW_Admin/WebUserControls/mod_adminClienti.ascx.cs +++ b/GPW_Admin/WebUserControls/mod_adminClienti.ascx.cs @@ -140,8 +140,12 @@ namespace GPW_Admin.WebUserControls /// protected DataColumnCollection colonneObj() { - DS_Applicazione.AnagClientiDataTable tabella = new DS_Applicazione.AnagClientiDataTable(); - DataColumnCollection colonne = tabella.Columns; + DataColumnCollection colonne = null; + using ( + DS_Applicazione.AnagClientiDataTable tabella = new DS_Applicazione.AnagClientiDataTable()) + { + colonne = tabella.Columns; + } return colonne; } /// @@ -153,16 +157,12 @@ namespace GPW_Admin.WebUserControls { bool answ = true; // solo se ha diritti scrittura controllo - if (answ) + if (idxObj != null) { int trovati = 0; - // !!!FARE!!! -#if false - // controllo se ci siano tipo celle associate - trovati = MagClass.magazzino.taTipoCella.getByCodMag(memLayer.ML.StringSessionObj("CodCS"), idxObj.ToString()).Rows.Count; - // controllo se ci siano blocchi associati - trovati = trovati + MagClass.magazzino.taBlocchi.getByCodMag(memLayer.ML.StringSessionObj("CodCS"), idxObj.ToString()).Rows.Count; -#endif + int idxCli = 0; + _ = int.TryParse(idxObj.ToString(), out idxCli); + trovati = DataProxy.DP.taAP.getByIdxCli(idxCli, true, true).Rows.Count; // controllo se ci sono record correlati... if (trovati > 0) { @@ -189,51 +189,54 @@ namespace GPW_Admin.WebUserControls /// protected void recuperaFooter(object sender, ObjectDataSourceMethodEventArgs e) { - if (chkLicOk) + if (e != null) { - //recupero la riga footer... - DataColumnCollection colonne = colonneObj(); - string nomeCol; - string tipoColonna = ""; - foreach (DataColumn colonna in colonne) + if (chkLicOk) { - nomeCol = colonna.ColumnName; - // cerco un textbox o quello che sia... - if (grView.FooterRow.FindControl(string.Format("txt{0}", nomeCol)) != null) + //recupero la riga footer... + DataColumnCollection colonne = colonneObj(); + string nomeCol; + string tipoColonna = ""; + foreach (DataColumn colonna in colonne) { - tipoColonna = "textBox"; + nomeCol = colonna.ColumnName; + // cerco un textbox o quello che sia... + if (grView.FooterRow.FindControl(string.Format("txt{0}", nomeCol)) != null) + { + tipoColonna = "textBox"; + } + else if (grView.FooterRow.FindControl(string.Format("dl{0}", nomeCol)) != null) + { + tipoColonna = "dropDownList"; + } + else if (grView.FooterRow.FindControl(string.Format("chk{0}", nomeCol)) != null) + { + tipoColonna = "checkBox"; + } + // in base al tipo salvo negli inputparameters dell'ODS + switch (tipoColonna) + { + case "textBox": + e.InputParameters[nomeCol] = ((TextBox)grView.FooterRow.FindControl(string.Format("txt{0}", nomeCol))).Text; + break; + case "dropDownList": + e.InputParameters[nomeCol] = ((DropDownList)grView.FooterRow.FindControl(string.Format("dl{0}", nomeCol))).SelectedValue; + break; + case "checkBox": + e.InputParameters[nomeCol] = ((CheckBox)grView.FooterRow.FindControl(string.Format("chk{0}", nomeCol))).Checked; + break; + default: + break; + } + tipoColonna = ""; } - else if (grView.FooterRow.FindControl(string.Format("dl{0}", nomeCol)) != null) - { - tipoColonna = "dropDownList"; - } - else if (grView.FooterRow.FindControl(string.Format("chk{0}", nomeCol)) != null) - { - tipoColonna = "checkBox"; - } - // in base al tipo salvo negli inputparameters dell'ODS - switch (tipoColonna) - { - case "textBox": - e.InputParameters[nomeCol] = ((TextBox)grView.FooterRow.FindControl(string.Format("txt{0}", nomeCol))).Text; - break; - case "dropDownList": - e.InputParameters[nomeCol] = ((DropDownList)grView.FooterRow.FindControl(string.Format("dl{0}", nomeCol))).SelectedValue; - break; - case "checkBox": - e.InputParameters[nomeCol] = ((CheckBox)grView.FooterRow.FindControl(string.Format("chk{0}", nomeCol))).Checked; - break; - default: - break; - } - tipoColonna = ""; } - } - else - { - // annullo insert se licenze sforate... - e.Cancel = true; - grView.DataBind(); + else + { + // annullo insert se licenze sforate... + e.Cancel = true; + grView.DataBind(); + } } } /// @@ -245,10 +248,13 @@ namespace GPW_Admin.WebUserControls { if (!licenzeGPW.checkLicenze) { - // annullo insert se licenze sforate... - e.Cancel = true; - grView.EditIndex = -1; - grView.DataBind(); + if (e != null) + { + // annullo insert se licenze sforate... + e.Cancel = true; + grView.EditIndex = -1; + grView.DataBind(); + } } } diff --git a/GPW_Admin/WebUserControls/mod_adminDipendenti.ascx.cs b/GPW_Admin/WebUserControls/mod_adminDipendenti.ascx.cs index f6c0b18..05a048c 100644 --- a/GPW_Admin/WebUserControls/mod_adminDipendenti.ascx.cs +++ b/GPW_Admin/WebUserControls/mod_adminDipendenti.ascx.cs @@ -140,8 +140,11 @@ namespace GPW_Admin.WebUserControls /// protected DataColumnCollection colonneObj() { - DS_Applicazione.DipendentiDataTable tabella = new DS_Applicazione.DipendentiDataTable(); - DataColumnCollection colonne = tabella.Columns; + DataColumnCollection colonne = null; + using (DS_Applicazione.DipendentiDataTable tabella = new DS_Applicazione.DipendentiDataTable()) + { + colonne = tabella.Columns; + } return colonne; } /// @@ -153,16 +156,12 @@ namespace GPW_Admin.WebUserControls { bool answ = true; // solo se ha diritti scrittura controllo - if (answ) + if (idxObj != null) { int trovati = 0; - // !!!FARE!!! -#if false - // controllo se ci siano tipo celle associate - trovati = MagClass.magazzino.taTipoCella.getByCodMag(memLayer.ML.StringSessionObj("CodCS"), idxObj.ToString()).Rows.Count; - // controllo se ci siano blocchi associati - trovati = trovati + MagClass.magazzino.taBlocchi.getByCodMag(memLayer.ML.StringSessionObj("CodCS"), idxObj.ToString()).Rows.Count; -#endif + int idxDip = 0; + _ = int.TryParse(idxObj.ToString(), out idxDip); + trovati = DataProxy.DP.taTimb.getLastByDip(idxDip).Count; // controllo se ci sono record correlati... if (trovati > 0) { @@ -189,54 +188,57 @@ namespace GPW_Admin.WebUserControls /// protected void recuperaFooter(object sender, ObjectDataSourceMethodEventArgs e) { - if (chkLicOk) + if (e != null) { - //recupero la riga footer... - DataColumnCollection colonne = colonneObj(); - string nomeCol; - string tipoColonna = ""; - foreach (DataColumn colonna in colonne) + if (chkLicOk) { - nomeCol = colonna.ColumnName; - // cerco un textbox o quello che sia... - if (grView.FooterRow.FindControl(string.Format("txt{0}", nomeCol)) != null) + //recupero la riga footer... + DataColumnCollection colonne = colonneObj(); + string nomeCol; + string tipoColonna = ""; + foreach (DataColumn colonna in colonne) { - tipoColonna = "textBox"; + nomeCol = colonna.ColumnName; + // cerco un textbox o quello che sia... + if (grView.FooterRow.FindControl(string.Format("txt{0}", nomeCol)) != null) + { + tipoColonna = "textBox"; + } + else if (grView.FooterRow.FindControl(string.Format("dl{0}", nomeCol)) != null) + { + tipoColonna = "dropDownList"; + } + else if (grView.FooterRow.FindControl(string.Format("chk{0}", nomeCol)) != null) + { + tipoColonna = "checkBox"; + } + // in base al tipo salvo negli inputparameters dell'ODS + switch (tipoColonna) + { + case "textBox": + e.InputParameters[nomeCol] = ((TextBox)grView.FooterRow.FindControl(string.Format("txt{0}", nomeCol))).Text; + break; + case "dropDownList": + e.InputParameters[nomeCol] = ((DropDownList)grView.FooterRow.FindControl(string.Format("dl{0}", nomeCol))).SelectedValue; + break; + case "checkBox": + e.InputParameters[nomeCol] = ((CheckBox)grView.FooterRow.FindControl(string.Format("chk{0}", nomeCol))).Checked; + break; + default: + break; + } + tipoColonna = ""; } - else if (grView.FooterRow.FindControl(string.Format("dl{0}", nomeCol)) != null) - { - tipoColonna = "dropDownList"; - } - else if (grView.FooterRow.FindControl(string.Format("chk{0}", nomeCol)) != null) - { - tipoColonna = "checkBox"; - } - // in base al tipo salvo negli inputparameters dell'ODS - switch (tipoColonna) - { - case "textBox": - e.InputParameters[nomeCol] = ((TextBox)grView.FooterRow.FindControl(string.Format("txt{0}", nomeCol))).Text; - break; - case "dropDownList": - e.InputParameters[nomeCol] = ((DropDownList)grView.FooterRow.FindControl(string.Format("dl{0}", nomeCol))).SelectedValue; - break; - case "checkBox": - e.InputParameters[nomeCol] = ((CheckBox)grView.FooterRow.FindControl(string.Format("chk{0}", nomeCol))).Checked; - break; - default: - break; - } - tipoColonna = ""; + // attivo imposto a true! + e.InputParameters["attivo"] = "true"; + // sistemo calendario! + } + else + { + // annullo insert se licenze sforate... + e.Cancel = true; + grView.DataBind(); } - // attivo imposto a true! - e.InputParameters["attivo"] = "true"; - // sistemo calendario! - } - else - { - // annullo insert se licenze sforate... - e.Cancel = true; - grView.DataBind(); } } /// @@ -246,12 +248,15 @@ namespace GPW_Admin.WebUserControls /// protected void ods_Updating(object sender, ObjectDataSourceMethodEventArgs e) { - if (!licenzeGPW.checkLicenze) + if (e != null) { - // annullo insert se licenze sforate... - e.Cancel = true; - grView.EditIndex = -1; - grView.DataBind(); + if (!licenzeGPW.checkLicenze) + { + // annullo insert se licenze sforate... + e.Cancel = true; + grView.EditIndex = -1; + grView.DataBind(); + } } } diff --git a/GPW_Admin/WebUserControls/mod_autocomplete.ascx.cs b/GPW_Admin/WebUserControls/mod_autocomplete.ascx.cs index b357633..f87c8b6 100644 --- a/GPW_Admin/WebUserControls/mod_autocomplete.ascx.cs +++ b/GPW_Admin/WebUserControls/mod_autocomplete.ascx.cs @@ -61,7 +61,7 @@ namespace GPW_Admin.WebUserControls protected void txtSel_TextChanged(object sender, EventArgs e) { - if (txtSel.Text.Trim() == "") + if (string.IsNullOrEmpty(txtSel.Text.Trim())) { hiddenFieldID.Text = defaultVal; _valore = defaultVal; @@ -130,7 +130,7 @@ namespace GPW_Admin.WebUserControls { answ = txtSel.Text.Trim(); } - if (answ == "") + if (string.IsNullOrEmpty(answ)) { answ = txtSel.Text.Trim(); } diff --git a/GPW_Admin/WebUserControls/mod_dateTime.ascx.cs b/GPW_Admin/WebUserControls/mod_dateTime.ascx.cs index 7b70403..a3d318c 100644 --- a/GPW_Admin/WebUserControls/mod_dateTime.ascx.cs +++ b/GPW_Admin/WebUserControls/mod_dateTime.ascx.cs @@ -54,7 +54,7 @@ namespace GPW_Admin.WebUserControls /// protected void Page_Load(object sender, EventArgs e) { - if (!Page.IsPostBack)// || txtData.Text == "") + if (!Page.IsPostBack) { setInitVal(); valoreDateTime = dataOra; diff --git a/GPW_Admin/WebUserControls/mod_filtro.ascx.cs b/GPW_Admin/WebUserControls/mod_filtro.ascx.cs index 3b0598f..f0a1ad5 100644 --- a/GPW_Admin/WebUserControls/mod_filtro.ascx.cs +++ b/GPW_Admin/WebUserControls/mod_filtro.ascx.cs @@ -32,7 +32,7 @@ public partial class mod_filtro : ApplicationUserControl { get { - bool answ=false; + bool answ = false; try { memLayer.ML.isInSessionObject(string.Format("valFiltro_{0}", this.ID)); @@ -40,7 +40,7 @@ public partial class mod_filtro : ApplicationUserControl catch { } return answ; - } + } } protected bool _changeCheckEnabled = true; protected bool _changeCheckVisible = true; @@ -76,8 +76,8 @@ public partial class mod_filtro : ApplicationUserControl base.OnInit(e); if (!Page.IsPostBack) { - if (_showFiltered == "") _showFiltered = "mostraSoloSelez"; - if (_showAll == "") _showAll = "mostraTutti"; + if (string.IsNullOrEmpty(_showFiltered)) _showFiltered = "mostraSoloSelez"; + if (string.IsNullOrEmpty(_showAll)) _showAll = "mostraTutti"; } } @@ -304,7 +304,7 @@ public partial class mod_filtro : ApplicationUserControl chkFilt.Checked = true; } } - catch(Exception exc) + catch (Exception exc) { logger.lg.scriviLog(string.Format("Eccezione:{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION); dlFilt.SelectedIndex = 0; @@ -376,7 +376,7 @@ public partial class mod_filtro : ApplicationUserControl updateChkLbl(); } } - + /// /// oggetto ODS con cui popolare il selettore, VINCOLO abbia campi value(key) / label /// diff --git a/GPW_Admin/WebUserControls/mod_ricercaGenerica.ascx.cs b/GPW_Admin/WebUserControls/mod_ricercaGenerica.ascx.cs index c4917b9..957a3b0 100644 --- a/GPW_Admin/WebUserControls/mod_ricercaGenerica.ascx.cs +++ b/GPW_Admin/WebUserControls/mod_ricercaGenerica.ascx.cs @@ -64,7 +64,7 @@ public partial class mod_ricercaGenerica : ApplicationUserControl /// protected void salvaCerca() { - if (testoRicerca == "") + if (string.IsNullOrEmpty(testoRicerca)) { SteamWare.memLayer.ML.emptySessionVal("valoreCercato"); } diff --git a/GPW_Admin/approvTimbrature.aspx.cs b/GPW_Admin/approvTimbrature.aspx.cs index edd4d3d..d4bb211 100644 --- a/GPW_Admin/approvTimbrature.aspx.cs +++ b/GPW_Admin/approvTimbrature.aspx.cs @@ -7,7 +7,7 @@ using System.Web.UI.WebControls; namespace GPW_Admin { - public partial class approvTimbrature : System.Web.UI.Page + public partial class approvTimbrature : BasePage { protected void Page_Load(object sender, EventArgs e) { diff --git a/GPW_Admin/chLang.aspx.cs b/GPW_Admin/chLang.aspx.cs index 53a4564..b9ca0aa 100644 --- a/GPW_Admin/chLang.aspx.cs +++ b/GPW_Admin/chLang.aspx.cs @@ -7,7 +7,7 @@ using System.Web.UI.WebControls; namespace GPW_Admin { - public partial class chLang : System.Web.UI.Page + public partial class chLang : BasePage { protected void Page_Load(object sender, EventArgs e) { diff --git a/GPW_Admin/clienti.aspx.cs b/GPW_Admin/clienti.aspx.cs index 85e0105..538e43c 100644 --- a/GPW_Admin/clienti.aspx.cs +++ b/GPW_Admin/clienti.aspx.cs @@ -7,7 +7,7 @@ using System.Web.UI.WebControls; namespace GPW_Admin { - public partial class clienti : System.Web.UI.Page + public partial class clienti :BasePage { protected void Page_Load(object sender, EventArgs e) { diff --git a/GPW_Admin/dipendenti.aspx.cs b/GPW_Admin/dipendenti.aspx.cs index eb69f3d..08a7c6e 100644 --- a/GPW_Admin/dipendenti.aspx.cs +++ b/GPW_Admin/dipendenti.aspx.cs @@ -7,7 +7,7 @@ using System.Web.UI.WebControls; namespace GPW_Admin { - public partial class dipendenti : System.Web.UI.Page + public partial class dipendenti :BasePage { protected void Page_Load(object sender, EventArgs e) { diff --git a/GPW_Admin/fasi.aspx.cs b/GPW_Admin/fasi.aspx.cs index 776e658..86647fa 100644 --- a/GPW_Admin/fasi.aspx.cs +++ b/GPW_Admin/fasi.aspx.cs @@ -8,7 +8,7 @@ using SteamWare; namespace GPW_Admin { - public partial class fasi : System.Web.UI.Page + public partial class fasi :BasePage { protected void Page_Load(object sender, EventArgs e) { diff --git a/GPW_Admin/gestCalendario.aspx.cs b/GPW_Admin/gestCalendario.aspx.cs index cbe9721..9c12546 100644 --- a/GPW_Admin/gestCalendario.aspx.cs +++ b/GPW_Admin/gestCalendario.aspx.cs @@ -7,7 +7,7 @@ using System.Web.UI.WebControls; namespace GPW_Admin { - public partial class gestCalendario : System.Web.UI.Page + public partial class gestCalendario :BasePage { protected void Page_Load(object sender, EventArgs e) { diff --git a/GPW_Admin/gestOrario.aspx.cs b/GPW_Admin/gestOrario.aspx.cs index c1498aa..f0792c1 100644 --- a/GPW_Admin/gestOrario.aspx.cs +++ b/GPW_Admin/gestOrario.aspx.cs @@ -7,7 +7,7 @@ using System.Web.UI.WebControls; namespace GPW_Admin { - public partial class gestOrario : System.Web.UI.Page + public partial class gestOrario :BasePage { protected void Page_Load(object sender, EventArgs e) { diff --git a/GPW_Admin/infoPage.aspx b/GPW_Admin/infoPage.aspx index 6481362..190e7d4 100644 --- a/GPW_Admin/infoPage.aspx +++ b/GPW_Admin/infoPage.aspx @@ -1,5 +1,5 @@ <%@ Page Title="GPW-ADM"Language="C#" MasterPageFile="~/WebMasterPages/AjaxSimpleFull.master" AutoEventWireup="true" CodeBehind="infoPage.aspx.cs" - Inherits="GPW.infoPage" %> + Inherits="GPW_Admin.infoPage" %>
diff --git a/GPW_Admin/infoPage.aspx.cs b/GPW_Admin/infoPage.aspx.cs index 1cf83de..14bbe3f 100644 --- a/GPW_Admin/infoPage.aspx.cs +++ b/GPW_Admin/infoPage.aspx.cs @@ -6,9 +6,9 @@ using System.Web.UI; using System.Web.UI.WebControls; using GPW_data; -namespace GPW +namespace GPW_Admin { - public partial class infoPage : System.Web.UI.Page + public partial class infoPage : BasePage { protected void Page_Load(object sender, EventArgs e) { diff --git a/GPW_Admin/infoPage.aspx.designer.cs b/GPW_Admin/infoPage.aspx.designer.cs index ff5de0c..2ce59e1 100644 --- a/GPW_Admin/infoPage.aspx.designer.cs +++ b/GPW_Admin/infoPage.aspx.designer.cs @@ -1,68 +1,70 @@ //------------------------------------------------------------------------------ -// -// 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 { - - - public partial class infoPage { - +namespace GPW_Admin +{ + + + public partial class infoPage + { + /// - /// pnlCheck control. + /// Controllo pnlCheck. /// /// - /// 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.Panel pnlCheck; - + /// - /// lblInstallation control. + /// Controllo lblInstallation. /// /// - /// 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 lblInstallation; - + /// - /// lblApplication control. + /// Controllo lblApplication. /// /// - /// 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 lblApplication; - + /// - /// lblNumLic control. + /// Controllo lblNumLic. /// /// - /// 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 lblNumLic; - + /// - /// lblExpiryDate control. + /// Controllo lblExpiryDate. /// /// - /// 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 lblExpiryDate; - + /// - /// lblAuthKey control. + /// Controllo lblAuthKey. /// /// - /// 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 lblAuthKey; } diff --git a/GPW_Admin/login.aspx.cs b/GPW_Admin/login.aspx.cs index f6a268e..4c7616a 100644 --- a/GPW_Admin/login.aspx.cs +++ b/GPW_Admin/login.aspx.cs @@ -7,14 +7,14 @@ using System.Web.UI.WebControls; namespace GPW_Admin { - public partial class login : System.Web.UI.Page + public partial class login : BasePage { protected string _nextPage { get { string pagina = SteamWare.memLayer.ML.StringSessionObj("nextPage"); - if (pagina == "") + if (string.IsNullOrEmpty(pagina)) { pagina = "menu.aspx"; } diff --git a/GPW_Admin/menu.aspx.cs b/GPW_Admin/menu.aspx.cs index 0dc7ed3..f164c8f 100644 --- a/GPW_Admin/menu.aspx.cs +++ b/GPW_Admin/menu.aspx.cs @@ -7,7 +7,7 @@ using System.Web.UI.WebControls; namespace GPW_Admin { - public partial class menu : System.Web.UI.Page + public partial class menu :BasePage { protected void Page_Load(object sender, EventArgs e) { diff --git a/GPW_Admin/progetti.aspx.cs b/GPW_Admin/progetti.aspx.cs index 612f1b4..244a4f5 100644 --- a/GPW_Admin/progetti.aspx.cs +++ b/GPW_Admin/progetti.aspx.cs @@ -7,7 +7,7 @@ using System.Web.UI.WebControls; namespace GPW_Admin { - public partial class progetti : System.Web.UI.Page + public partial class progetti :BasePage { protected void Page_Load(object sender, EventArgs e) { diff --git a/GPW_Admin/reportProgetti.aspx.cs b/GPW_Admin/reportProgetti.aspx.cs index bbaf962..cc60a52 100644 --- a/GPW_Admin/reportProgetti.aspx.cs +++ b/GPW_Admin/reportProgetti.aspx.cs @@ -7,7 +7,7 @@ using System.Web.UI.WebControls; namespace GPW_Admin { - public partial class reportProgetti : System.Web.UI.Page + public partial class reportProgetti :BasePage { protected void Page_Load(object sender, EventArgs e) { diff --git a/GPW_Admin/reviewTimbrature.aspx.cs b/GPW_Admin/reviewTimbrature.aspx.cs index cc0866f..4a11a0d 100644 --- a/GPW_Admin/reviewTimbrature.aspx.cs +++ b/GPW_Admin/reviewTimbrature.aspx.cs @@ -7,7 +7,7 @@ using System.Web.UI.WebControls; namespace GPW_Admin { - public partial class reviewTimbrature : System.Web.UI.Page + public partial class reviewTimbrature :BasePage { protected void Page_Load(object sender, EventArgs e) { diff --git a/GPW_Admin/spostaFasi.aspx.cs b/GPW_Admin/spostaFasi.aspx.cs index 97a49bd..8a87ef4 100644 --- a/GPW_Admin/spostaFasi.aspx.cs +++ b/GPW_Admin/spostaFasi.aspx.cs @@ -9,17 +9,8 @@ using SteamWare; namespace GPW_Admin { - public partial class spostaFasi : System.Web.UI.Page + public partial class spostaFasi : BasePage { - /// - /// effettua traduzione del lemma - /// - /// - /// - public string traduci(string lemma) - { - return user_std.UtSn.Traduci(lemma); - } /// /// caricamento pagina /// diff --git a/GPW_Admin/spostaOre.aspx.cs b/GPW_Admin/spostaOre.aspx.cs index 0e1135a..e63cf28 100644 --- a/GPW_Admin/spostaOre.aspx.cs +++ b/GPW_Admin/spostaOre.aspx.cs @@ -7,7 +7,7 @@ using System.Web.UI.WebControls; namespace GPW_Admin { - public partial class spostaOre : System.Web.UI.Page + public partial class spostaOre :BasePage { protected void Page_Load(object sender, EventArgs e) { diff --git a/GPW_Admin/timbratureMensili.aspx.cs b/GPW_Admin/timbratureMensili.aspx.cs index 6b2d8f3..31d3b1c 100644 --- a/GPW_Admin/timbratureMensili.aspx.cs +++ b/GPW_Admin/timbratureMensili.aspx.cs @@ -7,7 +7,7 @@ using System.Web.UI.WebControls; namespace GPW_Admin { - public partial class timbratureMensili : System.Web.UI.Page + public partial class timbratureMensili :BasePage { protected void Page_Load(object sender, EventArgs e) { diff --git a/GPW_Admin/unauthorized.aspx.cs b/GPW_Admin/unauthorized.aspx.cs index 25300ef..b05e4ae 100644 --- a/GPW_Admin/unauthorized.aspx.cs +++ b/GPW_Admin/unauthorized.aspx.cs @@ -7,7 +7,7 @@ using System.Web.UI.WebControls; namespace GPW_Admin { - public partial class unauthorized1 : System.Web.UI.Page + public partial class unauthorized1 :BasePage { protected void Page_Load(object sender, EventArgs e) { diff --git a/GPW_Admin/utility.cs b/GPW_Admin/utility.cs deleted file mode 100644 index e87babd..0000000 --- a/GPW_Admin/utility.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using SteamWare; - -namespace GPW_Admin -{ - public class utility - { - /// - /// determina se si debba usare CDN x scaricare librerie asp.net ajax - /// - public static bool EnableCdnAjax - { - get - { - bool answ = false; - try - { - answ = memLayer.ML.confReadBool("EnableCdnAjax"); - } - catch - { - } - return answ; - } - } - /// - /// determina se si debba usare CDN x scaricare librerie jquery - /// - public static bool EnableCdnJQ - { - get - { - bool answ = false; - try - { - answ = memLayer.ML.confReadBool("EnableCdnJQ"); - } - catch - { - } - return answ; - } - } - } -} \ No newline at end of file diff --git a/GPW_Barcode/GPW_Barcode.csproj b/GPW_Barcode/GPW_Barcode.csproj index 9cab8e5..3d92e42 100644 --- a/GPW_Barcode/GPW_Barcode.csproj +++ b/GPW_Barcode/GPW_Barcode.csproj @@ -24,7 +24,7 @@ - 3.7 + 3.9 true diff --git a/GPW_Barcode/Web.config b/GPW_Barcode/Web.config index f149b51..70fa3b5 100644 --- a/GPW_Barcode/Web.config +++ b/GPW_Barcode/Web.config @@ -44,9 +44,6 @@ - - - diff --git a/GPW_Barcode/WebUserControls/mod_bCodeTimb.ascx.cs b/GPW_Barcode/WebUserControls/mod_bCodeTimb.ascx.cs index ba7c34b..cf6b991 100644 --- a/GPW_Barcode/WebUserControls/mod_bCodeTimb.ascx.cs +++ b/GPW_Barcode/WebUserControls/mod_bCodeTimb.ascx.cs @@ -9,465 +9,465 @@ using GPW_data; namespace GPW.WebUserControls { - public partial class mod_bCodeTimb : System.Web.UI.UserControl - { - /// - /// salva il dato se il prox sia entrata... - /// - protected bool nextIsEntrata + public partial class mod_bCodeTimb : System.Web.UI.UserControl { - 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 + /// + /// salva il dato se il prox sia entrata... + /// + protected bool nextIsEntrata { - answ = memLayer.ML.StringSessionObj("nextUsrMsg"); - } - catch - { } - if (answ == "") - { - answ = "...waiting..."; - } - return answ; - } - set - { - memLayer.ML.setSessionVal("nextUsrMsg", value); - } - } - - /// - /// 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) - { - 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); - - } - 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() - { - 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 + get { - idxOper = Convert.ToInt32(barcodeIn.ToLowerInvariant().Replace("idx", "")); + return memLayer.ML.BoolSessionObj("nextIsEntrata"); } - catch - { } - // controllo esista il codice idxDipendente scansionato - if (DataProxy.DP.taDipendenti.getByIdx(idxOper).Rows.Count == 0) + set { - setCtrlState(false); - DataProxy.idxDipendente = 0; - orarioBCode = DateTime.Now; - timerConf.Enabled = false; - nextUsrMsg = "...waiting..."; - lblMessaggi.Text += " - codice non valido / non trovato."; - pnlAll.CssClass = "stileComandoKo"; + 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 + { + answ = memLayer.ML.StringSessionObj("nextUsrMsg"); + } + catch + { } + if (string.IsNullOrEmpty(answ)) + { + answ = "...waiting..."; + } + return answ; + } + set + { + memLayer.ML.setSessionVal("nextUsrMsg", value); + } + } + + /// + /// 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 { - 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; + // salvo operazione di default! + registraTimbratura(nextIsEntrata); + // reset visualizzazione + setCtrlState(false); + timerConf.Enabled = false; + // reset valori + Response.Redirect(paginaCorrente); } - 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) + } + /// + /// imposta lo stato visibile dei controlli + /// + /// + private void setCtrlState(bool visibile) + { + pnlTimer.Visible = visibile; + //imgRun.Visible = visibile; + if (DataProxy.idxDipendente > 0) { - timerConf.Enabled = false; - setCtrlState(false); + grView.Visible = true; } - nextUsrMsg = "...waiting..."; - // controlla se sia entra/esci (IN/OUT) - if (barcodeIn.ToUpperInvariant() == "CMDIN") + else { - // registro ingresso! - registraTimbratura(true); - Response.Redirect(paginaCorrente); + grView.Visible = visibile; } - else if (barcodeIn.ToUpperInvariant() == "CMDOUT") + } + /// + /// 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) { - // registro uscita! - registraTimbratura(false); - Response.Redirect(paginaCorrente); + // 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); + } - //else if (barcodeIn.ToUpperInvariant() == "CMD") - //{ - // Response.Redirect(paginaCorrente); - //} - //DataProxy.idxDipendente = -1; + 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() + { + 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(); - 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")) + /// + /// valore barcode + /// + public string barcodeIn { - CognomeNome = DataProxy.DP.CognomeNomeByIdx(DataProxy.idxDipendente); + get + { + return txtBarcode.Text.Trim(); + } + set + { + txtBarcode.Text = value; + } } - if (nextIsEntrata) + /// + /// salvo entrata + /// + /// + /// + protected void btnEntrata_Click(object sender, EventArgs e) { - nextUsrMsg = string.Format("{1} ENTRATA {0:HH:mm:ss}", orarioBCode, CognomeNome); + // salvo entrata... + registraTimbratura(true); + Response.Redirect(paginaCorrente); } - else + /// + /// salvo uscita + /// + /// + /// + protected void btnUscita_Click(object sender, EventArgs e) { - nextUsrMsg = string.Format("{1} USCITA {0:HH:mm:ss}", orarioBCode, CognomeNome); + // salvo uscita + registraTimbratura(false); + Response.Redirect(paginaCorrente); } - 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)) + /// + /// registro timbratura + /// + /// + /// + private void registraTimbratura(bool isEntrata) { - answ = tipoCodiceBarcode.Comando; + // 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"; + } } - // controllo se sia un codice "idx" - else if (barcodeIn.StartsWith("idx", StringComparison.InvariantCultureIgnoreCase)) + /// + /// imposta i buttons secondo i valori in sessione... + /// + private void setButtons() { - answ = tipoCodiceBarcode.idxDipendente; + // mostrare e abilitare secondo condizioni al contorno } - // controllo se sia un codice "matr" - else if (barcodeIn.StartsWith("matr", StringComparison.InvariantCultureIgnoreCase)) + /// + /// decodifica il tipo barcode acquisito + /// + public tipoCodiceBarcode tipoBCode { - answ = tipoCodiceBarcode.matrDipendente; + 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; + } } - // controllo se sia un codice "cf" - else if (barcodeIn.StartsWith("cf", StringComparison.InvariantCultureIgnoreCase)) + /// + /// inverte valore booleano + /// + /// + /// + public bool invBool(object valore) { - answ = tipoCodiceBarcode.cfDipendente; + 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(); + } } - 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); - } - } + /// + /// 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_Commesse/GPW_Commesse.csproj b/GPW_Commesse/GPW_Commesse.csproj index 433fd39..3d5efad 100644 --- a/GPW_Commesse/GPW_Commesse.csproj +++ b/GPW_Commesse/GPW_Commesse.csproj @@ -24,7 +24,8 @@ - 3.5 + 3.9 + true @@ -128,7 +129,6 @@ - ..\packages\System.Diagnostics.PerformanceCounter.4.7.0\lib\net461\System.Diagnostics.PerformanceCounter.dll @@ -197,7 +197,6 @@ ..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.7\lib\net45\System.Web.Http.WebHost.dll - @@ -227,6 +226,7 @@ ..\packages\Microsoft.AspNet.FriendlyUrls.Core.1.0.2\lib\net45\Microsoft.AspNet.FriendlyUrls.dll + ..\packages\WebGrease.1.6.0\lib\WebGrease.dll True diff --git a/GPW_Commesse/Web.config b/GPW_Commesse/Web.config index 54b4227..2d6c07f 100644 --- a/GPW_Commesse/Web.config +++ b/GPW_Commesse/Web.config @@ -1,85 +1,89 @@ - + - - -
-
-
-
- - - - - - - - - - - + + +
+
+
+
+ + + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - + \ No newline at end of file diff --git a/GPW_Commesse/WebUserControls/mod_autocomplete.ascx.cs b/GPW_Commesse/WebUserControls/mod_autocomplete.ascx.cs index 382cc57..183b6b7 100644 --- a/GPW_Commesse/WebUserControls/mod_autocomplete.ascx.cs +++ b/GPW_Commesse/WebUserControls/mod_autocomplete.ascx.cs @@ -61,7 +61,7 @@ namespace GPW_Commesse.WebUserControls protected void txtSel_TextChanged(object sender, EventArgs e) { - if (txtSel.Text.Trim() == "") + if (string.IsNullOrEmpty(txtSel.Text.Trim())) { hiddenFieldID.Text = defaultVal; _valore = defaultVal; @@ -130,7 +130,7 @@ namespace GPW_Commesse.WebUserControls { answ = txtSel.Text.Trim(); } - if (answ == "") + if (string.IsNullOrEmpty(answ)) { answ = txtSel.Text.Trim(); } diff --git a/GPW_Commesse/WebUserControls/mod_dateTime.ascx.cs b/GPW_Commesse/WebUserControls/mod_dateTime.ascx.cs index 5dccdd5..1d9538c 100644 --- a/GPW_Commesse/WebUserControls/mod_dateTime.ascx.cs +++ b/GPW_Commesse/WebUserControls/mod_dateTime.ascx.cs @@ -54,7 +54,7 @@ namespace GPW_Commesse.WebUserControls /// protected void Page_Load(object sender, EventArgs e) { - if (!Page.IsPostBack)// || txtData.Text == "") + if (!Page.IsPostBack) { setInitVal(); valoreDateTime = dataOra; diff --git a/GPW_Commesse/WebUserControls/mod_filtro.ascx.cs b/GPW_Commesse/WebUserControls/mod_filtro.ascx.cs index 3b0598f..f0a1ad5 100644 --- a/GPW_Commesse/WebUserControls/mod_filtro.ascx.cs +++ b/GPW_Commesse/WebUserControls/mod_filtro.ascx.cs @@ -32,7 +32,7 @@ public partial class mod_filtro : ApplicationUserControl { get { - bool answ=false; + bool answ = false; try { memLayer.ML.isInSessionObject(string.Format("valFiltro_{0}", this.ID)); @@ -40,7 +40,7 @@ public partial class mod_filtro : ApplicationUserControl catch { } return answ; - } + } } protected bool _changeCheckEnabled = true; protected bool _changeCheckVisible = true; @@ -76,8 +76,8 @@ public partial class mod_filtro : ApplicationUserControl base.OnInit(e); if (!Page.IsPostBack) { - if (_showFiltered == "") _showFiltered = "mostraSoloSelez"; - if (_showAll == "") _showAll = "mostraTutti"; + if (string.IsNullOrEmpty(_showFiltered)) _showFiltered = "mostraSoloSelez"; + if (string.IsNullOrEmpty(_showAll)) _showAll = "mostraTutti"; } } @@ -304,7 +304,7 @@ public partial class mod_filtro : ApplicationUserControl chkFilt.Checked = true; } } - catch(Exception exc) + catch (Exception exc) { logger.lg.scriviLog(string.Format("Eccezione:{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION); dlFilt.SelectedIndex = 0; @@ -376,7 +376,7 @@ public partial class mod_filtro : ApplicationUserControl updateChkLbl(); } } - + /// /// oggetto ODS con cui popolare il selettore, VINCOLO abbia campi value(key) / label /// diff --git a/GPW_Commesse/WebUserControls/mod_menuTopFull.ascx.cs b/GPW_Commesse/WebUserControls/mod_menuTopFull.ascx.cs index 12f98a1..3a3d94a 100644 --- a/GPW_Commesse/WebUserControls/mod_menuTopFull.ascx.cs +++ b/GPW_Commesse/WebUserControls/mod_menuTopFull.ascx.cs @@ -53,7 +53,7 @@ namespace GPW_Commesse.WebUserControls ///
private void checkUser() { - if (user_std.UtSn.CognomeNome == "") + if (string.IsNullOrEmpty(user_std.UtSn.CognomeNome)) { // fix memLayer.ML.setSessionVal("preUrlString", "", true); diff --git a/GPW_Commesse/WebUserControls/mod_ricercaGenerica.ascx.cs b/GPW_Commesse/WebUserControls/mod_ricercaGenerica.ascx.cs index c4917b9..fb623c7 100644 --- a/GPW_Commesse/WebUserControls/mod_ricercaGenerica.ascx.cs +++ b/GPW_Commesse/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); @@ -64,7 +64,7 @@ public partial class mod_ricercaGenerica : ApplicationUserControl ///
protected void salvaCerca() { - if (testoRicerca == "") + if (string.IsNullOrEmpty(testoRicerca)) { SteamWare.memLayer.ML.emptySessionVal("valoreCercato"); } diff --git a/GPW_Commesse/login.aspx.cs b/GPW_Commesse/login.aspx.cs index 2c6f39b..be8e04f 100644 --- a/GPW_Commesse/login.aspx.cs +++ b/GPW_Commesse/login.aspx.cs @@ -14,7 +14,7 @@ namespace GPW.A4 get { string pagina = SteamWare.memLayer.ML.StringSessionObj("nextPage"); - if (pagina == "") + if (string.IsNullOrEmpty(pagina)) { pagina = "commesseUtente"; } diff --git a/GPW_Smart/GPW_Smart.csproj b/GPW_Smart/GPW_Smart.csproj index f952ae5..c367624 100644 --- a/GPW_Smart/GPW_Smart.csproj +++ b/GPW_Smart/GPW_Smart.csproj @@ -24,7 +24,7 @@ - 3.5 + 3.9 true diff --git a/GPW_Smart/Web.config b/GPW_Smart/Web.config index fef0cd1..953295c 100644 --- a/GPW_Smart/Web.config +++ b/GPW_Smart/Web.config @@ -57,9 +57,6 @@ - - - diff --git a/GPW_Smart/WebUserControls/cmp_menuTop.ascx.cs b/GPW_Smart/WebUserControls/cmp_menuTop.ascx.cs index 8b8f24a..921e654 100644 --- a/GPW_Smart/WebUserControls/cmp_menuTop.ascx.cs +++ b/GPW_Smart/WebUserControls/cmp_menuTop.ascx.cs @@ -98,7 +98,7 @@ namespace GPW_Smart.WebUserControls try { HttpCookie cookie = Request.Cookies["AuthGPW"]; - if (cookie == null || cookie.Value == "") + if (cookie == null || string.IsNullOrEmpty(cookie.Value )) { // rimando pagina x registrazione devices Response.Redirect("~/regNewDevice.aspx"); diff --git a/HOME/HOME.csproj b/HOME/HOME.csproj index c915b7f..334d441 100644 --- a/HOME/HOME.csproj +++ b/HOME/HOME.csproj @@ -26,7 +26,7 @@ - 3.7 + 3.9 true