diff --git a/.editorconfig b/.editorconfig index 770d280..7932c1e 100644 --- a/.editorconfig +++ b/.editorconfig @@ -41,3 +41,6 @@ dotnet_diagnostic.CA1716.severity = none # CA2227: Le proprietà delle raccolte devono essere di sola lettura dotnet_diagnostic.CA2227.severity = none + +# CA1805: Do not initialize unnecessarily +dotnet_diagnostic.CA1805.severity = none diff --git a/Jenkinsfile b/Jenkinsfile index 3943876..7342e91 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -186,8 +186,8 @@ pipeline { // lancio upload con nuget! echo 'Start upload with nuget push' - bat "e:\\nuget setapikey fe387daa-d07c-3207-877e-96c8be1be91b -source http://nexus.steamware.net/repository/nuget-hosted" - bat "e:\\nuget.exe push NKC_SDK.${env.packVers}.nupkg -Source http://nexus.steamware.net/repository/nuget-hosted" + bat "e:\\nuget setapikey fe387daa-d07c-3207-877e-96c8be1be91b -source https://nexus.steamware.net/repository/nuget-hosted" + bat "e:\\nuget.exe push NKC_SDK.${env.packVers}.nupkg -Source https://nexus.steamware.net/repository/nuget-hosted" } else { @@ -277,16 +277,16 @@ def sendSlack(status, colorCode) { // funzione x fix pacchetti nuget da NOSTRO repo Nexus con proxy def fixNuget(solutionFile) { - // bat "e:\\nuget setapikey fe387daa-d07c-3207-877e-96c8be1be91b -source http://nexus.steamware.net/repository/nuget-group" + // bat "e:\\nuget setapikey fe387daa-d07c-3207-877e-96c8be1be91b -source https://nexus.steamware.net/repository/nuget-group" // solo la prima volta va aggiunta... hasSource = bat "e:\\nuget sources list | find \"Steamware\" /C" if (hasSource == "0") { - bat "e:\\nuget sources Add -Name \"Steamware Nexus\" -Source http://nexus.steamware.net/repository/nuget-group -username \"nugetUser\" -password \"viaDante16\"" + bat "e:\\nuget sources Add -Name \"Steamware Nexus\" -Source https://nexus.steamware.net/repository/nuget-group -username \"nugetUser\" -password \"viaDante16\"" } else { - bat "e:\\nuget sources Update -Name \"Steamware Nexus\" -Source http://nexus.steamware.net/repository/nuget-group -username \"nugetUser\" -password \"viaDante16\"" + bat "e:\\nuget sources Update -Name \"Steamware Nexus\" -Source https://nexus.steamware.net/repository/nuget-group -username \"nugetUser\" -password \"viaDante16\"" } bat "e:\\nuget.exe restore ${solutionFile}" } \ No newline at end of file diff --git a/NKC_WF/BasePage.cs b/NKC_WF/BasePage.cs index 2454bf8..b49937d 100644 --- a/NKC_WF/BasePage.cs +++ b/NKC_WF/BasePage.cs @@ -48,7 +48,7 @@ namespace NKC_WF /// public void lgFatal(string message, Exception exc) { - logger.lg.scriviLog(message, tipoLog.FATAL); + logger.lg.scriviLog($"{message}{Environment.NewLine}{exc}", tipoLog.FATAL); } /// diff --git a/NKC_WF/BaseUserControl.cs b/NKC_WF/BaseUserControl.cs index fe00cf3..d29ab87 100644 --- a/NKC_WF/BaseUserControl.cs +++ b/NKC_WF/BaseUserControl.cs @@ -22,7 +22,7 @@ namespace NKC_WF /// /// Codice macchina (da v2) /// - public string PlaceCod = "WRK001"; + public string PlaceCod = "VIRTNE"; #endregion Public Fields @@ -206,7 +206,7 @@ namespace NKC_WF /// public void lgFatal(string message, Exception exc) { - logger.lg.scriviLog(message, tipoLog.FATAL); + logger.lg.scriviLog($"{message}{Environment.NewLine}{exc}", tipoLog.FATAL); } /// diff --git a/NKC_WF/Compressor.cs b/NKC_WF/Compressor.cs index e30cd3f..ddbd6fe 100644 --- a/NKC_WF/Compressor.cs +++ b/NKC_WF/Compressor.cs @@ -5,6 +5,7 @@ namespace NKC_WF { public static class Compressor { + #region Public Methods public static byte[] Compress(byte[] data) { @@ -18,22 +19,28 @@ namespace NKC_WF public static byte[] Decompress(byte[] data) { + byte[] answ = new byte[1]; MemoryStream input = new MemoryStream(); input.Write(data, 0, data.Length); input.Position = 0; GZipStream gzip = new GZipStream(input, CompressionMode.Decompress, true); - MemoryStream output = new MemoryStream(); - byte[] buff = new byte[64]; - int read = -1; - read = gzip.Read(buff, 0, buff.Length); - while (read > 0) + using (MemoryStream output = new MemoryStream()) { - output.Write(buff, 0, read); + byte[] buff = new byte[64]; + int read = -1; read = gzip.Read(buff, 0, buff.Length); + while (read > 0) + { + output.Write(buff, 0, read); + read = gzip.Read(buff, 0, buff.Length); + } + gzip.Close(); + answ = output.ToArray(); } - gzip.Close(); - return output.ToArray(); + return answ; } + + #endregion Public Methods } -} +} \ No newline at end of file diff --git a/NKC_WF/Controllers/BatchProcController.cs b/NKC_WF/Controllers/BatchProcController.cs index cfc5bc7..7ff08f5 100644 --- a/NKC_WF/Controllers/BatchProcController.cs +++ b/NKC_WF/Controllers/BatchProcController.cs @@ -576,7 +576,7 @@ namespace NKC_WF.Controllers answ = "WRONG DATA (expected baseNestAnsw object)"; } } - catch (Exception exc) + catch { answ = "NO"; } diff --git a/NKC_WF/NKC_WF.csproj b/NKC_WF/NKC_WF.csproj index 6e65cb6..47aa535 100644 --- a/NKC_WF/NKC_WF.csproj +++ b/NKC_WF/NKC_WF.csproj @@ -30,7 +30,7 @@ - 3.4 + Latest true @@ -100,8 +100,8 @@ ..\packages\MongoDB.Driver.Core.2.13.1\lib\net452\MongoDB.Driver.Core.dll - - ..\packages\MongoDB.Libmongocrypt.1.2.2\lib\net452\MongoDB.Libmongocrypt.dll + + ..\packages\MongoDB.Libmongocrypt.1.2.3\lib\netstandard2.0\MongoDB.Libmongocrypt.dll ..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll @@ -118,8 +118,8 @@ ..\packages\Pipelines.Sockets.Unofficial.2.2.0\lib\net461\Pipelines.Sockets.Unofficial.dll - - ..\packages\SharpCompress.0.28.3\lib\netstandard2.0\SharpCompress.dll + + ..\packages\SharpCompress.0.29.0\lib\netstandard2.0\SharpCompress.dll ..\packages\Snappy.NET.1.1.1.8\lib\net45\Snappy.NET.dll @@ -127,11 +127,11 @@ ..\packages\StackExchange.Redis.2.2.62\lib\net461\StackExchange.Redis.dll - - ..\packages\SteamWare.5.1.2108.1912\lib\net462\SteamWare.dll + + ..\packages\SteamWare.5.1.2109.1713\lib\net462\SteamWare.dll - - ..\packages\SteamWare.Logger.5.1.2108.1912\lib\net462\SteamWare.Logger.dll + + ..\packages\SteamWare.Logger.5.1.2109.1713\lib\net462\SteamWare.Logger.dll ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll @@ -1894,9 +1894,9 @@ True True - 61257 + 44388 / - https://localhost:44388/ + https://localhost:44393/ False False @@ -1922,8 +1922,8 @@ - + + @@ -378,7 +379,7 @@ - + diff --git a/NKC_WF/WebUserControls/cmp_batchDetailSplit.ascx.cs b/NKC_WF/WebUserControls/cmp_batchDetailSplit.ascx.cs index 2b6bb98..58fa094 100644 --- a/NKC_WF/WebUserControls/cmp_batchDetailSplit.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_batchDetailSplit.ascx.cs @@ -12,15 +12,6 @@ namespace NKC_WF.WebUserControls { public partial class cmp_batchDetailSplit : BaseUserControl { - #region Protected Fields - - /// - /// Master Place (hard-coded) - /// - protected string PlaceCod = "VIRTNE"; - - #endregion Protected Fields - #region Protected Properties protected bool BatchIsAncestor @@ -59,20 +50,6 @@ namespace NKC_WF.WebUserControls } } - public bool isSplitted - { - get - { - bool answ = false; - bool.TryParse(hfIsSplit.Value, out answ); - return answ; - } - set - { - hfIsSplit.Value = $"{value}"; - } - } - protected int lastValRatio { get @@ -192,6 +169,20 @@ namespace NKC_WF.WebUserControls } } + public bool isSplitted + { + get + { + bool answ = false; + bool.TryParse(hfIsSplit.Value, out answ); + return answ; + } + set + { + hfIsSplit.Value = $"{value}"; + } + } + #endregion Public Properties #region Private Methods diff --git a/NKC_WF/WebUserControls/cmp_footer.ascx.cs b/NKC_WF/WebUserControls/cmp_footer.ascx.cs index 00af3f7..8da28c6 100644 --- a/NKC_WF/WebUserControls/cmp_footer.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_footer.ascx.cs @@ -6,14 +6,14 @@ namespace NKC_WF.WebUserControls { public partial class cmp_footer : BaseUserControl { - public event EventHandler eh_doRefresh; - protected void Page_Load(object sender, EventArgs e) + #region Private Methods + + private void setClock() { - // sistemo le stringhe... - lblApp.Text = string.Format("{0} v.{1}", ConfigurationManager.AppSettings.Get("appName"), System.Reflection.Assembly.GetExecutingAssembly().GetName().Version); - setTimer(); - setClock(); + lblDateTime.Text = DateTime.Now.ToString("ddd dd.MM.yyyy, HH:mm:ss"); + lblCodOperatore.Text = $"{user_std.UtSn.CognomeNome} ({Page.User.Identity.Name})"; } + /// /// imposta il tempo di scadenza del timer x il refresh della pagina (della parte top) per evitare che la sessione sul server scada /// @@ -21,20 +21,25 @@ namespace NKC_WF.WebUserControls { Timer1.Interval = SteamWare.memLayer.ML.confReadInt("intUpdatePagina_ms"); } + + #endregion Private Methods + + #region Protected Methods + + protected void Page_Load(object sender, EventArgs e) + { + // sistemo le stringhe... + lblApp.Text = string.Format("{0} v.{1}", ConfigurationManager.AppSettings.Get("appName"), System.Reflection.Assembly.GetExecutingAssembly().GetName().Version); + setTimer(); + setClock(); + } + protected void Timer1_Tick(object sender, EventArgs e) { setClock(); - // se qualcuno ascolta sollevo evento nuovo valore... - if (eh_doRefresh != null) - { - eh_doRefresh(this, new EventArgs()); - } + raiseEvent(); } - private void setClock() - { - lblDateTime.Text = DateTime.Now.ToString("ddd dd.MM.yyyy, HH:mm:ss"); - lblCodOperatore.Text = $"{user_std.UtSn.CognomeNome} ({Page.User.Identity.Name})"; - } + #endregion Protected Methods } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_menuTop.ascx.cs b/NKC_WF/WebUserControls/cmp_menuTop.ascx.cs index 31b4edf..4faeab6 100644 --- a/NKC_WF/WebUserControls/cmp_menuTop.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_menuTop.ascx.cs @@ -7,44 +7,27 @@ namespace NKC_WF.WebUserControls { public partial class cmp_menuTop : BaseUserControl { - public event EventHandler eh_doRefresh; - protected void Page_Load(object sender, EventArgs e) - { - if (!Page.IsPostBack) - { - checkAuth(); - searchVal = ""; - doSearch(); - updateTreeMenu(); - } - } - - private void checkAuth() - { - // in primis SOLO SE non è permesso login anonymous... - if (!enableAnonym) - { - if (!Page.User.Identity.IsAuthenticated) - { - Response.Redirect("default"); - } - } - } + #region Protected Properties /// - /// imposta visibilità search globale + /// Valore ricerca attivo /// - public bool showSearch + protected string searchVal { get { - return divSearch.Visible; + return txtSearch.Text.Trim(); } set { - divSearch.Visible = value; + txtSearch.Text = value.Trim(); } } + + #endregion Protected Properties + + #region Public Properties + /// /// Abilitazione esecuzione anonima /// @@ -62,9 +45,35 @@ namespace NKC_WF.WebUserControls } } - protected void txtSearch_TextChanged(object sender, EventArgs e) + /// + /// imposta visibilità search globale + /// + public bool showSearch { - doSearch(); + get + { + return divSearch.Visible; + } + set + { + divSearch.Visible = value; + } + } + + #endregion Public Properties + + #region Private Methods + + private void checkAuth() + { + // in primis SOLO SE non è permesso login anonymous... + if (!enableAnonym) + { + if (!Page.User.Identity.IsAuthenticated) + { + Response.Redirect("default"); + } + } } private void doSearch() @@ -78,27 +87,9 @@ namespace NKC_WF.WebUserControls { memLayer.ML.emptySessionVal("valoreSearch"); } - // se qualcuno ascolta sollevo evento nuovo valore... - if (eh_doRefresh != null) - { - eh_doRefresh(this, new EventArgs()); - } + raiseEvent(); } - /// - /// Valore ricerca attivo - /// - protected string searchVal - { - get - { - return txtSearch.Text.Trim(); - } - set - { - txtSearch.Text = value.Trim(); - } - } /// /// aggiornamento del menù /// @@ -127,6 +118,11 @@ namespace NKC_WF.WebUserControls } } } + + #endregion Private Methods + + #region Protected Methods + /// /// click su pagina corrente, fa update! /// @@ -140,9 +136,28 @@ namespace NKC_WF.WebUserControls Response.Redirect("default"); } } + protected void lbtSearch_Click(object sender, EventArgs e) { doSearch(); } + + protected void Page_Load(object sender, EventArgs e) + { + if (!Page.IsPostBack) + { + checkAuth(); + searchVal = ""; + doSearch(); + updateTreeMenu(); + } + } + + protected void txtSearch_TextChanged(object sender, EventArgs e) + { + doSearch(); + } + + #endregion Protected Methods } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_numRow.ascx.cs b/NKC_WF/WebUserControls/cmp_numRow.ascx.cs index 33f8f54..a5acd8c 100644 --- a/NKC_WF/WebUserControls/cmp_numRow.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_numRow.ascx.cs @@ -4,20 +4,8 @@ namespace NKC_WF.WebUserControls { public partial class cmp_numRow : BaseUserControl { - public event EventHandler eh_doRefresh; - protected void Page_Load(object sender, EventArgs e) - { + #region Public Properties - } - - private void raiseEvent() - { - // se qualcuno ascolta sollevo evento nuovo valore... - if (eh_doRefresh != null) - { - eh_doRefresh(this, new EventArgs()); - } - } public int numRow { set @@ -32,10 +20,19 @@ namespace NKC_WF.WebUserControls } } + #endregion Public Properties + + #region Protected Methods + + protected void Page_Load(object sender, EventArgs e) + { + } + protected void txtNumRow_TextChanged(object sender, EventArgs e) { - raiseEvent(); } + + #endregion Protected Methods } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/mod_righePag.ascx.cs b/NKC_WF/WebUserControls/mod_righePag.ascx.cs index 7163ade..0af3cf1 100644 --- a/NKC_WF/WebUserControls/mod_righePag.ascx.cs +++ b/NKC_WF/WebUserControls/mod_righePag.ascx.cs @@ -6,80 +6,17 @@ namespace NKC_WF.WebUserControls { public partial class mod_righePag : BaseUserControl { + #region Public Events + /// /// indicato (nuovo) numero righe x pagina /// public event EventHandler eh_newNum; - /// - /// caricamento pagina - /// - /// - /// - protected void Page_Load(object sender, EventArgs e) - { - if (!Page.IsPostBack) - { - numRowReq = numRowPag; - } - } - /// - /// stringa UID univoca - /// - public string uid - { - get - { - return this.UniqueID.Replace("$", "_").Replace("-", "_"); - } - } - /// - /// effettua traduzione del lemma - /// - /// - /// - public string traduci(string lemma) - { - return user_std.UtSn.Traduci(lemma); - } - /// - /// aggiorno controllo paginazione... - /// - /// - /// - protected void txtNumRighe_TextChanged(object sender, EventArgs e) - { - // salvo num righe... - numRowPag = numRowReq; - // sollevo evento nuovo valore... - if (eh_newNum != null) - { - eh_newNum(this, new EventArgs()); - } - } - /// - /// numero righe per pagina (in sessione) - /// - public int numRowPag - { - get - { - int answ = 10; - try - { - answ = memLayer.ML.IntSessionObj(uid + "_numRowPag"); - } - catch - { - answ = 10; - } - return answ; - } - set - { - memLayer.ML.setSessionVal(uid + "_numRowPag", value); - numRowReq = value; - } - } + + #endregion Public Events + + #region Protected Properties + /// /// numero righe gridview da mostrare legato a controllo textbox /// @@ -106,5 +43,80 @@ namespace NKC_WF.WebUserControls txtNumRighe.Text = value.ToString(); } } + + #endregion Protected Properties + + #region Public Properties + + /// + /// numero righe per pagina (in sessione) + /// + public int numRowPag + { + get + { + int answ = 10; + try + { + answ = memLayer.ML.IntSessionObj(uid + "_numRowPag"); + } + catch + { + answ = 10; + } + return answ; + } + set + { + memLayer.ML.setSessionVal(uid + "_numRowPag", value); + numRowReq = value; + } + } + + /// + /// stringa UID univoca + /// + public string uid + { + get + { + return this.UniqueID.Replace("$", "_").Replace("-", "_"); + } + } + + #endregion Public Properties + + #region Protected Methods + + /// + /// caricamento pagina + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!Page.IsPostBack) + { + numRowReq = numRowPag; + } + } + + /// + /// aggiorno controllo paginazione... + /// + /// + /// + protected void txtNumRighe_TextChanged(object sender, EventArgs e) + { + // salvo num righe... + numRowPag = numRowReq; + // sollevo evento nuovo valore... + if (eh_newNum != null) + { + eh_newNum(this, new EventArgs()); + } + } + + #endregion Protected Methods } } \ No newline at end of file diff --git a/NKC_WF/packages.config b/NKC_WF/packages.config index d409ef4..5000d37 100644 --- a/NKC_WF/packages.config +++ b/NKC_WF/packages.config @@ -39,7 +39,7 @@ - + @@ -48,19 +48,19 @@ - + - + - - + + diff --git a/NKC_WF/site/UpdMan.aspx.cs b/NKC_WF/site/UpdMan.aspx.cs index bc66d13..d887d9c 100644 --- a/NKC_WF/site/UpdMan.aspx.cs +++ b/NKC_WF/site/UpdMan.aspx.cs @@ -191,7 +191,7 @@ namespace NKC_WF.site } else { - answ = string.Format("http://nexus.steamware.net/repository/SWS/{0}/{1}/LAST/manifest.xml", package, memLayer.ML.CRS("appVers")); + answ = string.Format("https://nexus.steamware.net/repository/SWS/{0}/{1}/LAST/manifest.xml", package, memLayer.ML.CRS("appVers")); } return answ; }