diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bb7833ea..542ab049 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -30,8 +30,6 @@ variables: .nexusUpload: &nexusUpload - | Set-Alias mCurl C:\Windows\system32\curl.exe - $currentDate = get-date -format yyMM; - $currentTime = get-date -format ddHH; $fileVers = $env:APP_NAME + "\Resources\VersNum.txt" $VersNumb = Get-Content $fileVers echo "Curr Version: $VersNumb" diff --git a/MP.AppAuth/AppAuthContext.cs b/MP.AppAuth/AppAuthContext.cs index 520acb42..306cc5c2 100644 --- a/MP.AppAuth/AppAuthContext.cs +++ b/MP.AppAuth/AppAuthContext.cs @@ -3,10 +3,6 @@ using Microsoft.Extensions.Configuration; using MP.AppAuth.Models; using NLog; using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace MP.AppAuth { @@ -60,7 +56,6 @@ namespace MP.AppAuth public virtual DbSet DbSetAnagOpr { get; set; } public virtual DbSet DbSetUpdMan { get; set; } - public virtual DbSet DbSetVocabolario { get; set; } #endregion Public Properties diff --git a/MP.AppAuth/Controllers/AppAuthController.cs b/MP.AppAuth/Controllers/AppAuthController.cs index 26d54e80..e441149a 100644 --- a/MP.AppAuth/Controllers/AppAuthController.cs +++ b/MP.AppAuth/Controllers/AppAuthController.cs @@ -115,8 +115,8 @@ namespace MP.AppAuth.Controllers using (AppAuthContext localDbCtx = new AppAuthContext(_configuration)) { dbResult = localDbCtx - .DbSetVocabolario - .ToList(); + .DbSetVocabolario + .ToList(); } return dbResult; } diff --git a/MP.AppAuth/Controllers/MPController .cs b/MP.AppAuth/Controllers/MPController .cs new file mode 100644 index 00000000..81c577ca --- /dev/null +++ b/MP.AppAuth/Controllers/MPController .cs @@ -0,0 +1,60 @@ +using Microsoft.Extensions.Configuration; +using NLog; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MP.AppAuth.Controllers +{ + public class MPController : IDisposable + { + #region Private Fields + + private static IConfiguration _configuration; + private static NLog.Logger Log = LogManager.GetCurrentClassLogger(); + public static AppAuth.Controllers.MPController dbController; + + #endregion Private Fields + + #region Public Constructors + + public MPController(IConfiguration configuration) + { + _configuration = configuration; + Log.Info("Avviata classe MpController"); + } + + #endregion Public Constructors + + #region Public Methods + + public void Dispose() + { + // Clear database controller + dbController.Dispose(); + } + + + /// + /// Elenco Record x AnagKeyValue + /// + /// + public List AnagKeyValuesGetAll() + { + List dbResult = new List(); + using (MoonProContext localDbCtx = new MoonProContext(_configuration)) + { + dbResult = localDbCtx + .DbSetAnagKeyValues + .ToList(); + } + return dbResult; + } + + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/MP.AppAuth/Models/AnagKeyValue.cs b/MP.AppAuth/Models/AnagKeyValue.cs index bdeede66..d2be5358 100644 --- a/MP.AppAuth/Models/AnagKeyValue.cs +++ b/MP.AppAuth/Models/AnagKeyValue.cs @@ -1,19 +1,26 @@ using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; #nullable disable namespace MP.AppAuth.Models { + // + // This is here so CodeMaid doesn't reorganize this document + // + [Table("AnagKeyValue")] public partial class AnagKeyValue { #region Public Properties - public string Descrizione { get; set; } + [Key] public string NomeVar { get; set; } - public double? ValFloat { get; set; } public int? ValInt { get; set; } + public double? ValFloat { get; set; } public string ValString { get; set; } + public string Descrizione { get; set; } #endregion Public Properties } diff --git a/MP.AppAuth/MoonProContext.cs b/MP.AppAuth/MoonProContext.cs index a1eca39d..7c4d02d8 100644 --- a/MP.AppAuth/MoonProContext.cs +++ b/MP.AppAuth/MoonProContext.cs @@ -1,23 +1,53 @@ -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Configuration; using MP.AppAuth.Models; - -#nullable disable +using NLog; +using System; namespace MP.AppAuth { public partial class MoonProContext : DbContext { + #region Private Fields + + private static NLog.Logger Log = LogManager.GetCurrentClassLogger(); + + private IConfiguration _configuration; + + #endregion Private Fields + #region Public Constructors + [Obsolete("This constructor should never be used directly, and is only needed to generate entityframework stuff. Connection string can be adapted as pleased.")] public MoonProContext() { } - public MoonProContext(DbContextOptions options) - : base(options) + public MoonProContext(IConfiguration configuration) { + _configuration = configuration; + try + { + // se non ci fosse... crea o migra! + Database.Migrate(); + } + catch (Exception exc) + { + Log.Error(exc, "Exception during context initialization 01"); + } + } + + public MoonProContext(DbContextOptions options) : base(options) + { + try + { + // se non ci fosse... crea o migra! + Database.Migrate(); + } + catch (Exception exc) + { + Log.Error(exc, "Exception during context initialization 02"); + } } #endregion Public Constructors @@ -26,7 +56,6 @@ namespace MP.AppAuth public virtual DbSet AnagArticolis { get; set; } public virtual DbSet AnagClassiTempos { get; set; } - public virtual DbSet AnagKeyValues { get; set; } public virtual DbSet AnagraficaCausaliScartos { get; set; } public virtual DbSet AnagraficaFlussis { get; set; } public virtual DbSet AnagraficaIngressis { get; set; } @@ -34,6 +63,7 @@ namespace MP.AppAuth public virtual DbSet AnagraficaOperatoris { get; set; } public virtual DbSet Configs { get; set; } public virtual DbSet DatiMacchines { get; set; } + public virtual DbSet DbSetAnagKeyValues { get; set; } public virtual DbSet FamigliaTipoIngressis { get; set; } public virtual DbSet FamiglieMacchines { get; set; } public virtual DbSet KeepAlives { get; set; } @@ -57,7 +87,15 @@ namespace MP.AppAuth { if (!optionsBuilder.IsConfigured) { - optionsBuilder.UseSqlServer("Data Source=SQL2016DEV;Initial Catalog=MoonPro;Trusted_Connection=True;"); + string connString = _configuration.GetConnectionString("MP.Land"); + if (!string.IsNullOrEmpty(connString)) + { + optionsBuilder.UseSqlServer(connString); + } + else + { + optionsBuilder.UseSqlServer("Server=SQL2016DEV;Database=MoonPro;Trusted_Connection=True;"); + } } } diff --git a/MP.Land/Data/AppAuthService.cs b/MP.Land/Data/AppAuthService.cs index 2d9b5d23..6f586b39 100644 --- a/MP.Land/Data/AppAuthService.cs +++ b/MP.Land/Data/AppAuthService.cs @@ -47,6 +47,7 @@ namespace MP.Land.Data #region Public Fields public static AppAuth.Controllers.AppAuthController dbController; + public static AppAuth.Controllers.MPController MpDbController; #endregion Public Fields @@ -68,6 +69,7 @@ namespace MP.Land.Data else { dbController = new AppAuth.Controllers.AppAuthController(configuration); + MpDbController = new AppAuth.Controllers.MPController(configuration); _logger.LogInformation("DbController OK"); } } @@ -143,6 +145,7 @@ namespace MP.Land.Data { // Clear database controller dbController.Dispose(); + MpDbController.Dispose(); } public string Traduci(string lemma, string lingua = "IT") @@ -170,6 +173,18 @@ namespace MP.Land.Data return await Task.FromResult(dbResult); } + public async Task> AnagKeyValList() + { + List dbResult = new List(); + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + dbResult = MpDbController.AnagKeyValuesGetAll(); + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Trace($"Effettuata lettura da DB per AnagKeyValList: {ts.TotalMilliseconds} ms"); + return await Task.FromResult(dbResult); + } + #endregion Public Methods } } \ No newline at end of file diff --git a/MP.Land/MP.Land.csproj b/MP.Land/MP.Land.csproj index 3bd78b24..9672a391 100644 --- a/MP.Land/MP.Land.csproj +++ b/MP.Land/MP.Land.csproj @@ -3,7 +3,7 @@ net5.0 MP.Land - 6.14.2111.2414 + 6.14.2112.2315 diff --git a/MP.Land/Pages/SysInfo.razor b/MP.Land/Pages/SysInfo.razor index 5b5c2c2a..d5cfbb5c 100644 --- a/MP.Land/Pages/SysInfo.razor +++ b/MP.Land/Pages/SysInfo.razor @@ -3,11 +3,12 @@ @using MP.Land.Data @using Microsoft.Extensions.Configuration +@inject AppAuthService DataService @inject MessageService AppMService @inject IConfiguration Configuration
-
+
@@ -126,6 +127,9 @@
+
@@ -135,6 +139,26 @@ protected string Titolo = "MAPO System Info"; protected string Messaggio = "HW & SW details"; protected HwSwInfo currHwSwInfo = HwSwInfo.man(System.Reflection.Assembly.GetExecutingAssembly()); + + protected string masterLic = ""; + + protected override async Task OnInitializedAsync() + { + await ReloadData(); + } + + protected async Task ReloadData() + { + var akvList = await DataService.AnagKeyValList(); + var licRecord = akvList + .Where(x => x.NomeVar == "MAPO") + .FirstOrDefault(); + if (licRecord != null) + { + masterLic = licRecord.ValString; + } + } + protected string DbNameExample { get @@ -156,6 +180,4 @@ } } - //string connStr = memLayer.ML.confReadString("DbConfConnectionString"); - //currHwSwInfo = currHwSwInfo; } \ No newline at end of file diff --git a/MP.Land/Resources/ChangeLog.html b/MP.Land/Resources/ChangeLog.html index 46de6f68..3fcbcdb1 100644 --- a/MP.Land/Resources/ChangeLog.html +++ b/MP.Land/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo gestione Programmi MAPO -

Versione: 6.14.2111.2414

+

Versione: 6.14.2112.2315


Note di rilascio:
    diff --git a/MP.Land/Resources/VersNum.txt b/MP.Land/Resources/VersNum.txt index 814b8410..aae3317e 100644 --- a/MP.Land/Resources/VersNum.txt +++ b/MP.Land/Resources/VersNum.txt @@ -1 +1 @@ -6.14.2111.2414 +6.14.2112.2315 diff --git a/MP.Land/Resources/manifest.xml b/MP.Land/Resources/manifest.xml index f595ace3..26b3c9a1 100644 --- a/MP.Land/Resources/manifest.xml +++ b/MP.Land/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.14.2111.2414 + 6.14.2112.2315 https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/MP.Land.zip https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/ChangeLog.html false diff --git a/MP.Land/appsettings.Production.json b/MP.Land/appsettings.Production.json index 557d5444..18d68259 100644 --- a/MP.Land/appsettings.Production.json +++ b/MP.Land/appsettings.Production.json @@ -1,12 +1,21 @@ { - "DetailedErrors": true, - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft": "Warning", - "Microsoft.Hosting.Lifetime": "Information" + "DetailedErrors": true, + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "Environment": "Steam PROD", + "BaseUrl": "https://iis02.egalware.com/", + "AllowedHosts": "*", + "QrJumpPath": "MP/TAB/jumper?", + "downloadPath": "C:\\Steamware\\installers\\MP", + "appVers": "stable", + "ConnectionStrings": { + "DefaultConnection": "Server=SQL2016DEV;Database=MoonPro;Trusted_Connection=True;MultipleActiveResultSets=true", + "MP.Land": "Server=SQL2016DEV;Database=MoonPro;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=MP.Land;", + "Redis": "localhost:6379,defaultDatabase=1,keepAlive=180,asyncTimeout=5000" } - }, - "Environment": "Steam PROD", - "BaseUrl": "https://iis02.egalware.com/MP/" } \ No newline at end of file diff --git a/MP.Land/appsettings.Staging.json b/MP.Land/appsettings.Staging.json index 31aa23ba..85cfe9d8 100644 --- a/MP.Land/appsettings.Staging.json +++ b/MP.Land/appsettings.Staging.json @@ -8,5 +8,5 @@ } }, "Environment": "Steam DEV", - "BaseUrl": "https://iis01.egalware.com/MP/" + "BaseUrl": "https://iis01.egalware.com/" } \ No newline at end of file diff --git a/MP.Stats/Startup.cs.bak b/MP.Stats/Startup.cs.bak deleted file mode 100644 index bb9ae887..00000000 --- a/MP.Stats/Startup.cs.bak +++ /dev/null @@ -1,74 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Components; -using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.HttpsPolicy; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; -using MP.Stats.Data; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -using Microsoft.AspNetCore.Localization; -using System.Globalization; - -namespace MP.Stats -{ - public class Startup - { - public Startup(IConfiguration configuration) - { - Configuration = configuration; - } - - public IConfiguration Configuration { get; } - - // This method gets called by the runtime. Use this method to add services to the container. - // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 - public void ConfigureServices(IServiceCollection services) - { - services.AddRazorPages(); - services.AddServerSideBlazor(); - services.AddSingleton(); - } - - // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IWebHostEnvironment env) - { - if (env.IsDevelopment()) - { - app.UseDeveloperExceptionPage(); - } - else - { - app.UseExceptionHandler("/Error"); - // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. - app.UseHsts(); - } - - // cultura IT... - var supportedCultures = new[]{ - new CultureInfo("it-IT") - }; - app.UseRequestLocalization(new RequestLocalizationOptions - { - DefaultRequestCulture = new RequestCulture("it-IT"), - SupportedCultures = supportedCultures, - FallBackToParentCultures = false - }); - CultureInfo.DefaultThreadCurrentCulture = CultureInfo.CreateSpecificCulture("it-IT"); - app.UseHttpsRedirection(); - app.UseStaticFiles(); - - app.UseRouting(); - - app.UseEndpoints(endpoints => - { - endpoints.MapBlazorHub(); - endpoints.MapFallbackToPage("/_Host"); - }); - } - } -}