Eliminazioni warnings vari codice

This commit is contained in:
Samuele Locatelli
2021-09-17 14:51:27 +02:00
parent 8ec6ce6390
commit 62cc21f43d
10 changed files with 214 additions and 184 deletions
+3
View File
@@ -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
+1 -1
View File
@@ -48,7 +48,7 @@ namespace NKC_WF
/// <param name="message"></param>
public void lgFatal(string message, Exception exc)
{
logger.lg.scriviLog(message, tipoLog.FATAL);
logger.lg.scriviLog($"{message}{Environment.NewLine}{exc}", tipoLog.FATAL);
}
/// <summary>
+2 -2
View File
@@ -22,7 +22,7 @@ namespace NKC_WF
/// <summary>
/// Codice macchina (da v2)
/// </summary>
public string PlaceCod = "WRK001";
public string PlaceCod = "VIRTNE";
#endregion Public Fields
@@ -206,7 +206,7 @@ namespace NKC_WF
/// <param name="message"></param>
public void lgFatal(string message, Exception exc)
{
logger.lg.scriviLog(message, tipoLog.FATAL);
logger.lg.scriviLog($"{message}{Environment.NewLine}{exc}", tipoLog.FATAL);
}
/// <summary>
+16 -9
View File
@@ -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
}
}
}
+1 -1
View File
@@ -576,7 +576,7 @@ namespace NKC_WF.Controllers
answ = "WRONG DATA (expected baseNestAnsw object)";
}
}
catch (Exception exc)
catch
{
answ = "NO";
}
@@ -12,15 +12,6 @@ namespace NKC_WF.WebUserControls
{
public partial class cmp_batchDetailSplit : BaseUserControl
{
#region Protected Fields
/// <summary>
/// Master Place (hard-coded)
/// </summary>
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
+21 -16
View File
@@ -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("<b>{0}</b> 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})";
}
/// <summary>
/// imposta il tempo di scadenza del timer x il refresh della pagina (della parte top) per evitare che la sessione sul server scada
/// </summary>
@@ -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("<b>{0}</b> 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
}
}
+63 -48
View File
@@ -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
/// <summary>
/// imposta visibilità search globale
/// Valore ricerca attivo
/// </summary>
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
/// <summary>
/// Abilitazione esecuzione anonima
/// </summary>
@@ -62,9 +45,35 @@ namespace NKC_WF.WebUserControls
}
}
protected void txtSearch_TextChanged(object sender, EventArgs e)
/// <summary>
/// imposta visibilità search globale
/// </summary>
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();
}
/// <summary>
/// Valore ricerca attivo
/// </summary>
protected string searchVal
{
get
{
return txtSearch.Text.Trim();
}
set
{
txtSearch.Text = value.Trim();
}
}
/// <summary>
/// aggiornamento del menù
/// </summary>
@@ -127,6 +118,11 @@ namespace NKC_WF.WebUserControls
}
}
}
#endregion Private Methods
#region Protected Methods
/// <summary>
/// click su pagina corrente, fa update!
/// </summary>
@@ -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
}
}
+11 -14
View File
@@ -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
}
}
+82 -70
View File
@@ -6,80 +6,17 @@ namespace NKC_WF.WebUserControls
{
public partial class mod_righePag : BaseUserControl
{
#region Public Events
/// <summary>
/// indicato (nuovo) numero righe x pagina
/// </summary>
public event EventHandler eh_newNum;
/// <summary>
/// caricamento pagina
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
numRowReq = numRowPag;
}
}
/// <summary>
/// stringa UID univoca
/// </summary>
public string uid
{
get
{
return this.UniqueID.Replace("$", "_").Replace("-", "_");
}
}
/// <summary>
/// effettua traduzione del lemma
/// </summary>
/// <param name="lemma"></param>
/// <returns></returns>
public string traduci(string lemma)
{
return user_std.UtSn.Traduci(lemma);
}
/// <summary>
/// aggiorno controllo paginazione...
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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());
}
}
/// <summary>
/// numero righe per pagina (in sessione)
/// </summary>
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
/// <summary>
/// numero righe gridview da mostrare legato a controllo textbox
/// </summary>
@@ -106,5 +43,80 @@ namespace NKC_WF.WebUserControls
txtNumRighe.Text = value.ToString();
}
}
#endregion Protected Properties
#region Public Properties
/// <summary>
/// numero righe per pagina (in sessione)
/// </summary>
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;
}
}
/// <summary>
/// stringa UID univoca
/// </summary>
public string uid
{
get
{
return this.UniqueID.Replace("$", "_").Replace("-", "_");
}
}
#endregion Public Properties
#region Protected Methods
/// <summary>
/// caricamento pagina
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
numRowReq = numRowPag;
}
}
/// <summary>
/// aggiorno controllo paginazione...
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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
}
}