Merge branch 'Release/UpdateNLogNadNuget01'
@@ -7,9 +7,9 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
|
||||
<PackageReference Include="NLog" Version="5.1.1" />
|
||||
<PackageReference Include="YamlDotNet" Version="13.0.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="NLog" Version="5.3.3" />
|
||||
<PackageReference Include="YamlDotNet" Version="16.1.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -11,48 +11,57 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<div class="card">
|
||||
<div class="card-header d-flex justify-content-between">
|
||||
<div class="px-1">
|
||||
<h2>INI</h2>
|
||||
@if (!fileOk)
|
||||
{
|
||||
<div class="alert alert-warning">
|
||||
No file found
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="col-4">
|
||||
<div class="card">
|
||||
<div class="card-header d-flex justify-content-between">
|
||||
<div class="px-1">
|
||||
<h2>INI</h2>
|
||||
</div>
|
||||
<div class="px-1">
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-1">
|
||||
<div class="card-body small textConsensed">
|
||||
<p>@confINI</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body small textConsensed">
|
||||
<p>@confINI</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="card">
|
||||
<div class="card-header d-flex justify-content-between">
|
||||
<div class="px-1">
|
||||
<h2>JSON</h2>
|
||||
<div class="col-4">
|
||||
<div class="card">
|
||||
<div class="card-header d-flex justify-content-between">
|
||||
<div class="px-1">
|
||||
<h2>JSON</h2>
|
||||
</div>
|
||||
<div class="px-1">
|
||||
<button class="btn btn-sm btn-primary" @onclick="() => SaveJson()">Save Json</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-1">
|
||||
<button class="btn btn-sm btn-primary" @onclick="() => SaveJson()">Save Json</button>
|
||||
<div class="card-body small textConsensed">
|
||||
<p>@confJson</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body small textConsensed">
|
||||
<p>@confJson</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="card">
|
||||
<div class="card-header d-flex justify-content-between">
|
||||
<div class="px-1">
|
||||
<h2>YAML</h2>
|
||||
<div class="col-4">
|
||||
<div class="card">
|
||||
<div class="card-header d-flex justify-content-between">
|
||||
<div class="px-1">
|
||||
<h2>YAML</h2>
|
||||
</div>
|
||||
<div class="px-1">
|
||||
<button class="btn btn-sm btn-primary" @onclick="() => SaveYaml()">Save Yaml</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-1">
|
||||
<button class="btn btn-sm btn-primary" @onclick="() => SaveYaml()">Save Yaml</button>
|
||||
<div class="card-body small textConsensed">
|
||||
<p>@confYaml</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body small textConsensed">
|
||||
<p>@confYaml</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@@ -7,15 +7,23 @@ namespace IobConf.UI.Components
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
public async Task LoadINI()
|
||||
public void LoadINI()
|
||||
{
|
||||
checkOutDir();
|
||||
await Task.Delay(1);
|
||||
rawFileContent = File.ReadAllText(iniPath);
|
||||
confINI=getMarkup(rawFileContent);
|
||||
CurrentConf = IobConfTree.LoadFromINI(iniPath);
|
||||
updateConf();
|
||||
if (File.Exists(iniPath))
|
||||
{
|
||||
fileOk = true;
|
||||
rawFileContent = File.ReadAllText(iniPath);
|
||||
confINI = getMarkup(rawFileContent);
|
||||
CurrentConf = IobConfTree.LoadFromINI(iniPath);
|
||||
updateConf();
|
||||
}
|
||||
else
|
||||
{
|
||||
fileOk = false;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task SaveJson()
|
||||
{
|
||||
checkOutDir();
|
||||
@@ -32,13 +40,33 @@ namespace IobConf.UI.Components
|
||||
CurrentConf.SaveYaml(fileName);
|
||||
}
|
||||
|
||||
private void updateConf()
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected MarkupString confINI { get; set; }
|
||||
protected MarkupString confJson { get; set; }
|
||||
protected MarkupString confYaml { get; set; }
|
||||
protected IobConfTree CurrentConf { get; set; } = new IobConfTree();
|
||||
protected bool fileOk { get; set; } = false;
|
||||
|
||||
protected string iniPath
|
||||
{
|
||||
// aggiorno conf JSON/YAML
|
||||
confJson = getMarkup(CurrentConf.GetJson());
|
||||
confYaml = getMarkup(CurrentConf.GetYaml());
|
||||
get => _iniPath;
|
||||
set
|
||||
{
|
||||
if (!iniPath.Equals(value))
|
||||
{
|
||||
_iniPath = value;
|
||||
LoadINI();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// Converte la stringa in formato markup valido
|
||||
/// </summary>
|
||||
@@ -49,40 +77,26 @@ namespace IobConf.UI.Components
|
||||
return new MarkupString(rawData.Replace("\n", "<br/>").Replace(" ", " "));
|
||||
}
|
||||
|
||||
protected string iniPath = @"C:\temp\DATA\CONF\SIMUL_01.ini";
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected string baseDir = @"c:\temp\IobConf";
|
||||
|
||||
protected string CodIOB = "NewIOB_00";
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected MarkupString confINI { get; set; }
|
||||
protected MarkupString confJson { get; set; }
|
||||
|
||||
protected MarkupString confYaml { get; set; }
|
||||
|
||||
protected string rawFileContent = "";
|
||||
|
||||
protected IobConfTree CurrentConf { get; set; } = new IobConfTree();
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await LoadINI();
|
||||
LoadINI();
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private string _iniPath = @"C:\temp\DATA\CONF\SIMUL_01.ini";
|
||||
|
||||
private string baseDir = @"c:\temp\IobConf";
|
||||
|
||||
private string CodIOB = "NewIOB_00";
|
||||
|
||||
private string rawFileContent = "";
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void checkOutDir()
|
||||
@@ -93,6 +107,13 @@ namespace IobConf.UI.Components
|
||||
}
|
||||
}
|
||||
|
||||
private void updateConf()
|
||||
{
|
||||
// aggiorno conf JSON/YAML
|
||||
confJson = getMarkup(CurrentConf.GetJson());
|
||||
confYaml = getMarkup(CurrentConf.GetYaml());
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,10 @@
|
||||
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS04.pubxml" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NLog.Web.AspNetCore" Version="5.3.12" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\IobConf.Core\IobConf.Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
|
||||
autoReload="true"
|
||||
throwExceptions="false"
|
||||
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log">
|
||||
|
||||
<variable name="logDir" value="${basedir}/logs"/>
|
||||
<targets>
|
||||
<target xsi:type="File"
|
||||
name="f_base"
|
||||
fileName="${logDir}/${var:codIOB:default=0000}/${shortdate}.log"
|
||||
layout="${longdate} [${uppercase:${level}}] ${logger:shortName=true}|${message}"
|
||||
archiveFileName="${logDir}/${var:codIOB:default=0000}/${shortdate}.{###}.log"
|
||||
archiveNumbering="Sequence"
|
||||
archiveAboveSize="10240000"
|
||||
maxArchiveFiles="90"
|
||||
enableArchiveFileCompression="false"
|
||||
keepFileOpen="false"
|
||||
/>
|
||||
<target xsi:type="File"
|
||||
name="f_error"
|
||||
fileName="${logDir}/${var:codIOB:default=0000}/${shortdate}_err.log"
|
||||
layout="${longdate} [${uppercase:${level}}] ${logger:shortName=true}|${message}${newline}${exception:format=tostring}"
|
||||
archiveFileName="${logDir}/${var:codIOB:default=0000}/${shortdate}_err.{###}.log"
|
||||
archiveNumbering="Sequence"
|
||||
archiveAboveSize="10240000"
|
||||
maxArchiveFiles="90"
|
||||
enableArchiveFileCompression="false"
|
||||
keepFileOpen="false"
|
||||
/>
|
||||
</targets>
|
||||
<rules>
|
||||
<!-- Logging Levels (Trace, Debug, Info, Warn, Error, Fatal)-->
|
||||
<logger name="*" minlevel="Trace" maxlevel="Warn" final="true" writeTo="f_base" />
|
||||
<logger name="*" minlevel="Error" writeTo="f_error" />
|
||||
</rules>
|
||||
</nlog>
|
||||
@@ -19,10 +19,5 @@ namespace IobConf.UI.Pages
|
||||
{
|
||||
public partial class Converter
|
||||
{
|
||||
private int currentCount = 0;
|
||||
private void IncrementCount()
|
||||
{
|
||||
currentCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,16 @@
|
||||
using IobConf.UI.Data;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using NLog;
|
||||
using NLog.Web;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
var logger = LogManager.Setup()
|
||||
.LoadConfigurationFromAppSettings()
|
||||
.GetCurrentClassLogger();
|
||||
logger.Info("Program.cs: startup");
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddRazorPages();
|
||||
builder.Services.AddServerSideBlazor();
|
||||
@@ -28,4 +35,5 @@ app.UseRouting();
|
||||
app.MapBlazorHub();
|
||||
app.MapFallbackToPage("/_Host");
|
||||
|
||||
logger.Info("Run App");
|
||||
app.Run();
|
||||
|
||||
@@ -5,5 +5,48 @@
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
"AllowedHosts": "*",
|
||||
"NLog": {
|
||||
"variables": {
|
||||
"baseFileDir": "${basedir}/logs/",
|
||||
"layout": "${longdate} | ${uppercase:${level}} | ${logger:shortName=false} | ${message}"
|
||||
},
|
||||
// "internalLogLevel": "Info",
|
||||
// "internalLogFile": "c:\\temp\\internal-nlog.txt",
|
||||
"extensions": [
|
||||
{ "assembly": "NLog.Extensions.Logging" },
|
||||
{ "assembly": "NLog.Web.AspNetCore" }
|
||||
],
|
||||
"throwConfigExceptions": true,
|
||||
"targets": {
|
||||
"async": true,
|
||||
"logfile": {
|
||||
"type": "File",
|
||||
"fileName": "${basedir}/logs/${shortdate}.log",
|
||||
"archiveEvery": "Day",
|
||||
"archiveFileName": "${basedir}/logs/old/${shortdate}_{#}.log",
|
||||
"archiveNumbering": "DateAndSequence",
|
||||
"archiveAboveSize": "1024000",
|
||||
"archiveDateFormat": "HH",
|
||||
"maxArchiveFiles": "60",
|
||||
"maxArchiveDays": "30"
|
||||
},
|
||||
"logconsole": {
|
||||
"type": "ColoredConsole",
|
||||
"layout": "${longdate} | ${uppercase:${level}} | ${logger:shortName=true} | ${message}"
|
||||
}
|
||||
},
|
||||
"rules": [
|
||||
{
|
||||
"logger": "*",
|
||||
"minLevel": "Trace",
|
||||
"writeTo": "logconsole"
|
||||
},
|
||||
{
|
||||
"logger": "*",
|
||||
"minLevel": "Info",
|
||||
"writeTo": "logfile"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<Version>6.16.2406.508</Version>
|
||||
<Version>6.16.2409.408</Version>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>MP_TAB3</RootNamespace>
|
||||
</PropertyGroup>
|
||||
@@ -25,9 +25,13 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="EgwCoreLib.Razor" Version="1.4.2402.2311" />
|
||||
<PackageReference Include="EgwCoreLib.Utils" Version="1.4.2402.2311" />
|
||||
<PackageReference Include="StackExchange.Redis" Version="2.2.4" />
|
||||
<PackageReference Include="EgwCoreLib.Razor" Version="1.5.2408.2710" />
|
||||
<PackageReference Include="EgwCoreLib.Utils" Version="1.5.2408.2710" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components" Version="6.0.33" />
|
||||
<PackageReference Include="NLog" Version="5.3.3" />
|
||||
<PackageReference Include="NLog.Web.AspNetCore" Version="5.3.12" />
|
||||
<PackageReference Include="StackExchange.Redis" Version="2.8.0" />
|
||||
<PackageReference Include="System.Text.Encodings.Web" Version="6.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
|
||||
autoReload="true"
|
||||
throwExceptions="false"
|
||||
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log">
|
||||
|
||||
<!-- optional, add some variables
|
||||
https://github.com/nlog/NLog/wiki/Configuration-file#variables
|
||||
-->
|
||||
<variable name="myvar" value="myvalue" />
|
||||
|
||||
<!--
|
||||
See https://github.com/nlog/nlog/wiki/Configuration-file
|
||||
for information on customizing logging rules and outputs.
|
||||
-->
|
||||
<targets>
|
||||
|
||||
<!--
|
||||
add your targets here
|
||||
See https://github.com/nlog/NLog/wiki/Targets for possible targets.
|
||||
See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers.
|
||||
-->
|
||||
|
||||
<!--
|
||||
Write events to a file with the date in the filename.
|
||||
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
|
||||
layout="${longdate} ${uppercase:${level}} ${message}" />
|
||||
-->
|
||||
<target xsi:type="File" name="fileTarget" fileName="${basedir}/logs/${shortdate}.log" layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=false} | ${message}" />
|
||||
<target xsi:type="ColoredConsole" name="consoleTarget" layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=true} | ${message}" />
|
||||
</targets>
|
||||
|
||||
<rules>
|
||||
<!-- add your logging rules here -->
|
||||
|
||||
<!--
|
||||
Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f"
|
||||
<logger name="*" minlevel="Debug" writeTo="f" />
|
||||
-->
|
||||
<!--<logger name="*" minlevel="Info" writeTo="consoleTarget" />-->
|
||||
<logger name="*" minlevel="Trace" writeTo="consoleTarget" />
|
||||
<logger name="*" minlevel="Info" writeTo="fileTarget" />
|
||||
</rules>
|
||||
</nlog>
|
||||
@@ -6,14 +6,21 @@ using Microsoft.AspNetCore.StaticFiles;
|
||||
using Microsoft.Extensions.FileProviders;
|
||||
using MP.Data;
|
||||
using MP.Data.Services;
|
||||
using NLog;
|
||||
using NLog.Web;
|
||||
using StackExchange.Redis;
|
||||
using static Org.BouncyCastle.Math.EC.ECCurve;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
var logger = LogManager.Setup()
|
||||
.LoadConfigurationFromAppSettings()
|
||||
.GetCurrentClassLogger();
|
||||
logger.Info("Program.cs: startup");
|
||||
|
||||
ConfigurationManager configuration = builder.Configuration;
|
||||
// REDIS setup
|
||||
logger.Info("Setup REDIS");
|
||||
var cString = configuration.GetConnectionString("Redis");
|
||||
string connStringRedis = cString ?? "localhost:6379, DefaultDatabase=5, connectTimeout=5000, syncTimeout=5000, asyncTimeout=5000, abortConnect=false, ssl=false";
|
||||
//string redisSrvAddr = connStringRedis.Substring(0, connStringRedis.IndexOf(":"));
|
||||
@@ -44,6 +51,7 @@ builder.Services.AddScoped<MailService>();
|
||||
|
||||
builder.Services.AddHttpContextAccessor();
|
||||
|
||||
logger.Info("Aggiunti services");
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
@@ -79,9 +87,12 @@ if (!string.IsNullOrEmpty(BasePathDisegni))
|
||||
}
|
||||
}
|
||||
|
||||
logger.Info("Add disegni path");
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
app.MapBlazorHub();
|
||||
app.MapFallbackToPage("/_Host");
|
||||
|
||||
logger.Info("Run App");
|
||||
app.Run();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MAPOSPEC </i>
|
||||
<h4>Versione: 6.16.2406.508</h4>
|
||||
<h4>Versione: 6.16.2409.408</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2406.508
|
||||
6.16.2409.408
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2406.508</version>
|
||||
<version>6.16.2409.408</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/MP-TAB3.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
@@ -15,6 +15,49 @@
|
||||
"MP.Tab": "Server=SQL2016DEV;Database=MoonPro; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.TAB3;",
|
||||
"MP.Mag": "Server=SQL2016DEV;Database=MoonPro_MAG; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.TAB3;"
|
||||
},
|
||||
"NLog": {
|
||||
"variables": {
|
||||
"baseFileDir": "${basedir}/logs/",
|
||||
"layout": "${longdate} | ${uppercase:${level}} | ${logger:shortName=false} | ${message}"
|
||||
},
|
||||
// "internalLogLevel": "Info",
|
||||
// "internalLogFile": "c:\\temp\\internal-nlog.txt",
|
||||
"extensions": [
|
||||
{ "assembly": "NLog.Extensions.Logging" },
|
||||
{ "assembly": "NLog.Web.AspNetCore" }
|
||||
],
|
||||
"throwConfigExceptions": true,
|
||||
"targets": {
|
||||
"async": true,
|
||||
"logfile": {
|
||||
"type": "File",
|
||||
"fileName": "${basedir}/logs/${shortdate}.log",
|
||||
"archiveEvery": "Day",
|
||||
"archiveFileName": "${basedir}/logs/old/${shortdate}_{#}.log",
|
||||
"archiveNumbering": "DateAndSequence",
|
||||
"archiveAboveSize": "1024000",
|
||||
"archiveDateFormat": "HH",
|
||||
"maxArchiveFiles": "60",
|
||||
"maxArchiveDays": "30"
|
||||
},
|
||||
"logconsole": {
|
||||
"type": "ColoredConsole",
|
||||
"layout": "${longdate} | ${uppercase:${level}} | ${logger:shortName=true} | ${message}"
|
||||
}
|
||||
},
|
||||
"rules": [
|
||||
{
|
||||
"logger": "*",
|
||||
"minLevel": "Trace",
|
||||
"writeTo": "logconsole"
|
||||
},
|
||||
{
|
||||
"logger": "*",
|
||||
"minLevel": "Info",
|
||||
"writeTo": "logfile"
|
||||
}
|
||||
]
|
||||
},
|
||||
"OptConf": {
|
||||
"msRefresh": "1100",
|
||||
"CodModulo": "MP-TAB3",
|
||||
|
||||
@@ -59,6 +59,8 @@ namespace MP.AppAuth
|
||||
public virtual DbSet<Gruppi2Operatori> DbSetGruppi2Oper { get; set; }
|
||||
public virtual DbSet<UpdMan> DbSetUpdMan { get; set; }
|
||||
public virtual DbSet<VocabolarioModel> DbSetVocabolario { get; set; }
|
||||
public virtual DbSet<PermessiModel> DbSetPermessi { get; set; } = null!;
|
||||
public virtual DbSet<Permessi2FunzioneModel> DbSetPermessi2Funzione { get; set; } = null!;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
@@ -134,6 +136,72 @@ namespace MP.AppAuth
|
||||
entity.Property(e => e.CodGruppo).HasMaxLength(50);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<PermessiModel>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.CodPermesso);
|
||||
|
||||
entity.ToTable("Permessi");
|
||||
|
||||
entity.Property(e => e.CodPermesso)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("COD_PERMESSO")
|
||||
.UseCollation("Latin1_General_CI_AS");
|
||||
|
||||
entity.Property(e => e.Descrizione)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("DESCRIZIONE")
|
||||
.UseCollation("Latin1_General_CI_AS");
|
||||
|
||||
entity.Property(e => e.Gruppo).HasColumnName("GRUPPO");
|
||||
|
||||
entity.Property(e => e.Nome)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("NOME")
|
||||
.UseCollation("Latin1_General_CI_AS");
|
||||
|
||||
entity.Property(e => e.Numero).HasColumnName("NUMERO");
|
||||
|
||||
entity.Property(e => e.Url)
|
||||
.HasMaxLength(250)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("URL")
|
||||
.UseCollation("Latin1_General_CI_AS");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Permessi2FunzioneModel>(entity =>
|
||||
{
|
||||
entity.HasKey(e => new { e.CodPermesso, e.CodFunzione });
|
||||
|
||||
entity.ToTable("Permessi2Funzione");
|
||||
|
||||
entity.Property(e => e.CodPermesso)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("COD_PERMESSO")
|
||||
.UseCollation("Latin1_General_CI_AS");
|
||||
|
||||
entity.Property(e => e.CodFunzione)
|
||||
.HasMaxLength(31)
|
||||
.HasColumnName("COD_FUNZIONE")
|
||||
.UseCollation("Latin1_General_CI_AS");
|
||||
|
||||
entity.Property(e => e.Readwrite)
|
||||
.HasMaxLength(1)
|
||||
.IsUnicode(false)
|
||||
.HasColumnName("READWRITE")
|
||||
.IsFixedLength()
|
||||
.UseCollation("Latin1_General_CI_AS");
|
||||
|
||||
entity.HasOne(d => d.PermessiNav)
|
||||
.WithMany(p => p.Permessi2FunzioneNav)
|
||||
.HasForeignKey(d => d.CodPermesso)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("FK_Permessi2Funzione_Permessi");
|
||||
});
|
||||
|
||||
//
|
||||
modelBuilder.Seed();
|
||||
|
||||
|
||||
@@ -11,14 +11,6 @@ namespace MP.AppAuth.Controllers
|
||||
{
|
||||
public class AppAuthController : IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private static IConfiguration _configuration;
|
||||
private static AppAuthContext dbCtx;
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
public AppAuthController(IConfiguration configuration)
|
||||
@@ -48,6 +40,7 @@ namespace MP.AppAuth.Controllers
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Record x Gruppi
|
||||
/// </summary>
|
||||
@@ -64,28 +57,6 @@ namespace MP.AppAuth.Controllers
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
public List<AnagraficaOperatori> AnagOpGetAll(string searchVal)
|
||||
{
|
||||
List<AnagraficaOperatori> dbResult = new List<AnagraficaOperatori>();
|
||||
using (AppAuthContext localDbCtx = new AppAuthContext(_configuration))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(searchVal))
|
||||
{
|
||||
dbResult = localDbCtx
|
||||
.DbSetAnagOpr
|
||||
.Where(x => x.Cognome.Contains(searchVal) || x.Nome.Contains(searchVal))
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
dbResult = localDbCtx
|
||||
.DbSetAnagOpr
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
// ritorno
|
||||
return dbResult;
|
||||
}
|
||||
public List<AnagraficaOperatori> AnagOpByGruppoGetFilt(string codGruppo, string searchVal)
|
||||
{
|
||||
List<AnagraficaOperatori> dbResult = new List<AnagraficaOperatori>();
|
||||
@@ -122,12 +93,106 @@ namespace MP.AppAuth.Controllers
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
public List<AnagraficaOperatori> AnagOpGetAll(string searchVal)
|
||||
{
|
||||
List<AnagraficaOperatori> dbResult = new List<AnagraficaOperatori>();
|
||||
using (AppAuthContext localDbCtx = new AppAuthContext(_configuration))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(searchVal))
|
||||
{
|
||||
dbResult = localDbCtx
|
||||
.DbSetAnagOpr
|
||||
.Where(x => x.Cognome.Contains(searchVal) || x.Nome.Contains(searchVal))
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
dbResult = localDbCtx
|
||||
.DbSetAnagOpr
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
// ritorno
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Clear database context
|
||||
dbCtx.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco completo permessi2funzione
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<Permessi2FunzioneModel> Permessi2FunzioneGetAll()
|
||||
{
|
||||
List<Permessi2FunzioneModel> dbResult = new List<Permessi2FunzioneModel>();
|
||||
using (AppAuthContext dbCtx = new AppAuthContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetPermessi2Funzione
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco permessi2funzione filtrato x elenco funzioni
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<Permessi2FunzioneModel> Permessi2FunzioneGetFilt(List<string> FunList)
|
||||
{
|
||||
List<Permessi2FunzioneModel> dbResult = new List<Permessi2FunzioneModel>();
|
||||
using (AppAuthContext dbCtx = new AppAuthContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetPermessi2Funzione
|
||||
.Where(x => FunList.Contains(x.CodFunzione))
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco completo permessi
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<PermessiModel> PermessiGetAll()
|
||||
{
|
||||
List<PermessiModel> dbResult = new List<PermessiModel>();
|
||||
using (AppAuthContext dbCtx = new AppAuthContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetPermessi
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco permessi dato elenco funzioni
|
||||
/// </summary>
|
||||
/// <param name="ListCodFun"></param>
|
||||
/// <returns></returns>
|
||||
public List<PermessiModel> PermessiGetByFunc(List<string> ListCodFun)
|
||||
{
|
||||
List<PermessiModel> dbResult = new List<PermessiModel>();
|
||||
using (AppAuthContext dbCtx = new AppAuthContext(_configuration))
|
||||
{
|
||||
var listPer = PermessiGetAll();
|
||||
var listP2F = Permessi2FunzioneGetFilt(ListCodFun);
|
||||
|
||||
var query = from permesso in listPer
|
||||
join p2f in listP2F on permesso.CodPermesso equals p2f.CodPermesso
|
||||
select permesso;
|
||||
|
||||
dbResult = query.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
public void ResetController()
|
||||
{
|
||||
dbCtx = new AppAuthContext(_configuration);
|
||||
@@ -190,5 +255,13 @@ namespace MP.AppAuth.Controllers
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static IConfiguration _configuration;
|
||||
private static AppAuthContext dbCtx;
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
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.Controllers
|
||||
{
|
||||
public class MPUserController : IDisposable
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public MPUserController(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
Log.Info("Avviata classe MPUserController");
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Diritti utente da modulo
|
||||
/// </summary>
|
||||
/// <param name="UserName">UserName cercato</param>
|
||||
/// <param name="Modulo">Modulo desiderato, se "" allora tutti i diritti</param>
|
||||
/// <returns></returns>
|
||||
public List<UserDirittiModel> DirittiUtente(string UserName, string Modulo)
|
||||
{
|
||||
List<UserDirittiModel> dbResult = new List<UserDirittiModel>();
|
||||
using (UserAuthContext dbCtx = new UserAuthContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetUserDiritti
|
||||
.Where(x => x.UserName == UserName && (string.IsNullOrEmpty(Modulo) || x.Modulo == Modulo))
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
GC.Collect();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static IConfiguration _configuration = null!;
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -46,13 +46,6 @@ namespace MP.AppAuth
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Singleton!
|
||||
/// </summary>
|
||||
public static HwSwInfo man = new HwSwInfo();
|
||||
#endif
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="NLog" Version="5.0.4" />
|
||||
<PackageReference Include="NLog" Version="5.3.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MP.AppAuth.Models
|
||||
{
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
[Table("Permessi2Funzione")]
|
||||
public partial class Permessi2FunzioneModel
|
||||
{
|
||||
public string CodPermesso { get; set; } = null!;
|
||||
public string CodFunzione { get; set; } = null!;
|
||||
public string? Readwrite { get; set; }
|
||||
|
||||
public virtual PermessiModel PermessiNav { get; set; } = null!;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MP.AppAuth.Models
|
||||
{
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
[Table("Permessi")]
|
||||
public partial class PermessiModel
|
||||
{
|
||||
public PermessiModel()
|
||||
{
|
||||
Permessi2FunzioneNav = new HashSet<Permessi2FunzioneModel>();
|
||||
}
|
||||
|
||||
public string CodPermesso { get; set; } = null!;
|
||||
public string Url { get; set; } = null!;
|
||||
public int? Gruppo { get; set; }
|
||||
public int? Numero { get; set; }
|
||||
public string? Nome { get; set; }
|
||||
public string? Descrizione { get; set; }
|
||||
|
||||
public virtual ICollection<Permessi2FunzioneModel> Permessi2FunzioneNav { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MP.AppAuth.Models
|
||||
{
|
||||
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
[Table("DIRITTI")]
|
||||
public partial class UserDirittiModel
|
||||
{
|
||||
[Column("USER_NAME"), MaxLength(50)]
|
||||
public string UserName { get; set; } = "";
|
||||
[Column("COD_CDC"), MaxLength(50)]
|
||||
public string CdC { get; set; } = "";
|
||||
[Column("COD_MODULO"), MaxLength(31)]
|
||||
public string Modulo { get; set; } = "";
|
||||
[Column("COD_FUNZIONE"), MaxLength(31)]
|
||||
public string Funzione { get; set; } = "";
|
||||
[Column("VALUE"), MaxLength(255)]
|
||||
public string? Valore { get; set; } = "";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using MP.AppAuth.Models;
|
||||
using NLog;
|
||||
using NLog.Fluent;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MP.AppAuth
|
||||
{
|
||||
public partial class UserAuthContext : DbContext
|
||||
{
|
||||
#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 UserAuthContext()
|
||||
{
|
||||
}
|
||||
|
||||
public UserAuthContext(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 UserAuthContext(DbContextOptions<AppAuthContext> 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
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
if (!optionsBuilder.IsConfigured)
|
||||
{
|
||||
string connString = _configuration.GetConnectionString("MP.Land.Auth");
|
||||
if (!string.IsNullOrEmpty(connString))
|
||||
{
|
||||
optionsBuilder.UseSqlServer(connString);
|
||||
}
|
||||
else
|
||||
{
|
||||
optionsBuilder.UseSqlServer("Server=SQL2016DEV;Database=MoonPro_Anagrafica;Trusted_Connection=True;");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public virtual DbSet<UserDirittiModel> DbSetUserDiritti { get; set; } = null!;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<UserDirittiModel>(entity =>
|
||||
{
|
||||
entity.HasKey(e => new { e.UserName, e.CdC, e.Modulo, e.Funzione });
|
||||
|
||||
entity.ToTable("DIRITTI");
|
||||
});
|
||||
|
||||
OnModelCreatingPartial(modelBuilder);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private IConfiguration _configuration;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Methods
|
||||
|
||||
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -207,7 +207,7 @@ namespace MP.Data.Controllers
|
||||
dbResult = dbCtx
|
||||
.DbSetArticoli
|
||||
.AsNoTracking()
|
||||
.Where(x => (azienda == "*" || x.Azienda.Equals(azienda, StringComparison.InvariantCultureIgnoreCase)) && (string.IsNullOrEmpty(searchVal) || x.CodArticolo.Contains(searchVal) || x.DescArticolo.Contains(searchVal) || x.Disegno.Contains(searchVal)))
|
||||
.Where(x => (azienda == "*" || x.Azienda.ToLower().Equals(azienda.ToLower())) && (string.IsNullOrEmpty(searchVal) || x.CodArticolo.Contains(searchVal) || x.DescArticolo.Contains(searchVal) || x.Disegno.Contains(searchVal)))
|
||||
.OrderBy(x => x.CodArticolo)
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
|
||||
@@ -18,22 +18,22 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Blazored.LocalStorage" Version="4.3.0" />
|
||||
<PackageReference Include="Blazored.LocalStorage" Version="4.5.0" />
|
||||
<PackageReference Include="Blazored.SessionStorage" Version="2.4.0" />
|
||||
<PackageReference Include="EgwCoreLib.Utils" Version="1.4.2310.2417" />
|
||||
<PackageReference Include="MailKit" Version="4.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Http.Connections.Common" Version="6.0.24" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.9" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.9" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.9" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.9">
|
||||
<PackageReference Include="EgwCoreLib.Utils" Version="1.5.2408.2710" />
|
||||
<PackageReference Include="MailKit" Version="4.7.1.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Http.Connections.Common" Version="6.0.33" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.33" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.33" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.33" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.33">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="6.0.9" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="6.0.0" />
|
||||
<PackageReference Include="MongoDB.Driver" Version="2.19.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="NLog" Version="5.1.1" />
|
||||
<PackageReference Include="NLog" Version="5.3.3" />
|
||||
<PackageReference Include="StackExchange.Redis" Version="2.8.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -6,20 +6,19 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DiffMatchPatch" Version="1.0.3" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.13" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.13">
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.33" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.33">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.13" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.13" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.13">
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.33" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.33" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.33">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="6.0.13" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
|
||||
<PackageReference Include="NLog" Version="5.1.1" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="NLog" Version="5.3.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -6,6 +6,7 @@ using StackExchange.Redis;
|
||||
using System.Diagnostics;
|
||||
using EgwCoreLib.Razor;
|
||||
using EgwCoreLib.Razor.Data;
|
||||
using EgwCoreLib.Utils;
|
||||
|
||||
namespace MP.INVE.Data
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>MP.INVE</RootNamespace>
|
||||
<Version>6.16.2402.1914</Version>
|
||||
<Version>6.16.2409.408</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -21,11 +21,14 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Blazored.LocalStorage" Version="4.3.0" />
|
||||
<PackageReference Include="Blazored.LocalStorage" Version="4.5.0" />
|
||||
<PackageReference Include="Blazored.SessionStorage" Version="2.4.0" />
|
||||
<PackageReference Include="EgwCoreLib.Razor" Version="1.3.2302.507" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.Negotiate" Version="6.0.9" />
|
||||
<PackageReference Include="EgwCoreLib.Razor" Version="1.5.2408.2710" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.Negotiate" Version="6.0.33" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components" Version="6.0.33" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="NLog.Web.AspNetCore" Version="5.3.12" />
|
||||
<PackageReference Include="System.Text.Encodings.Web" Version="6.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
|
||||
autoReload="true"
|
||||
throwExceptions="false"
|
||||
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log">
|
||||
|
||||
<!-- optional, add some variables
|
||||
https://github.com/nlog/NLog/wiki/Configuration-file#variables
|
||||
-->
|
||||
<variable name="myvar" value="myvalue" />
|
||||
|
||||
<!--
|
||||
See https://github.com/nlog/nlog/wiki/Configuration-file
|
||||
for information on customizing logging rules and outputs.
|
||||
-->
|
||||
<targets>
|
||||
|
||||
<!--
|
||||
add your targets here
|
||||
See https://github.com/nlog/NLog/wiki/Targets for possible targets.
|
||||
See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers.
|
||||
-->
|
||||
|
||||
<!--
|
||||
Write events to a file with the date in the filename.
|
||||
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
|
||||
layout="${longdate} ${uppercase:${level}} ${message}" />
|
||||
-->
|
||||
<target xsi:type="File" name="fileTarget" fileName="${basedir}/logs/${shortdate}.log" layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=false} | ${message}" />
|
||||
<target xsi:type="ColoredConsole" name="consoleTarget" layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=true} | ${message}" />
|
||||
</targets>
|
||||
|
||||
<rules>
|
||||
<!-- add your logging rules here -->
|
||||
|
||||
<!--
|
||||
Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f"
|
||||
<logger name="*" minlevel="Debug" writeTo="f" />
|
||||
-->
|
||||
<logger name="*" minlevel="Trace" writeTo="consoleTarget" />
|
||||
<!--<logger name="Microsoft.*" maxlevel="Info" final="true" />-->
|
||||
<logger name="*" minlevel="Info" writeTo="fileTarget" />
|
||||
</rules>
|
||||
</nlog>
|
||||
@@ -6,6 +6,8 @@ using Microsoft.AspNetCore.Components.Web;
|
||||
using MP.INVE.Components;
|
||||
using MP.INVE.Data;
|
||||
using MP.INVE.Services;
|
||||
using NLog;
|
||||
using NLog.Web;
|
||||
using StackExchange.Redis;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
@@ -18,9 +20,16 @@ var builder = WebApplication.CreateBuilder(args);
|
||||
*
|
||||
* */
|
||||
|
||||
|
||||
var logger = LogManager.Setup()
|
||||
.LoadConfigurationFromAppSettings()
|
||||
.GetCurrentClassLogger();
|
||||
logger.Info("Program.cs: startup");
|
||||
|
||||
ConfigurationManager configuration = builder.Configuration;
|
||||
|
||||
// REDIS setup
|
||||
logger.Info("Setup REDIS");
|
||||
string connStringRedis = configuration.GetConnectionString("Redis");
|
||||
string redisSrvAddr = connStringRedis.Substring(0, connStringRedis.IndexOf(":"));
|
||||
// avvio oggetto shared x redis...
|
||||
@@ -41,6 +50,8 @@ builder.Services.AddBlazoredLocalStorage();
|
||||
builder.Services.AddHttpClient();
|
||||
builder.Services.AddSingleton<IOApiService>();
|
||||
|
||||
logger.Info("Aggiunti services");
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
@@ -60,4 +71,5 @@ app.UseRouting();
|
||||
app.MapBlazorHub();
|
||||
app.MapFallbackToPage("/_Host");
|
||||
|
||||
logger.Info("Run App");
|
||||
app.Run();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MAPOINVE </i>
|
||||
<h4>Versione: 6.16.2402.1914</h4>
|
||||
<h4>Versione: 6.16.2409.408</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2402.1914
|
||||
6.16.2409.408
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2402.1914</version>
|
||||
<version>6.16.2409.408</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/MP.INVE.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
@@ -5,6 +5,49 @@
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"NLog": {
|
||||
"variables": {
|
||||
"baseFileDir": "${basedir}/logs/",
|
||||
"layout": "${longdate} | ${uppercase:${level}} | ${logger:shortName=false} | ${message}"
|
||||
},
|
||||
// "internalLogLevel": "Info",
|
||||
// "internalLogFile": "c:\\temp\\internal-nlog.txt",
|
||||
"extensions": [
|
||||
{ "assembly": "NLog.Extensions.Logging" },
|
||||
{ "assembly": "NLog.Web.AspNetCore" }
|
||||
],
|
||||
"throwConfigExceptions": true,
|
||||
"targets": {
|
||||
"async": true,
|
||||
"logfile": {
|
||||
"type": "File",
|
||||
"fileName": "${basedir}/logs/${shortdate}.log",
|
||||
"archiveEvery": "Day",
|
||||
"archiveFileName": "${basedir}/logs/old/${shortdate}_{#}.log",
|
||||
"archiveNumbering": "DateAndSequence",
|
||||
"archiveAboveSize": "1024000",
|
||||
"archiveDateFormat": "HH",
|
||||
"maxArchiveFiles": "60",
|
||||
"maxArchiveDays": "30"
|
||||
},
|
||||
"logconsole": {
|
||||
"type": "ColoredConsole",
|
||||
"layout": "${longdate} | ${uppercase:${level}} | ${logger:shortName=true} | ${message}"
|
||||
}
|
||||
},
|
||||
"rules": [
|
||||
{
|
||||
"logger": "*",
|
||||
"minLevel": "Trace",
|
||||
"writeTo": "logconsole"
|
||||
},
|
||||
{
|
||||
"logger": "*",
|
||||
"minLevel": "Info",
|
||||
"writeTo": "logfile"
|
||||
}
|
||||
]
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"CodApp": "MP.INVE",
|
||||
"ConnectionStrings": {
|
||||
|
||||
@@ -22,9 +22,10 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NLog" Version="5.1.1" />
|
||||
<PackageReference Include="StackExchange.Redis" Version="2.6.90" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
|
||||
<PackageReference Include="NLog" Version="5.3.3" />
|
||||
<PackageReference Include="NLog.Web.AspNetCore" Version="5.3.12" />
|
||||
<PackageReference Include="StackExchange.Redis" Version="2.8.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.7.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,9 +1,16 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using MP.IOC.Data;
|
||||
using NLog;
|
||||
using NLog.Web;
|
||||
using StackExchange.Redis;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
var logger = LogManager.Setup()
|
||||
.LoadConfigurationFromAppSettings()
|
||||
.GetCurrentClassLogger();
|
||||
logger.Info("Program.cs: startup");
|
||||
|
||||
// Add services to the container.
|
||||
|
||||
builder.Services.AddControllers();
|
||||
@@ -13,6 +20,7 @@ builder.Services.AddSwaggerGen();
|
||||
|
||||
ConfigurationManager configuration = builder.Configuration;
|
||||
// REDIS setup
|
||||
logger.Info("Setup REDIS");
|
||||
string connStringRedis = configuration.GetConnectionString("Redis");
|
||||
string redisSrvAddr = connStringRedis.Substring(0, connStringRedis.IndexOf(":"));
|
||||
// avvio oggetto shared x redis...
|
||||
@@ -28,6 +36,7 @@ if (app.Environment.IsDevelopment() || app.Environment.IsStaging())
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI();
|
||||
}
|
||||
logger.Info("Added swagger");
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
@@ -39,4 +48,6 @@ app.UseStaticFiles();
|
||||
|
||||
app.MapControllers();
|
||||
|
||||
logger.Info("Run App");
|
||||
|
||||
app.Run();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MP-IOC </i>
|
||||
<h4>Versione: 6.16.2310.411</h4>
|
||||
<h4>Versione: 6.16.2409.409</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2310.411
|
||||
6.16.2409.409
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2310.411</version>
|
||||
<version>6.16.2409.409</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-IOC/stable/LAST/MP.IOC.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-IOC/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
@@ -5,6 +5,49 @@
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"NLog": {
|
||||
"variables": {
|
||||
"baseFileDir": "${basedir}/logs/",
|
||||
"layout": "${longdate} | ${uppercase:${level}} | ${logger:shortName=false} | ${message}"
|
||||
},
|
||||
// "internalLogLevel": "Info",
|
||||
// "internalLogFile": "c:\\temp\\internal-nlog.txt",
|
||||
"extensions": [
|
||||
{ "assembly": "NLog.Extensions.Logging" },
|
||||
{ "assembly": "NLog.Web.AspNetCore" }
|
||||
],
|
||||
"throwConfigExceptions": true,
|
||||
"targets": {
|
||||
"async": true,
|
||||
"logfile": {
|
||||
"type": "File",
|
||||
"fileName": "${basedir}/logs/${shortdate}.log",
|
||||
"archiveEvery": "Day",
|
||||
"archiveFileName": "${basedir}/logs/old/${shortdate}_{#}.log",
|
||||
"archiveNumbering": "DateAndSequence",
|
||||
"archiveAboveSize": "1024000",
|
||||
"archiveDateFormat": "HH",
|
||||
"maxArchiveFiles": "60",
|
||||
"maxArchiveDays": "30"
|
||||
},
|
||||
"logconsole": {
|
||||
"type": "ColoredConsole",
|
||||
"layout": "${longdate} | ${uppercase:${level}} | ${logger:shortName=true} | ${message}"
|
||||
}
|
||||
},
|
||||
"rules": [
|
||||
{
|
||||
"logger": "*",
|
||||
"minLevel": "Trace",
|
||||
"writeTo": "logconsole"
|
||||
},
|
||||
{
|
||||
"logger": "*",
|
||||
"minLevel": "Info",
|
||||
"writeTo": "logfile"
|
||||
}
|
||||
]
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"CodApp": "MP.IOC",
|
||||
"ConnectionStrings": {
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MP.AppAuth.Controllers;
|
||||
using MP.AppAuth.Models;
|
||||
using Newtonsoft.Json;
|
||||
using NLog;
|
||||
using StackExchange.Redis;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using NLog;
|
||||
using Microsoft.Extensions.Caching.Distributed;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json;
|
||||
using System.Diagnostics.Eventing.Reader;
|
||||
using MP.AppAuth.Models;
|
||||
|
||||
namespace MP.Land.Data
|
||||
{
|
||||
@@ -19,20 +17,36 @@ namespace MP.Land.Data
|
||||
{
|
||||
#region Public Fields
|
||||
|
||||
public static AppAuth.Controllers.AppAuthController dbController;
|
||||
public static AppAuth.Controllers.MPController MpDbController;
|
||||
// diritti (cablòato)
|
||||
public const string RoleSuperAdmin = "MoonPro_SuperAdmin";
|
||||
|
||||
public static AppAuthController dbController;
|
||||
public static MPController MpDbController;
|
||||
public static MPUserController userController;
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
public AppAuthService(IConfiguration configuration, ILogger<AppAuthService> logger, IMemoryCache memoryCache, IDistributedCache distributedCache)
|
||||
public AppAuthService(IConfiguration configuration, ILogger<AppAuthService> logger, IConnectionMultiplexer redisConnMult)
|
||||
{
|
||||
_logger = logger;
|
||||
_configuration = configuration;
|
||||
// conf cache
|
||||
this.memoryCache = memoryCache;
|
||||
this.distributedCache = distributedCache;
|
||||
|
||||
// cod app
|
||||
CodApp = _configuration.GetValue<string>("ServerConf:CodApp");
|
||||
Modulo = _configuration.GetValue<string>("ServerConf:Modulo");
|
||||
|
||||
// Conf cache
|
||||
redisConn = redisConnMult;
|
||||
redisDb = this.redisConn.GetDatabase();
|
||||
|
||||
// json serializer... FIX errore loop circolare https://www.ryadel.com/en/jsonserializationexception-self-referencing-loop-detected-error-fix-entity-framework-asp-net-core/
|
||||
JSSettings = new JsonSerializerSettings()
|
||||
{
|
||||
ReferenceLoopHandling = ReferenceLoopHandling.Ignore
|
||||
};
|
||||
|
||||
// conf DB
|
||||
string connStr = _configuration.GetConnectionString("MP.Land");
|
||||
if (string.IsNullOrEmpty(connStr))
|
||||
@@ -41,8 +55,9 @@ namespace MP.Land.Data
|
||||
}
|
||||
else
|
||||
{
|
||||
dbController = new AppAuth.Controllers.AppAuthController(configuration);
|
||||
MpDbController = new AppAuth.Controllers.MPController(configuration);
|
||||
dbController = new AppAuthController(configuration);
|
||||
MpDbController = new MPController(configuration);
|
||||
userController = new MPUserController(configuration);
|
||||
_logger.LogInformation("DbController OK");
|
||||
}
|
||||
}
|
||||
@@ -200,6 +215,41 @@ namespace MP.Land.Data
|
||||
return await Task.FromResult(answ);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco diritti dato utente
|
||||
/// </summary>
|
||||
/// <param name="UserName"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<UserDirittiModel>> DirittiGetByUser(string UserName)
|
||||
{
|
||||
string source = "DB";
|
||||
List<UserDirittiModel>? dbResult = new List<UserDirittiModel>();
|
||||
string currKey = $"{rKeyDirittiUser}:{UserName}";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
string? rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (!string.IsNullOrEmpty(rawData) && rawData.Length > 2)
|
||||
{
|
||||
source = "REDIS";
|
||||
var tempResult = JsonConvert.DeserializeObject<List<UserDirittiModel>>(rawData);
|
||||
dbResult = tempResult ?? new List<UserDirittiModel>();
|
||||
}
|
||||
else
|
||||
{
|
||||
// recupero diritti utente
|
||||
dbResult = userController.DirittiUtente(UserName, Modulo);
|
||||
rawData = JsonConvert.SerializeObject(dbResult, JSSettings);
|
||||
await redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
|
||||
}
|
||||
if (dbResult == null)
|
||||
{
|
||||
dbResult = new List<UserDirittiModel>();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"DirittiGetByUser | {source} | {sw.ElapsedMilliseconds} ms");
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Clear database controller
|
||||
@@ -207,15 +257,65 @@ namespace MP.Land.Data
|
||||
MpDbController.Dispose();
|
||||
}
|
||||
|
||||
public async Task ResetCache()
|
||||
public async Task FlushRedisCache()
|
||||
{
|
||||
string cacheKey = ":MP:VOCAB";
|
||||
await distributedCache.RemoveAsync(cacheKey);
|
||||
RedisValue pattern = new RedisValue($"{redisBaseAddr}:*");
|
||||
bool answ = await ExecFlushRedisPattern(pattern);
|
||||
// reset in RAM
|
||||
Vocabolario = new Dictionary<string, string>();
|
||||
CheckVoc();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco permessi dato utente
|
||||
/// </summary>
|
||||
/// <param name="UserName"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<PermessiModel>> PermessiGetByUser(string UserName)
|
||||
{
|
||||
string source = "DB";
|
||||
List<PermessiModel>? dbResult = new List<PermessiModel>();
|
||||
string currKey = $"{rKeyPermUser}:{UserName}";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
string? rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (!string.IsNullOrEmpty(rawData))
|
||||
{
|
||||
source = "REDIS";
|
||||
var tempResult = JsonConvert.DeserializeObject<List<PermessiModel>>(rawData);
|
||||
if (tempResult == null)
|
||||
{
|
||||
dbResult = new List<PermessiModel>();
|
||||
}
|
||||
else
|
||||
{
|
||||
dbResult = tempResult;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// recupero diritti utente
|
||||
var userRightList = userController.DirittiUtente(UserName, Modulo);
|
||||
// proietto come funzioni...
|
||||
var ListFunc = userRightList.Select(x => x.Funzione).ToList();
|
||||
// trasformo i permessi utente
|
||||
if (ListFunc == null)
|
||||
{
|
||||
ListFunc = new List<string>();
|
||||
}
|
||||
dbResult = dbController.PermessiGetByFunc(ListFunc);
|
||||
rawData = JsonConvert.SerializeObject(dbResult, JSSettings);
|
||||
await redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
|
||||
}
|
||||
if (dbResult == null)
|
||||
{
|
||||
dbResult = new List<PermessiModel>();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"PermessiGetByUser | {source} | {sw.ElapsedMilliseconds} ms");
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
public string Traduci(string lemma, string lingua = "IT")
|
||||
{
|
||||
string answ = $"__{lemma}__";
|
||||
@@ -295,28 +395,29 @@ namespace MP.Land.Data
|
||||
|
||||
protected void CheckVoc()
|
||||
{
|
||||
string cacheKey = ":MP:VOCAB";
|
||||
string rawData;
|
||||
if (Vocabolario.Count == 0)
|
||||
{
|
||||
var redisDataList = distributedCache.Get(cacheKey);
|
||||
if (redisDataList != null)
|
||||
string source = "DB";
|
||||
string currKey = $"{redisBaseAddr}:MP:VOCAB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
string? rawData = redisDb.StringGet(currKey);
|
||||
if (!string.IsNullOrEmpty(rawData) && rawData.Length > 2)
|
||||
{
|
||||
rawData = Encoding.UTF8.GetString(redisDataList);
|
||||
Vocabolario = JsonConvert.DeserializeObject<Dictionary<string, string>>(rawData);
|
||||
source = "REDIS";
|
||||
var tempResult = JsonConvert.DeserializeObject<Dictionary<string, string>>(rawData);
|
||||
Vocabolario = tempResult ?? new Dictionary<string, string>();
|
||||
}
|
||||
else
|
||||
{
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
Vocabolario = dbController.VocabolarioGetAll().ToDictionary(x => $"{x.Lingua}#{x.Lemma}", x => x.Traduzione);
|
||||
Vocabolario = dbController
|
||||
.VocabolarioGetAll()
|
||||
.ToDictionary(x => $"{x.Lingua}#{x.Lemma}", x => x.Traduzione);
|
||||
rawData = JsonConvert.SerializeObject(Vocabolario);
|
||||
redisDataList = Encoding.UTF8.GetBytes(rawData);
|
||||
distributedCache.Set(cacheKey, redisDataList, cacheOptLong);
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Trace($"Effettuato rilettura da DB + caching per VocabolarioModel: {ts.TotalMilliseconds} ms");
|
||||
redisDb.StringSet(currKey, rawData, UltraLongCache);
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Trace($"Rilettura Vocabolario | {source} | {sw.ElapsedMilliseconds} ms");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -324,28 +425,47 @@ namespace MP.Land.Data
|
||||
|
||||
#region Private Fields
|
||||
|
||||
// gestione key Redis
|
||||
private const string redisBaseAddr = "MP:LAND";
|
||||
|
||||
private const string rKeyDirittiUser = $"{redisBaseAddr}:DIR_USER";
|
||||
|
||||
private const string rKeyPermUser = $"{redisBaseAddr}:PERM_USER";
|
||||
|
||||
private static IConfiguration _configuration;
|
||||
|
||||
private static ILogger<AppAuthService> _logger;
|
||||
|
||||
private static List<Macchine> ElencoMacchine = new List<Macchine>();
|
||||
|
||||
private static JsonSerializerSettings? JSSettings;
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private readonly IDistributedCache distributedCache;
|
||||
|
||||
private readonly IMemoryCache memoryCache;
|
||||
private static string Modulo = "";
|
||||
|
||||
/// <summary>
|
||||
/// Durata assoluta massima della cache
|
||||
/// Durata cache lunga IN SECONDI
|
||||
/// </summary>
|
||||
private int chAbsExp = 15;
|
||||
private int cacheTtlLong = 60 * 5;
|
||||
|
||||
/// <summary>
|
||||
/// Durata della cache in modalità inattiva (non acceduta) prima di venire rimossa NON
|
||||
/// estende oltre il tempo massimo di validità della cache (chAbsExp)
|
||||
/// Durata cache breve IN SECONDI
|
||||
/// </summary>
|
||||
private int chSliExp = 5;
|
||||
private int cacheTtlShort = 60 * 1;
|
||||
|
||||
/// <summary>
|
||||
/// Oggetto per connessione a REDIS
|
||||
/// </summary>
|
||||
private IConnectionMultiplexer redisConn;
|
||||
|
||||
//ISubscriber sub = redis.GetSubscriber();
|
||||
/// <summary>
|
||||
/// Oggetto DB redis da impiegare x chiamate R/W
|
||||
/// </summary>
|
||||
private IDatabase redisDb = null!;
|
||||
|
||||
private Random rnd = new Random();
|
||||
|
||||
private Dictionary<string, string> Vocabolario = new Dictionary<string, string>();
|
||||
|
||||
@@ -353,22 +473,63 @@ namespace MP.Land.Data
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private DistributedCacheEntryOptions cacheOpt
|
||||
private string CodApp { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Durata cache lunga (+ perturbazione percentuale +/-10%)
|
||||
/// </summary>
|
||||
private TimeSpan FastCache
|
||||
{
|
||||
get
|
||||
{
|
||||
return new DistributedCacheEntryOptions().SetAbsoluteExpiration(DateTime.Now.AddMinutes(chAbsExp)).SetSlidingExpiration(TimeSpan.FromMinutes(chSliExp));
|
||||
}
|
||||
get => TimeSpan.FromSeconds(cacheTtlShort * rnd.Next(900, 1100) / 1000);
|
||||
}
|
||||
|
||||
private DistributedCacheEntryOptions cacheOptLong
|
||||
/// <summary>
|
||||
/// Durata cache lunga (+ perturbazione percentuale +/-10%)
|
||||
/// </summary>
|
||||
private TimeSpan LongCache
|
||||
{
|
||||
get
|
||||
{
|
||||
return new DistributedCacheEntryOptions().SetAbsoluteExpiration(DateTime.Now.AddMinutes(chAbsExp * 10)).SetSlidingExpiration(TimeSpan.FromMinutes(chSliExp));
|
||||
}
|
||||
get => TimeSpan.FromSeconds(cacheTtlLong * rnd.Next(900, 1100) / 1000);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Durata cache lunga (+ perturbazione percentuale +/-10%)
|
||||
/// </summary>
|
||||
private TimeSpan UltraLongCache
|
||||
{
|
||||
get => TimeSpan.FromSeconds(cacheTtlLong * 10 * rnd.Next(900, 1100) / 1000);
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Esegue flush memoria redis dato pattern
|
||||
/// </summary>
|
||||
/// <param name="pattern"></param>
|
||||
/// <returns></returns>
|
||||
private async Task<bool> ExecFlushRedisPattern(RedisValue pattern)
|
||||
{
|
||||
bool answ = false;
|
||||
var listEndpoints = redisConn.GetEndPoints();
|
||||
foreach (var endPoint in listEndpoints)
|
||||
{
|
||||
//var server = redisConnAdmin.GetServer(listEndpoints[0]);
|
||||
var server = redisConn.GetServer(endPoint);
|
||||
if (server != null)
|
||||
{
|
||||
var keyList = server.Keys(redisDb.Database, pattern);
|
||||
foreach (var item in keyList)
|
||||
{
|
||||
await redisDb.KeyDeleteAsync(item);
|
||||
}
|
||||
answ = true;
|
||||
}
|
||||
}
|
||||
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ using Microsoft.Extensions.Logging;
|
||||
using MP.AppAuth.Models;
|
||||
using Newtonsoft.Json;
|
||||
using RestSharp;
|
||||
using StackExchange.Redis;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -28,12 +29,20 @@ namespace MP.Land.Data
|
||||
/// </summary>
|
||||
/// <param name="configuration"></param>
|
||||
/// <param name="logger"></param>
|
||||
/// <param name="distributedCache"></param>
|
||||
public LicenseService(IConfiguration configuration, ILogger<LicenseService> logger, IDistributedCache distributedCache)
|
||||
/// <param name="redisConnMult"></param>
|
||||
public LicenseService(IConfiguration configuration, ILogger<LicenseService> logger, IConnectionMultiplexer redisConnMult)
|
||||
{
|
||||
_logger = logger;
|
||||
_configuration = configuration;
|
||||
this.distributedCache = distributedCache;
|
||||
// Conf cache
|
||||
redisConn = redisConnMult;
|
||||
redisDb = this.redisConn.GetDatabase();
|
||||
|
||||
// json serializer... FIX errore loop circolare https://www.ryadel.com/en/jsonserializationexception-self-referencing-loop-detected-error-fix-entity-framework-asp-net-core/
|
||||
JSSettings = new JsonSerializerSettings()
|
||||
{
|
||||
ReferenceLoopHandling = ReferenceLoopHandling.Ignore
|
||||
};
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
@@ -114,7 +123,6 @@ namespace MP.Land.Data
|
||||
{
|
||||
List<LiManObj.AttivazioneDTO> dbResult = new List<LiManObj.AttivazioneDTO>();
|
||||
string cacheKey = $"{rKeyAttByLic}:{MasterKey}";
|
||||
trackCache(cacheKey);
|
||||
string rawData = await getRSV(cacheKey);
|
||||
if (!string.IsNullOrEmpty(rawData))
|
||||
{
|
||||
@@ -226,7 +234,6 @@ namespace MP.Land.Data
|
||||
{
|
||||
List<LiManObj.ApplicativoDTO> dbResult = new List<LiManObj.ApplicativoDTO>();
|
||||
string cacheKey = $"{rkeyAppInfo}:{MasterKey}";
|
||||
trackCache(cacheKey);
|
||||
string rawData = await getRSV(cacheKey);
|
||||
if (!string.IsNullOrEmpty(rawData))
|
||||
{
|
||||
@@ -281,7 +288,8 @@ namespace MP.Land.Data
|
||||
bool fatto = false;
|
||||
string cacheKey = $"{rKeyAttByLic}:{MasterKey}";
|
||||
var rawData = JsonConvert.SerializeObject(newActList);
|
||||
await setRSV(cacheKey, rawData, numDays * cacheFact * 24);
|
||||
TimeSpan cacheTs = TimeSpan.FromDays(numDays);
|
||||
await setRSV(cacheKey, rawData, cacheTs);
|
||||
fatto = true;
|
||||
if (EA_InfoUpdated != null)
|
||||
{
|
||||
@@ -295,7 +303,8 @@ namespace MP.Land.Data
|
||||
bool fatto = false;
|
||||
string cacheKey = $"{rkeyAppInfo}:{MasterKey}";
|
||||
var rawData = JsonConvert.SerializeObject(newAppInfo);
|
||||
await setRSV(cacheKey, rawData, numDays * cacheFact * 24);
|
||||
TimeSpan cacheTs = TimeSpan.FromDays(numDays);
|
||||
await setRSV(cacheKey, rawData, cacheTs);
|
||||
fatto = true;
|
||||
if (EA_InfoUpdated != null)
|
||||
{
|
||||
@@ -362,12 +371,8 @@ namespace MP.Land.Data
|
||||
/// <returns></returns>
|
||||
protected async Task<string> getRSV(string rKey)
|
||||
{
|
||||
string answ = "";
|
||||
var redisDataList = await distributedCache.GetAsync(rKey);
|
||||
if (redisDataList != null)
|
||||
{
|
||||
answ = Encoding.UTF8.GetString(redisDataList);
|
||||
}
|
||||
var rawData = await redisDb.StringGetAsync(rKey);
|
||||
string answ = rawData.HasValue ? $"{rawData}" : "";
|
||||
return answ;
|
||||
}
|
||||
|
||||
@@ -376,14 +381,11 @@ namespace MP.Land.Data
|
||||
/// </summary>
|
||||
/// <param name="rKey"></param>
|
||||
/// <param name="rVal"></param>
|
||||
/// <param name="cacheMult"></param>
|
||||
/// <param name="cacheTS"></param>
|
||||
/// <returns></returns>
|
||||
protected async Task<bool> setRSV(string rKey, string rVal, int cacheMult)
|
||||
protected async Task<bool> setRSV(string rKey, string rVal, TimeSpan cacheTS)
|
||||
{
|
||||
bool fatto = false;
|
||||
var redisDataList = Encoding.UTF8.GetBytes(rVal);
|
||||
await distributedCache.SetAsync(rKey, redisDataList, cacheOpt(cacheMult));
|
||||
fatto = true;
|
||||
bool fatto = await redisDb.StringSetAsync(rKey, rVal, cacheTS);
|
||||
return fatto;
|
||||
}
|
||||
|
||||
@@ -392,29 +394,14 @@ namespace MP.Land.Data
|
||||
/// </summary>
|
||||
/// <param name="rKey"></param>
|
||||
/// <param name="rValInt"></param>
|
||||
/// <param name="cacheMult"></param>
|
||||
/// <param name="cacheTS"></param>
|
||||
/// <returns></returns>
|
||||
protected async Task<bool> setRSV(string rKey, int rValInt, int cacheMult)
|
||||
protected async Task<bool> setRSV(string rKey, int rValInt, TimeSpan cacheTS)
|
||||
{
|
||||
bool fatto = false;
|
||||
var redisDataList = Encoding.UTF8.GetBytes($"{rValInt}");
|
||||
await distributedCache.SetAsync(rKey, redisDataList, cacheOpt(cacheMult));
|
||||
fatto = true;
|
||||
bool fatto = await setRSV(rkeyAppInfo, $"{rValInt}", cacheTS);
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registra in cache chiave se non fosse già in elenco
|
||||
/// </summary>
|
||||
/// <param name="newKey"></param>
|
||||
protected void trackCache(string newKey)
|
||||
{
|
||||
if (!cachedDataList.Contains(newKey))
|
||||
{
|
||||
cachedDataList.Add(newKey);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
@@ -426,34 +413,25 @@ namespace MP.Land.Data
|
||||
/// </summary>
|
||||
private static string apiUrl = "https://liman.egalware.com/ELM.API/";
|
||||
|
||||
private static JsonSerializerSettings? JSSettings;
|
||||
|
||||
/// <summary>
|
||||
/// Chiave redis x info della licenza
|
||||
/// </summary>
|
||||
private static string rkeyAppInfo = "LongCache:AppInfo";
|
||||
|
||||
//private static string apiUrl = "https://localhost:44351/";
|
||||
private readonly IDistributedCache distributedCache;
|
||||
|
||||
/// <summary>
|
||||
/// Elenco obj in cache
|
||||
/// Oggetto per connessione a REDIS
|
||||
/// </summary>
|
||||
private List<string> cachedDataList = new List<string>();
|
||||
private IConnectionMultiplexer redisConn;
|
||||
|
||||
//ISubscriber sub = redis.GetSubscriber();
|
||||
/// <summary>
|
||||
/// Fattorte conversione cache sliding --> 1 h
|
||||
/// Oggetto DB redis da impiegare x chiamate R/W
|
||||
/// </summary>
|
||||
private int cacheFact = 12;
|
||||
private IDatabase redisDb = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Durata assoluta massima della cache IN SECONDI
|
||||
/// </summary>
|
||||
private int chAbsExp = 60 * 5;
|
||||
|
||||
/// <summary>
|
||||
/// Durata della cache IN SECONDI in modalità inattiva (non acceduta) prima di venire
|
||||
/// rimossa NON estende oltre il tempo massimo di validità della cache (chAbsExp)
|
||||
/// </summary>
|
||||
private int chSliExp = 60 * 1;
|
||||
private Random rnd = new Random();
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
@@ -465,18 +443,6 @@ namespace MP.Land.Data
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Opzioni cache con moltiplicatore durata risp durata base (1/5 minuti)
|
||||
/// </summary>
|
||||
/// <param name="multFact"></param>
|
||||
/// <returns></returns>
|
||||
private DistributedCacheEntryOptions cacheOpt(int multFact)
|
||||
{
|
||||
var numSecAbsExp = chAbsExp * multFact;
|
||||
var numSecSliExp = chSliExp * multFact;
|
||||
return new DistributedCacheEntryOptions().SetAbsoluteExpiration(DateTime.Now.AddSeconds(numSecAbsExp)).SetSlidingExpiration(TimeSpan.FromSeconds(numSecSliExp));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco attivazioni attuali
|
||||
/// </summary>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<RootNamespace>MP.Land</RootNamespace>
|
||||
<Version>6.16.2407.3117</Version>
|
||||
<Version>6.16.2409.0319</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -43,19 +43,19 @@
|
||||
<PackageReference Include="Blazored.LocalStorage" Version="4.5.0" />
|
||||
<PackageReference Include="Blazored.SessionStorage" Version="2.4.0" />
|
||||
<PackageReference Include="DiffMatchPatch" Version="1.0.3" />
|
||||
<PackageReference Include="EgwCoreLib.Razor" Version="1.4.2311.1612" />
|
||||
<PackageReference Include="EgwCoreLib.Utils" Version="1.4.2311.1612" />
|
||||
<PackageReference Include="EgwCoreLib.Razor" Version="1.5.2408.2710" />
|
||||
<PackageReference Include="EgwCoreLib.Utils" Version="1.5.2408.2710" />
|
||||
<PackageReference Include="Majorsoft.Blazor.Components.Debounce" Version="1.5.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.Negotiate" Version="6.0.11" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.9">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="6.0.9" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.9" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
|
||||
<PackageReference Include="NLog.Web.AspNetCore" Version="5.1.4" />
|
||||
<PackageReference Include="RestSharp" Version="107.1.2" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="NLog.Web.AspNetCore" Version="5.3.12" />
|
||||
<PackageReference Include="RestSharp" Version="112.0.0" />
|
||||
<PackageReference Include="StackExchange.Redis" Version="2.8.12" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
|
||||
autoReload="true"
|
||||
throwExceptions="false"
|
||||
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log">
|
||||
|
||||
<!-- optional, add some variables
|
||||
https://github.com/nlog/NLog/wiki/Configuration-file#variables
|
||||
-->
|
||||
<variable name="myvar" value="myvalue" />
|
||||
|
||||
<!--
|
||||
See https://github.com/nlog/nlog/wiki/Configuration-file
|
||||
for information on customizing logging rules and outputs.
|
||||
-->
|
||||
<targets>
|
||||
|
||||
<!--
|
||||
add your targets here
|
||||
See https://github.com/nlog/NLog/wiki/Targets for possible targets.
|
||||
See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers.
|
||||
-->
|
||||
|
||||
<!--
|
||||
Write events to a file with the date in the filename.
|
||||
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
|
||||
layout="${longdate} ${uppercase:${level}} ${message}" />
|
||||
-->
|
||||
<target xsi:type="File" name="fileTarget" fileName="${basedir}/logs/${shortdate}.log" layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=false} | ${message}" />
|
||||
<target xsi:type="ColoredConsole" name="consoleTarget" layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=true}| ${message}" />
|
||||
</targets>
|
||||
|
||||
<rules>
|
||||
<!-- add your logging rules here -->
|
||||
|
||||
<!--
|
||||
Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f"
|
||||
<logger name="*" minlevel="Debug" writeTo="f" />
|
||||
-->
|
||||
<logger name="*" minlevel="Trace" writeTo="consoleTarget" />
|
||||
<!--<logger name="Microsoft.*" maxlevel="Info" final="true" />-->
|
||||
<logger name="*" minlevel="Info" writeTo="fileTarget" />
|
||||
</rules>
|
||||
</nlog>
|
||||
@@ -84,7 +84,7 @@
|
||||
<div class="px-1">
|
||||
<i class="fa fa-key" aria-hidden="true"></i> Key
|
||||
</div>
|
||||
<div class="px-1">
|
||||
<div class="px-1 w-75">
|
||||
<EgwCoreLib.Razor.CopyToClipboard Text="@MastKey" ShowText="true"></EgwCoreLib.Razor.CopyToClipboard>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
await Task.Delay(100);
|
||||
LicServ.AKVList = new List<AppAuth.Models.AnagKeyValueModel>();
|
||||
await Task.Delay(100);
|
||||
await DataService.ResetCache();
|
||||
await Task.Delay(100);
|
||||
await DataService.FlushRedisCache();
|
||||
await Task.Delay(200);
|
||||
|
||||
// redireziono
|
||||
NavManager.NavigateTo("");
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
@page "/Unauthorized"
|
||||
|
||||
<div class="card bg-dark text-light">
|
||||
<div class="card-header py-3 text-center">
|
||||
<span class="text-nowrap textMain"><b>Accesso Negato</b></span>
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
<div class="d-flex justify-content-around py-5 backImage">
|
||||
<img src="img/BMA.png" class="img-fluid frontImage w-50" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer text-center">
|
||||
<div><i class="fas fa-exclamation-triangle"></i> Permessi non riconosciuti <i class="fas fa-exclamation-triangle"></i></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
.textMain {
|
||||
font-size: 4rem;
|
||||
-webkit-animation: glow 9s ease-in-out infinite alternate;
|
||||
-moz-animation: glow 9s ease-in-out infinite alternate;
|
||||
animation: glow 9s ease-in-out infinite alternate;
|
||||
}
|
||||
@-webkit-keyframes glow {
|
||||
0% {
|
||||
text-shadow: 0 0 0px #000;
|
||||
}
|
||||
90%,
|
||||
100% {
|
||||
text-shadow: 0 0 10px #fff, 0 0 20px #0073e6;
|
||||
}
|
||||
95% {
|
||||
text-shadow: 0 0 15px #fff, 0 0 20px #4da6ff, 0 0 30px #4da6ff;
|
||||
}
|
||||
}
|
||||
@media (max-width: 600px) {
|
||||
.textMain {
|
||||
font-size: 2rem;
|
||||
}
|
||||
}
|
||||
@media (max-width: 992px) {
|
||||
.textMain {
|
||||
font-size: 3rem;
|
||||
}
|
||||
}
|
||||
.backImage {
|
||||
background-image: url('img/darkthree02.jpg');
|
||||
background-repeat: no-repeat;
|
||||
animation: zoom-bg 4s ease-in-out infinite;
|
||||
}
|
||||
@keyframes zoom-bg {
|
||||
0%,
|
||||
80% {
|
||||
background-size: 100% 100%;
|
||||
filter: brightness(80%);
|
||||
}
|
||||
90% {
|
||||
background-size: 500% 500%;
|
||||
background-position: 50% 50%;
|
||||
filter: brightness(120%);
|
||||
}
|
||||
100% {
|
||||
background-size: 100% 100%;
|
||||
filter: brightness(80%);
|
||||
}
|
||||
}
|
||||
.frontImage {
|
||||
padding: 0rem;
|
||||
background: -webkit-linear-gradient(135deg, #000 30%, #D8951C 45%, #FAF2A2 50%, #C8850C 55%, #000 70%);
|
||||
background-size: 250% 250%;
|
||||
animation: gradient-bg 6s ease-in-out infinite;
|
||||
}
|
||||
@keyframes gradient-bg {
|
||||
0% {
|
||||
background-position: 0% 50%;
|
||||
filter: brightness(90%);
|
||||
box-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 30px #0ff, 0 0 40px #0ff, 0 0 50px #0073e6, 0 0 60px #0073e6, 0 0 70px #0073e6;
|
||||
}
|
||||
40% {
|
||||
filter: brightness(105%);
|
||||
box-shadow: 0 0 40px #fff, 0 0 50px #4da6ff, 0 0 60px #4da6ff, 0 0 70px #4da6ff, 0 0 80px #4da6ff, 0 0 90px #4da6ff, 0 0 100px #4da6ff;
|
||||
}
|
||||
80% {
|
||||
background-position: 0% 50%;
|
||||
filter: brightness(90%);
|
||||
box-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 30px #0ff, 0 0 40px #0ff, 0 0 50px #0073e6, 0 0 60px #0073e6, 0 0 70px #0073e6;
|
||||
}
|
||||
92% {
|
||||
background-position: 100% 50%;
|
||||
filter: brightness(110%);
|
||||
box-shadow: 0 0 0px #fff;
|
||||
}
|
||||
100% {
|
||||
background-position: 0% 50%;
|
||||
filter: brightness(90%);
|
||||
box-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 30px #0ff, 0 0 40px #0ff, 0 0 50px #0073e6, 0 0 60px #0073e6, 0 0 70px #0073e6;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
@timeGlow: 9s;
|
||||
|
||||
.textMain {
|
||||
font-size: 4rem;
|
||||
-webkit-animation: glow @timeGlow ease-in-out infinite alternate;
|
||||
-moz-animation: glow @timeGlow ease-in-out infinite alternate;
|
||||
animation: glow @timeGlow ease-in-out infinite alternate;
|
||||
}
|
||||
|
||||
@-webkit-keyframes glow {
|
||||
0% {
|
||||
text-shadow: 0 0 0px #000;
|
||||
}
|
||||
|
||||
90%, 100% {
|
||||
text-shadow: 0 0 10px #fff, 0 0 20px #0073e6;
|
||||
}
|
||||
|
||||
95% {
|
||||
text-shadow: 0 0 15px #fff, 0 0 20px #4da6ff, 0 0 30px #4da6ff;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
.textMain {
|
||||
font-size: 2rem;
|
||||
}
|
||||
}
|
||||
@media (max-width: 992px) {
|
||||
.textMain {
|
||||
font-size: 3rem;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.backImage {
|
||||
background-image: url('img/darkthree02.jpg');
|
||||
background-repeat: no-repeat;
|
||||
animation: zoom-bg 4s ease-in-out infinite;
|
||||
}
|
||||
|
||||
@keyframes zoom-bg {
|
||||
0%, 80% {
|
||||
background-size: 100% 100%;
|
||||
filter: brightness(80%);
|
||||
}
|
||||
|
||||
90% {
|
||||
background-size: 500% 500%;
|
||||
background-position: 50% 50%;
|
||||
filter: brightness(120%);
|
||||
}
|
||||
|
||||
100% {
|
||||
background-size: 100% 100%;
|
||||
filter: brightness(80%);
|
||||
}
|
||||
}
|
||||
|
||||
.frontImage {
|
||||
padding: 0rem;
|
||||
background: -webkit-linear-gradient(135deg, #000 30%, #D8951C 45%, #FAF2A2 50%, #C8850C 55%, #000 70%);
|
||||
background-size: 250% 250%;
|
||||
animation: gradient-bg 6s ease-in-out infinite;
|
||||
}
|
||||
|
||||
@keyframes gradient-bg {
|
||||
0% {
|
||||
background-position: 0% 50%;
|
||||
filter: brightness(90%);
|
||||
box-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 30px #0ff, 0 0 40px #0ff, 0 0 50px #0073e6, 0 0 60px #0073e6, 0 0 70px #0073e6;
|
||||
}
|
||||
|
||||
40% {
|
||||
filter: brightness(105%);
|
||||
box-shadow: 0 0 40px #fff, 0 0 50px #4da6ff, 0 0 60px #4da6ff, 0 0 70px #4da6ff, 0 0 80px #4da6ff, 0 0 90px #4da6ff, 0 0 100px #4da6ff;
|
||||
}
|
||||
|
||||
80% {
|
||||
background-position: 0% 50%;
|
||||
filter: brightness(90%);
|
||||
box-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 30px #0ff, 0 0 40px #0ff, 0 0 50px #0073e6, 0 0 60px #0073e6, 0 0 70px #0073e6;
|
||||
}
|
||||
|
||||
92% {
|
||||
background-position: 100% 50%;
|
||||
filter: brightness(110%);
|
||||
box-shadow: 0 0 0px #fff;
|
||||
}
|
||||
|
||||
100% {
|
||||
background-position: 0% 50%;
|
||||
filter: brightness(90%);
|
||||
box-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 30px #0ff, 0 0 40px #0ff, 0 0 50px #0073e6, 0 0 60px #0073e6, 0 0 70px #0073e6;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
.textMain{font-size:4rem;-webkit-animation:glow 9s ease-in-out infinite alternate;-moz-animation:glow 9s ease-in-out infinite alternate;animation:glow 9s ease-in-out infinite alternate;}@-webkit-keyframes glow{0%{text-shadow:0 0 0 #000;}90%,100%{text-shadow:0 0 10px #fff,0 0 20px #0073e6;}95%{text-shadow:0 0 15px #fff,0 0 20px #4da6ff,0 0 30px #4da6ff;}}@media(max-width:600px){.textMain{font-size:2rem;}}@media(max-width:992px){.textMain{font-size:3rem;}}.backImage{background-image:url('img/darkthree02.jpg');background-repeat:no-repeat;animation:zoom-bg 4s ease-in-out infinite;}@keyframes zoom-bg{0%,80%{background-size:100% 100%;filter:brightness(80%);}90%{background-size:500% 500%;background-position:50% 50%;filter:brightness(120%);}100%{background-size:100% 100%;filter:brightness(80%);}}.frontImage{padding:0;background:-webkit-linear-gradient(135deg,#000 30%,#d8951c 45%,#faf2a2 50%,#c8850c 55%,#000 70%);background-size:250% 250%;animation:gradient-bg 6s ease-in-out infinite;}@keyframes gradient-bg{0%{background-position:0% 50%;filter:brightness(90%);box-shadow:0 0 10px #fff,0 0 20px #fff,0 0 30px #0ff,0 0 40px #0ff,0 0 50px #0073e6,0 0 60px #0073e6,0 0 70px #0073e6;}40%{filter:brightness(105%);box-shadow:0 0 40px #fff,0 0 50px #4da6ff,0 0 60px #4da6ff,0 0 70px #4da6ff,0 0 80px #4da6ff,0 0 90px #4da6ff,0 0 100px #4da6ff;}80%{background-position:0% 50%;filter:brightness(90%);box-shadow:0 0 10px #fff,0 0 20px #fff,0 0 30px #0ff,0 0 40px #0ff,0 0 50px #0073e6,0 0 60px #0073e6,0 0 70px #0073e6;}92%{background-position:100% 50%;filter:brightness(110%);box-shadow:0 0 0 #fff;}100%{background-position:0% 50%;filter:brightness(90%);box-shadow:0 0 10px #fff,0 0 20px #fff,0 0 30px #0ff,0 0 40px #0ff,0 0 50px #0073e6,0 0 60px #0073e6,0 0 70px #0073e6;}}
|
||||
@@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using NLog;
|
||||
using NLog.Web;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -30,9 +31,9 @@ namespace MP.Land
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
// inclusione NLog:
|
||||
// https://github.com/NLog/NLog/wiki/Getting-started-with-ASP.NET-Core-5
|
||||
// https://codewithmukesh.com/blog/logging-with-nlog-in-aspnet-core/
|
||||
var logger = NLog.Web.NLogBuilder.ConfigureNLog("NLog.config").GetCurrentClassLogger();
|
||||
var logger = LogManager.Setup()
|
||||
.LoadConfigurationFromAppSettings()
|
||||
.GetCurrentClassLogger();
|
||||
try
|
||||
{
|
||||
logger.Info("MP.Land Application Starting Up");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo Tablet MAPO - DotNet6</i>
|
||||
<h4>Versione: 6.16.2407.3117</h4>
|
||||
<h4>Versione: 6.16.2409.0319</h4>
|
||||
<br />
|
||||
Note di rilascio:
|
||||
<ul>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2407.3117
|
||||
6.16.2409.0319
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2407.3117</version>
|
||||
<version>6.16.2409.0319</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>
|
||||
|
||||
@@ -70,7 +70,6 @@ namespace MP.Land.Shared
|
||||
|
||||
protected bool annualAuthOk { get; set; } = false;
|
||||
|
||||
private List<MP.AppAuth.Models.UpdMan> ListRecords;
|
||||
|
||||
#endregion Private Properties
|
||||
}
|
||||
|
||||
@@ -9,56 +9,56 @@
|
||||
|
||||
<div class="@NavMenuCssClass" @onclick="ToggleNavMenu">
|
||||
<nav class="flex-column">
|
||||
<div class="nav-item px-2">
|
||||
<NavLink class="nav-link py-0 px-2 mb-0" href="" Match="NavLinkMatch.All">
|
||||
<span class="fas fa-home fa-2x pe-2" aria-hidden="true"></span> Home
|
||||
</NavLink>
|
||||
</div>
|
||||
<div class="nav-item px-2">
|
||||
<NavLink class="nav-link py-0 px-2 mb-0" href="UserQr">
|
||||
<span class="fas fa-qrcode fa-2x pe-2" aria-hidden="true"></span> QR Card User
|
||||
</NavLink>
|
||||
</div>
|
||||
<div class="nav-item px-2">
|
||||
<NavLink class="nav-link py-0 px-2 mb-0" href="UpdateManager">
|
||||
<span class="fas fa-download fa-2x pe-2" aria-hidden="true"></span> Update Manager
|
||||
</NavLink>
|
||||
</div>
|
||||
<div class="nav-item px-2">
|
||||
<NavLink class="nav-link py-0 px-2 mb-0" href="ConfSync">
|
||||
<span class="fas fa-file-import fa-2x pe-2" aria-hidden="true"></span> Config Sync
|
||||
</NavLink>
|
||||
</div>
|
||||
<div class="nav-item px-2">
|
||||
<NavLink class="nav-link py-0 px-2 mb-0" href="About">
|
||||
<span class="fas fa-info-circle fa-2x pe-2" aria-hidden="true"></span> About
|
||||
</NavLink>
|
||||
</div>
|
||||
<div class="nav-item px-2">
|
||||
<NavLink class="nav-link py-0 px-2 mb-0" href="Contacts">
|
||||
<span class="fas fa-envelope fa-2x pe-2" aria-hidden="true"></span> Contacts
|
||||
</NavLink>
|
||||
</div>
|
||||
<div class="nav-item px-2">
|
||||
<NavLink class="nav-link py-0 px-2 mb-0" href="SysInfo">
|
||||
<span class="fas fa-wrench fa-2x pe-2" aria-hidden="true"></span> System Info
|
||||
</NavLink>
|
||||
</div>
|
||||
<div class="nav-item px-2">
|
||||
<NavLink class="nav-link py-0 px-2 mb-0" href="RefreshData">
|
||||
<span class="fas fa-sync-alt fa-2x pe-2" aria-hidden="true"></span> Refresh Data
|
||||
</NavLink>
|
||||
</div>
|
||||
@if (isLoading)
|
||||
{
|
||||
<LoadingData DisplayMode="LoadingData.SpinMode.Growl" DisplaySize="LoadingData.CtrlSize.Small"></LoadingData>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="nav-item px-2">
|
||||
<NavLink class="nav-link py-0 px-2 mb-0" href="" Match="NavLinkMatch.All">
|
||||
<span class="fas fa-home fa-2x pe-2" aria-hidden="true"></span> Home
|
||||
</NavLink>
|
||||
</div>
|
||||
<div class="nav-item px-2">
|
||||
<NavLink class="nav-link py-0 px-2 mb-0" href="UserQr">
|
||||
<span class="fas fa-qrcode fa-2x pe-2" aria-hidden="true"></span> QR Card User
|
||||
</NavLink>
|
||||
</div>
|
||||
<div class="nav-item px-2">
|
||||
<NavLink class="nav-link py-0 px-2 mb-0" href="UpdateManager">
|
||||
<span class="fas fa-download fa-2x pe-2" aria-hidden="true"></span> Update Manager
|
||||
</NavLink>
|
||||
</div>
|
||||
@if (IsSuperAdmin)
|
||||
{
|
||||
<div class="nav-item px-2">
|
||||
<NavLink class="nav-link py-0 px-2 mb-0" href="ConfSync">
|
||||
<span class="fas fa-file-import fa-2x pe-2" aria-hidden="true"></span> Config Sync
|
||||
</NavLink>
|
||||
</div>
|
||||
}
|
||||
<div class="nav-item px-2">
|
||||
<NavLink class="nav-link py-0 px-2 mb-0" href="About">
|
||||
<span class="fas fa-info-circle fa-2x pe-2" aria-hidden="true"></span> About
|
||||
</NavLink>
|
||||
</div>
|
||||
<div class="nav-item px-2">
|
||||
<NavLink class="nav-link py-0 px-2 mb-0" href="Contacts">
|
||||
<span class="fas fa-envelope fa-2x pe-2" aria-hidden="true"></span> Contacts
|
||||
</NavLink>
|
||||
</div>
|
||||
<div class="nav-item px-2">
|
||||
<NavLink class="nav-link py-0 px-2 mb-0" href="SysInfo">
|
||||
<span class="fas fa-wrench fa-2x pe-2" aria-hidden="true"></span> System Info
|
||||
</NavLink>
|
||||
</div>
|
||||
<div class="nav-item px-2">
|
||||
<NavLink class="nav-link py-0 px-2 mb-0" href="RefreshData">
|
||||
<span class="fas fa-sync-alt fa-2x pe-2" aria-hidden="true"></span> Refresh Data
|
||||
</NavLink>
|
||||
</div>
|
||||
}
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
private bool collapseNavMenu = true;
|
||||
|
||||
private string NavMenuCssClass => collapseNavMenu ? "collapse" : null;
|
||||
|
||||
private void ToggleNavMenu()
|
||||
{
|
||||
collapseNavMenu = !collapseNavMenu;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using MP.AppAuth.Models;
|
||||
using MP.Land.Data;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MP.Land.Shared
|
||||
{
|
||||
public partial class NavMenu
|
||||
{
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected AuthenticationStateProvider AuthStateProvider { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected AppAuthService DataService { get; set; }
|
||||
|
||||
protected bool IsSuperAdmin
|
||||
{
|
||||
get => HasRight(AppAuthService.RoleSuperAdmin);
|
||||
}
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavManager { get; set; } = null!;
|
||||
|
||||
protected string pageName
|
||||
{
|
||||
get
|
||||
{
|
||||
string pName = NavManager.ToBaseRelativePath(NavManager.Uri).ToLower();
|
||||
if (pName.Contains("?"))
|
||||
{
|
||||
pName = pName.Substring(0, pName.IndexOf("?"));
|
||||
}
|
||||
return pName;
|
||||
}
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected List<PermessiModel> UserPerm { get; set; } = new List<PermessiModel>();
|
||||
protected List<UserDirittiModel> UserRight { get; set; } = new List<UserDirittiModel>();
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected bool HasRight(string codFunz)
|
||||
{
|
||||
bool answ = false;
|
||||
if (UserRight != null && UserRight.Count > 0)
|
||||
{
|
||||
answ = UserRight
|
||||
.Where(x => x.Funzione.Equals(codFunz, System.StringComparison.InvariantCultureIgnoreCase))
|
||||
.Count() > 0;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private bool collapseNavMenu = true;
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
private string SafePages = "";
|
||||
private string userName = "";
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
[Inject]
|
||||
private IConfiguration ConfMan { get; set; } = null!;
|
||||
|
||||
private string NavMenuCssClass => collapseNavMenu ? "collapse" : null;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void checkAuth()
|
||||
{
|
||||
// verifico pagina tra i permessi, se manca --> rimando a pagina unauth... se contiene
|
||||
// index --> salto
|
||||
if (!pageName.Contains("index"))
|
||||
{
|
||||
bool isAuth = false;
|
||||
if (UserPerm != null)
|
||||
{
|
||||
isAuth = UserPerm.Where(x => x.Url.ToLower() == pageName).Count() > 0;
|
||||
bool pageIsSafe = SafePages.ToLower().Contains($"|{pageName.ToLower()}|");
|
||||
if (!pageIsSafe && !isAuth)
|
||||
{
|
||||
NavManager.NavigateTo("Unauthorized", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
await Task.Delay(1);
|
||||
// sistemo elenco pagine safe...
|
||||
SafePages = ConfMan.GetValue<string>("Application:SafePages").ToLower();
|
||||
var authState = await AuthStateProvider.GetAuthenticationStateAsync();
|
||||
var user = authState.User;
|
||||
if (user.Identity != null && user.Identity.IsAuthenticated)
|
||||
{
|
||||
userName = $"{user.Identity.Name}";
|
||||
}
|
||||
else
|
||||
{
|
||||
userName = "N.A.";
|
||||
}
|
||||
// carico diritti...
|
||||
var domUser = userName.Split("\\");
|
||||
if (domUser.Length > 0)
|
||||
{
|
||||
string dominio = domUser[0];
|
||||
string uName = domUser[1];
|
||||
UserRight = await DataService.DirittiGetByUser(uName);
|
||||
UserPerm = await DataService.PermessiGetByUser(uName);
|
||||
}
|
||||
checkAuth();
|
||||
await Task.Delay(1);
|
||||
isLoading = false;
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
private void ToggleNavMenu()
|
||||
{
|
||||
collapseNavMenu = !collapseNavMenu;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -11,8 +11,10 @@ using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using MP.Land.Data;
|
||||
using StackExchange.Redis;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
@@ -116,13 +118,12 @@ namespace MP.Land
|
||||
options.FallbackPolicy = options.DefaultPolicy;
|
||||
});
|
||||
|
||||
// REDIS setup
|
||||
string connStringRedis = Configuration.GetConnectionString("Redis");
|
||||
string redisSrvAddr = connStringRedis.Substring(0, connStringRedis.IndexOf(":"));
|
||||
// avvio oggetto shared x redis...
|
||||
var redisMultiplexer = ConnectionMultiplexer.Connect(connStringRedis);
|
||||
|
||||
services.AddStackExchangeRedisCache(options =>
|
||||
{
|
||||
//options.ConfigurationOptions = new StackExchange.Redis.ConfigurationOptions() { KeepAlive = 180, DefaultDatabase = 1, EndPoints = { { "localhost", 6379 } } };
|
||||
options.Configuration = Configuration["ConnectionStrings:Redis"];
|
||||
options.InstanceName = "MP:Land";
|
||||
});
|
||||
|
||||
services.AddLocalization();
|
||||
|
||||
@@ -135,6 +136,7 @@ namespace MP.Land
|
||||
|
||||
services.AddScoped<AppAuthService>();
|
||||
services.AddScoped<MessageService>();
|
||||
services.AddSingleton<IConnectionMultiplexer>(redisMultiplexer);
|
||||
|
||||
services.AddBlazoredLocalStorage();
|
||||
services.AddBlazoredSessionStorage();
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
"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;",
|
||||
"MP.Land.Auth": "Server=SQL2016DEV;Database=MoonPro_Anagrafica;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=MP.Land;",
|
||||
"Redis": "localhost:26379,serviceName=devel,defaultDatabase=5,keepAlive=180,asyncTimeout=5000"
|
||||
},
|
||||
"ServerConf": {
|
||||
|
||||
@@ -6,6 +6,49 @@
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"NLog": {
|
||||
"variables": {
|
||||
"baseFileDir": "${basedir}/logs/",
|
||||
"layout": "${longdate} | ${uppercase:${level}} | ${logger:shortName=false} | ${message}"
|
||||
},
|
||||
// "internalLogLevel": "Info",
|
||||
// "internalLogFile": "c:\\temp\\internal-nlog.txt",
|
||||
"extensions": [
|
||||
{ "assembly": "NLog.Extensions.Logging" },
|
||||
{ "assembly": "NLog.Web.AspNetCore" }
|
||||
],
|
||||
"throwConfigExceptions": true,
|
||||
"targets": {
|
||||
"async": true,
|
||||
"logfile": {
|
||||
"type": "File",
|
||||
"fileName": "${basedir}/logs/${shortdate}.log",
|
||||
"archiveEvery": "Day",
|
||||
"archiveFileName": "${basedir}/logs/old/${shortdate}_{#}.log",
|
||||
"archiveNumbering": "DateAndSequence",
|
||||
"archiveAboveSize": "1024000",
|
||||
"archiveDateFormat": "HH",
|
||||
"maxArchiveFiles": "60",
|
||||
"maxArchiveDays": "30"
|
||||
},
|
||||
"logconsole": {
|
||||
"type": "ColoredConsole",
|
||||
"layout": "${longdate} | ${uppercase:${level}} | ${logger:shortName=true} | ${message}"
|
||||
}
|
||||
},
|
||||
"rules": [
|
||||
{
|
||||
"logger": "*",
|
||||
"minLevel": "Trace",
|
||||
"writeTo": "logconsole"
|
||||
},
|
||||
{
|
||||
"logger": "*",
|
||||
"minLevel": "Info",
|
||||
"writeTo": "logfile"
|
||||
}
|
||||
]
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"QrJumpPath": "MP/TAB/jumper?",
|
||||
"Environment": "Steam DEV",
|
||||
@@ -13,10 +56,16 @@
|
||||
"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;",
|
||||
"MP.Land.Auth": "Server=SQL2016DEV;Database=MoonPro_Anagrafica;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=MP.Land;",
|
||||
//"MP.Land": "Server=SQL2016DEV;Database=MoonPro_ONE;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=MP.Land;",
|
||||
"Redis": "localhost:26379, serviceName=devel, defaultDatabase=1, keepAlive=180, connectTimeout=5000, syncTimeout=5000, asyncTimeout=5000, abortConnect=false, ssl=false, allowAdmin=true"
|
||||
},
|
||||
"Application": {
|
||||
"SafePages": "||LAND|Home|Index|About|Help|Unauthorized|"
|
||||
},
|
||||
"ServerConf": {
|
||||
"CodApp": "MP-LAND",
|
||||
"Modulo": "MoonPro",
|
||||
"BaseUrl": "https://localhost:44309/",
|
||||
"downloadPath": "C:\\Steamware\\installers\\MP"
|
||||
}
|
||||
|
||||
@@ -6,5 +6,9 @@
|
||||
{
|
||||
"outputFile": "wwwroot/css/site.css",
|
||||
"inputFile": "wwwroot/css/site.less"
|
||||
},
|
||||
{
|
||||
"outputFile": "Pages/Unauthorized.razor.css",
|
||||
"inputFile": "Pages/Unauthorized.razor.less"
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,71 @@
|
||||
{
|
||||
"compilers": {
|
||||
"less": {
|
||||
"autoPrefix": "",
|
||||
"cssComb": "none",
|
||||
"ieCompat": true,
|
||||
"math": null,
|
||||
"strictMath": false,
|
||||
"strictUnits": false,
|
||||
"relativeUrls": true,
|
||||
"rootPath": "",
|
||||
"sourceMapRoot": "",
|
||||
"sourceMapBasePath": "",
|
||||
"sourceMap": false
|
||||
},
|
||||
"sass": {
|
||||
"autoPrefix": "",
|
||||
"loadPaths": "",
|
||||
"style": "expanded",
|
||||
"relativeUrls": true,
|
||||
"sourceMap": false
|
||||
},
|
||||
"nodesass": {
|
||||
"autoPrefix": "",
|
||||
"includePath": "",
|
||||
"indentType": "space",
|
||||
"indentWidth": 2,
|
||||
"outputStyle": "nested",
|
||||
"precision": 5,
|
||||
"relativeUrls": true,
|
||||
"sourceMapRoot": "",
|
||||
"lineFeed": "",
|
||||
"sourceMap": false
|
||||
},
|
||||
"stylus": {
|
||||
"sourceMap": false
|
||||
},
|
||||
"babel": {
|
||||
"sourceMap": false
|
||||
},
|
||||
"coffeescript": {
|
||||
"bare": false,
|
||||
"runtimeMode": "node",
|
||||
"sourceMap": false
|
||||
},
|
||||
"handlebars": {
|
||||
"root": "",
|
||||
"noBOM": false,
|
||||
"name": "",
|
||||
"namespace": "",
|
||||
"knownHelpersOnly": false,
|
||||
"forcePartial": false,
|
||||
"knownHelpers": [],
|
||||
"commonjs": "",
|
||||
"amd": false,
|
||||
"sourceMap": false
|
||||
}
|
||||
},
|
||||
"minifiers": {
|
||||
"css": {
|
||||
"enabled": true,
|
||||
"termSemicolons": true,
|
||||
"gzip": false
|
||||
},
|
||||
"javascript": {
|
||||
"enabled": true,
|
||||
"termSemicolons": true,
|
||||
"gzip": false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 178 KiB |
|
After Width: | Height: | Size: 100 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 314 KiB |
|
After Width: | Height: | Size: 376 KiB |
|
After Width: | Height: | Size: 358 KiB |
|
After Width: | Height: | Size: 100 KiB |
@@ -4,7 +4,7 @@
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Version>6.16.2405.2315</Version>
|
||||
<Version>6.16.2409.408</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -36,10 +36,12 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="EgwCoreLib.Razor" Version="1.4.2402.2311" />
|
||||
<PackageReference Include="EgwCoreLib.Utils" Version="1.4.2402.2311" />
|
||||
<PackageReference Include="EgwCoreLib.Razor" Version="1.5.2408.2710" />
|
||||
<PackageReference Include="EgwCoreLib.Utils" Version="1.5.2408.2710" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components" Version="6.0.33" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="StackExchange.Redis" Version="2.6.90" />
|
||||
<PackageReference Include="NLog.Web.AspNetCore" Version="5.3.12" />
|
||||
<PackageReference Include="StackExchange.Redis" Version="2.8.0" />
|
||||
<PackageReference Include="System.Text.Encodings.Web" Version="6.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ using Newtonsoft.Json;
|
||||
using NLog;
|
||||
using System;
|
||||
using EgwCoreLib.Razor;
|
||||
using EgwCoreLib.Razor.Data;
|
||||
|
||||
namespace MP.Mon.Pages
|
||||
{
|
||||
|
||||
@@ -2,6 +2,8 @@ using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using MP.Data;
|
||||
using MP.Data.Services;
|
||||
using NLog;
|
||||
using NLog.Web;
|
||||
using StackExchange.Redis;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
@@ -14,15 +16,24 @@ var builder = WebApplication.CreateBuilder(args);
|
||||
*
|
||||
* */
|
||||
|
||||
|
||||
|
||||
var logger = LogManager.Setup()
|
||||
.LoadConfigurationFromAppSettings()
|
||||
.GetCurrentClassLogger();
|
||||
logger.Info("Program.cs: startup");
|
||||
|
||||
ConfigurationManager configuration = builder.Configuration;
|
||||
|
||||
// REDIS setup
|
||||
logger.Info("Setup REDIS");
|
||||
string connStringRedis = configuration.GetConnectionString("Redis");
|
||||
string redisSrvAddr = connStringRedis.Substring(0, connStringRedis.IndexOf(":"));
|
||||
// avvio oggetto shared x redis...
|
||||
var redisMultiplexer = ConnectionMultiplexer.Connect(connStringRedis);
|
||||
|
||||
// Add services to the container.
|
||||
logger.Info("Setup Services");
|
||||
builder.Services.AddRazorPages();
|
||||
builder.Services.AddServerSideBlazor();
|
||||
builder.Services.AddSingleton<IConnectionMultiplexer>(redisMultiplexer);
|
||||
@@ -47,4 +58,5 @@ app.UseRouting();
|
||||
app.MapBlazorHub();
|
||||
app.MapFallbackToPage("/_Host");
|
||||
|
||||
logger.Info("Run App");
|
||||
app.Run();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MON MAPO</i>
|
||||
<h4>Versione: 6.16.2405.2315</h4>
|
||||
<h4>Versione: 6.16.2409.408</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2405.2315
|
||||
6.16.2409.408
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2405.2315</version>
|
||||
<version>6.16.2409.408</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/MP.Mon.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
@@ -5,6 +5,49 @@
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"NLog": {
|
||||
"variables": {
|
||||
"baseFileDir": "${basedir}/logs/",
|
||||
"layout": "${longdate} | ${uppercase:${level}} | ${logger:shortName=false} | ${message}"
|
||||
},
|
||||
// "internalLogLevel": "Info",
|
||||
// "internalLogFile": "c:\\temp\\internal-nlog.txt",
|
||||
"extensions": [
|
||||
{ "assembly": "NLog.Extensions.Logging" },
|
||||
{ "assembly": "NLog.Web.AspNetCore" }
|
||||
],
|
||||
"throwConfigExceptions": true,
|
||||
"targets": {
|
||||
"async": true,
|
||||
"logfile": {
|
||||
"type": "File",
|
||||
"fileName": "${basedir}/logs/${shortdate}.log",
|
||||
"archiveEvery": "Day",
|
||||
"archiveFileName": "${basedir}/logs/old/${shortdate}_{#}.log",
|
||||
"archiveNumbering": "DateAndSequence",
|
||||
"archiveAboveSize": "1024000",
|
||||
"archiveDateFormat": "HH",
|
||||
"maxArchiveFiles": "60",
|
||||
"maxArchiveDays": "30"
|
||||
},
|
||||
"logconsole": {
|
||||
"type": "ColoredConsole",
|
||||
"layout": "${longdate} | ${uppercase:${level}} | ${logger:shortName=true} | ${message}"
|
||||
}
|
||||
},
|
||||
"rules": [
|
||||
{
|
||||
"logger": "*",
|
||||
"minLevel": "Trace",
|
||||
"writeTo": "logconsole"
|
||||
},
|
||||
{
|
||||
"logger": "*",
|
||||
"minLevel": "Info",
|
||||
"writeTo": "logfile"
|
||||
}
|
||||
]
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"CodApp": "MP.MON",
|
||||
"ConnectionStrings": {
|
||||
|
||||
@@ -14,46 +14,12 @@ using System.Threading.Tasks;
|
||||
using System.Diagnostics;
|
||||
using MP.FileData.Controllers;
|
||||
using MP.FileData.DTO;
|
||||
using StackExchange.Redis;
|
||||
|
||||
namespace MP.Prog.Data
|
||||
{
|
||||
public class FileArchDataService : IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private static IConfiguration _configuration;
|
||||
|
||||
private static ILogger<FileArchDataService> _logger;
|
||||
|
||||
private static List<FileData.DatabaseModels.MacchinaModel> ElencoMacchine = new List<FileData.DatabaseModels.MacchinaModel>();
|
||||
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private readonly IDistributedCache distributedCache;
|
||||
|
||||
private readonly IMemoryCache memoryCache;
|
||||
|
||||
/// <summary>
|
||||
/// Durata assoluta massima della cache
|
||||
/// </summary>
|
||||
private int chAbsExp = 15;
|
||||
|
||||
/// <summary>
|
||||
/// Durata della cache in modalità inattiva (non acceduta) prima di venire rimossa
|
||||
/// NON estende oltre il tempo massimo di validità della cache (chAbsExp)
|
||||
/// </summary>
|
||||
private int chSliExp = 5;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected static string connStringBBM = "";
|
||||
|
||||
protected static string connStringFatt = "";
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Public Fields
|
||||
|
||||
public static FileData.Controllers.FileController dbController;
|
||||
@@ -62,13 +28,15 @@ namespace MP.Prog.Data
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
public FileArchDataService(IConfiguration configuration, ILogger<FileArchDataService> logger, IMemoryCache memoryCache, IDistributedCache distributedCache)
|
||||
public FileArchDataService(IConfiguration configuration, ILogger<FileArchDataService> logger, IConnectionMultiplexer redisConnMult)
|
||||
{
|
||||
_logger = logger;
|
||||
_configuration = configuration;
|
||||
// conf cache
|
||||
this.memoryCache = memoryCache;
|
||||
this.distributedCache = distributedCache;
|
||||
|
||||
// Conf cache
|
||||
redisConn = redisConnMult;
|
||||
redisDb = this.redisConn.GetDatabase();
|
||||
|
||||
// conf DB
|
||||
string connStr = _configuration.GetConnectionString("MP.Prog");
|
||||
if (string.IsNullOrEmpty(connStr))
|
||||
@@ -84,60 +52,6 @@ namespace MP.Prog.Data
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private DistributedCacheEntryOptions cacheOpt
|
||||
{
|
||||
get
|
||||
{
|
||||
return new DistributedCacheEntryOptions().SetAbsoluteExpiration(DateTime.Now.AddMinutes(chAbsExp)).SetSlidingExpiration(TimeSpan.FromMinutes(chSliExp));
|
||||
}
|
||||
}
|
||||
|
||||
private DistributedCacheEntryOptions cacheOptLong
|
||||
{
|
||||
get
|
||||
{
|
||||
return new DistributedCacheEntryOptions().SetAbsoluteExpiration(DateTime.Now.AddMinutes(chAbsExp * 10)).SetSlidingExpiration(TimeSpan.FromMinutes(chSliExp));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Internal Methods
|
||||
|
||||
internal Task FileApprove(FileData.DatabaseModels.FileModel currItem)
|
||||
{
|
||||
return Task.FromResult(dbController.FileModApprove(currItem));
|
||||
}
|
||||
|
||||
internal Task FileDelete(FileData.DatabaseModels.FileModel currItem)
|
||||
{
|
||||
return Task.FromResult(dbController.FileDelete(currItem));
|
||||
}
|
||||
|
||||
internal Task FileExport(FileData.DatabaseModels.FileModel currItem)
|
||||
{
|
||||
return Task.FromResult(dbController.FileExport(currItem));
|
||||
}
|
||||
|
||||
internal Task FileReject(FileData.DatabaseModels.FileModel currItem)
|
||||
{
|
||||
return Task.FromResult(dbController.FileModReject(currItem));
|
||||
}
|
||||
|
||||
internal Task FileUpdate(FileData.DatabaseModels.FileModel updItem)
|
||||
{
|
||||
return Task.FromResult(dbController.FileUpdate(updItem));
|
||||
}
|
||||
|
||||
internal void ResetController()
|
||||
{
|
||||
dbController.ResetController();
|
||||
}
|
||||
|
||||
#endregion Internal Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void Dispose()
|
||||
@@ -227,24 +141,12 @@ namespace MP.Prog.Data
|
||||
return Task.FromResult(answ);
|
||||
}
|
||||
|
||||
#if false
|
||||
protected string getCacheKey(string TableName, SelectData CurrFilter)
|
||||
{
|
||||
string answ = $"{TableName}:M_{CurrFilter.IdxMacchina}:A_{CurrFilter.CodArticolo}:K_{CurrFilter.KeyRichiesta}:O_{CurrFilter.IdxOdl}:D_{CurrFilter.DateStart:yyyyMMddHHmm}_{CurrFilter.DateEnd:yyyyMMddHHmm}";
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected string getCacheKeyPaged(string TableName, SelectData CurrFilter)
|
||||
{
|
||||
string answ = $"{TableName}:M_{CurrFilter.IdxMacchina}:A_{CurrFilter.CodArticolo}:K_{CurrFilter.KeyRichiesta}:O_{CurrFilter.IdxOdl}:D_{CurrFilter.DateStart:yyMMddHHmm}_{CurrFilter.DateEnd:yyMMddHHmm}:R_{CurrFilter.FirstRecord}_{CurrFilter.FirstRecord + CurrFilter.NumRecord}";
|
||||
return answ;
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Aggiorna intero archivio scansionando dati x tutte le macchine che hanno un path valido
|
||||
/// </summary>
|
||||
/// <param name="numDayPre">Numero giorni x ricerca all'indietro da data corrente / 0 = nessun limite</param>
|
||||
/// <param name="numDayPre">
|
||||
/// Numero giorni x ricerca all'indietro da data corrente / 0 = nessun limite
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
public async Task<int> updateAllArchive(int numDayPre, bool forceTag)
|
||||
{
|
||||
@@ -262,7 +164,9 @@ namespace MP.Prog.Data
|
||||
/// Aggiorna archivio di una amcchina scansionando path relativo
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina">Codice macchina</param>
|
||||
/// <param name="numDayPre">Numero giorni x ricerca all'indietro da data corrente / 0 = nessun limite</param>
|
||||
/// <param name="numDayPre">
|
||||
/// Numero giorni x ricerca all'indietro da data corrente / 0 = nessun limite
|
||||
/// </param>
|
||||
/// <param name="forceTag">Forza la riverifica dei tags (x update da setup)</param>
|
||||
/// <param name="fullLog">Scrittura log verboso macchina</param>
|
||||
/// <returns></returns>
|
||||
@@ -342,5 +246,109 @@ namespace MP.Prog.Data
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Internal Methods
|
||||
|
||||
internal Task FileApprove(FileData.DatabaseModels.FileModel currItem)
|
||||
{
|
||||
return Task.FromResult(dbController.FileModApprove(currItem));
|
||||
}
|
||||
|
||||
internal Task FileDelete(FileData.DatabaseModels.FileModel currItem)
|
||||
{
|
||||
return Task.FromResult(dbController.FileDelete(currItem));
|
||||
}
|
||||
|
||||
internal Task FileExport(FileData.DatabaseModels.FileModel currItem)
|
||||
{
|
||||
return Task.FromResult(dbController.FileExport(currItem));
|
||||
}
|
||||
|
||||
internal Task FileReject(FileData.DatabaseModels.FileModel currItem)
|
||||
{
|
||||
return Task.FromResult(dbController.FileModReject(currItem));
|
||||
}
|
||||
|
||||
internal Task FileUpdate(FileData.DatabaseModels.FileModel updItem)
|
||||
{
|
||||
return Task.FromResult(dbController.FileUpdate(updItem));
|
||||
}
|
||||
|
||||
internal void ResetController()
|
||||
{
|
||||
dbController.ResetController();
|
||||
}
|
||||
|
||||
#endregion Internal Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected static string connStringBBM = "";
|
||||
protected static string connStringFatt = "";
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static IConfiguration _configuration;
|
||||
|
||||
private static ILogger<FileArchDataService> _logger;
|
||||
|
||||
private static List<FileData.DatabaseModels.MacchinaModel> ElencoMacchine = new List<FileData.DatabaseModels.MacchinaModel>();
|
||||
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
/// <summary>
|
||||
/// Durata cache lunga IN SECONDI
|
||||
/// </summary>
|
||||
private int cacheTtlLong = 60 * 5;
|
||||
|
||||
/// <summary>
|
||||
/// Durata cache breve IN SECONDI
|
||||
/// </summary>
|
||||
private int cacheTtlShort = 60 * 1;
|
||||
|
||||
/// <summary>
|
||||
/// Oggetto per connessione a REDIS
|
||||
/// </summary>
|
||||
private IConnectionMultiplexer redisConn;
|
||||
|
||||
//ISubscriber sub = redis.GetSubscriber();
|
||||
/// <summary>
|
||||
/// Oggetto DB redis da impiegare x chiamate R/W
|
||||
/// </summary>
|
||||
private IDatabase redisDb = null!;
|
||||
|
||||
private Random rnd = new Random();
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
/// <summary>
|
||||
/// Durata cache lunga (+ perturbazione percentuale +/-10%)
|
||||
/// </summary>
|
||||
private TimeSpan FastCache
|
||||
{
|
||||
get => TimeSpan.FromSeconds(cacheTtlShort * rnd.Next(900, 1100) / 1000);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Durata cache lunga (+ perturbazione percentuale +/-10%)
|
||||
/// </summary>
|
||||
private TimeSpan LongCache
|
||||
{
|
||||
get => TimeSpan.FromSeconds(cacheTtlLong * rnd.Next(900, 1100) / 1000);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Durata cache lunga (+ perturbazione percentuale +/-10%)
|
||||
/// </summary>
|
||||
private TimeSpan UltraLongCache
|
||||
{
|
||||
get => TimeSpan.FromSeconds(cacheTtlLong * 10 * rnd.Next(900, 1100) / 1000);
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<RootNamespace>MP.Prog</RootNamespace>
|
||||
<Version>6.16.2402.1919</Version>
|
||||
<Version>6.16.2409.0409</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -18,15 +18,11 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DiffMatchPatch" Version="1.0.3" />
|
||||
<PackageReference Include="Majorsoft.Blazor.Components.Debounce" Version="1.5.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.13">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="6.0.13" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.11" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
|
||||
<PackageReference Include="NLog" Version="5.1.1" />
|
||||
<PackageReference Include="NLog.Web.AspNetCore" Version="5.2.1" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.17" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="NLog" Version="5.3.3" />
|
||||
<PackageReference Include="NLog.Web.AspNetCore" Version="5.3.12" />
|
||||
<PackageReference Include="StackExchange.Redis" Version="2.8.12" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
|
||||
autoReload="true"
|
||||
throwExceptions="false"
|
||||
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log">
|
||||
|
||||
<!-- optional, add some variables
|
||||
https://github.com/nlog/NLog/wiki/Configuration-file#variables
|
||||
-->
|
||||
<variable name="myvar" value="myvalue" />
|
||||
|
||||
<!--
|
||||
See https://github.com/nlog/nlog/wiki/Configuration-file
|
||||
for information on customizing logging rules and outputs.
|
||||
-->
|
||||
<targets>
|
||||
|
||||
<!--
|
||||
add your targets here
|
||||
See https://github.com/nlog/NLog/wiki/Targets for possible targets.
|
||||
See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers.
|
||||
-->
|
||||
|
||||
<!--
|
||||
Write events to a file with the date in the filename.
|
||||
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
|
||||
layout="${longdate} ${uppercase:${level}} ${message}" />
|
||||
-->
|
||||
<target xsi:type="File" name="fileTarget" fileName="${basedir}/logs/${shortdate}.log" layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=false} | ${message}" />
|
||||
<target xsi:type="ColoredConsole" name="consoleTarget" layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=true} | ${message}" />
|
||||
</targets>
|
||||
|
||||
<rules>
|
||||
<!-- add your logging rules here -->
|
||||
|
||||
<!--
|
||||
Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f"
|
||||
<logger name="*" minlevel="Debug" writeTo="f" />
|
||||
-->
|
||||
<logger name="*" minlevel="Trace" writeTo="consoleTarget" />
|
||||
<!--<logger name="Microsoft.*" maxlevel="Info" final="true" />-->
|
||||
<logger name="*" minlevel="Info" writeTo="fileTarget" />
|
||||
</rules>
|
||||
</nlog>
|
||||
@@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using NLog;
|
||||
using NLog.Web;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -30,9 +31,9 @@ namespace MP.Prog
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
// inclusione NLog:
|
||||
// https://github.com/NLog/NLog/wiki/Getting-started-with-ASP.NET-Core-5
|
||||
// https://codewithmukesh.com/blog/logging-with-nlog-in-aspnet-core/
|
||||
var logger = NLog.Web.NLogBuilder.ConfigureNLog("NLog.config").GetCurrentClassLogger();
|
||||
var logger = LogManager.Setup()
|
||||
.LoadConfigurationFromAppSettings()
|
||||
.GetCurrentClassLogger();
|
||||
try
|
||||
{
|
||||
logger.Info("MP.Prog Application Starting Up");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo gestione Programmi MAPO</i>
|
||||
<h4>Versione: 6.16.2402.1919</h4>
|
||||
<h4>Versione: 6.16.2409.0409</h4>
|
||||
<br />
|
||||
Note di rilascio:
|
||||
<ul>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2402.1919
|
||||
6.16.2409.0409
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2402.1919</version>
|
||||
<version>6.16.2409.0409</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-PROG/stable/LAST/MP.Prog.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-PROG/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
@@ -8,6 +8,7 @@ using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using MP.Prog.Data;
|
||||
using StackExchange.Redis;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
@@ -116,12 +117,20 @@ namespace MP.Prog
|
||||
// options.ConnectionString = elmaConn;
|
||||
//});
|
||||
|
||||
#if false
|
||||
services.AddStackExchangeRedisCache(options =>
|
||||
{
|
||||
//options.Configuration = "localhost:6379";
|
||||
options.ConfigurationOptions = new StackExchange.Redis.ConfigurationOptions() { KeepAlive = 180, DefaultDatabase = 5, EndPoints = { { "localhost", 6379 } } };
|
||||
options.InstanceName = "MP:Prog";
|
||||
});
|
||||
{
|
||||
//options.Configuration = "localhost:6379";
|
||||
options.ConfigurationOptions = new StackExchange.Redis.ConfigurationOptions() { KeepAlive = 180, DefaultDatabase = 5, EndPoints = { { "localhost", 6379 } } };
|
||||
options.InstanceName = "MP:Prog";
|
||||
});
|
||||
#endif
|
||||
// REDIS setup
|
||||
string connStringRedis = Configuration.GetConnectionString("Redis");
|
||||
string redisSrvAddr = connStringRedis.Substring(0, connStringRedis.IndexOf(":"));
|
||||
// avvio oggetto shared x redis...
|
||||
var redisMultiplexer = ConnectionMultiplexer.Connect(connStringRedis);
|
||||
|
||||
|
||||
services.AddLocalization();
|
||||
|
||||
@@ -134,6 +143,7 @@ namespace MP.Prog
|
||||
//services.AddSingleton<FileArchDataService>();
|
||||
services.AddScoped<FileArchDataService>();
|
||||
services.AddScoped<MessageService>();
|
||||
services.AddSingleton<IConnectionMultiplexer>(redisMultiplexer);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
@@ -1,18 +1,61 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"Tags": {
|
||||
"DefaultSearch": "##"
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"DefaultConnection": "Server=SQL2016DEV;Database=MoonPro_PROG;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=MP.Prog;",
|
||||
"MP.Prog": "Server=SQL2016DEV;Database=MoonPro_PROG;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=MP.Prog;",
|
||||
"Redis": "localhost:26379,serviceName=devel,DefaultDatabase=5,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false"
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"NLog": {
|
||||
"variables": {
|
||||
"baseFileDir": "${basedir}/logs/",
|
||||
"layout": "${longdate} | ${uppercase:${level}} | ${logger:shortName=false} | ${message}"
|
||||
},
|
||||
// "internalLogLevel": "Info",
|
||||
// "internalLogFile": "c:\\temp\\internal-nlog.txt",
|
||||
"extensions": [
|
||||
{ "assembly": "NLog.Extensions.Logging" },
|
||||
{ "assembly": "NLog.Web.AspNetCore" }
|
||||
],
|
||||
"throwConfigExceptions": true,
|
||||
"targets": {
|
||||
"async": true,
|
||||
"logfile": {
|
||||
"type": "File",
|
||||
"fileName": "${basedir}/logs/${shortdate}.log",
|
||||
"archiveEvery": "Day",
|
||||
"archiveFileName": "${basedir}/logs/old/${shortdate}_{#}.log",
|
||||
"archiveNumbering": "DateAndSequence",
|
||||
"archiveAboveSize": "1024000",
|
||||
"archiveDateFormat": "HH",
|
||||
"maxArchiveFiles": "60",
|
||||
"maxArchiveDays": "30"
|
||||
},
|
||||
"logconsole": {
|
||||
"type": "ColoredConsole",
|
||||
"layout": "${longdate} | ${uppercase:${level}} | ${logger:shortName=true} | ${message}"
|
||||
}
|
||||
},
|
||||
"rules": [
|
||||
{
|
||||
"logger": "*",
|
||||
"minLevel": "Trace",
|
||||
"writeTo": "logconsole"
|
||||
},
|
||||
{
|
||||
"logger": "*",
|
||||
"minLevel": "Info",
|
||||
"writeTo": "logfile"
|
||||
}
|
||||
]
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"Tags": {
|
||||
"DefaultSearch": "##"
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"DefaultConnection": "Server=SQL2016DEV;Database=MoonPro_PROG;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=MP.Prog;",
|
||||
"MP.Prog": "Server=SQL2016DEV;Database=MoonPro_PROG;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=MP.Prog;",
|
||||
"Redis": "localhost:26379,serviceName=devel,DefaultDatabase=5,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false"
|
||||
}
|
||||
}
|
||||
@@ -76,7 +76,7 @@ namespace MP.SPEC.Components
|
||||
protected async Task getReparto()
|
||||
{
|
||||
string keyStor = "reparto";
|
||||
string localReparto = await localStorage.GetItemAsync<string>(keyStor);
|
||||
string localReparto = await localStorage.GetItemAsync<string>(keyStor) ?? "";
|
||||
if (!string.IsNullOrEmpty(localReparto))
|
||||
{
|
||||
selReparto = localReparto;
|
||||
|
||||
@@ -329,7 +329,7 @@ namespace MP.SPEC.Data
|
||||
// cerco in cache redis...
|
||||
string redKeyArtUsed = $"{Utils.redKeyArtUsed}:{codArticolo}";
|
||||
string redKeyTabCheckArt = Utils.redKeyTabCheckArt;
|
||||
string rawData = redisDb.StringGet(redKeyArtUsed);
|
||||
var rawData = redisDb.StringGet(redKeyArtUsed);
|
||||
if (!string.IsNullOrEmpty(rawData))
|
||||
{
|
||||
bool.TryParse(rawData, out answ);
|
||||
@@ -340,11 +340,11 @@ namespace MP.SPEC.Data
|
||||
try
|
||||
{
|
||||
// cerco in cache se ci sia la tabella con gli articoli impiegati...
|
||||
string rawTable = redisDb.StringGet(redKeyTabCheckArt);
|
||||
var rawTable = redisDb.StringGet(redKeyTabCheckArt);
|
||||
List<string>? artList = new List<string>();
|
||||
if (!string.IsNullOrEmpty(rawTable))
|
||||
{
|
||||
artList = JsonConvert.DeserializeObject<List<string>>(rawTable);
|
||||
artList = JsonConvert.DeserializeObject<List<string>>($"{rawTable}");
|
||||
}
|
||||
// rileggo...
|
||||
if (artList == null || artList.Count == 0)
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>MP.SPEC</RootNamespace>
|
||||
<Version>6.16.2404.3016</Version>
|
||||
<Version>6.16.2409.407</Version>
|
||||
<UserSecretsId>1800a78a-6ff1-40f9-b490-87fb8bfc1394</UserSecretsId>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -38,12 +38,14 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Blazored.LocalStorage" Version="4.3.0" />
|
||||
<PackageReference Include="Blazored.LocalStorage" Version="4.5.0" />
|
||||
<PackageReference Include="Blazored.SessionStorage" Version="2.4.0" />
|
||||
<PackageReference Include="EgwCoreLib.Razor" Version="1.4.2310.2417" />
|
||||
<PackageReference Include="EgwCoreLib.Utils" Version="1.4.2310.2417" />
|
||||
<PackageReference Include="EgwCoreLib.Razor" Version="1.5.2408.2710" />
|
||||
<PackageReference Include="EgwCoreLib.Utils" Version="1.5.2408.2710" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.Negotiate" Version="6.0.9" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="NLog.Web.AspNetCore" Version="5.3.12" />
|
||||
<PackageReference Include="StackExchange.Redis" Version="2.8.12" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
|
||||
autoReload="true"
|
||||
throwExceptions="false"
|
||||
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log">
|
||||
|
||||
<!-- optional, add some variables
|
||||
https://github.com/nlog/NLog/wiki/Configuration-file#variables
|
||||
-->
|
||||
<variable name="myvar" value="myvalue" />
|
||||
|
||||
<!--
|
||||
See https://github.com/nlog/nlog/wiki/Configuration-file
|
||||
for information on customizing logging rules and outputs.
|
||||
-->
|
||||
<targets>
|
||||
|
||||
<!--
|
||||
add your targets here
|
||||
See https://github.com/nlog/NLog/wiki/Targets for possible targets.
|
||||
See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers.
|
||||
-->
|
||||
|
||||
<!--
|
||||
Write events to a file with the date in the filename.
|
||||
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
|
||||
layout="${longdate} ${uppercase:${level}} ${message}" />
|
||||
-->
|
||||
<target xsi:type="File" name="fileTarget" fileName="${basedir}/logs/${shortdate}.log" layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=false} | ${message}" />
|
||||
<target xsi:type="ColoredConsole" name="consoleTarget" layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=true} | ${message}" />
|
||||
</targets>
|
||||
|
||||
<rules>
|
||||
<!-- add your logging rules here -->
|
||||
|
||||
<!--
|
||||
Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f"
|
||||
<logger name="*" minlevel="Debug" writeTo="f" />
|
||||
-->
|
||||
<logger name="*" minlevel="Debug" writeTo="consoleTarget" />
|
||||
<!--<logger name="Microsoft.*" maxlevel="Info" final="true" />-->
|
||||
<logger name="*" minlevel="Info" writeTo="fileTarget" />
|
||||
</rules>
|
||||
</nlog>
|
||||
@@ -90,7 +90,7 @@ namespace MP.SPEC.Pages
|
||||
protected async Task getReparto()
|
||||
{
|
||||
string keyStor = "reparto";
|
||||
string localReparto = await localStorage.GetItemAsync<string>(keyStor);
|
||||
string localReparto = await localStorage.GetItemAsync<string>(keyStor)??"";
|
||||
if (!string.IsNullOrEmpty(localReparto))
|
||||
{
|
||||
selReparto = localReparto;
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace MP.SPEC.Pages
|
||||
protected async Task getReparto()
|
||||
{
|
||||
string keyStor = "reparto";
|
||||
string localReparto = await localStorage.GetItemAsync<string>(keyStor);
|
||||
string localReparto = await localStorage.GetItemAsync<string>(keyStor) ?? "";
|
||||
if (!string.IsNullOrEmpty(localReparto))
|
||||
{
|
||||
selReparto = localReparto;
|
||||
|
||||
@@ -6,6 +6,8 @@ using Microsoft.AspNetCore.Components.Web;
|
||||
using MP.SPEC.Components;
|
||||
using MP.SPEC.Data;
|
||||
using MP.SPEC.Services;
|
||||
using NLog;
|
||||
using NLog.Web;
|
||||
using StackExchange.Redis;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
@@ -18,15 +20,26 @@ var builder = WebApplication.CreateBuilder(args);
|
||||
*
|
||||
* */
|
||||
|
||||
|
||||
var logger = LogManager.Setup()
|
||||
.LoadConfigurationFromAppSettings()
|
||||
.GetCurrentClassLogger();
|
||||
logger.Info("Program.cs: startup");
|
||||
|
||||
ConfigurationManager configuration = builder.Configuration;
|
||||
|
||||
|
||||
// REDIS setup
|
||||
logger.Info("Setup REDIS");
|
||||
string connStringRedis = configuration.GetConnectionString("Redis");
|
||||
//string connStringRedis = configuration.GetConnectionString("RedisAdmin");
|
||||
string redisSrvAddr = connStringRedis.Substring(0, connStringRedis.IndexOf(":"));
|
||||
// avvio oggetto shared x redis...
|
||||
var redisMultiplexer = ConnectionMultiplexer.Connect(connStringRedis);
|
||||
|
||||
|
||||
// Add services to the container.
|
||||
logger.Info("Setup Auth");
|
||||
builder.Services.AddAuthentication(NegotiateDefaults.AuthenticationScheme)
|
||||
.AddNegotiate();
|
||||
|
||||
@@ -47,7 +60,10 @@ builder.Services.AddBlazoredSessionStorage();
|
||||
builder.Services.AddHttpClient();
|
||||
builder.Services.AddSingleton<IOApiService>();
|
||||
|
||||
logger.Info("Aggiunti services");
|
||||
|
||||
var app = builder.Build();
|
||||
logger.Info("Build App");
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (!app.Environment.IsDevelopment())
|
||||
@@ -75,4 +91,6 @@ app.UseEndpoints(endpoints =>
|
||||
//app.MapBlazorHub();
|
||||
//app.MapFallbackToPage("/_Host");
|
||||
|
||||
logger.Info("Run App");
|
||||
|
||||
app.Run();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MAPOSPEC </i>
|
||||
<h4>Versione: 6.16.2404.3016</h4>
|
||||
<h4>Versione: 6.16.2409.407</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2404.3016
|
||||
6.16.2409.407
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2404.3016</version>
|
||||
<version>6.16.2409.407</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/MP.SPEC.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
@@ -5,6 +5,49 @@
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"NLog": {
|
||||
"variables": {
|
||||
"baseFileDir": "${basedir}/logs/",
|
||||
"layout": "${longdate} | ${uppercase:${level}} | ${logger:shortName=false} | ${message}"
|
||||
},
|
||||
// "internalLogLevel": "Info",
|
||||
// "internalLogFile": "c:\\temp\\internal-nlog.txt",
|
||||
"extensions": [
|
||||
{ "assembly": "NLog.Extensions.Logging" },
|
||||
{ "assembly": "NLog.Web.AspNetCore" }
|
||||
],
|
||||
"throwConfigExceptions": true,
|
||||
"targets": {
|
||||
"async": true,
|
||||
"logfile": {
|
||||
"type": "File",
|
||||
"fileName": "${basedir}/logs/${shortdate}.log",
|
||||
"archiveEvery": "Day",
|
||||
"archiveFileName": "${basedir}/logs/old/${shortdate}_{#}.log",
|
||||
"archiveNumbering": "DateAndSequence",
|
||||
"archiveAboveSize": "1024000",
|
||||
"archiveDateFormat": "HH",
|
||||
"maxArchiveFiles": "60",
|
||||
"maxArchiveDays": "30"
|
||||
},
|
||||
"logconsole": {
|
||||
"type": "ColoredConsole",
|
||||
"layout": "${longdate} | ${uppercase:${level}} | ${logger:shortName=true} | ${message}"
|
||||
}
|
||||
},
|
||||
"rules": [
|
||||
{
|
||||
"logger": "*",
|
||||
"minLevel": "Trace",
|
||||
"writeTo": "logconsole"
|
||||
},
|
||||
{
|
||||
"logger": "*",
|
||||
"minLevel": "Info",
|
||||
"writeTo": "logfile"
|
||||
}
|
||||
]
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"CodApp": "MP.SPEC",
|
||||
"ConnectionStrings": {
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<RootNamespace>MP.Stats</RootNamespace>
|
||||
<UserSecretsId>826e877c-ba70-4253-84cb-d0b1cafd4440</UserSecretsId>
|
||||
<Version>6.16.2404.1616</Version>
|
||||
<Version>6.16.2404.1616</Version>
|
||||
<Version>6.16.2409.0409</Version>
|
||||
<Version>6.16.2409.0409</Version>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);1591</NoWarn>
|
||||
</PropertyGroup>
|
||||
@@ -188,13 +188,15 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="EgwCoreLib.Razor" Version="1.4.2310.2417" />
|
||||
<PackageReference Include="EgwCoreLib.Razor" Version="1.5.2408.2710" />
|
||||
<PackageReference Include="ElmahCore" Version="2.1.2" />
|
||||
<PackageReference Include="ElmahCore.Common" Version="2.1.2" />
|
||||
<PackageReference Include="ElmahCore.Sql" Version="2.1.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components" Version="6.0.33" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="NLog.Web.AspNetCore" Version="5.2.1" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
|
||||
<PackageReference Include="NLog.Web.AspNetCore" Version="5.3.12" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.7.3" />
|
||||
<PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
|
||||
autoReload="true"
|
||||
throwExceptions="false"
|
||||
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log">
|
||||
|
||||
<!-- optional, add some variables
|
||||
https://github.com/nlog/NLog/wiki/Configuration-file#variables
|
||||
-->
|
||||
<variable name="myvar" value="myvalue" />
|
||||
|
||||
<!--
|
||||
See https://github.com/nlog/nlog/wiki/Configuration-file
|
||||
for information on customizing logging rules and outputs.
|
||||
-->
|
||||
<targets>
|
||||
|
||||
<!--
|
||||
add your targets here
|
||||
See https://github.com/nlog/NLog/wiki/Targets for possible targets.
|
||||
See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers.
|
||||
-->
|
||||
|
||||
<!--
|
||||
Write events to a file with the date in the filename.
|
||||
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
|
||||
layout="${longdate} ${uppercase:${level}} ${message}" />
|
||||
-->
|
||||
<target xsi:type="File" name="fileTarget" fileName="${basedir}/logs/${shortdate}.log" layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=false} | ${message}" />
|
||||
<target xsi:type="ColoredConsole" name="consoleTarget" layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=true}| ${message}" />
|
||||
</targets>
|
||||
|
||||
<rules>
|
||||
<!-- add your logging rules here -->
|
||||
|
||||
<!--
|
||||
Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f"
|
||||
<logger name="*" minlevel="Debug" writeTo="f" />
|
||||
-->
|
||||
<logger name="*" minlevel="Trace" writeTo="consoleTarget" />
|
||||
<!--<logger name="Microsoft.*" maxlevel="Info" final="true" />-->
|
||||
<logger name="*" minlevel="Info" writeTo="fileTarget" />
|
||||
</rules>
|
||||
</nlog>
|
||||
@@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using NLog;
|
||||
using NLog.Web;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -23,7 +24,7 @@ namespace MP.Stats
|
||||
.ConfigureLogging(logging =>
|
||||
{
|
||||
logging.ClearProviders();
|
||||
logging.SetMinimumLevel(LogLevel.Information);
|
||||
logging.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Information);
|
||||
//logging.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace);
|
||||
})
|
||||
.UseNLog();
|
||||
@@ -31,9 +32,9 @@ namespace MP.Stats
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
// inclusione NLog:
|
||||
// https://github.com/NLog/NLog/wiki/Getting-started-with-ASP.NET-Core-5
|
||||
// https://codewithmukesh.com/blog/logging-with-nlog-in-aspnet-core/
|
||||
var logger = NLog.Web.NLogBuilder.ConfigureNLog("NLog.config").GetCurrentClassLogger();
|
||||
var logger = LogManager.Setup()
|
||||
.LoadConfigurationFromAppSettings()
|
||||
.GetCurrentClassLogger();
|
||||
try
|
||||
{
|
||||
logger.Info("MP.STATS Application Starting Up");
|
||||
|
||||