Modifica x recuperare e msotrare cod licenza
This commit is contained in:
@@ -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<AnagraficaOperatori> DbSetAnagOpr { get; set; }
|
||||
public virtual DbSet<UpdMan> DbSetUpdMan { get; set; }
|
||||
|
||||
public virtual DbSet<Vocabolario> DbSetVocabolario { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
@@ -115,8 +115,8 @@ namespace MP.AppAuth.Controllers
|
||||
using (AppAuthContext localDbCtx = new AppAuthContext(_configuration))
|
||||
{
|
||||
dbResult = localDbCtx
|
||||
.DbSetVocabolario
|
||||
.ToList();
|
||||
.DbSetVocabolario
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MP.AppAuth.Controllers
|
||||
{
|
||||
public class MPController
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private static IConfiguration _configuration;
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
public MPController(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
Log.Info("Avviata classe MpController");
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Record x AnagKeyValue
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<Models.AnagKeyValue> AnagKeyValuesGetAll()
|
||||
{
|
||||
List<Models.AnagKeyValue> dbResult = new List<Models.AnagKeyValue>();
|
||||
using (MoonProContext localDbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = localDbCtx
|
||||
.DbSetAnagKeyValues
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
[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
|
||||
}
|
||||
|
||||
@@ -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<MoonProContext> 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<MoonProContext> 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<AnagArticoli> AnagArticolis { get; set; }
|
||||
public virtual DbSet<AnagClassiTempo> AnagClassiTempos { get; set; }
|
||||
public virtual DbSet<AnagKeyValue> AnagKeyValues { get; set; }
|
||||
public virtual DbSet<AnagraficaCausaliScarto> AnagraficaCausaliScartos { get; set; }
|
||||
public virtual DbSet<AnagraficaFlussi> AnagraficaFlussis { get; set; }
|
||||
public virtual DbSet<AnagraficaIngressi> AnagraficaIngressis { get; set; }
|
||||
@@ -34,6 +63,7 @@ namespace MP.AppAuth
|
||||
public virtual DbSet<AnagraficaOperatori> AnagraficaOperatoris { get; set; }
|
||||
public virtual DbSet<Config> Configs { get; set; }
|
||||
public virtual DbSet<DatiMacchine> DatiMacchines { get; set; }
|
||||
public virtual DbSet<AnagKeyValue> DbSetAnagKeyValues { get; set; }
|
||||
public virtual DbSet<FamigliaTipoIngressi> FamigliaTipoIngressis { get; set; }
|
||||
public virtual DbSet<FamiglieMacchine> FamiglieMacchines { get; set; }
|
||||
public virtual DbSet<KeepAlive> 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;");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -170,6 +171,18 @@ namespace MP.Land.Data
|
||||
return await Task.FromResult(dbResult);
|
||||
}
|
||||
|
||||
public async Task<List<AppAuth.Models.AnagKeyValue>> AnagKeyValList()
|
||||
{
|
||||
List<AppAuth.Models.AnagKeyValue> dbResult = new List<AppAuth.Models.AnagKeyValue>();
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<RootNamespace>MP.Land</RootNamespace>
|
||||
<Version>6.14.2111.2415</Version>
|
||||
<Version>6.14.2112.2314</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -3,11 +3,12 @@
|
||||
@using MP.Land.Data
|
||||
@using Microsoft.Extensions.Configuration
|
||||
|
||||
@inject AppAuthService DataService
|
||||
@inject MessageService AppMService
|
||||
@inject IConfiguration Configuration
|
||||
|
||||
<div class="row mx-2">
|
||||
<div class="col-12 col-lg-8 offset-lg-2">
|
||||
<div class="col-12 col-lg-10 offset-lg-1">
|
||||
<div class="card">
|
||||
<div class="card-header text-center">
|
||||
<div class="row">
|
||||
@@ -126,6 +127,9 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer py-1">
|
||||
<span>Chiave licenza: <b>@masterLic()</b></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -135,6 +139,21 @@
|
||||
protected string Titolo = "MAPO System Info";
|
||||
protected string Messaggio = "HW & SW details";
|
||||
protected HwSwInfo currHwSwInfo = HwSwInfo.man(System.Reflection.Assembly.GetExecutingAssembly());
|
||||
|
||||
protected async Task<string> masterLic()
|
||||
{
|
||||
string answ = "-";
|
||||
var akvList = await DataService.AnagKeyValList();
|
||||
var licRecord = akvList
|
||||
.Where(x => x.NomeVar == "MAPO")
|
||||
.FirstOrDefault();
|
||||
if (licRecord != null)
|
||||
{
|
||||
answ = licRecord.ValString;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected string DbNameExample
|
||||
{
|
||||
get
|
||||
@@ -156,6 +175,4 @@
|
||||
}
|
||||
}
|
||||
|
||||
//string connStr = memLayer.ML.confReadString("DbConfConnectionString");
|
||||
//currHwSwInfo = currHwSwInfo;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo gestione Programmi MAPO</i>
|
||||
<h4>Versione: 6.14.2111.2415</h4>
|
||||
<h4>Versione: 6.14.2112.2314</h4>
|
||||
<br />
|
||||
Note di rilascio:
|
||||
<ul>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.14.2111.2415
|
||||
6.14.2112.2314
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.14.2111.2415</version>
|
||||
<version>6.14.2112.2314</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/MP.Land.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
Reference in New Issue
Block a user