diff --git a/IntegrationEgaltech/Generator.cs b/IntegrationEgaltech/Generator.cs index cb5ce4b..19872f5 100644 --- a/IntegrationEgaltech/Generator.cs +++ b/IntegrationEgaltech/Generator.cs @@ -1050,7 +1050,30 @@ namespace ib.essetre.integration.egaltech } } - // Apro file + // Preparazione interrogazione per Dati Utente del DB + _SqlConnectionStr = parameters.ConnectionString; + DataSet dsUser = new DataSet(); + + string sqlUser = "SELECT [group], [key], [value] " + + "FROM [ESSETRE].[dbo].[vw_ConfigurationParam] " + + "WHERE [group] <> 'TEXTS' AND [group] <> 'PARAMS' AND configurationId = @ConfigId"; + + // Connessione al DB ed esecuzione query + using (SqlConnection cn = new SqlConnection(_SqlConnectionStr)) + { + cn.Open(); + using (SqlCommand cmd = new SqlCommand(sqlUser, cn)) + { + cmd.Parameters.Add("@ConfigId", SqlDbType.Int); + cmd.Parameters["@ConfigId"].Value = parameters.ConfigurationId; + var dataAdapter = new SqlDataAdapter(cmd); + // Lettura DB e riempimento DataSet + dsUser.Clear(); + dataAdapter.Fill(dsUser); + } + } + + // Apro file using ( var tw = new StreamWriter( DataPath, false)) { // Scrittura intestazione @@ -1083,8 +1106,24 @@ namespace ib.essetre.integration.egaltech tw.WriteLine( "}") ; tw.WriteLine( "") ; - // Scrittura tabella da restituire - tw.WriteLine( "local Machine = { Offsets=Offsets, Trave=Trave}") ; + // Scrittura dei dati di Utente + tw.WriteLine("local User = {"); + foreach (DataTable table in dsUser.Tables) + { + foreach (DataRow row in table.Rows) + { + String Group = row["group"].ToString(); + String Key = row["key"].ToString(); + String Value = row["value"].ToString(); + tw.WriteLine(" " + Group + "_" + Key + "=" + Value + ","); + } + } + tw.WriteLine(" Zzz=1"); + tw.WriteLine("}"); + tw.WriteLine(""); + + // Scrittura tabella da restituire + tw.WriteLine( "local Machine = { Offsets=Offsets, Trave=Trave, User=User}") ; tw.WriteLine( "return Machine") ; } diff --git a/IntegrationEgaltech/Properties/AssemblyInfo.cs b/IntegrationEgaltech/Properties/AssemblyInfo.cs index 3e9a177..b27b306 100644 --- a/IntegrationEgaltech/Properties/AssemblyInfo.cs +++ b/IntegrationEgaltech/Properties/AssemblyInfo.cs @@ -36,5 +36,5 @@ using System.Runtime.InteropServices; // È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build // usando l'asterisco '*' come illustrato di seguito: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.2.2.2")] -[assembly: AssemblyFileVersion("2.2.2.2")] +[assembly: AssemblyVersion("2.2.5.1")] +[assembly: AssemblyFileVersion("2.2.5.1")]