From 2a67ab7e4daa1861a45d5a660559cebe0cafe518 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Fri, 10 Apr 2020 14:35:20 +0200 Subject: [PATCH] Correzioni vari warnings --- .editorconfig | 19 + GPW.sln | 5 + GPW_Admin/WS/autoComplete.asmx.cs | 141 +++--- .../mod_commAttivitaDesk.ascx.cs | 80 +-- GPW_Barcode/Web.config | 476 +++++++++++++----- GPW_data/GPW_data.csproj | 3 + 6 files changed, 482 insertions(+), 242 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..41a918e --- /dev/null +++ b/.editorconfig @@ -0,0 +1,19 @@ +[*.cs] + +# CA1822: Contrassegnare i membri come static +dotnet_diagnostic.CA1822.severity = none + +# IDE0055: Correggi formattazione +dotnet_diagnostic.IDE0055.severity = none + +# CA1707: Gli identificatori non devono contenere caratteri di sottolineatura +dotnet_diagnostic.CA1707.severity = none + +# CA1031: Non rilevare tipi di eccezione generali +dotnet_diagnostic.CA1031.severity = none + +# IDE0060: Rimuovere il parametro inutilizzato +dotnet_code_quality_unused_parameters = all:none + +# CA1305: Specificare IFormatProvider +dotnet_diagnostic.CA1305.severity = none diff --git a/GPW.sln b/GPW.sln index fc469a0..4c8348f 100644 --- a/GPW.sln +++ b/GPW.sln @@ -17,6 +17,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GPW_Commesse", "GPW_Commess EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HOME", "HOME\HOME.csproj", "{7D89DF90-4A60-45D5-9710-3EF25C58DA31}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{DD45B2B2-533E-44F7-A1BD-17C2A66FD7C0}" + ProjectSection(SolutionItems) = preProject + .editorconfig = .editorconfig + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU diff --git a/GPW_Admin/WS/autoComplete.asmx.cs b/GPW_Admin/WS/autoComplete.asmx.cs index 2e08113..437658d 100644 --- a/GPW_Admin/WS/autoComplete.asmx.cs +++ b/GPW_Admin/WS/autoComplete.asmx.cs @@ -13,74 +13,79 @@ using GPW_data; namespace GPW.WS { - /// - /// autoComplete per metodi jscript/ajax - /// - [WebService(Namespace = "http://www.steamware.net/")] - [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] - [System.ComponentModel.ToolboxItem(false)] - [System.Web.Script.Services.ScriptService] - public class autoComplete : System.Web.Services.WebService + /// + /// autoComplete per metodi jscript/ajax + /// + [WebService(Namespace = "http://www.steamware.net/")] + [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] + [System.ComponentModel.ToolboxItem(false)] + [System.Web.Script.Services.ScriptService] + public class autoComplete : System.Web.Services.WebService + { + + public autoComplete() { - - public autoComplete() - { - //Uncomment the following line if using designed components - //InitializeComponent(); - } - - - [WebMethod] - public CascadingDropDownNameValue[] GetClienti(string knownCategoryValues, string category) - { - DS_Applicazione.AnagClientiDataTable tabCli = DataProxy.DP.taAnCli.GetData(); - List values = new List(); - foreach (DataRow dr in tabCli) - { - string label = (string)dr["RagSociale"]; - int value = (int)dr["idxCliente"]; - values.Add(new CascadingDropDownNameValue(label, value.ToString())); - } - return values.ToArray(); - } - - [WebMethod] - public CascadingDropDownNameValue[] GetProgettiByCli(string knownCategoryValues, string category) - { - StringDictionary kv = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues); - int idxCliente; - if (!kv.ContainsKey("clienti") || !Int32.TryParse(kv["clienti"], out idxCliente)) - { - return null; - } - DS_Applicazione.AnagProgettiDataTable tabProj = DataProxy.DP.taAP.getByIdxCli(idxCliente, false, false); - List values = new List(); - foreach (DataRow dr in tabProj) - { - string label = (string)dr["nomeProj"]; - int value = (int)dr["idxProgetto"]; - values.Add(new CascadingDropDownNameValue(label, value.ToString())); - } - return values.ToArray(); - } - [WebMethod] - public CascadingDropDownNameValue[] GetFasiByProgetti(string knownCategoryValues, string category) - { - StringDictionary kv = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues); - int idxCliente; - if (!kv.ContainsKey("clienti") || !Int32.TryParse(kv["clienti"], out idxCliente)) - { - return null; - } - DS_Applicazione.AnagProgettiDataTable tabProj = DataProxy.DP.taAP.getByIdxCli(idxCliente, false, false); - List values = new List(); - foreach (DataRow dr in tabProj) - { - string label = (string)dr["nomeProj"]; - int value = (int)dr["idxProgetto"]; - values.Add(new CascadingDropDownNameValue(label, value.ToString())); - } - return values.ToArray(); - } + //Uncomment the following line if using designed components + //InitializeComponent(); } + + + [WebMethod] + public CascadingDropDownNameValue[] GetClienti(string knownCategoryValues, string category) + { + if (knownCategoryValues is null) + { + throw new ArgumentNullException(nameof(knownCategoryValues)); + } + + DS_Applicazione.AnagClientiDataTable tabCli = DataProxy.DP.taAnCli.GetData(); + List values = new List(); + foreach (DataRow dr in tabCli) + { + string label = (string)dr["RagSociale"]; + int value = (int)dr["idxCliente"]; + values.Add(new CascadingDropDownNameValue(label, value.ToString())); + } + return values.ToArray(); + } + + [WebMethod] + public CascadingDropDownNameValue[] GetProgettiByCli(string knownCategoryValues, string category) + { + StringDictionary kv = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues); + int idxCliente; + if (!kv.ContainsKey("clienti") || !Int32.TryParse(kv["clienti"], out idxCliente)) + { + return null; + } + DS_Applicazione.AnagProgettiDataTable tabProj = DataProxy.DP.taAP.getByIdxCli(idxCliente, false, false); + List values = new List(); + foreach (DataRow dr in tabProj) + { + string label = (string)dr["nomeProj"]; + int value = (int)dr["idxProgetto"]; + values.Add(new CascadingDropDownNameValue(label, value.ToString())); + } + return values.ToArray(); + } + [WebMethod] + public CascadingDropDownNameValue[] GetFasiByProgetti(string knownCategoryValues, string category) + { + StringDictionary kv = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues); + int idxCliente; + if (!kv.ContainsKey("clienti") || !Int32.TryParse(kv["clienti"], out idxCliente)) + { + return null; + } + DS_Applicazione.AnagProgettiDataTable tabProj = DataProxy.DP.taAP.getByIdxCli(idxCliente, false, false); + List values = new List(); + foreach (DataRow dr in tabProj) + { + string label = (string)dr["nomeProj"]; + int value = (int)dr["idxProgetto"]; + values.Add(new CascadingDropDownNameValue(label, value.ToString())); + } + return values.ToArray(); + } + } } diff --git a/GPW_Admin/WebUserControls/mod_commAttivitaDesk.ascx.cs b/GPW_Admin/WebUserControls/mod_commAttivitaDesk.ascx.cs index 5babab4..6c7f734 100644 --- a/GPW_Admin/WebUserControls/mod_commAttivitaDesk.ascx.cs +++ b/GPW_Admin/WebUserControls/mod_commAttivitaDesk.ascx.cs @@ -252,8 +252,11 @@ namespace GPW_Admin.WebUserControls /// protected void odsRA_Updating(object sender, ObjectDataSourceMethodEventArgs e) { - DropDownList ddlfase_int = (DropDownList)grView.Rows[grView.EditIndex].FindControl("ddlFase"); - e.InputParameters["idxFase"] = ddlfase_int.SelectedValue; + if (e != null) + { + DropDownList ddlfase_int = (DropDownList)grView.Rows[grView.EditIndex].FindControl("ddlFase"); + e.InputParameters["idxFase"] = ddlfase_int.SelectedValue; + } } /// /// aggiorno ods fasi... @@ -503,28 +506,31 @@ namespace GPW_Admin.WebUserControls /// protected void ddlFase_DataBound(object sender, EventArgs e) { - // cerco eventuali controlli tipo "ancestor" e li disattivo! - DropDownList ddlFase_int = (DropDownList)sender; - ListItem li = new ListItem(); - while (li != null) + if (sender != null) { - li = ddlFase_int.Items.FindByValue("0"); + // cerco eventuali controlli tipo "ancestor" e li disattivo! + DropDownList ddlFase_int = (DropDownList)sender; + ListItem li = new ListItem(); + while (li != null) + { + li = ddlFase_int.Items.FindByValue("0"); + try + { + li.Attributes.Add("style", "color:gray;"); + li.Attributes.Add("disabled", "true"); + li.Value = "-1"; + li.Text = string.Format("[ {0} ]", li.Text); + } + catch + { } + } try { - li.Attributes.Add("style", "color:gray;"); - li.Attributes.Add("disabled", "true"); - li.Value = "-1"; - li.Text = string.Format("[ {0} ]", li.Text); + ddlFase_int.SelectedIndex = 1; } catch { } } - try - { - ddlFase_int.SelectedIndex = 1; - } - catch - { } } /// /// richiesta creazioen nuovo record @@ -565,29 +571,31 @@ namespace GPW_Admin.WebUserControls /// protected void txtSearchFase_TextChanged(object sender, EventArgs e) { - - // recupero testo... - string search = ""; - try + if (sender != null) { - search = ((TextBox)sender).Text.Trim(); - } - catch - { } - if (search != "") - { - // faccio ricerca x progetto e fase... - GPW_data.DS_Utility.stp_VSProjFasi_searchDataTable tabRes = DataProxy.DP.taVSProjFasiSearch.GetData(search); - if (tabRes.Rows.Count > 0) + // recupero testo... + string search = ""; + try { - idxFaseSel = tabRes[0].idxFase; - idxProjSel = tabRes[0].idxProgetto; + search = ((TextBox)sender).Text.Trim(); } + catch + { } + if (!string.IsNullOrEmpty(search)) + { + // faccio ricerca x progetto e fase... + GPW_data.DS_Utility.stp_VSProjFasi_searchDataTable tabRes = DataProxy.DP.taVSProjFasiSearch.GetData(search); + if (tabRes.Rows.Count > 0) + { + idxFaseSel = tabRes[0].idxFase; + idxProjSel = tabRes[0].idxProgetto; + } + } + //stato = statoControllo.edit; + //refreshControlli(); + //stato = statoControllo.item; + //minutiSel = -1; } - //stato = statoControllo.edit; - //refreshControlli(); - //stato = statoControllo.item; - //minutiSel = -1; refreshControlli(); } diff --git a/GPW_Barcode/Web.config b/GPW_Barcode/Web.config index 76d1555..bb9b8fd 100644 --- a/GPW_Barcode/Web.config +++ b/GPW_Barcode/Web.config @@ -1,4 +1,4 @@ - + - - - - + + + + - - - + + + - - + + - + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - + + + - - - - - - - - - + + + + + + + + + - + - - - - + + + + - - - - + + + + - - - + + + - + - - + + - + - - + + - - + + - + - - - - - + + + + + - + - - - - + + + + - + - - - - - + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - - + + + - - - - - - - - + + + + + + + + - + - + - + diff --git a/GPW_data/GPW_data.csproj b/GPW_data/GPW_data.csproj index c11f081..7c1b703 100644 --- a/GPW_data/GPW_data.csproj +++ b/GPW_data/GPW_data.csproj @@ -172,6 +172,9 @@ + + .editorconfig + Designer