53 Commits

Author SHA1 Message Date
Samuele Locatelli 9bf93c4996 reorg config vari 2024-03-04 11:34:13 +01:00
Samuele Locatelli 82248f1068 fix calcolo url logout 2024-03-04 11:34:06 +01:00
Samuele Locatelli b0c37aa79f Merge tag 'BasePathIdentityFix02' into develop
Fix logout (spero...)
2024-03-04 11:22:31 +01:00
Samuele Locatelli 967a4e0e2f Merge branch 'release/BasePathIdentityFix02' 2024-03-04 11:22:23 +01:00
Samuele Locatelli 361854f5b5 Try fix action x logout 2024-03-04 11:22:10 +01:00
Samuele Locatelli 52d65add22 Update x login partial 2024-03-04 11:16:41 +01:00
Samuele Locatelli b868660ed9 Merge tag 'BasePathIdentityFix01' into develop
Fix base path (da testare)
2024-03-04 11:08:41 +01:00
Samuele Locatelli 2bbfa4b6bf Merge branch 'release/BasePathIdentityFix01' 2024-03-04 11:08:32 +01:00
Samuele Locatelli 118e43f0c2 Fix base URL 2024-03-04 11:07:54 +01:00
Samuele Locatelli 726df4d36c Merge branch 'main' into develop 2024-03-04 10:56:38 +01:00
Samuele Locatelli 68204acddd Merge branch 'develop' 2024-03-04 10:56:24 +01:00
Samuele Locatelli 2b2e258020 Update nuget EFCore a 6.0.27 2024-03-04 10:51:52 +01:00
Samuele Locatelli 17bbaf2136 Update login page 2024-03-04 10:48:46 +01:00
Samuele Locatelli b2fd3a39fa Update email settings 2024-03-04 10:47:16 +01:00
Samuele Locatelli f843aff337 Fix user menu nav 2024-03-04 10:44:38 +01:00
Samuele Locatelli 13afc6464f Merge branch 'release/UpdateLoginLogoutPage01' 2024-02-21 11:30:03 +01:00
Samuele Locatelli eb64db41da Update pagine login/logout 2024-02-21 11:29:15 +01:00
Samuele Locatelli 65e54aefbe Merge tag 'FixreloadLayout01' into develop
Fix modifiche reload page x javascript di base blazor
2024-02-19 19:29:11 +01:00
Samuele Locatelli e44d1e04a2 Merge branch 'release/FixreloadLayout01' 2024-02-19 19:28:40 +01:00
Samuele Locatelli fa948fd5d0 Fix gestione reload page 2024-02-19 19:28:11 +01:00
Samuele Locatelli 30fa3b8444 Merge tag 'TestForceRecalcSvg01' into develop
Gestione ricalcolo porte quando missing: inserita, testata
2024-02-16 18:07:15 +01:00
Samuele Locatelli 35815c3a56 Merge branch 'release/TestForceRecalcSvg01' 2024-02-16 18:06:56 +01:00
Samuele Locatelli 4585ac4bf8 Aggiunta e testata rilettura DDF + SVG da missing 2024-02-16 18:05:43 +01:00
Samuele Locatelli 70cd621f80 Bozza modifiche x richeista ricalcolo porta (se missing) 2024-02-16 17:09:58 +01:00
Samuele Locatelli 145a0f5c7e Merge tag 'FixLogVerboseSrv01' into develop
Fix log verboso su SRV
2024-02-16 16:03:19 +01:00
Samuele Locatelli 9bac691032 Merge branch 'release/FixLogVerboseSrv01' 2024-02-16 16:03:03 +01:00
Samuele Locatelli ba7d395d20 Review livelli out info x richieste + frequenti 2024-02-16 15:55:33 +01:00
Samuele Locatelli 3c07a3ae26 Update logging x SRV e WebDoorCreatorService 2024-02-16 15:50:13 +01:00
Samuele Locatelli ca5731d2e6 Deduplica log avvio QueueController 2024-02-16 15:40:17 +01:00
Samuele Locatelli f8426f304a Update log... 2024-02-16 15:21:17 +01:00
Samuele Locatelli b9414c7a48 fix loog statistiche e log 2024-02-16 14:51:31 +01:00
Samuele Locatelli 6c9c3d8d85 Riscrittura metodi log QueueController e QueueDataService 2024-02-16 14:38:01 +01:00
Samuele Locatelli 5df108a979 Merge tag 'TestOvhDeploy04' into develop
completo merge con update json conf
2024-02-16 08:35:31 +01:00
Samuele Locatelli f15b1694f7 Merge branch 'release/TestOvhDeploy04' 2024-02-16 08:35:23 +01:00
Samuele Locatelli 30e37531a2 update conf 2024-02-16 08:34:23 +01:00
Samuele Locatelli 215383c630 Merge tag 'TestOvhDeploy04' into develop
Test deploy post fix DB num (11 --> 12)
2024-02-16 08:34:07 +01:00
Samuele Locatelli 5df5391030 Merge branch 'release/TestOvhDeploy04' 2024-02-16 08:33:44 +01:00
Samuele Locatelli 530faf053f Nuovo test deploy OVH 2024-02-16 08:33:26 +01:00
Samuele Locatelli 592034c9d4 Merge tag 'TestOvhDeploy03' into develop
mancava modifica utente deploy oltre a pwd...
2024-02-15 18:42:10 +01:00
Samuele Locatelli 2a2e31d087 Merge branch 'release/TestOvhDeploy03' 2024-02-15 18:42:00 +01:00
Samuele Locatelli 419150a41f modifica user deploy WDC 2024-02-15 18:41:46 +01:00
Samuele Locatelli fc4be10caa Merge tag 'TestOvhDeploy02' into develop
fix variabile x upload su OVH/WDC
2024-02-15 18:39:12 +01:00
Samuele Locatelli 2413b27678 Merge branch 'release/TestOvhDeploy02' 2024-02-15 18:39:01 +01:00
Samuele Locatelli 95ff88ac11 modifica variabile x pwd OVH 2024-02-15 18:38:39 +01:00
Samuele Locatelli 54d7e594f1 Merge tag 'TestOvhDeploy01' into develop
primo test deploy su OVH da CI/CD
2024-02-15 18:36:31 +01:00
Samuele Locatelli 7900141bda Merge branch 'release/TestOvhDeploy01' 2024-02-15 18:36:19 +01:00
Samuele Locatelli 13953a86d6 Merge commit '06b06db04dea2f591ca4c75c7b763a2e7d540876' into develop 2024-02-15 18:31:14 +01:00
Samuele Locatelli 7f0ee8ad7f Test CI/CD verso prod da testare 2024-02-15 18:30:40 +01:00
Samuele Locatelli 788112e54e impostata modifica x ricalcolo file svg missing 2024-02-15 18:26:19 +01:00
Samuele Locatelli 0e8ec13e68 refresh conf UI x nuovo prod json 2024-02-15 17:40:26 +01:00
Samuele Locatelli 67fe028cb6 Pulizia conf utenti 2024-02-15 17:40:05 +01:00
Samuele Locatelli 55f4ee077d Update x API SRV su WDC-OVH 2024-02-15 17:33:59 +01:00
Samuele Locatelli cc6b195aa3 Aggiunta conf x deploy su WDC-OVH 2024-02-15 17:33:21 +01:00
38 changed files with 1348 additions and 439 deletions
+12 -8
View File
@@ -111,6 +111,8 @@ WDC.Api:staging:
script: script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj - dotnet build $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj - dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
## IIS 02
#- dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
WDC.UI:staging: WDC.UI:staging:
stage: staging stage: staging
@@ -131,6 +133,8 @@ WDC.UI:staging:
script: script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj - dotnet build $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj - dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
## IIS 02
#- dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
# ---------- DEPLOY ---------- # ---------- DEPLOY ----------
WDC.Api:deploy: WDC.Api:deploy:
@@ -151,10 +155,10 @@ WDC.Api:deploy:
- dotnet restore "$env:SOL_NAME.sln" - dotnet restore "$env:SOL_NAME.sln"
script: script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj - dotnet build $env:APP_NAME/$env:APP_NAME.csproj
# IIS 02 # IIS OVH PROD
- dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj - dotnet publish -p:PublishProfile=IIS-OVH-PROD.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=steamware -p:Password=$WDC_IIS_PWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
# IIS PROD ## IIS PROD
- dotnet publish -p:PublishProfile=IIS-PROD.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj #- dotnet publish -p:PublishProfile=IIS-PROD.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
WDC.UI:deploy: WDC.UI:deploy:
stage: deploy stage: deploy
@@ -171,10 +175,10 @@ WDC.UI:deploy:
- dotnet restore "$env:SOL_NAME.sln" - dotnet restore "$env:SOL_NAME.sln"
script: script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj - dotnet build $env:APP_NAME/$env:APP_NAME.csproj
# IIS EXT # IIS OVH PROD
- dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj - dotnet publish -p:PublishProfile=IIS-OVH-PROD.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=steamware -p:Password=$WDC_IIS_PWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
# IIS INT ## IIS PROD
- dotnet publish -p:PublishProfile=IIS-PROD.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj #- dotnet publish -p:PublishProfile=IIS-PROD.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
# ---------- RELEASE ---------- # ---------- RELEASE ----------
WDC.Api:release: WDC.Api:release:
Binary file not shown.
+1 -1
View File
@@ -1,6 +1,6 @@
<body> <body>
<i>WebDoorCreator - Egalware</i> <i>WebDoorCreator - Egalware</i>
<h4>Version: 0.9.2401.0415</h4> <h4>Version: 0.9.2403.0411</h4>
<br /> Release note: <br /> Release note:
<ul> <ul>
<li> <li>
+1 -1
View File
@@ -1 +1 @@
0.9.2401.0415 0.9.2403.0411
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<item> <item>
<version>0.9.2401.0415</version> <version>0.9.2403.0411</version>
<url>http://nexus.steamware.net/repository/SWS/WDC/stable/WDC.UI.zip</url> <url>http://nexus.steamware.net/repository/SWS/WDC/stable/WDC.UI.zip</url>
<changelog>http://nexus.steamware.net/repository/SWS/WDC/stable/ChangeLog.html</changelog> <changelog>http://nexus.steamware.net/repository/SWS/WDC/stable/ChangeLog.html</changelog>
<mandatory>false</mandatory> <mandatory>false</mandatory>
@@ -5,6 +5,7 @@ using Svg;
using Svg.Skia; using Svg.Skia;
using System.Drawing; using System.Drawing;
using WebDoorCreator.Data.Services; using WebDoorCreator.Data.Services;
#if false #if false
using SkiaSharp; using SkiaSharp;
using Svg.Skia; using Svg.Skia;
@@ -18,11 +19,13 @@ namespace WebDoorCreator.API.Controllers
{ {
#region Public Constructors #region Public Constructors
public DoorImageController(IConfiguration configuration, QueueDataService DataService) public DoorImageController(IConfiguration configuration, QueueDataService cQDService, WebDoorCreatorService cWDCService)
{ {
Log.Info("Starting DoorImageController"); Log.Info("Starting DoorImageController");
_configuration = configuration; _configuration = configuration;
QDataServ = DataService; WaitReloadSvg = _configuration.GetValue<int>("RuntimeOpt:WaitReloadSvg");
QDService = cQDService;
WDService = cWDCService;
Log.Info("Avviato DoorImageController"); Log.Info("Avviato DoorImageController");
} }
@@ -37,12 +40,24 @@ namespace WebDoorCreator.API.Controllers
return "OK"; return "OK";
} }
[HttpGet("GetImage.png")] [HttpGet("GetImage.png")]
public async Task<IActionResult> GetImagePng(int DoorId) public async Task<IActionResult> GetImagePng(int DoorId)
{ {
byte[] result = new byte[0]; byte[] result = new byte[0];
string svgContent = await QDataServ.DoorGetLastSvg(DoorId); string svgContent = await QDService.DoorGetLastSvg(DoorId);
// se fosse vuoto...
if (string.IsNullOrEmpty(svgContent))
{
// richiede ricalcolo img
svgContent = await SendRecalcReq(DoorId);
}
// se fosse vuoto...
if (string.IsNullOrEmpty(svgContent))
{
// legge img vuota
svgContent = QDService.DoorGetMissingSvg();
}
// ora prosegue con conversione...
if (!string.IsNullOrEmpty(svgContent)) if (!string.IsNullOrEmpty(svgContent))
{ {
using (var svg = new SKSvg()) using (var svg = new SKSvg())
@@ -73,7 +88,15 @@ namespace WebDoorCreator.API.Controllers
[HttpGet("GetImage.svg")] [HttpGet("GetImage.svg")]
public async Task<IActionResult> GetImageSvg(int DoorId) public async Task<IActionResult> GetImageSvg(int DoorId)
{ {
string svgContent = await QDataServ.DoorGetLastSvg(DoorId); string svgContent = await QDService.DoorGetLastSvg(DoorId);
// se fosse vuoto...
if (string.IsNullOrEmpty(svgContent))
{
// richiede ricalcolo img
await SendRecalcReq(DoorId);
// legge img vuota
svgContent = QDService.DoorGetMissingSvg();
}
var result = System.Text.Encoding.UTF8.GetBytes(svgContent); var result = System.Text.Encoding.UTF8.GetBytes(svgContent);
return File(result, "image/svg+xml"); return File(result, "image/svg+xml");
} }
@@ -86,18 +109,48 @@ namespace WebDoorCreator.API.Controllers
private static Logger Log = LogManager.GetCurrentClassLogger(); private static Logger Log = LogManager.GetCurrentClassLogger();
private int WaitReloadSvg = 100;
#endregion Private Fields #endregion Private Fields
#region Private Properties #region Private Properties
private QueueDataService QDataServ { get; set; } = null!; private QueueDataService QDService { get; set; } = null!;
private WebDoorCreatorService WDService { get; set; } = null!;
#endregion Private Properties #endregion Private Properties
#region Private Methods #region Private Methods
/// <summary>
/// Invio richiesta ricalcolo porta
/// </summary>
/// <param name="DoorId"></param>
/// <returns></returns>
private async Task<string> SendRecalcReq(int DoorId)
{
string answ = "";
// richiede ricalcolo img
List<string> doorIdList = new List<string>() { $"{DoorId}" };
// chiamo reset richieste
var list2Proc = await QDService.ResetQueueByDoorList(doorIdList);
// recupero DDF ed invio x processing
if (DoorId > 0)
{
string currDDF = await WDService.DoorOpGetDDF(DoorId);
// versione corrente del DDF generato
int currVers = await QDService.SendCalcReq(DoorId, currDDF);
}
// attende ...
await Task.Delay(WaitReloadSvg);
// riprova lettura
answ = await QDService.DoorGetLastSvg(DoorId);
return answ;
}
#endregion Private Methods #endregion Private Methods
} }
} }
@@ -1,5 +1,7 @@
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using NLog; using NLog;
using System.Diagnostics;
using WebDoorCreator.Core;
using WebDoorCreator.Data.DTO; using WebDoorCreator.Data.DTO;
using WebDoorCreator.Data.Services; using WebDoorCreator.Data.Services;
@@ -13,11 +15,20 @@ namespace WebDoorCreator.API.Controllers
public QueueController(IConfiguration configuration, QueueDataService DataService, WebDoorCreatorService _WDService) public QueueController(IConfiguration configuration, QueueDataService DataService, WebDoorCreatorService _WDService)
{ {
Log.Info("Starting QueueController");
_configuration = configuration; _configuration = configuration;
logTimingEnable = configuration.GetValue<bool>("RuntimeOpt:LogTimingEnable");
QDataServ = DataService; QDataServ = DataService;
WDService = _WDService; WDService = _WDService;
Log.Info("Avviato QueueController"); // aggiungo..
string statName = "QueueController";
bool doWrite = QDataServ.StatUpsert(statName, new TimeSpan(), 5).Result;
// se campione "pieno"...
if (doWrite)
{
// recupero e resetto
ExecStats statRec = QDataServ.StatReset(statName).Result;
Log.Trace($"Avviato QueueController x {statRec.NumCall}");
}
} }
#endregion Public Constructors #endregion Public Constructors
@@ -133,6 +144,7 @@ namespace WebDoorCreator.API.Controllers
string answ = "NA"; string answ = "NA";
bool fatto = await QDataServ.SaveProcessingResult(calcResults); bool fatto = await QDataServ.SaveProcessingResult(calcResults);
answ = fatto ? "OK" : "NO"; answ = fatto ? "OK" : "NO";
Log.Debug("Eseguito SaveProcResult");
return answ; return answ;
} }
@@ -143,6 +155,11 @@ namespace WebDoorCreator.API.Controllers
[HttpGet("StatusList")] [HttpGet("StatusList")]
public async Task<Dictionary<string, Dictionary<string, string>>> StatusList() public async Task<Dictionary<string, Dictionary<string, string>>> StatusList()
{ {
Stopwatch sw = new Stopwatch();
if (logTimingEnable)
{
sw.Start();
}
Dictionary<string, Dictionary<string, string>> answ = new Dictionary<string, Dictionary<string, string>>(); Dictionary<string, Dictionary<string, string>> answ = new Dictionary<string, Dictionary<string, string>>();
var actPend = await QDataServ.RequestPending(); var actPend = await QDataServ.RequestPending();
answ.Add("pending", actPend); answ.Add("pending", actPend);
@@ -155,6 +172,20 @@ namespace WebDoorCreator.API.Controllers
var actDone = await QDataServ.RequestDone(); var actDone = await QDataServ.RequestDone();
answ.Add("done", actDone); answ.Add("done", actDone);
if (logTimingEnable)
{
sw.Stop();
// aggiungo..
string statName = "StatusList";
bool doWrite = await QDataServ.StatUpsert(statName, sw.Elapsed, 5);
// se campione "pieno"...
if (doWrite)
{
// recupero e resetto
ExecStats statRec = await QDataServ.StatReset(statName);
Log.Info($"Eseguito {statName} x {statRec.NumCall} | {statRec.AvgTime.TotalMilliseconds:N3}ms");
}
}
return answ; return answ;
} }
@@ -168,6 +199,7 @@ namespace WebDoorCreator.API.Controllers
public async Task<Dictionary<string, string>> TakeProcessingItems(int numItems = 10) public async Task<Dictionary<string, string>> TakeProcessingItems(int numItems = 10)
{ {
var actQueue = await QDataServ.TakeProcessingItems(numItems); var actQueue = await QDataServ.TakeProcessingItems(numItems);
Log.Debug($"Eseguito TakeProcessingItems per {numItems} items");
return actQueue; return actQueue;
} }
@@ -175,9 +207,10 @@ namespace WebDoorCreator.API.Controllers
#region Private Fields #region Private Fields
private static IConfiguration _configuration = null!;
private static Logger Log = LogManager.GetCurrentClassLogger(); private static Logger Log = LogManager.GetCurrentClassLogger();
private IConfiguration _configuration = null!;
private bool logTimingEnable = false;
#endregion Private Fields #endregion Private Fields
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<WebPublishMethod>MSDeploy</WebPublishMethod>
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish>https://wdc.egalware.com/SRV/swagger/index.html</SiteUrlToLaunchAfterPublish>
<ExcludeApp_Data>false</ExcludeApp_Data>
<ProjectGuid>c2109e71-4eae-4167-9052-175123ccc2bc</ProjectGuid>
<SelfContained>false</SelfContained>
<MSDeployServiceURL>https://wdc-w-iis-01.ovh:8172/MsDeploy.axd</MSDeployServiceURL>
<DeployIisAppPath>wdc.egalware.com/SRV</DeployIisAppPath>
<RemoteSitePhysicalPath />
<SkipExtraFilesOnServer>false</SkipExtraFilesOnServer>
<MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
<EnableMSDeployBackup>true</EnableMSDeployBackup>
<EnableMsDeployAppOffline>true</EnableMsDeployAppOffline>
<UserName>steamware</UserName>
<_SavePWD>true</_SavePWD>
<_TargetId>IISWebDeploy</_TargetId>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
</Project>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TimeStampOfAssociatedLegacyPublishXmlFile />
<EncryptedPassword>AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAs/7D3mNhw0uqUXeNq4OiHAAAAAACAAAAAAADZgAAwAAAABAAAACWZ0w5h84UFtYYB4xT+4rFAAAAAASAAACgAAAAEAAAAIcwjcdAiCDZN1OwNWoZSfQYAAAAiyiNcp/zeuC6Vt16+OALvsaO0rbkiVMVFAAAAHS264wElPIM4sYvPHMhW0YsXNe9</EncryptedPassword>
<History>True|2024-02-15T18:34:35.8362293Z;False|2024-02-15T19:33:47.6399861+01:00;True|2024-02-13T17:40:01.6315651+01:00;False|2024-02-13T17:37:21.2072257+01:00;False|2024-02-13T17:33:33.1471911+01:00;True|2023-05-22T15:37:00.8611764+02:00;True|2023-05-11T17:35:09.5858697+02:00;True|2022-01-27T10:34:09.2346456+01:00;True|2022-01-27T10:13:36.3080675+01:00;True|2022-01-27T10:05:45.6649507+01:00;True|2022-01-26T14:34:16.5263189+01:00;True|2022-01-26T13:04:22.2336648+01:00;False|2022-01-26T13:04:06.0677616+01:00;True|2021-11-08T09:03:37.7855257+01:00;True|2021-11-08T09:03:34.8263479+01:00;True|2021-11-08T09:03:31.8889390+01:00;True|2021-10-29T16:19:33.6539408+02:00;True|2021-10-29T16:19:28.2082360+02:00;True|2021-10-26T16:12:11.7740950+02:00;True|2021-10-26T16:11:56.2014641+02:00;True|2021-10-26T16:11:22.2897842+02:00;False|2021-10-26T16:10:58.3733037+02:00;False|2021-10-26T16:10:29.4793991+02:00;True|2021-10-21T17:35:11.9761128+02:00;True|2021-10-18T20:22:00.9305399+02:00;True|2021-10-18T18:32:29.4558070+02:00;True|2021-10-18T18:32:22.8950294+02:00;True|2021-10-18T18:16:13.7563877+02:00;True|2021-10-18T18:15:48.5678387+02:00;True|2021-10-18T12:45:45.7228681+02:00;True|2021-10-18T12:14:22.3221605+02:00;True|2021-10-18T12:14:15.7373530+02:00;True|2021-10-18T12:10:43.8607301+02:00;</History>
<LastFailureDetails />
</PropertyGroup>
</Project>
@@ -8,6 +8,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS-OVH-PROD.pubxml" />
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS-PROD.pubxml" /> <_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS-PROD.pubxml" />
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS01.pubxml" /> <_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS01.pubxml" />
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS02.pubxml" /> <_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS02.pubxml" />
@@ -15,6 +16,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="Properties\PublishProfiles\IIS-OVH-PROD.pubxml.user" />
<None Include="Properties\PublishProfiles\IIS-PROD.pubxml.user" /> <None Include="Properties\PublishProfiles\IIS-PROD.pubxml.user" />
</ItemGroup> </ItemGroup>
@@ -38,6 +40,9 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Update="logs\.placeholder.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Reports\Report.rdlc"> <None Update="Reports\Report.rdlc">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>
@@ -6,7 +6,7 @@
} }
}, },
"ConnectionStrings": { "ConnectionStrings": {
"Redis": "nkcredis.steamware.net:6379, DefaultDatabase=12, connectTimeout=5000, syncTimeout=5000, asyncTimeout=5000, abortConnect=false, ssl=false, password=BtN9Py1wtLfLRvmzWnOPJ7RytDM+CLiVsJ/16zduNTlV8IOPGNrtzJSXPUnImA5PqmUMhKaUqo9NdHIG", "Redis": "wdc-u-redis-01.ovh:6379, DefaultDatabase=12, connectTimeout=5000, syncTimeout=5000, asyncTimeout=5000, abortConnect=false, ssl=false, password=BtN9Py1wtLfLRvmzWnOPJ7RytDM+CLiVsJ/16zduNTlV8IOPGNrtzJSXPUnImA5PqmUMhKaUqo9NdHIG",
"WDC.DB": "Server=SQL2016PROD;Database=DCA_WebDoorCreator; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=WebDoorCreator.UI;" "WDC.DB": "Server=WDC-W-SQL-01\\SQLEXPRESS;Database=DCA_WebDoorCreator; User ID=steamware;Password=viadante16; integrated security=False; MultipleActiveResultSets=True; App=WebDoorCreator.UI;"
} }
} }
+6 -3
View File
@@ -24,10 +24,13 @@
}, },
"MailDest": { "MailDest": {
"Admin": "samuele@steamware.net", "Admin": "samuele@steamware.net",
"ProjCheck": "samuele.locatelli@egalware.com,mara.baroni@egalware.com", "ProjCheck": "samuele.locatelli@egalware.com",
"TimbCheck": "samuele.locatelli@egalware.com,mara.baroni@egalware.com" "TimbCheck": "samuele.locatelli@egalware.com"
}, },
"RuntimeOpt": { "RuntimeOpt": {
"VetoRemoveProcessing": 5 "WaitReloadSvg": 200,
"VetoRemoveProcessing": 5,
"StatSampleSize": 30,
"LogTimingEnable": true
} }
} }
-1
View File
@@ -19,7 +19,6 @@ Public Module ConstIni
' File con dati di licenza ' File con dati di licenza
Public Const LIC_FILE_NAME As String = "WebDoorCreator.CamSrv.lic" Public Const LIC_FILE_NAME As String = "WebDoorCreator.CamSrv.lic"
Public Const S_LICENCE As String = "Licence" Public Const S_LICENCE As String = "Licence"
Public Const K_LOCKID As String = "LockId"
Public Const K_KEY As String = "Key" Public Const K_KEY As String = "Key"
' File di log generale ' File di log generale
+21 -29
View File
@@ -937,10 +937,7 @@ Public Class ProcMan
' elimino vecchi ' elimino vecchi
If Not IsNothing(fileList) Then If Not IsNothing(fileList) Then
For Each sFile In fileList For Each sFile In fileList
Try File.Delete(sFile)
File.Delete(sFile)
Catch ex As Exception
End Try
Next Next
End If End If
@@ -1300,27 +1297,22 @@ Public Class ProcMan
Private Sub ProcMan_Load(sender As Object, e As EventArgs) Handles MyBase.Load Private Sub ProcMan_Load(sender As Object, e As EventArgs) Handles MyBase.Load
m_IniFilePath = AppDomain.CurrentDomain.BaseDirectory & INI_FILE_NAME m_IniFilePath = AppDomain.CurrentDomain.BaseDirectory & INI_FILE_NAME
ManageInstance() ManageInstance()
'' Imposto tipo di chiave ' Imposto tipo di chiave
'EgtSetLockType(KEY_TYPE.HW) EgtSetLockType(KEY_TYPE.HW)
'' Leggo e imposto chiave di protezione ' Leggo e imposto chiave di protezione
'Dim sLicFileName As String = String.Empty Dim sLicFileName As String = String.Empty
'GetPrivateProfileString(S_GENERAL, K_LICENCE, LIC_FILE_NAME, sLicFileName, m_IniFilePath) GetPrivateProfileString(S_GENERAL, K_LICENCE, LIC_FILE_NAME, sLicFileName, m_IniFilePath)
'Dim sLicFile As String = AppDomain.CurrentDomain.BaseDirectory & sLicFileName Dim sLicFile As String = AppDomain.CurrentDomain.BaseDirectory & sLicFileName
'Dim sKey As String = String.Empty Dim sKey As String = String.Empty
'EgtUILib.GetPrivateProfileString(S_LICENCE, K_KEY, "", sKey, sLicFile) EgtUILib.GetPrivateProfileString(S_LICENCE, K_KEY, "", sKey, sLicFile)
'EgtSetKey(sKey) EgtSetKey(sKey)
'Dim bNetHwKey As Boolean = (GetPrivateProfileInt(S_GENERAL, K_NETKEY, 0, m_IniFilePath) = 1) Dim bNetHwKey As Boolean = (GetPrivateProfileInt(S_GENERAL, K_NETKEY, 0, m_IniFilePath) = 1)
'EgtSetNetHwKey(bNetHwKey) EgtSetNetHwKey(bNetHwKey)
'Dim sLockId As String = "" ' Recupero livello e opzioni della chiave
'EgtUILib.GetPrivateProfileString(S_LICENCE, K_LOCKID, "", sLockId, sLicFile) Dim nKeyLevel As Integer = 0
'If Not String.IsNullOrEmpty(sLockId) Then Dim nKeyOptions As Integer = 0
' Dim x = EgtSetLockId(sLockId) Dim bKey As Boolean = EgtGetKeyLevel(9935, 2505, 1, nKeyLevel) And
'End If EgtGetKeyOptions(9935, 2505, 1, nKeyOptions)
'' Recupero livello e opzioni della chiave
'Dim nKeyLevel As Integer = 0
'Dim nKeyOptions As Integer = 0
'Dim bKey As Boolean = EgtGetKeyLevel(9935, 2505, 1, nKeyLevel) And
' EgtGetKeyOptions(9935, 2505, 1, nKeyOptions)
' Inizializzazione generale di EgtInterface ' Inizializzazione generale di EgtInterface
m_sLogFile = AppDomain.CurrentDomain.BaseDirectory & GENLOG_FILE_NAME.Replace("#", m_nInstance.ToString()) m_sLogFile = AppDomain.CurrentDomain.BaseDirectory & GENLOG_FILE_NAME.Replace("#", m_nInstance.ToString())
Dim sLogMsg As String = "User " & Environment.MachineName & "\" & Environment.UserName & " (" & m_nInstance.ToString() & ")" & vbLf & Dim sLogMsg As String = "User " & Environment.MachineName & "\" & Environment.UserName & " (" & m_nInstance.ToString() & ")" & vbLf &
@@ -1330,10 +1322,10 @@ Public Class ProcMan
(ChrW(97 - 1 + My.Application.Info.Version.Build)).ToString() & (ChrW(97 - 1 + My.Application.Info.Version.Build)).ToString() &
My.Application.Info.Version.Revision.ToString() My.Application.Info.Version.Revision.ToString()
EgtInit(0, m_sLogFile, sLogMsg) EgtInit(0, m_sLogFile, sLogMsg)
'If Not bKey Then If Not bKey Then
' MessageBox.Show("No licences available!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error) MessageBox.Show("No licences available!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
' End End
'End If End If
' leggo sorgente richieste rest da ini ' leggo sorgente richieste rest da ini
GetPrivateProfileString(S_GENERAL, K_BASEIP, "", baseIp, m_IniFilePath) GetPrivateProfileString(S_GENERAL, K_BASEIP, "", baseIp, m_IniFilePath)
+2
View File
@@ -28,6 +28,8 @@ namespace WebDoorCreator.Core
public static readonly string CALC_REQ_SVG_CACHE = $"{BASE_HASH}:CalcRequests:CacheSVG"; public static readonly string CALC_REQ_SVG_CACHE = $"{BASE_HASH}:CalcRequests:CacheSVG";
public static readonly string DOOR_TPL_LIST = $"{BASE_HASH}:Template:DoorList"; public static readonly string DOOR_TPL_LIST = $"{BASE_HASH}:Template:DoorList";
// REDIS KEY dati x registrazione statistiche esecuzione
public static readonly string STATS_DATA = $"{BASE_HASH}:CallStats";
// REDIS Channels messaggi x QueueMan (verso UI/srv) // REDIS Channels messaggi x QueueMan (verso UI/srv)
public static readonly string CALC_REQ_QUEUE = $"CalcRequest"; public static readonly string CALC_REQ_QUEUE = $"CalcRequest";
+50
View File
@@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WebDoorCreator.Core
{
public class ExecStats
{
/// <summary>
/// Numero chiamate registrate
/// </summary>
public int NumCall { get; set; } = 0;
/// <summary>
/// Durata totale chiamate
/// </summary>
public TimeSpan TotalTime { get; set; } = new TimeSpan(0, 0, 0);
/// <summary>
/// Tempo medio (calcolato)
/// </summary>
[NotMapped]
public TimeSpan AvgTime
{
get
{
TimeSpan answ = TotalTime;
if (NumCall > 1)
{
answ = TotalTime / NumCall;
}
return answ;
}
}
/// <summary>
/// Init classe
/// </summary>
/// <param name="numCall"></param>
/// <param name="duration"></param>
public ExecStats(int numCall, TimeSpan duration)
{
this.NumCall = numCall;
this.TotalTime = duration;
}
}
}
@@ -15,7 +15,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.14" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.27" />
<PackageReference Include="NLog" Version="5.2.2" /> <PackageReference Include="NLog" Version="5.2.2" />
<PackageReference Include="ReportViewerCore.NETCore" Version="15.1.17" /> <PackageReference Include="ReportViewerCore.NETCore" Version="15.1.17" />
<PackageReference Include="ToDataTable" Version="0.1.2" /> <PackageReference Include="ToDataTable" Version="0.1.2" />
+425 -126
View File
@@ -2,6 +2,7 @@
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Newtonsoft.Json; using Newtonsoft.Json;
using NLog; using NLog;
using NLog.LayoutRenderers.Wrappers;
using StackExchange.Redis; using StackExchange.Redis;
using System.Diagnostics; using System.Diagnostics;
using WebDoorCreator.Core; using WebDoorCreator.Core;
@@ -45,6 +46,14 @@ namespace WebDoorCreator.Data.Services
}; };
// leggo conf speciali // leggo conf speciali
vetoRemoveProcSec = _configuration.GetValue<int>("RuntimeOpt:VetoRemoveProcessing"); vetoRemoveProcSec = _configuration.GetValue<int>("RuntimeOpt:VetoRemoveProcessing");
logTimingEnable = configuration.GetValue<bool>("RuntimeOpt:LogTimingEnable");
statSampleSize = configuration.GetValue<int>("RuntimeOpt:StatSampleSize");
// fix dati img missing...
missingFilePath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/images", "MissingOrange.svg");
if (File.Exists(missingFilePath))
{
missingSvgContent = File.ReadAllText(missingFilePath);
}
Log.Info("QueueDataService started!"); Log.Info("QueueDataService started!");
} }
@@ -179,16 +188,42 @@ namespace WebDoorCreator.Data.Services
answ = $"{rawData}"; answ = $"{rawData}";
} }
} }
#if false
// se non trovata --> missing! // se non trovata --> missing!
if (string.IsNullOrEmpty(answ)) if (string.IsNullOrEmpty(answ))
{ {
// 2024.02.15: se mancasse, provo a richiedere ricalcolo porta... se poi arriva, la
// pagina in ascolto l'avrà aggiornata
// leggo missing standard... // leggo missing standard...
string missingFilePath = Path.Combine(System.IO.Directory.GetCurrentDirectory(), "wwwroot/images", "MissingOrange.svg"); string missingFilePath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/images", "MissingOrange.svg");
if (File.Exists(missingFilePath)) if (File.Exists(missingFilePath))
{ {
answ = File.ReadAllText(missingFilePath); answ = File.ReadAllText(missingFilePath);
} }
} }
#endif
return answ;
}
/// <summary>
/// Restituisce SVG dell'immagine missing...
/// </summary>
/// <param name="DoorId"></param>
/// <returns></returns>
public string DoorGetMissingSvg()
{
string answ = missingSvgContent;
if(string.IsNullOrEmpty(answ))
{
// fix dati img missing...
missingFilePath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/images", "MissingOrange.svg");
if (File.Exists(missingFilePath))
{
missingSvgContent = File.ReadAllText(missingFilePath);
answ = missingSvgContent;
}
}
return answ; return answ;
} }
@@ -209,13 +244,15 @@ namespace WebDoorCreator.Data.Services
/// <returns>Dictionary of DoorId, saveVersNumb</returns> /// <returns>Dictionary of DoorId, saveVersNumb</returns>
public async Task<Dictionary<string, string>> DoorRefreshStatus() public async Task<Dictionary<string, string>> DoorRefreshStatus()
{ {
string source = "REDIS";
long numReq = 0; long numReq = 0;
Dictionary<string, string> dictResult = new Dictionary<string, string>(); Dictionary<string, string> dictResult = new Dictionary<string, string>();
// cerco da cache // cerco da cache
RedisKey currKey = new RedisKey(Constants.LAST_DOOR_REFR_KEY); RedisKey currKey = new RedisKey(Constants.LAST_DOOR_REFR_KEY);
Stopwatch stopWatch = new Stopwatch(); Stopwatch sw = new Stopwatch();
stopWatch.Start(); if (logTimingEnable)
{
sw.Start();
}
numReq = redisDb.HashLength(currKey); numReq = redisDb.HashLength(currKey);
if (numReq > 0) if (numReq > 0)
{ {
@@ -225,9 +262,12 @@ namespace WebDoorCreator.Data.Services
dictResult.Add($"{item.Name}", $"{item.Value}"); dictResult.Add($"{item.Name}", $"{item.Value}");
} }
} }
stopWatch.Stop(); if (logTimingEnable)
TimeSpan ts = stopWatch.Elapsed; {
Log.Debug($"DoorRefreshStatus | {source} in: {ts.TotalMilliseconds} ms"); sw.Stop();
// gestione statistiche
await ProcStatLog("DoorRefreshStatus", sw.Elapsed, 1, 0.3);
}
return dictResult; return dictResult;
} }
@@ -265,7 +305,7 @@ namespace WebDoorCreator.Data.Services
{ {
bool found = false; bool found = false;
RedisKey currKey = new RedisKey(Constants.DOOR_TPL_LIST); RedisKey currKey = new RedisKey(Constants.DOOR_TPL_LIST);
var rawVal = await RedHashGetString(currKey, DoorId); var rawVal = await RedHashGetString(currKey, DoorId, true);
found = !string.IsNullOrEmpty(rawVal) && (rawVal == DoorId); found = !string.IsNullOrEmpty(rawVal) && (rawVal == DoorId);
return found; return found;
} }
@@ -304,12 +344,18 @@ namespace WebDoorCreator.Data.Services
Dictionary<string, string> dictResult = new Dictionary<string, string>(); Dictionary<string, string> dictResult = new Dictionary<string, string>();
// cerco da cache // cerco da cache
RedisKey currKey = new RedisKey(Constants.CALC_REQ_DONE); RedisKey currKey = new RedisKey(Constants.CALC_REQ_DONE);
Stopwatch stopWatch = new Stopwatch(); Stopwatch sw = new Stopwatch();
stopWatch.Start(); if (logTimingEnable)
{
sw.Start();
}
numReq = await redisDb.HashLengthAsync(currKey); numReq = await redisDb.HashLengthAsync(currKey);
stopWatch.Stop(); if (logTimingEnable)
TimeSpan ts = stopWatch.Elapsed; {
Log.Debug($"NumRequestDone | {source} in: {ts.TotalMilliseconds} ms"); sw.Stop();
// gestione statistiche
await ProcStatLog("NumRequestDone", sw.Elapsed, 2, 10);
}
return numReq; return numReq;
} }
@@ -323,12 +369,18 @@ namespace WebDoorCreator.Data.Services
Dictionary<string, string> dictResult = new Dictionary<string, string>(); Dictionary<string, string> dictResult = new Dictionary<string, string>();
// cerco da cache // cerco da cache
RedisKey currKey = new RedisKey(Constants.CALC_REQ_ERRS); RedisKey currKey = new RedisKey(Constants.CALC_REQ_ERRS);
Stopwatch stopWatch = new Stopwatch(); Stopwatch sw = new Stopwatch();
stopWatch.Start(); if (logTimingEnable)
{
sw.Start();
}
numReq = await redisDb.HashLengthAsync(currKey); numReq = await redisDb.HashLengthAsync(currKey);
stopWatch.Stop(); if (logTimingEnable)
TimeSpan ts = stopWatch.Elapsed; {
Log.Debug($"NumRequestErrors | {source} in: {ts.TotalMilliseconds} ms"); sw.Stop();
// gestione statistiche
await ProcStatLog("NumRequestErrors", sw.Elapsed, 2, 10);
}
return numReq; return numReq;
} }
@@ -342,12 +394,18 @@ namespace WebDoorCreator.Data.Services
Dictionary<string, string> dictResult = new Dictionary<string, string>(); Dictionary<string, string> dictResult = new Dictionary<string, string>();
// cerco da cache // cerco da cache
RedisKey currKey = new RedisKey(Constants.CALC_REQ_PEND); RedisKey currKey = new RedisKey(Constants.CALC_REQ_PEND);
Stopwatch stopWatch = new Stopwatch(); Stopwatch sw = new Stopwatch();
stopWatch.Start(); if (logTimingEnable)
{
sw.Start();
}
numReq = await redisDb.HashLengthAsync(currKey); numReq = await redisDb.HashLengthAsync(currKey);
stopWatch.Stop(); if (logTimingEnable)
TimeSpan ts = stopWatch.Elapsed; {
Log.Debug($"NumRequestPending | {source} in: {ts.TotalMilliseconds} ms"); sw.Stop();
// gestione statistiche
await ProcStatLog("NumRequestPending", sw.Elapsed, 2, 10);
}
return numReq; return numReq;
} }
@@ -361,12 +419,18 @@ namespace WebDoorCreator.Data.Services
Dictionary<string, string> dictResult = new Dictionary<string, string>(); Dictionary<string, string> dictResult = new Dictionary<string, string>();
// cerco da cache // cerco da cache
RedisKey currKey = new RedisKey(Constants.CALC_REQ_PROC); RedisKey currKey = new RedisKey(Constants.CALC_REQ_PROC);
Stopwatch stopWatch = new Stopwatch(); Stopwatch sw = new Stopwatch();
stopWatch.Start(); if (logTimingEnable)
{
sw.Start();
}
numReq = await redisDb.HashLengthAsync(currKey); numReq = await redisDb.HashLengthAsync(currKey);
stopWatch.Stop(); if (logTimingEnable)
TimeSpan ts = stopWatch.Elapsed; {
Log.Debug($"NumRequestProcessing | {source} in: {ts.TotalMilliseconds} ms"); sw.Stop();
// gestione statistiche
await ProcStatLog("NumRequestProcessing", sw.Elapsed, 2, 10);
}
return numReq; return numReq;
} }
@@ -379,8 +443,11 @@ namespace WebDoorCreator.Data.Services
public async Task<int> RedHashGetInt(RedisKey currKey, string chiave) public async Task<int> RedHashGetInt(RedisKey currKey, string chiave)
{ {
int result = 0; int result = 0;
Stopwatch stopWatch = new Stopwatch(); Stopwatch sw = new Stopwatch();
stopWatch.Start(); if (logTimingEnable)
{
sw.Start();
}
var hasVal = await redisDb.HashExistsAsync(currKey, chiave); var hasVal = await redisDb.HashExistsAsync(currKey, chiave);
if (hasVal) if (hasVal)
{ {
@@ -390,9 +457,12 @@ namespace WebDoorCreator.Data.Services
int.TryParse($"{rawRes}", out result); int.TryParse($"{rawRes}", out result);
} }
} }
stopWatch.Stop(); if (logTimingEnable)
TimeSpan ts = stopWatch.Elapsed; {
Log.Trace($"RedHashGetInt | {currKey} | in: {ts.TotalMilliseconds} ms"); sw.Stop();
// gestione statistiche
await ProcStatLog("RedHashGetInt", sw.Elapsed, 0, 0.3);
}
return result; return result;
} }
@@ -401,12 +471,16 @@ namespace WebDoorCreator.Data.Services
/// </summary> /// </summary>
/// <param name="currKey">Redis Key for Hashlist</param> /// <param name="currKey">Redis Key for Hashlist</param>
/// <param name="chiave">Requested key on list</param> /// <param name="chiave">Requested key on list</param>
/// <param name="doTimeLog">Execute time log processing</param>
/// <returns>Value as string</returns> /// <returns>Value as string</returns>
public async Task<string> RedHashGetString(RedisKey currKey, string chiave) public async Task<string> RedHashGetString(RedisKey currKey, string chiave, bool doTimeLog)
{ {
string result = ""; string result = "";
Stopwatch stopWatch = new Stopwatch(); Stopwatch sw = new Stopwatch();
stopWatch.Start(); if (logTimingEnable && doTimeLog)
{
sw.Start();
}
var hasVal = await redisDb.HashExistsAsync(currKey, chiave); var hasVal = await redisDb.HashExistsAsync(currKey, chiave);
if (hasVal) if (hasVal)
{ {
@@ -416,9 +490,12 @@ namespace WebDoorCreator.Data.Services
result = $"{rawRes}"; result = $"{rawRes}";
} }
} }
stopWatch.Stop(); if (logTimingEnable && doTimeLog)
TimeSpan ts = stopWatch.Elapsed; {
Log.Trace($"RedHashGetString | {currKey} | in: {ts.TotalMilliseconds} ms"); sw.Stop();
// gestione statistiche
await ProcStatLog("RedHashGetString", sw.Elapsed, 0, 0.3);
}
return result; return result;
} }
@@ -431,15 +508,48 @@ namespace WebDoorCreator.Data.Services
public async Task<bool> RedHashRemove(RedisKey currKey, string chiave) public async Task<bool> RedHashRemove(RedisKey currKey, string chiave)
{ {
bool fatto = false; bool fatto = false;
Stopwatch stopWatch = new Stopwatch(); Stopwatch sw = new Stopwatch();
stopWatch.Start(); if (logTimingEnable)
{
sw.Start();
}
fatto = await redisDb.HashDeleteAsync(currKey, chiave); fatto = await redisDb.HashDeleteAsync(currKey, chiave);
stopWatch.Stop(); if (logTimingEnable)
TimeSpan ts = stopWatch.Elapsed; {
Log.Trace($"RedHashRemove | {currKey} | in: {ts.TotalMilliseconds} ms"); sw.Stop();
// gestione statistiche
await ProcStatLog("RedHashRemove", sw.Elapsed, 0, 0.3);
}
return fatto; return fatto;
} }
/// <summary>
/// Effettua upsert in HasList redis
/// </summary>
/// <param name="currKey">Chiave redis della Hashlist</param>
/// <param name="chiave">Chiave nella HashList</param>
/// <param name="valore">Valore da salvare</param>
/// <param name="doTimeLog">Gestione log time abilitata</param>
/// <returns>Num record nella HashList</returns>
public async Task<long> RedHashUpsert(RedisKey currKey, string chiave, string valore, bool doTimeLog = true)
{
long numReq = 0;
Stopwatch sw = new Stopwatch();
if (logTimingEnable && doTimeLog)
{
sw.Start();
}
await redisDb.HashSetAsync(currKey, chiave, valore);
numReq = await redisDb.HashLengthAsync(currKey);
if (logTimingEnable && doTimeLog)
{
sw.Stop();
// gestione statistiche
await ProcStatLog("RedHashUpsert", sw.Elapsed, 0, 0.3);
}
return numReq;
}
/// <summary> /// <summary>
/// Restitusice gli errori della porta in oggetto /// Restitusice gli errori della porta in oggetto
/// </summary> /// </summary>
@@ -462,13 +572,15 @@ namespace WebDoorCreator.Data.Services
/// <returns>Dictionary of DoorId, saveVersNumb</returns> /// <returns>Dictionary of DoorId, saveVersNumb</returns>
public async Task<Dictionary<string, string>> RequestDone() public async Task<Dictionary<string, string>> RequestDone()
{ {
string source = "REDIS";
long numReq = 0; long numReq = 0;
Dictionary<string, string> dictResult = new Dictionary<string, string>(); Dictionary<string, string> dictResult = new Dictionary<string, string>();
// cerco da cache // cerco da cache
RedisKey currKey = new RedisKey(Constants.CALC_REQ_DONE); RedisKey currKey = new RedisKey(Constants.CALC_REQ_DONE);
Stopwatch stopWatch = new Stopwatch(); Stopwatch sw = new Stopwatch();
stopWatch.Start(); if (logTimingEnable)
{
sw.Start();
}
numReq = redisDb.HashLength(currKey); numReq = redisDb.HashLength(currKey);
if (numReq > 0) if (numReq > 0)
{ {
@@ -478,9 +590,12 @@ namespace WebDoorCreator.Data.Services
dictResult.Add($"{item.Name}", $"{item.Value}"); dictResult.Add($"{item.Name}", $"{item.Value}");
} }
} }
stopWatch.Stop(); if (logTimingEnable)
TimeSpan ts = stopWatch.Elapsed; {
Log.Debug($"RequestDone | {source} in: {ts.TotalMilliseconds} ms"); sw.Stop();
// gestione statistiche
await ProcStatLog("RequestDone", sw.Elapsed, 1, 10);
}
return dictResult; return dictResult;
} }
@@ -491,13 +606,15 @@ namespace WebDoorCreator.Data.Services
/// <returns></returns> /// <returns></returns>
public async Task<Dictionary<string, string>> RequestDoneGetSingle(int DoorId) public async Task<Dictionary<string, string>> RequestDoneGetSingle(int DoorId)
{ {
string source = "REDIS";
long numReq = 0; long numReq = 0;
Dictionary<string, string> dictResult = new Dictionary<string, string>(); Dictionary<string, string> dictResult = new Dictionary<string, string>();
// cerco da cache // cerco da cache
RedisKey currKey = new RedisKey(Constants.CALC_REQ_DONE); RedisKey currKey = new RedisKey(Constants.CALC_REQ_DONE);
Stopwatch stopWatch = new Stopwatch(); Stopwatch sw = new Stopwatch();
stopWatch.Start(); if (logTimingEnable)
{
sw.Start();
}
numReq = redisDb.HashLength(currKey); numReq = redisDb.HashLength(currKey);
if (numReq > 0) if (numReq > 0)
{ {
@@ -507,9 +624,12 @@ namespace WebDoorCreator.Data.Services
dictResult.Add($"{DoorId}", $"{rawData}"); dictResult.Add($"{DoorId}", $"{rawData}");
} }
} }
stopWatch.Stop(); if (logTimingEnable)
TimeSpan ts = stopWatch.Elapsed; {
Log.Debug($"RequestDoneGetSingle | {source} in: {ts.TotalMilliseconds} ms"); sw.Stop();
// gestione statistiche
await ProcStatLog("RequestDoneGetSingle", sw.Elapsed, 1, 0.3);
}
return dictResult; return dictResult;
} }
@@ -541,13 +661,15 @@ namespace WebDoorCreator.Data.Services
/// <returns>Dictionary of DoorId, saveVersNumb</returns> /// <returns>Dictionary of DoorId, saveVersNumb</returns>
public async Task<Dictionary<string, string>> RequestErr() public async Task<Dictionary<string, string>> RequestErr()
{ {
string source = "REDIS";
long numReq = 0; long numReq = 0;
Dictionary<string, string> dictResult = new Dictionary<string, string>(); Dictionary<string, string> dictResult = new Dictionary<string, string>();
// cerco da cache // cerco da cache
RedisKey currKey = new RedisKey(Constants.CALC_REQ_ERRS); RedisKey currKey = new RedisKey(Constants.CALC_REQ_ERRS);
Stopwatch stopWatch = new Stopwatch(); Stopwatch sw = new Stopwatch();
stopWatch.Start(); if (logTimingEnable)
{
sw.Start();
}
numReq = redisDb.HashLength(currKey); numReq = redisDb.HashLength(currKey);
if (numReq > 0) if (numReq > 0)
{ {
@@ -557,9 +679,12 @@ namespace WebDoorCreator.Data.Services
dictResult.Add($"{item.Name}", $"{item.Value}"); dictResult.Add($"{item.Name}", $"{item.Value}");
} }
} }
stopWatch.Stop(); if (logTimingEnable)
TimeSpan ts = stopWatch.Elapsed; {
Log.Debug($"RequestErr | {source} in: {ts.TotalMilliseconds} ms"); sw.Stop();
// gestione statistiche
await ProcStatLog("RequestErr", sw.Elapsed, 1, 10);
}
return dictResult; return dictResult;
} }
@@ -591,13 +716,15 @@ namespace WebDoorCreator.Data.Services
/// <returns>Dictionary of DoorId, saveVersNumb</returns> /// <returns>Dictionary of DoorId, saveVersNumb</returns>
public async Task<Dictionary<string, string>> RequestPending() public async Task<Dictionary<string, string>> RequestPending()
{ {
string source = "REDIS";
long numReq = 0; long numReq = 0;
Dictionary<string, string> dictResult = new Dictionary<string, string>(); Dictionary<string, string> dictResult = new Dictionary<string, string>();
// cerco da cache // cerco da cache
RedisKey currKey = new RedisKey(Constants.CALC_REQ_PEND); RedisKey currKey = new RedisKey(Constants.CALC_REQ_PEND);
Stopwatch stopWatch = new Stopwatch(); Stopwatch sw = new Stopwatch();
stopWatch.Start(); if (logTimingEnable)
{
sw.Start();
}
numReq = redisDb.HashLength(currKey); numReq = redisDb.HashLength(currKey);
if (numReq > 0) if (numReq > 0)
{ {
@@ -607,9 +734,12 @@ namespace WebDoorCreator.Data.Services
dictResult.Add($"{item.Name}", $"{item.Value}"); dictResult.Add($"{item.Name}", $"{item.Value}");
} }
} }
stopWatch.Stop(); if (logTimingEnable)
TimeSpan ts = stopWatch.Elapsed; {
Log.Debug($"RequestPending | {source} in: {ts.TotalMilliseconds} ms"); sw.Stop();
// gestione statistiche
await ProcStatLog("RequestPending", sw.Elapsed, 1, 10);
}
return dictResult; return dictResult;
} }
@@ -641,13 +771,15 @@ namespace WebDoorCreator.Data.Services
/// <returns>Dictionary of DoorId, saveVersNumb</returns> /// <returns>Dictionary of DoorId, saveVersNumb</returns>
public async Task<Dictionary<string, string>> RequestProcessing() public async Task<Dictionary<string, string>> RequestProcessing()
{ {
string source = "REDIS";
long numReq = 0; long numReq = 0;
Dictionary<string, string> dictResult = new Dictionary<string, string>(); Dictionary<string, string> dictResult = new Dictionary<string, string>();
// cerco da cache // cerco da cache
RedisKey currKey = new RedisKey(Constants.CALC_REQ_PROC); RedisKey currKey = new RedisKey(Constants.CALC_REQ_PROC);
Stopwatch stopWatch = new Stopwatch(); Stopwatch sw = new Stopwatch();
stopWatch.Start(); if (logTimingEnable)
{
sw.Start();
}
numReq = redisDb.HashLength(currKey); numReq = redisDb.HashLength(currKey);
if (numReq > 0) if (numReq > 0)
{ {
@@ -657,9 +789,12 @@ namespace WebDoorCreator.Data.Services
dictResult.Add($"{item.Name}", $"{item.Value}"); dictResult.Add($"{item.Name}", $"{item.Value}");
} }
} }
stopWatch.Stop(); if (logTimingEnable)
TimeSpan ts = stopWatch.Elapsed; {
Log.Debug($"RequestProcessing | {source} in: {ts.TotalMilliseconds} ms"); sw.Stop();
// gestione statistiche
await ProcStatLog("RequestProcessing", sw.Elapsed, 1, 10);
}
return dictResult; return dictResult;
} }
@@ -695,9 +830,11 @@ namespace WebDoorCreator.Data.Services
public async Task<bool> ResetQueue() public async Task<bool> ResetQueue()
{ {
bool fatto = false; bool fatto = false;
await Task.Delay(1); Stopwatch sw = new Stopwatch();
Stopwatch stopWatch = new Stopwatch(); if (logTimingEnable)
stopWatch.Start(); {
sw.Start();
}
// cerco le richieste processing // cerco le richieste processing
RedisKey currKey = new RedisKey(Constants.CALC_REQ_PROC); RedisKey currKey = new RedisKey(Constants.CALC_REQ_PROC);
var rawData = await redisDb.HashGetAllAsync(currKey); var rawData = await redisDb.HashGetAllAsync(currKey);
@@ -725,9 +862,12 @@ namespace WebDoorCreator.Data.Services
await RequestDoneRemove(item.Name!); await RequestDoneRemove(item.Name!);
fatto = true; fatto = true;
} }
stopWatch.Stop(); if (logTimingEnable)
TimeSpan ts = stopWatch.Elapsed; {
Log.Debug($"ResetQueue | REDIS EXEC in: {ts.TotalMilliseconds} ms"); sw.Stop();
// gestione statistiche
await ProcStatLog("ResetQueue", sw.Elapsed, 1, 0.3);
}
return fatto; return fatto;
} }
@@ -739,8 +879,11 @@ namespace WebDoorCreator.Data.Services
{ {
int num2proc = DoorIdList.Count; int num2proc = DoorIdList.Count;
List<string> listDone = new List<string>(); List<string> listDone = new List<string>();
Stopwatch stopWatch = new Stopwatch(); Stopwatch sw = new Stopwatch();
stopWatch.Start(); if (logTimingEnable)
{
sw.Start();
}
// cerco le richieste processing // cerco le richieste processing
RedisKey currKey = new RedisKey(Constants.CALC_REQ_PROC); RedisKey currKey = new RedisKey(Constants.CALC_REQ_PROC);
var rawData = await redisDb.HashGetAllAsync(currKey); var rawData = await redisDb.HashGetAllAsync(currKey);
@@ -787,9 +930,11 @@ namespace WebDoorCreator.Data.Services
DoorIdList.Remove(item); DoorIdList.Remove(item);
} }
#endif #endif
stopWatch.Stop(); if (logTimingEnable)
TimeSpan ts = stopWatch.Elapsed; {
Log.Debug($"ResetQueueByDoorList | doors #: {num2proc} --> {DoorIdList.Count} | EXEC in: {ts.TotalMilliseconds} ms"); sw.Stop();
Log.Debug($"ResetQueueByDoorList | doors #: {num2proc} --> {DoorIdList.Count} | EXEC in: {sw.Elapsed.TotalMilliseconds} ms");
}
return DoorIdList; return DoorIdList;
} }
@@ -801,8 +946,11 @@ namespace WebDoorCreator.Data.Services
{ {
bool fatto = false; bool fatto = false;
await Task.Delay(1); await Task.Delay(1);
Stopwatch stopWatch = new Stopwatch(); Stopwatch sw = new Stopwatch();
stopWatch.Start(); if (logTimingEnable)
{
sw.Start();
}
// cerco le richieste processing // cerco le richieste processing
RedisKey currKey = new RedisKey(Constants.CALC_REQ_PROC); RedisKey currKey = new RedisKey(Constants.CALC_REQ_PROC);
RedisKey currVetoKey = new RedisKey($"{Constants.CALC_REQ_PROC}:0"); RedisKey currVetoKey = new RedisKey($"{Constants.CALC_REQ_PROC}:0");
@@ -819,9 +967,12 @@ namespace WebDoorCreator.Data.Services
fatto = true; fatto = true;
} }
} }
stopWatch.Stop(); if (logTimingEnable)
TimeSpan ts = stopWatch.Elapsed; {
Log.Debug($"ResetQueueProcessing | REDIS EXEC in: {ts.TotalMilliseconds} ms"); sw.Stop();
// gestione statistiche
await ProcStatLog("ResetQueueProcessing", sw.Elapsed, 1, 10);
}
return fatto; return fatto;
} }
@@ -858,7 +1009,8 @@ namespace WebDoorCreator.Data.Services
} }
else else
{ {
await redisDb.StringSetAsync(currSvgKey, calcTask.SvgGen, WeekLongCache); // 2024.02.15 salvo in cache x 2 settimane, fare 1+ mesi?!?
await redisDb.StringSetAsync(currSvgKey, calcTask.SvgGen, DblWeekLongCache);
} }
// elimino dalle code proc/err // elimino dalle code proc/err
await RequestProcessingRemove(sDoorId); await RequestProcessingRemove(sDoorId);
@@ -904,8 +1056,11 @@ namespace WebDoorCreator.Data.Services
/// <returns>indice/versione del calcolo DDF</returns> /// <returns>indice/versione del calcolo DDF</returns>
public async Task<int> SendCalcReq(int DoorId, string FullDDF) public async Task<int> SendCalcReq(int DoorId, string FullDDF)
{ {
Stopwatch stopWatch = new Stopwatch(); Stopwatch sw = new Stopwatch();
stopWatch.Start(); if (logTimingEnable)
{
sw.Start();
}
string sDoorId = $"{DoorId}"; string sDoorId = $"{DoorId}";
int currVers = await DoorCalcRev(sDoorId); int currVers = await DoorCalcRev(sDoorId);
string sCurrVers = $"{currVers}"; string sCurrVers = $"{currVers}";
@@ -915,18 +1070,91 @@ namespace WebDoorCreator.Data.Services
// salvo nell'archivio REDIS delle porte il DDF corrente (key=doorId.versNumb), potrebbe // salvo nell'archivio REDIS delle porte il DDF corrente (key=doorId.versNumb), potrebbe
// venire buono anche x eventuale UNDO... // venire buono anche x eventuale UNDO...
RedisKey currDdfKey = new RedisKey($"{Constants.CALC_REQ_DDF_CACHE}:{sDoorId}:{sCurrVers}"); RedisKey currDdfKey = new RedisKey($"{Constants.CALC_REQ_DDF_CACHE}:{sDoorId}:{sCurrVers}");
await redisDb.StringSetAsync(currDdfKey, FullDDF, WeekLongCache); await redisDb.StringSetAsync(currDdfKey, FullDDF, DblWeekLongCache);
// invio sul canale dei messaggi il numero di items in coda attuali x chiedere esecuzione... // invio sul canale dei messaggi il numero di items in coda attuali x chiedere esecuzione...
long numPending = await NumRequestPending(); long numPending = await NumRequestPending();
bool answ = CalcReqPipe.saveAndSendMessage(Constants.LAST_CALC_REQ_KEY, $"{numPending}"); bool answ = CalcReqPipe.saveAndSendMessage(Constants.LAST_CALC_REQ_KEY, $"{numPending}");
stopWatch.Stop(); if (logTimingEnable)
TimeSpan ts = stopWatch.Elapsed; {
Log.Debug($"SendCalcReq | DoorId: {DoorId} enqueued in: {ts.TotalMilliseconds} ms"); sw.Stop();
Log.Debug($"SendCalcReq | DoorId: {DoorId} enqueued in: {sw.Elapsed.TotalMilliseconds} ms");
}
return currVers; return currVers;
} }
/// <summary>
/// Restituisce dati statistica richiesta
/// </summary>
/// <param name="statName">Nome statistica</param>
/// <returns></returns>
public async Task<ExecStats> StatGetAsync(string statName)
{
ExecStats answ = new ExecStats(0, new TimeSpan());
RedisKey currKey = new RedisKey(Constants.STATS_DATA);
// cerco nella hashTable...
var rawData = await RedHashGetString(currKey, statName, false);
// se c'è rileggo ed aggiorno
if (!string.IsNullOrEmpty(rawData))
{
var currStat = JsonConvert.DeserializeObject<ExecStats>(rawData);
if (currStat != null)
{
answ = currStat;
}
}
return answ;
}
/// <summary>
/// Resetta dati statistica esecuzione x log restituendo i valori precedentemente contenuti
/// </summary>
/// <param name="statName">Nome statistica</param>
/// <returns></returns>
public async Task<ExecStats> StatReset(string statName)
{
RedisKey currKey = new RedisKey(Constants.STATS_DATA);
ExecStats answ = await StatGetAsync(statName);
// ora rimuovo valore
await RedHashRemove(currKey, statName);
return answ;
}
/// <summary>
/// Effettua upsert dati statistica esecuzione x log
/// </summary>
/// <param name="statName">Nome statistica</param>
/// <param name="duration">Durata esecuzione come timespan</param>
/// <param name="evMultipl">moltiplicatore soglia x log statistica (default = 1)</param>
/// <returns></returns>
public async Task<bool> StatUpsert(string statName, TimeSpan duration, double evMultipl)
{
bool answ = false;
RedisKey currKey = new RedisKey(Constants.STATS_DATA);
// cerco nella hashTable...
var rawData = await RedHashGetString(currKey, statName, false);
// di default inizializzo a null...
ExecStats newStat = new ExecStats(1, duration);
// se c'è rileggo ed aggiorno
if (!string.IsNullOrEmpty(rawData))
{
var currStat = JsonConvert.DeserializeObject<ExecStats>(rawData);
if (currStat != null)
{
currStat.NumCall++;
currStat.TotalTime += duration;
newStat = currStat;
}
}
// ora aggiorno su redis
rawData = JsonConvert.SerializeObject(newStat);
var numRec = await RedHashUpsert(currKey, statName, rawData, false);
// verifico se da considerare superato limite sample
answ = newStat.NumCall >= (int)(statSampleSize * evMultipl);
return answ;
}
/// <summary> /// <summary>
/// Get Queue request pending, removing from queue and putting on processing queue /// Get Queue request pending, removing from queue and putting on processing queue
/// </summary> /// </summary>
@@ -938,8 +1166,11 @@ namespace WebDoorCreator.Data.Services
Dictionary<string, string> dictResult = new Dictionary<string, string>(); Dictionary<string, string> dictResult = new Dictionary<string, string>();
// cerco da cache // cerco da cache
RedisKey currKey = new RedisKey(Constants.CALC_REQ_PEND); RedisKey currKey = new RedisKey(Constants.CALC_REQ_PEND);
Stopwatch stopWatch = new Stopwatch(); Stopwatch sw = new Stopwatch();
stopWatch.Start(); if (logTimingEnable)
{
sw.Start();
}
// calcolo il totale delle richieste pending // calcolo il totale delle richieste pending
numReq = redisDb.HashLength(currKey); numReq = redisDb.HashLength(currKey);
if (numReq > 0) if (numReq > 0)
@@ -971,9 +1202,12 @@ namespace WebDoorCreator.Data.Services
// sblocco // sblocco
queueLock = false; queueLock = false;
} }
stopWatch.Stop(); if (logTimingEnable)
TimeSpan ts = stopWatch.Elapsed; {
Log.Debug($"TakeProcessingItems | REDIS in: {ts.TotalMilliseconds} ms"); sw.Stop();
// gestione statistiche
await ProcStatLog("TakeProcessingItems", sw.Elapsed, 1, 0.3);
}
return dictResult; return dictResult;
} }
@@ -982,7 +1216,9 @@ namespace WebDoorCreator.Data.Services
#region Protected Fields #region Protected Fields
protected const string rKeyCalcOreFase = "Check:OreFasi"; protected const string rKeyCalcOreFase = "Check:OreFasi";
protected const string rKeyFasiAct = "Check:FasiAct"; protected const string rKeyFasiAct = "Check:FasiAct";
protected const string rKeyProjAct = "Check:ProjAct"; protected const string rKeyProjAct = "Check:ProjAct";
/// <summary> /// <summary>
@@ -991,6 +1227,7 @@ namespace WebDoorCreator.Data.Services
protected const int shortTTL = 60 * 5; protected const int shortTTL = 60 * 5;
protected int idxSim = 0; protected int idxSim = 0;
protected Random rnd = new Random(); protected Random rnd = new Random();
#endregion Protected Fields #endregion Protected Fields
@@ -1086,26 +1323,6 @@ namespace WebDoorCreator.Data.Services
return answ; return answ;
} }
/// <summary>
/// Effettua upsert in HasList redis
/// </summary>
/// <param name="currKey">Chiave redis della Hashlist</param>
/// <param name="chiave">Chiave nella HashList</param>
/// <param name="valore">Valore da salvare</param>
/// <returns>Num record nella HashList</returns>
protected async Task<long> RedHashUpsert(RedisKey currKey, string chiave, string valore)
{
long numReq = 0;
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
await redisDb.HashSetAsync(currKey, chiave, valore);
numReq = await redisDb.HashLengthAsync(currKey);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"RedHashUpsert | {currKey} | in: {ts.TotalMilliseconds} ms");
return numReq;
}
/// <summary> /// <summary>
/// Salvataggio chiave in redis /// Salvataggio chiave in redis
/// </summary> /// </summary>
@@ -1116,8 +1333,7 @@ namespace WebDoorCreator.Data.Services
protected async Task<bool> setRSV(string rKey, string rVal, int ttlSec) protected async Task<bool> setRSV(string rKey, string rVal, int ttlSec)
{ {
bool fatto = false; bool fatto = false;
await redisDb.StringSetAsync(rKey, rVal, TimeSpan.FromSeconds(ttlSec)); fatto = await redisDb.StringSetAsync(rKey, rVal, TimeSpan.FromSeconds(ttlSec));
fatto = true;
return fatto; return fatto;
} }
@@ -1131,8 +1347,7 @@ namespace WebDoorCreator.Data.Services
protected async Task<bool> setRSV(string rKey, int rValInt, int ttlSec) protected async Task<bool> setRSV(string rKey, int rValInt, int ttlSec)
{ {
bool fatto = false; bool fatto = false;
await redisDb.StringSetAsync(rKey, rValInt, TimeSpan.FromSeconds(ttlSec)); fatto = await redisDb.StringSetAsync(rKey, rValInt, TimeSpan.FromSeconds(ttlSec));
fatto = true;
return fatto; return fatto;
} }
@@ -1153,8 +1368,16 @@ namespace WebDoorCreator.Data.Services
#region Private Fields #region Private Fields
private static IConfiguration _configuration = null!; private static IConfiguration _configuration = null!;
private static JsonSerializerSettings? JSSettings; private static JsonSerializerSettings? JSSettings;
private static Logger Log = LogManager.GetCurrentClassLogger(); private static Logger Log = LogManager.GetCurrentClassLogger();
/// <summary>
/// Dimensione campione da registrare e trascrivere in log
/// </summary>
private static int statSampleSize = 1;
private readonly IEmailSender _emailSender; private readonly IEmailSender _emailSender;
/// <summary> /// <summary>
@@ -1172,6 +1395,20 @@ namespace WebDoorCreator.Data.Services
/// </summary> /// </summary>
private int cacheTtlShort = 60 * 1; private int cacheTtlShort = 60 * 1;
/// <summary>
/// abilitazione time log con stopwatch
/// </summary>
private bool logTimingEnable = false;
/// <summary>
/// Path dell'immagine "missing"
/// </summary>
private string missingFilePath = "";
/// <summary>
/// Contenuto SVG dell'immagine missing
/// </summary>
private string missingSvgContent = "";
/// <summary> /// <summary>
/// Oggetto per connessione a REDIS /// Oggetto per connessione a REDIS
/// </summary> /// </summary>
@@ -1194,6 +1431,14 @@ namespace WebDoorCreator.Data.Services
get => TimeSpan.FromHours(24); get => TimeSpan.FromHours(24);
} }
/// <summary>
/// Durata cache di 2 settimane/15gg
/// </summary>
private TimeSpan DblWeekLongCache
{
get => TimeSpan.FromHours(24 * 15 * rnd.Next(1000, 1100) / 1000);
}
/// <summary> /// <summary>
/// Durata cache lunga (+ perturbazione percentuale +/-10%) /// Durata cache lunga (+ perturbazione percentuale +/-10%)
/// </summary> /// </summary>
@@ -1269,6 +1514,60 @@ namespace WebDoorCreator.Data.Services
return answ; return answ;
} }
/// <summary>
/// Processa log statistiche:
/// - accumula dati
/// - se superata soglia (soglia x evMultipl) registra log
/// </summary>
/// <param name="statName">nome statistica</param>
/// <param name="elapsed">durata evento tracciato</param>
/// <param name="logLevReq">
/// livello richiesto: 0:trace, 1:debug, 2:info, 3:warn, 4:error, 5: fatal, 6: off
/// </param>
/// <param name="evMultipl">moltiplicatore soglia x log statistica (default = 1)</param>
/// <returns></returns>
private async Task ProcStatLog(string statName, TimeSpan elapsed, int logLevReq, double evMultipl)
{
bool doWrite = await StatUpsert(statName, elapsed, evMultipl);
if (doWrite)
{
// recupero e resetto
ExecStats statRec = await StatReset(statName);
string logMsg = $"Eseguito {statName} x {statRec.NumCall} | {statRec.AvgTime.TotalMilliseconds:N3}ms";
switch (logLevReq)
{
case 0:
Log.Trace(logMsg);
break;
case 1:
Log.Debug(logMsg);
break;
case 2:
Log.Info(logMsg);
break;
case 3:
Log.Warn(logMsg);
break;
case 4:
Log.Error(logMsg);
break;
case 5:
Log.Fatal(logMsg);
break;
case 6:
default:
Log.Error(logMsg);
break;
}
}
}
#endregion Private Methods #endregion Private Methods
} }
} }
@@ -55,7 +55,9 @@ namespace WebDoorCreator.Data.Services
{ {
dbController = new WebDoorCreatorController(configuration); dbController = new WebDoorCreatorController(configuration);
} }
// conf log
logTimingEnable = configuration.GetValue<bool>("RuntimeOpt:LogTimingEnable");
statSampleSize = configuration.GetValue<int>("RuntimeOpt:StatSampleSize");
// conf serializzatore DDF... // conf serializzatore DDF...
string vers = _configuration.GetValue<string>("ConfDDF:VersNumber"); string vers = _configuration.GetValue<string>("ConfDDF:VersNumber");
bool remDoorOp = _configuration.GetValue<bool>("ConfDDF:RemoveDoorOps"); bool remDoorOp = _configuration.GetValue<bool>("ConfDDF:RemoveDoorOps");
@@ -66,6 +68,252 @@ namespace WebDoorCreator.Data.Services
Log.Info("WebDoorCreatorService started!"); Log.Info("WebDoorCreatorService started!");
} }
/// <summary>
/// abilitazione time log con stopwatch
/// </summary>
private bool logTimingEnable = false;
/// <summary>
/// Dimensione campione da registrare e trascrivere in log
/// </summary>
private static int statSampleSize = 1;
/// <summary>
/// Processa log statistiche:
/// - accumula dati
/// - se superata soglia (soglia x evMultipl) registra log
/// </summary>
/// <param name="statName">nome statistica</param>
/// <param name="elapsed">durata evento tracciato</param>
/// <param name="logLevReq">
/// livello richiesto: 0:trace, 1:debug, 2:info, 3:warn, 4:error, 5: fatal, 6: off
/// </param>
/// <param name="evMultipl">moltiplicatore soglia x log statistica (default = 1)</param>
/// <returns></returns>
private async Task ProcStatLog(string statName, TimeSpan elapsed, int logLevReq, double evMultipl)
{
bool doWrite = await StatUpsert(statName, elapsed, evMultipl);
if (doWrite)
{
// recupero e resetto
ExecStats statRec = await StatReset(statName);
string logMsg = $"Eseguito {statName} x {statRec.NumCall} | {statRec.AvgTime.TotalMilliseconds:N3}ms";
switch (logLevReq)
{
case 0:
Log.Trace(logMsg);
break;
case 1:
Log.Debug(logMsg);
break;
case 2:
Log.Info(logMsg);
break;
case 3:
Log.Warn(logMsg);
break;
case 4:
Log.Error(logMsg);
break;
case 5:
Log.Fatal(logMsg);
break;
case 6:
default:
Log.Error(logMsg);
break;
}
}
}
/// <summary>
/// Effettua upsert dati statistica esecuzione x log
/// </summary>
/// <param name="statName">Nome statistica</param>
/// <param name="duration">Durata esecuzione come timespan</param>
/// <param name="evMultipl">moltiplicatore soglia x log statistica (default = 1)</param>
/// <returns></returns>
public async Task<bool> StatUpsert(string statName, TimeSpan duration, double evMultipl)
{
bool answ = false;
RedisKey currKey = new RedisKey(Constants.STATS_DATA);
// cerco nella hashTable...
var rawData = await RedHashGetString(currKey, statName, false);
// di default inizializzo a null...
ExecStats newStat = new ExecStats(1, duration);
// se c'è rileggo ed aggiorno
if (!string.IsNullOrEmpty(rawData))
{
var currStat = JsonConvert.DeserializeObject<ExecStats>(rawData);
if (currStat != null)
{
currStat.NumCall++;
currStat.TotalTime += duration;
newStat = currStat;
}
}
// ora aggiorno su redis
rawData = JsonConvert.SerializeObject(newStat);
var numRec = await RedHashUpsert(currKey, statName, rawData, false);
// verifico se da considerare superato limite sample
answ = newStat.NumCall >= (int)(statSampleSize * evMultipl);
return answ;
}
/// <summary>
/// Effettua upsert in HasList redis
/// </summary>
/// <param name="currKey">Chiave redis della Hashlist</param>
/// <param name="chiave">Chiave nella HashList</param>
/// <param name="valore">Valore da salvare</param>
/// <param name="doTimeLog">Gestione log time abilitata</param>
/// <returns>Num record nella HashList</returns>
public async Task<long> RedHashUpsert(RedisKey currKey, string chiave, string valore, bool doTimeLog = true)
{
long numReq = 0;
Stopwatch sw = new Stopwatch();
if (logTimingEnable && doTimeLog)
{
sw.Start();
}
await redisDb.HashSetAsync(currKey, chiave, valore);
numReq = await redisDb.HashLengthAsync(currKey);
if (logTimingEnable && doTimeLog)
{
sw.Stop();
// gestione statistiche
await ProcStatLog("RedHashUpsert", sw.Elapsed, 0, 0.3);
}
return numReq;
}
/// <summary>
/// Restituisce dati statistica richiesta
/// </summary>
/// <param name="statName">Nome statistica</param>
/// <returns></returns>
public async Task<ExecStats> StatGetAsync(string statName)
{
ExecStats answ = new ExecStats(0, new TimeSpan());
RedisKey currKey = new RedisKey(Constants.STATS_DATA);
// cerco nella hashTable...
var rawData = await RedHashGetString(currKey, statName, false);
// se c'è rileggo ed aggiorno
if (!string.IsNullOrEmpty(rawData))
{
var currStat = JsonConvert.DeserializeObject<ExecStats>(rawData);
if (currStat != null)
{
answ = currStat;
}
}
return answ;
}
/// <summary>
/// Resetta dati statistica esecuzione x log restituendo i valori precedentemente contenuti
/// </summary>
/// <param name="statName">Nome statistica</param>
/// <returns></returns>
public async Task<ExecStats> StatReset(string statName)
{
RedisKey currKey = new RedisKey(Constants.STATS_DATA);
ExecStats answ = await StatGetAsync(statName);
// ora rimuovo valore
await RedHashRemove(currKey, statName);
return answ;
}
/// <summary>
/// Get single hash record
/// </summary>
/// <param name="currKey">Redis Key for Hashlist</param>
/// <param name="chiave">Requested key on list</param>
/// <returns>Value as Int</returns>
public async Task<int> RedHashGetInt(RedisKey currKey, string chiave)
{
int result = 0;
Stopwatch sw = new Stopwatch();
if (logTimingEnable)
{
sw.Start();
}
var hasVal = await redisDb.HashExistsAsync(currKey, chiave);
if (hasVal)
{
var rawRes = await redisDb.HashGetAsync(currKey, chiave);
if (rawRes.HasValue)
{
int.TryParse($"{rawRes}", out result);
}
}
if (logTimingEnable)
{
sw.Stop();
// gestione statistiche
await ProcStatLog("RedHashGetInt", sw.Elapsed, 0, 0.3);
}
return result;
}
/// <summary>
/// Get single hash record
/// </summary>
/// <param name="currKey">Redis Key for Hashlist</param>
/// <param name="chiave">Requested key on list</param>
/// <param name="doTimeLog">Execute time log processing</param>
/// <returns>Value as string</returns>
public async Task<string> RedHashGetString(RedisKey currKey, string chiave, bool doTimeLog)
{
string result = "";
Stopwatch sw = new Stopwatch();
if (logTimingEnable && doTimeLog)
{
sw.Start();
}
var hasVal = await redisDb.HashExistsAsync(currKey, chiave);
if (hasVal)
{
var rawRes = await redisDb.HashGetAsync(currKey, chiave);
if (rawRes.HasValue)
{
result = $"{rawRes}";
}
}
if (logTimingEnable && doTimeLog)
{
sw.Stop();
// gestione statistiche
await ProcStatLog("RedHashGetString", sw.Elapsed, 0, 0.3);
}
return result;
}
/// <summary>
/// Remove for single hash record
/// </summary>
/// <param name="currKey">Chiave redis della Hashlist</param>
/// <param name="chiave">Chiave nella HashList</param>
/// <returns>Esito rimozione</returns>
public async Task<bool> RedHashRemove(RedisKey currKey, string chiave)
{
bool fatto = false;
Stopwatch sw = new Stopwatch();
if (logTimingEnable)
{
sw.Start();
}
fatto = await redisDb.HashDeleteAsync(currKey, chiave);
if (logTimingEnable)
{
sw.Stop();
// gestione statistiche
await ProcStatLog("RedHashRemove", sw.Elapsed, 0, 0.3);
}
return fatto;
}
#endregion Public Constructors #endregion Public Constructors
#region Public Properties #region Public Properties
@@ -1153,18 +1401,22 @@ namespace WebDoorCreator.Data.Services
List<DoorModel>? dbResult = new List<DoorModel>(); List<DoorModel>? dbResult = new List<DoorModel>();
try try
{ {
await Task.Delay(1); Stopwatch sw = new Stopwatch();
string source = "DB"; if (logTimingEnable)
Stopwatch stopWatch = new Stopwatch(); {
stopWatch.Start(); sw.Start();
}
dbResult = dbController.DoorGet2Del(); dbResult = dbController.DoorGet2Del();
if (dbResult == null) if (dbResult == null)
{ {
dbResult = new List<DoorModel>(); dbResult = new List<DoorModel>();
} }
stopWatch.Stop(); if (logTimingEnable)
TimeSpan ts = stopWatch.Elapsed; {
Log.Debug($"DoorGet2Del | {source} in: {ts.TotalMilliseconds} ms"); sw.Stop();
// gestione statistiche
await ProcStatLog("DoorGet2Del", sw.Elapsed, 2, 1);
}
} }
catch (Exception exc) catch (Exception exc)
{ {
+3 -3
View File
@@ -15,11 +15,11 @@ namespace WebDoorCreator.Data
// Default seeded users // Default seeded users
builder.HasData( builder.HasData(
// SuperAdmins // SuperAdmins
getNewTestRec("zaccaria.majid@egalware.com", "th1sIsTh3R1vrOfThNgt98"),
getNewTestRec("samuele.locatelli@egalware.com", "th1sIsTh3R1vrOfThNgt96"), getNewTestRec("samuele.locatelli@egalware.com", "th1sIsTh3R1vrOfThNgt96"),
getNewTestRec("emmanuele.sassi@egalware.com", "th1sIsTh3R1vrOfThNgt98!"),
// Admin // Admin
getNewTestRec("zaccaria.majid01@egalware.com", "th1sIsTh3R1vrOfThNgt94"), getNewTestRec("marco.locatelli@egalware.com", "th1sIsTh3R1vrOfThNgt94"),
getNewTestRec("zaccaria.majid02@egalware.com", "th1sIsTh3R1vrOfThNgt92") getNewTestRec("samuele@steamware.net", "th1sIsTh3R1vrOfThNgt92")
); );
} }
+4 -8
View File
@@ -15,15 +15,10 @@ namespace WebDoorCreator.Data
{ {
#region Public Constructors #region Public Constructors
#if false
public WDCDataContext()
{
}
#endif
public WDCDataContext(IConfiguration configuration) public WDCDataContext(IConfiguration configuration)
{ {
Log.Info("WDCDataContext starting 01A"); Log.Trace("WDCDataContext starting 01A");
_configuration = configuration; _configuration = configuration;
try try
{ {
@@ -38,7 +33,7 @@ namespace WebDoorCreator.Data
public WDCDataContext(DbContextOptions<WDCDataContext> options, IConfiguration configuration) : base(options) public WDCDataContext(DbContextOptions<WDCDataContext> options, IConfiguration configuration) : base(options)
{ {
Log.Info("WDCDataContext starting 01B"); Log.Trace("WDCDataContext starting 01B");
_configuration = configuration; _configuration = configuration;
// verifico SE devo eseguire la migration del DB IDENT... // verifico SE devo eseguire la migration del DB IDENT...
bool disableMigrate = _configuration.GetValue<bool>("SetupOpt:DisableWDCMigrate"); bool disableMigrate = _configuration.GetValue<bool>("SetupOpt:DisableWDCMigrate");
@@ -113,7 +108,7 @@ namespace WebDoorCreator.Data
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{ {
Log.Info("WDCDataContext starting 02"); Log.Trace("WDCDataContext starting 02");
if (!optionsBuilder.IsConfigured) if (!optionsBuilder.IsConfigured)
{ {
string connString = _configuration.GetConnectionString("WDC.DB"); string connString = _configuration.GetConnectionString("WDC.DB");
@@ -134,6 +129,7 @@ namespace WebDoorCreator.Data
// hierarchId eliminato // hierarchId eliminato
optionsBuilder.UseSqlServer("Server=SQL2016DEV;Database=WebDoorCreator;Trusted_Connection=True;"); optionsBuilder.UseSqlServer("Server=SQL2016DEV;Database=WebDoorCreator;Trusted_Connection=True;");
} }
Log.Trace("WDCDataContext starting 03");
} }
} }
@@ -15,11 +15,11 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="EgwCoreLib.Utils" Version="1.4.2307.3111" /> <PackageReference Include="EgwCoreLib.Utils" Version="1.4.2307.3111" />
<PackageReference Include="MailKit" Version="3.5.0" /> <PackageReference Include="MailKit" Version="3.5.0" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="6.0.14" /> <PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="6.0.27" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.14" /> <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.27" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="6.0.14" /> <PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="6.0.27" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.14" /> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.27" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.14"> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.27">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
@@ -3,13 +3,14 @@
@attribute [IgnoreAntiforgeryToken] @attribute [IgnoreAntiforgeryToken]
@inject SignInManager<IdentityUser> SignInManager @inject SignInManager<IdentityUser> SignInManager
@functions { @functions {
public async Task<IActionResult> OnPost() public async Task<IActionResult> OnPost(string returnUrl = null)
{ {
returnUrl ??= Url.Content("~/");
if (SignInManager.IsSignedIn(User)) if (SignInManager.IsSignedIn(User))
{ {
await SignInManager.SignOutAsync(); await SignInManager.SignOutAsync();
} }
return Redirect("~/"); return Redirect(returnUrl);
} }
} }
@@ -93,7 +93,10 @@ namespace WebDoorCreator.UI.Areas.Identity.Pages.Account
public async Task OnGetAsync(string returnUrl = null) public async Task OnGetAsync(string returnUrl = null)
{ {
await CheckSuperAdmin(); if (_configuration.GetValue<bool>("SetupOpt:CheckAdmUser"))
{
await CheckSuperAdmin();
}
if (!string.IsNullOrEmpty(ErrorMessage)) if (!string.IsNullOrEmpty(ErrorMessage))
{ {
ModelState.AddModelError(string.Empty, ErrorMessage); ModelState.AddModelError(string.Empty, ErrorMessage);
@@ -111,7 +114,7 @@ namespace WebDoorCreator.UI.Areas.Identity.Pages.Account
private async Task CheckSuperAdmin() private async Task CheckSuperAdmin()
{ {
//se non ci fosse --> creo samuele come superadmin //se non ci fosse --> creo samuele come superadmin
string superUser = "zaccaria.majid01@egalware.com"; string superUser = "samuele.locatelli@egalware.com";
string superPwd = "viaDante16!"; string superPwd = "viaDante16!";
string ADMIN_ROLE = "SuperAdmin"; string ADMIN_ROLE = "SuperAdmin";
var user = await _userManager.FindByEmailAsync(superUser); var user = await _userManager.FindByEmailAsync(superUser);
@@ -164,7 +167,7 @@ namespace WebDoorCreator.UI.Areas.Identity.Pages.Account
var result = await _signInManager.PasswordSignInAsync(Input.Email, Input.Password, Input.RememberMe, lockoutOnFailure: false); var result = await _signInManager.PasswordSignInAsync(Input.Email, Input.Password, Input.RememberMe, lockoutOnFailure: false);
if (result.Succeeded) if (result.Succeeded)
{ {
_logger.LogInformation("User logged in."); _logger.LogInformation($"{Input.Email} | User logged in.");
return LocalRedirect(returnUrl); return LocalRedirect(returnUrl);
} }
if (result.RequiresTwoFactor) if (result.RequiresTwoFactor)
@@ -12,5 +12,8 @@
} }
<li class="nav-item"><a class="nav-link @ManageNavPages.TwoFactorAuthenticationNavClass(ViewContext)" id="two-factor" asp-page="./TwoFactorAuthentication">Two-factor authentication</a></li> <li class="nav-item"><a class="nav-link @ManageNavPages.TwoFactorAuthenticationNavClass(ViewContext)" id="two-factor" asp-page="./TwoFactorAuthentication">Two-factor authentication</a></li>
<li class="nav-item"><a class="nav-link @ManageNavPages.PersonalDataNavClass(ViewContext)" id="personal-data" asp-page="./PersonalData">Personal data</a></li> <li class="nav-item"><a class="nav-link @ManageNavPages.PersonalDataNavClass(ViewContext)" id="personal-data" asp-page="./PersonalData">Personal data</a></li>
<li class="nav-item bg-dark rounded p-2"><a class="text-light text-decoration-none" id="personal-data" href="/WDC/UI/"><i class="fa-solid fa-arrow-left-long"></i> &nbsp; Back to Main page</a></li> @{
string baseUrl = Url.Content("~/");
<li class="nav-item bg-dark rounded p-2"><a class="text-light text-decoration-none" id="personal-data" href="@baseUrl"><i class="fa-solid fa-arrow-left-long"></i> &nbsp; Back to Main page</a></li>
}
</ul> </ul>
@@ -4,24 +4,26 @@
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
<ul class="navbar-nav"> <ul class="navbar-nav">
@if (SignInManager.IsSignedIn(User)) @if (SignInManager.IsSignedIn(User))
{ {
<li class="nav-item"> string baseUrl = Url.Content("~/");
<a class="nav-link text-dark" asp-area="Identity" asp-page="/Account/Manage/Index" title="Manage">Hello @User.Identity?.Name!</a> <li class="nav-item">
</li> <a class="nav-link text-dark" asp-area="Identity" asp-page="@($"{baseUrl}/Account/Manage/Index")" title="Manage">Hello @User.Identity?.Name!</a>
<li class="nav-item"> </li>
<form class="form-inline" asp-area="Identity" asp-page="/Account/Logout" asp-route-returnUrl="/" method="post"> <li class="nav-item">
<button type="submit" class="nav-link btn btn-link text-dark">Logout</button> <form class="form-inline" asp-area="Identity" asp-page="@($"{baseUrl}/Account/Logout")" asp-route-returnUrl="/" method="post">
</form> <button type="submit" class="nav-link btn btn-link text-dark">Logout</button>
</li> </form>
} </li>
else }
{ else
<li class="nav-item"> {
<a class="nav-link text-dark" asp-area="Identity" asp-page="/Account/Register">Register</a> string baseUrl = Url.Content("~/");
</li> <li class="nav-item">
<li class="nav-item"> <a class="nav-link text-dark" asp-area="Identity" asp-page="@($"{baseUrl}/Account/Register")">Register</a>
<a class="nav-link text-dark" asp-area="Identity" asp-page="/Account/Login">Login</a> </li>
</li> <li class="nav-item">
} <a class="nav-link text-dark" asp-area="Identity" asp-page="@($"{baseUrl}/Account/Login")">Login</a>
</li>
}
</ul> </ul>
@@ -11,6 +11,16 @@ namespace WebDoorCreator.UI.Components.DoorDef
{ {
public partial class DoorDefinition : IDisposable public partial class DoorDefinition : IDisposable
{ {
#region Public Properties
[Parameter]
public int idDoor { get; set; } = 0;
[Parameter]
public int idOrd { get; set; } = 0;
#endregion Public Properties
#region Public Methods #region Public Methods
public void Dispose() public void Dispose()
@@ -18,7 +28,7 @@ namespace WebDoorCreator.UI.Components.DoorDef
ListBaseDoorOp = null; ListBaseDoorOp = null;
currOrder = null; currOrder = null;
WDCUService.EA_CurrLanguage -= WDUService_EA_CurrLanguage; WDCUService.EA_CurrLanguage -= WDUService_EA_CurrLanguage;
QDataServ.CalcDonePipe.EA_NewMessage -= CalcDonePipe_EA_NewMessage; QDService.CalcDonePipe.EA_NewMessage -= CalcDonePipe_EA_NewMessage;
} }
#endregion Public Methods #endregion Public Methods
@@ -26,14 +36,14 @@ namespace WebDoorCreator.UI.Components.DoorDef
#region Protected Properties #region Protected Properties
protected bool B_doorOpUpd { get; set; } = false; protected bool B_doorOpUpd { get; set; } = false;
[Inject]
protected IConfiguration configuration { get; set; } = null!;
protected OrderStatusViewModel? currOrder { get; set; } = null;
protected string DoorSvgContent { get; set; } = ""; protected string DoorSvgContent { get; set; } = "";
protected string ErrCode { get; set; } = "ERRORE"; protected string ErrCode { get; set; } = "ERRORE";
[Parameter]
public int idDoor { get; set; } = 0;
[Parameter]
public int idOrd { get; set; } = 0;
protected bool isDoorOpConf { get; set; } = false; protected bool isDoorOpConf { get; set; } = false;
protected bool IsErr { get; set; } = false; protected bool IsErr { get; set; } = false;
@@ -43,12 +53,11 @@ namespace WebDoorCreator.UI.Components.DoorDef
[Inject] [Inject]
protected NavigationManager NavManager { get; set; } = null!; protected NavigationManager NavManager { get; set; } = null!;
protected OrderStatusViewModel? currOrder { get; set; } = null; protected int orderStat { get; set; } = 10;
protected bool paramChanged { get; set; } = false; protected bool paramChanged { get; set; } = false;
[Inject] [Inject]
protected QueueDataService QDataServ { get; set; } = null!; protected QueueDataService QDService { get; set; } = null!;
protected string userLang { get; set; } = "EN"; protected string userLang { get; set; } = "EN";
@@ -65,8 +74,6 @@ namespace WebDoorCreator.UI.Components.DoorDef
#region Protected Methods #region Protected Methods
protected int orderStat { get; set; } = 10;
protected async Task catchParamChange(bool ParamChanged) protected async Task catchParamChange(bool ParamChanged)
{ {
await Task.Delay(1); await Task.Delay(1);
@@ -92,7 +99,7 @@ namespace WebDoorCreator.UI.Components.DoorDef
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
await Task.Delay(1); WaitReloadSvg = configuration.GetValue<int>("RuntimeOpt:WaitReloadSvg");
var uri = NavManager.ToAbsoluteUri(NavManager.Uri); var uri = NavManager.ToAbsoluteUri(NavManager.Uri);
//if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("idOrd", out var _idOrd) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("idDoor", out var _idDoor)) //if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("idOrd", out var _idOrd) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("idDoor", out var _idDoor))
//{ //{
@@ -101,7 +108,7 @@ namespace WebDoorCreator.UI.Components.DoorDef
//} //}
await ReloadData(); await ReloadData();
WDCUService.EA_CurrLanguage += WDUService_EA_CurrLanguage; WDCUService.EA_CurrLanguage += WDUService_EA_CurrLanguage;
QDataServ.CalcDonePipe.EA_NewMessage += CalcDonePipe_EA_NewMessage; QDService.CalcDonePipe.EA_NewMessage += CalcDonePipe_EA_NewMessage;
WDCRService.EA_UpdDoorOp += WDService_EA_DoorOpUpdated; WDCRService.EA_UpdDoorOp += WDService_EA_DoorOpUpdated;
} }
@@ -112,7 +119,20 @@ namespace WebDoorCreator.UI.Components.DoorDef
currOrder = null; currOrder = null;
await Task.Delay(1); await Task.Delay(1);
// cerco img porta... // cerco img porta...
DoorSvgContent = await QDataServ.DoorGetLastSvg(idDoor); DoorSvgContent = await QDService.DoorGetLastSvg(idDoor);
// se fosse vuoto...
if (string.IsNullOrEmpty(DoorSvgContent))
{
// richiede ricalcolo img
DoorSvgContent = await SendRecalcReq(idDoor);
}
// se fosse vuoto...
if (string.IsNullOrEmpty(DoorSvgContent))
{
// legge img vuota
DoorSvgContent = QDService.DoorGetMissingSvg();
}
// recupero altri dati // recupero altri dati
var ListRecordDoorOp = await WDService.DoorOpGetByDoorId(idDoor); var ListRecordDoorOp = await WDService.DoorOpGetByDoorId(idDoor);
if (ListRecordDoorOp != null) if (ListRecordDoorOp != null)
@@ -132,7 +152,7 @@ namespace WebDoorCreator.UI.Components.DoorDef
if (ListOrdersStatus != null) if (ListOrdersStatus != null)
{ {
currOrder = ListOrdersStatus.Where(x => x.OrderId == idOrd).FirstOrDefault(); currOrder = ListOrdersStatus.Where(x => x.OrderId == idOrd).FirstOrDefault();
if(currOrder != null) if (currOrder != null)
{ {
orderStat = currOrder.OrderStatus; orderStat = currOrder.OrderStatus;
} }
@@ -162,6 +182,8 @@ namespace WebDoorCreator.UI.Components.DoorDef
private static Logger Log = LogManager.GetCurrentClassLogger(); private static Logger Log = LogManager.GetCurrentClassLogger();
private int WaitReloadSvg = 100;
#endregion Private Fields #endregion Private Fields
#region Private Properties #region Private Properties
@@ -197,16 +219,16 @@ namespace WebDoorCreator.UI.Components.DoorDef
doorSvgVers = doorSvgVers.Replace(".", ":"); doorSvgVers = doorSvgVers.Replace(".", ":");
} }
// fix ./: // fix ./:
var hasErr = await QDataServ.DoorErrExists(doorSvgVers); var hasErr = await QDService.DoorErrExists(doorSvgVers);
if (hasErr) if (hasErr)
{ {
var messErr = await QDataServ.DoorErrGet(doorSvgVers); var messErr = await QDService.DoorErrGet(doorSvgVers);
IsErr = true; IsErr = true;
ErrCode = messErr; ErrCode = messErr;
} }
else else
{ {
DoorSvgContent = await QDataServ.DoorSvgGet(doorSvgVers); DoorSvgContent = await QDService.DoorSvgGet(doorSvgVers);
} }
await Task.Run(async () => await InvokeAsync(StateHasChanged)); await Task.Run(async () => await InvokeAsync(StateHasChanged));
@@ -214,6 +236,34 @@ namespace WebDoorCreator.UI.Components.DoorDef
} }
} }
/// <summary>
/// Invio richiesta ricalcolo porta
/// </summary>
/// <param name="DoorId"></param>
/// <returns></returns>
private async Task<string> SendRecalcReq(int DoorId)
{
string answ = "";
// richiede ricalcolo img
List<string> doorIdList = new List<string>() { $"{DoorId}" };
// chiamo reset richieste
var list2Proc = await QDService.ResetQueueByDoorList(doorIdList);
// recupero DDF ed invio x processing
if (DoorId > 0)
{
string currDDF = await WDService.DoorOpGetDDF(DoorId);
// versione corrente del DDF generato
int currVers = await QDService.SendCalcReq(DoorId, currDDF);
}
// attende ...
await Task.Delay(WaitReloadSvg);
// riprova lettura
answ = await QDService.DoorGetLastSvg(DoorId);
return answ;
}
private void WDService_EA_DoorOpUpdated() private void WDService_EA_DoorOpUpdated()
{ {
B_doorOpUpd = WDCRService.isDoorOpUpd; B_doorOpUpd = WDCRService.isDoorOpUpd;
@@ -278,10 +278,16 @@ namespace WebDoorCreator.UI.Components.DoorMan
.Select(x => $"{x.DoorId}") .Select(x => $"{x.DoorId}")
.ToList(); .ToList();
// faccio upsert porte nell'elenco door tipo template... // solo se è template salvo nell'elenco...
var numTplDoor = await QDService.DoorTplListUpsert(doorIdList); if (isTplPage)
// chiamo reset {
// faccio upsert porte nell'elenco door tipo template...
var numTplDoor = await QDService.DoorTplListUpsert(doorIdList);
}
// chiamo reset richieste
var list2Proc = await QDService.ResetQueueByDoorList(doorIdList); var list2Proc = await QDService.ResetQueueByDoorList(doorIdList);
// se ho porte da processare --> chiamo save... // se ho porte da processare --> chiamo save...
string currDDF = ""; string currDDF = "";
int currDoorId = 0; int currDoorId = 0;
@@ -121,22 +121,16 @@
<option>IT</option> <option>IT</option>
</select> </select>
</div> </div>
<hr />
</li> </li>
<li class="list-group-item"> <li class="list-group-item">
<div class=""> <NavLink href=@($"{baseUrl}/Identity/Account/Manage")>
<NavLink class="nav-link text-nowrap" href=@($"{baseUrl}/Identity/Account/Manage")> <button class="btn btn-sm btn-success w-100 fw-bold text-light text-decoration-none" style="">@translate("UI_06")</button>
<button class="btn btn-sm btn-success w-100 fw-bold text-light text-decoration-none text-dark" style="">@translate("UI_06")</button> </NavLink>
</NavLink>
</div>
</li> </li>
<li class="list-group-item"> <li class="list-group-item">
<div class="text-end"> <form method="post" action="@logoutUrl">
<form method="post" action="@actionUrl"> <button type="submit" class="btn btn-sm btn-danger text-light w-100 fw-bold">Log out <i class="fa-solid fa-arrow-right-from-bracket"></i></button>
<button type="submit" class="btnLogout">Log out <i class="fa-solid fa-arrow-right-from-bracket"></i></button> </form>
</form>
</div>
</li> </li>
</ul> </ul>
</div> </div>
@@ -158,7 +152,7 @@
</div> </div>
<div class="text-end text-nowrap px-3 py-2 d-flex justify-content-between"> <div class="text-end text-nowrap px-3 py-2 d-flex justify-content-between">
@*<a href="Identity/Account/Register" class="text-decoration-none text-dark">@translate("UI_08") &nbsp; &nbsp;</a>*@ @*<a href="Identity/Account/Register" class="text-decoration-none text-dark">@translate("UI_08") &nbsp; &nbsp;</a>*@
<a href="Identity/Account/Login" class="text-decoration-none text-dark">@translate("UI_09") </a> <a href="@($"{baseUrl}/Identity/Account/Login")" class="text-decoration-none text-dark">@translate("UI_09") </a>
</div> </div>
</nav> </nav>
</NotAuthorized> </NotAuthorized>
@@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Authorization; using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using System.Security.Policy;
using WebDoorCreator.Data.DbModels; using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.Services; using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Data; using WebDoorCreator.UI.Data;
@@ -28,6 +29,7 @@ namespace WebDoorCreator.UI.Components.Gen
protected string baseUrl protected string baseUrl
{ {
// string baseUrl = Url.Content("~/");
get => configuration.GetValue<string>("RuntimeOpt:BaseUrl"); get => configuration.GetValue<string>("RuntimeOpt:BaseUrl");
} }
@@ -235,20 +237,11 @@ namespace WebDoorCreator.UI.Components.Gen
return answ; return answ;
} }
protected string actionUrl protected string logoutUrl
{ {
get get
{ {
string answ = ""; return $"{baseUrl}/Identity/Account/LogOut";
if (NavManager.Uri.Contains("/WDC/UI"))
{
answ = $"{baseUrl}/Identity/Account/LogOut";
}
else
{
answ = "/Identity/Account/LogOut";
}
return answ;
} }
} }
@@ -11,14 +11,99 @@ namespace WebDoorCreator.UI.Controllers
[ApiController] [ApiController]
public class DoorImageController : ControllerBase public class DoorImageController : ControllerBase
{ {
#region Public Constructors
public DoorImageController(IConfiguration configuration, QueueDataService cQDService, WebDoorCreatorService cWDCService)
{
Log.Info("Starting DoorImageController");
_configuration = configuration;
WaitReloadSvg = _configuration.GetValue<int>("RuntimeOpt:WaitReloadSvg");
QDService = cQDService;
WDService = cWDCService;
Log.Info("Avviato DoorImageController");
}
#endregion Public Constructors
#region Public Methods
// GET: api/DoorImage
[HttpGet]
public string Get()
{
return "OK";
}
[HttpGet("GetImage.svg")] [HttpGet("GetImage.svg")]
public async Task<IActionResult> GetImage(int DoorId) public async Task<IActionResult> GetImage(int DoorId)
{ {
string svgContent = await QDataServ.DoorGetLastSvg(DoorId); string svgContent = await QDService.DoorGetLastSvg(DoorId);
// se fosse vuoto...
if (string.IsNullOrEmpty(svgContent))
{
// richiede ricalcolo img
svgContent = await SendRecalcReq(DoorId);
}
// se fosse vuoto...
if (string.IsNullOrEmpty(svgContent))
{
// legge img vuota
svgContent = QDService.DoorGetMissingSvg();
}
var result = System.Text.Encoding.UTF8.GetBytes(svgContent); var result = System.Text.Encoding.UTF8.GetBytes(svgContent);
return File(result, "image/svg+xml"); return File(result, "image/svg+xml");
} }
#endregion Public Methods
#region Private Fields
private static Logger Log = LogManager.GetCurrentClassLogger();
private IConfiguration _configuration = null!;
private int WaitReloadSvg = 100;
#endregion Private Fields
#region Private Properties
private QueueDataService QDService { get; set; } = null!;
private WebDoorCreatorService WDService { get; set; } = null!;
#endregion Private Properties
#region Private Methods
/// <summary>
/// Invio richiesta ricalcolo porta
/// </summary>
/// <param name="DoorId"></param>
/// <returns></returns>
private async Task<string> SendRecalcReq(int DoorId)
{
string answ = "";
// richiede ricalcolo img
List<string> doorIdList = new List<string>() { $"{DoorId}" };
// chiamo reset richieste
var list2Proc = await QDService.ResetQueueByDoorList(doorIdList);
// recupero DDF ed invio x processing
if (DoorId > 0)
{
string currDDF = await WDService.DoorOpGetDDF(DoorId);
// versione corrente del DDF generato
int currVers = await QDService.SendCalcReq(DoorId, currDDF);
}
// attende ...
await Task.Delay(WaitReloadSvg);
// riprova lettura
answ = await QDService.DoorGetLastSvg(DoorId);
return answ;
}
#endregion Private Methods
#if false #if false
[HttpGet("GetImage.png")] [HttpGet("GetImage.png")]
public async Task<IActionResult> GetImagePng(int DoorId) public async Task<IActionResult> GetImagePng(int DoorId)
@@ -35,35 +120,5 @@ namespace WebDoorCreator.UI.Controllers
return File(result, "image/png"); return File(result, "image/png");
} }
#endif #endif
// GET: api/DoorImage
[HttpGet]
public string Get()
{
return "OK";
}
public DoorImageController(IConfiguration configuration, QueueDataService DataService)
{
Log.Info("Starting DoorImageController");
_configuration = configuration;
QDataServ = DataService;
Log.Info("Avviato DoorImageController");
}
#region Private Fields
private static IConfiguration _configuration = null!;
private static Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
#region Private Properties
private QueueDataService QDataServ { get; set; } = null!;
#endregion Private Properties
} }
} }
+28 -1
View File
@@ -110,7 +110,34 @@
<script src="~/Identity/js/site.js" asp-append-version="true"></script> <script src="~/Identity/js/site.js" asp-append-version="true"></script>
<script src="~/lib/SiteHelper.js" asp-append-version="true"></script> <script src="~/lib/SiteHelper.js" asp-append-version="true"></script>
<script src="_framework/blazor.server.js"></script> <script src="_framework/blazor.server.js" autostart="false"></script>
@*Gestione autoriconnessione: https://github.com/dotnet/aspnetcore/issues/38305 (vedere anche https://docs.microsoft.com/it-it/aspnet/core/blazor/fundamentals/signalr?view=aspnetcore-6.0#modify-the-reconnection-handler-blazor-server)*@
<script>
Blazor.start({
reconnectionOptions: {
maxRetries: 600,
retryIntervalMilliseconds: 1000
},
reconnectionHandler: {
onConnectionDown: (options, error) => console.error(error),
onConnectionUp: () => console.log("Client reconnected!")
}
}).then(() => {
Object.defineProperty(Blazor.defaultReconnectionHandler, '_reconnectionDisplay', {
get() {
return this.__reconnectionDisplay;
},
set(value) {
this.__reconnectionDisplay = {
show: () => value.show(),
update: (d) => value.update(d),
rejected: (d) => document.location.reload()
}
}
});
});
</script>
@await RenderSectionAsync("Scripts", required: false) @await RenderSectionAsync("Scripts", required: false)
</body> </body>
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<WebPublishMethod>MSDeploy</WebPublishMethod>
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish>https://wdc.egalware.com/UI/</SiteUrlToLaunchAfterPublish>
<ExcludeApp_Data>false</ExcludeApp_Data>
<ProjectGuid>c2109e71-4eae-4167-9052-175123ccc2bc</ProjectGuid>
<SelfContained>false</SelfContained>
<MSDeployServiceURL>https://wdc-w-iis-01.ovh:8172/MsDeploy.axd</MSDeployServiceURL>
<DeployIisAppPath>wdc.egalware.com/UI</DeployIisAppPath>
<RemoteSitePhysicalPath />
<SkipExtraFilesOnServer>false</SkipExtraFilesOnServer>
<MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
<EnableMSDeployBackup>true</EnableMSDeployBackup>
<EnableMsDeployAppOffline>true</EnableMsDeployAppOffline>
<UserName>steamware</UserName>
<_SavePWD>true</_SavePWD>
<_TargetId>IISWebDeploy</_TargetId>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
</Project>
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<History>True|2024-02-13T16:56:27.4654255Z;True|2023-05-22T15:35:59.9735292+02:00;False|2023-05-22T15:33:39.4808724+02:00;True|2023-05-11T17:36:48.1468628+02:00;</History>
<LastFailureDetails />
<TimeStampOfAssociatedLegacyPublishXmlFile />
<EncryptedPassword>AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAs/7D3mNhw0uqUXeNq4OiHAAAAAACAAAAAAADZgAAwAAAABAAAACQhhKbsfp+UTciHhrQH0GzAAAAAASAAACgAAAAEAAAAIwsEsbaK2BLsVBpap3Pa0oYAAAAyYg8C03gbwQgvT7iGggH24UdM5ET0UN8FAAAAHqaLNjIe/Ai9A1quKtegfN5FxtH</EncryptedPassword>
</PropertyGroup>
</Project>
+111 -109
View File
@@ -3,125 +3,127 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<Version>0.9.2401.0415</Version> <Version>0.9.2403.0411</Version>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>aspnet-WebDoorCreator.UI-dfe95fed-1398-4144-bd43-8b3a765d6608</UserSecretsId> <UserSecretsId>aspnet-WebDoorCreator.UI-dfe95fed-1398-4144-bd43-8b3a765d6608</UserSecretsId>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Content Remove="compilerconfig.json" /> <Content Remove="compilerconfig.json" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS-PROD.pubxml" /> <_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS-OVH-PROD.pubxml" />
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS01.pubxml" /> <_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS-PROD.pubxml" />
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS02.pubxml" /> <_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS01.pubxml" />
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IISProfile.pubxml" /> <_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS02.pubxml" />
</ItemGroup> <_WebToolingArtifacts Remove="Properties\PublishProfiles\IISProfile.pubxml" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="temp\Logo00.svg"> <Content Include="temp\Logo00.svg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </Content>
<Content Include="temp\Logo01.svg"> <Content Include="temp\Logo01.svg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </Content>
<Content Include="temp\Logo02.svg"> <Content Include="temp\Logo02.svg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </Content>
<Content Include="temp\Logo03.svg"> <Content Include="temp\Logo03.svg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </Content>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Blazored.LocalStorage" Version="4.3.0" /> <PackageReference Include="Blazored.LocalStorage" Version="4.3.0" />
<PackageReference Include="Blazored.SessionStorage" Version="2.3.0" /> <PackageReference Include="Blazored.SessionStorage" Version="2.3.0" />
<PackageReference Include="DiffMatchPatch" Version="1.0.3" /> <PackageReference Include="DiffMatchPatch" Version="1.0.3" />
<PackageReference Include="EgwCoreLib.Razor" Version="1.4.2308.216" /> <PackageReference Include="EgwCoreLib.Razor" Version="1.4.2308.216" />
<PackageReference Include="EgwCoreLib.Utils" Version="1.4.2307.3111" /> <PackageReference Include="EgwCoreLib.Utils" Version="1.4.2307.3111" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="6.0.14" /> <PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="6.0.27" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.14" /> <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.27" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="6.0.14" /> <PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="6.0.27" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.14" /> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.27" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.14"> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.27">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.14" /> <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.14" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NLog" Version="5.2.2" /> <PackageReference Include="NLog" Version="5.2.2" />
<PackageReference Include="StackExchange.Redis" Version="2.6.122" /> <PackageReference Include="StackExchange.Redis" Version="2.6.122" />
<PackageReference Include="YamlDotNet" Version="13.1.0" /> <PackageReference Include="YamlDotNet" Version="13.1.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\WebDoorCreator.Core\WebDoorCreator.Core.csproj" /> <ProjectReference Include="..\WebDoorCreator.Core\WebDoorCreator.Core.csproj" />
<ProjectReference Include="..\WebDoorCreator.Data\WebDoorCreator.Data.csproj" /> <ProjectReference Include="..\WebDoorCreator.Data\WebDoorCreator.Data.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="Areas\Identity\Data\" /> <Folder Include="Areas\Identity\Data\" />
<Folder Include="Reports\" /> <Folder Include="Reports\" />
<Folder Include="wwwroot\DoorOpTypeImg\" /> <Folder Include="wwwroot\DoorOpTypeImg\" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="compilerconfig.json" /> <None Include="compilerconfig.json" />
<None Include="Properties\PublishProfiles\IIS-PROD.pubxml.user" /> <None Include="Properties\PublishProfiles\IIS-OVH-PROD.pubxml.user" />
<None Include="Properties\PublishProfiles\IIS01.pubxml.user" /> <None Include="Properties\PublishProfiles\IIS-PROD.pubxml.user" />
<None Include="Properties\PublishProfiles\IIS02.pubxml.user" /> <None Include="Properties\PublishProfiles\IIS01.pubxml.user" />
<None Include="Properties\PublishProfiles\IISProfile.pubxml.user" /> <None Include="Properties\PublishProfiles\IIS02.pubxml.user" />
</ItemGroup> <None Include="Properties\PublishProfiles\IISProfile.pubxml.user" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<Content Update="wwwroot\images\icons\angles-left-solid.svg"> <Content Update="wwwroot\images\icons\angles-left-solid.svg">
<CopyToOutputDirectory>Never</CopyToOutputDirectory> <CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content> </Content>
<Content Update="wwwroot\images\icons\angles-right-solid.svg"> <Content Update="wwwroot\images\icons\angles-right-solid.svg">
<CopyToOutputDirectory>Never</CopyToOutputDirectory> <CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content> </Content>
<Content Update="wwwroot\images\icons\arrows-rotate-solid.svg"> <Content Update="wwwroot\images\icons\arrows-rotate-solid.svg">
<CopyToOutputDirectory>Never</CopyToOutputDirectory> <CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content> </Content>
<Content Update="wwwroot\images\icons\calculator-solid.svg"> <Content Update="wwwroot\images\icons\calculator-solid.svg">
<CopyToOutputDirectory>Never</CopyToOutputDirectory> <CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content> </Content>
<Content Update="wwwroot\images\icons\clipboard-regular.svg"> <Content Update="wwwroot\images\icons\clipboard-regular.svg">
<CopyToOutputDirectory>Never</CopyToOutputDirectory> <CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content> </Content>
<Content Update="wwwroot\images\icons\clone.svg"> <Content Update="wwwroot\images\icons\clone.svg">
<CopyToOutputDirectory>Never</CopyToOutputDirectory> <CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content> </Content>
<Content Update="wwwroot\images\icons\Exit.svg"> <Content Update="wwwroot\images\icons\Exit.svg">
<CopyToOutputDirectory>Never</CopyToOutputDirectory> <CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content> </Content>
<Content Update="wwwroot\images\icons\ExitWhite.svg"> <Content Update="wwwroot\images\icons\ExitWhite.svg">
<CopyToOutputDirectory>Never</CopyToOutputDirectory> <CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content> </Content>
<Content Update="wwwroot\images\icons\file-pdf-regular.svg"> <Content Update="wwwroot\images\icons\file-pdf-regular.svg">
<CopyToOutputDirectory>Never</CopyToOutputDirectory> <CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content> </Content>
<Content Update="wwwroot\images\icons\file.svg"> <Content Update="wwwroot\images\icons\file.svg">
<CopyToOutputDirectory>Never</CopyToOutputDirectory> <CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content> </Content>
<Content Update="wwwroot\images\icons\Plus.svg"> <Content Update="wwwroot\images\icons\Plus.svg">
<CopyToOutputDirectory>Never</CopyToOutputDirectory> <CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content> </Content>
<Content Update="wwwroot\images\icons\PlusWhite.svg"> <Content Update="wwwroot\images\icons\PlusWhite.svg">
<CopyToOutputDirectory>Never</CopyToOutputDirectory> <CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content> </Content>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Update="logs\.placeholder"> <None Update="logs\.placeholder">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>
<None Update="Reports\ReportOrder.rdlc"> <None Update="Reports\ReportOrder.rdlc">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>
</ItemGroup> </ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> <Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="powershell.exe -ExecutionPolicy Unrestricted -NoProfile -NonInteractive -File $(ProjectDir)\post-build.ps1 -ProjectDir $(ProjectDir) -ProjectPath $(ProjectPath)" /> <Exec Command="powershell.exe -ExecutionPolicy Unrestricted -NoProfile -NonInteractive -File $(ProjectDir)\post-build.ps1 -ProjectDir $(ProjectDir) -ProjectPath $(ProjectPath)" />
</Target> </Target>
</Project> </Project>
@@ -6,17 +6,17 @@
"Microsoft.AspNetCore": "Warning" "Microsoft.AspNetCore": "Warning"
} }
}, },
"RuntimeOpt": {
"MaxDayCalcCache": 7,
"BaseUrl": "/WDC/UI"
},
"ConnectionStrings": { "ConnectionStrings": {
"Redis": "nkcredis.steamware.net:6379, DefaultDatabase=12, connectTimeout=5000, syncTimeout=5000, asyncTimeout=5000, abortConnect=false, ssl=false, password=BtN9Py1wtLfLRvmzWnOPJ7RytDM+CLiVsJ/16zduNTlV8IOPGNrtzJSXPUnImA5PqmUMhKaUqo9NdHIG", "Redis": "wdc-u-redis-01.ovh:6379, DefaultDatabase=12, connectTimeout=5000, syncTimeout=5000, asyncTimeout=5000, abortConnect=false, ssl=false, password=BtN9Py1wtLfLRvmzWnOPJ7RytDM+CLiVsJ/16zduNTlV8IOPGNrtzJSXPUnImA5PqmUMhKaUqo9NdHIG",
"Identity.DB": "Server=SQL2016PROD;Database=DCA_WebDoorCreator; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=WebDoorCreator.UI;", "Identity.DB": "Server=WDC-W-SQL-01\\SQLEXPRESS;Database=DCA_WebDoorCreator; User ID=steamware;Password=viadante16; integrated security=False; MultipleActiveResultSets=True; App=WebDoorCreator.UI;",
"WDC.DB": "Server=SQL2016PROD;Database=DCA_WebDoorCreator; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=WebDoorCreator.UI;" "WDC.DB": "Server=WDC-W-SQL-01\\SQLEXPRESS;Database=DCA_WebDoorCreator; User ID=steamware;Password=viadante16; integrated security=False; MultipleActiveResultSets=True; App=WebDoorCreator.UI;"
},
"RuntimeOpt": {
"MaxDayCalcCache": 28,
"BaseUrl": "/UI"
}, },
"CompoBaseDirs": { "CompoBaseDirs": {
"CurrCompoDir": "J:\\WebDoorSync\\CurrentComp\\Compo", "CurrCompoDir": "U:\\WebDoorSync\\CurrentComp\\Compo",
"NewCompoDir": "J:\\WebDoorSync\\NewComp\\Compo" "NewCompoDir": "U:\\WebDoorSync\\NewComp\\Compo"
} }
} }
@@ -6,6 +6,11 @@
"Microsoft.AspNetCore": "Warning" "Microsoft.AspNetCore": "Warning"
} }
}, },
"ConnectionStrings": {
"Redis": "nkcredis.steamware.net:6379, DefaultDatabase=12, connectTimeout=5000, syncTimeout=5000, asyncTimeout=5000, abortConnect=false, ssl=false, password=BtN9Py1wtLfLRvmzWnOPJ7RytDM+CLiVsJ/16zduNTlV8IOPGNrtzJSXPUnImA5PqmUMhKaUqo9NdHIG",
"Identity.DB": "Server=SQL2016PROD;Database=DCA_WebDoorCreator; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=WebDoorCreator.UI;",
"WDC.DB": "Server=SQL2016PROD;Database=DCA_WebDoorCreator; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=WebDoorCreator.UI;"
},
"RuntimeOpt": { "RuntimeOpt": {
"MaxDayCalcCache": 7, "MaxDayCalcCache": 7,
"BaseUrl": "/WDC/UI" "BaseUrl": "/WDC/UI"
+5 -4
View File
@@ -10,9 +10,6 @@
"Redis": "nkcredis.steamware.net:6379, DefaultDatabase=11, connectTimeout=5000, syncTimeout=5000, asyncTimeout=5000, abortConnect=false, ssl=false, password=BtN9Py1wtLfLRvmzWnOPJ7RytDM+CLiVsJ/16zduNTlV8IOPGNrtzJSXPUnImA5PqmUMhKaUqo9NdHIG", "Redis": "nkcredis.steamware.net:6379, DefaultDatabase=11, connectTimeout=5000, syncTimeout=5000, asyncTimeout=5000, abortConnect=false, ssl=false, password=BtN9Py1wtLfLRvmzWnOPJ7RytDM+CLiVsJ/16zduNTlV8IOPGNrtzJSXPUnImA5PqmUMhKaUqo9NdHIG",
"Identity.DB": "Server=SQL2016DEV;Database=WebDoorCreator; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=WebDoorCreator.UI;", "Identity.DB": "Server=SQL2016DEV;Database=WebDoorCreator; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=WebDoorCreator.UI;",
"WDC.DB": "Server=SQL2016DEV;Database=WebDoorCreator; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=WebDoorCreator.UI;" "WDC.DB": "Server=SQL2016DEV;Database=WebDoorCreator; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=WebDoorCreator.UI;"
//"Redis": "nkcredis.steamware.net:6379, DefaultDatabase=12, connectTimeout=5000, syncTimeout=5000, asyncTimeout=5000, abortConnect=false, ssl=false, password=BtN9Py1wtLfLRvmzWnOPJ7RytDM+CLiVsJ/16zduNTlV8IOPGNrtzJSXPUnImA5PqmUMhKaUqo9NdHIG",
//"Identity.DB": "Server=SQL2016PROD;Database=DCA_WebDoorCreator; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=WebDoorCreator.UI;",
//"WDC.DB": "Server=SQL2016PROD;Database=DCA_WebDoorCreator; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=WebDoorCreator.UI;"
}, },
"ExternalProviders": { "ExternalProviders": {
"MailKit": { "MailKit": {
@@ -20,17 +17,19 @@
"Address": "smtp-mail.outlook.com", "Address": "smtp-mail.outlook.com",
"Port": "587", "Port": "587",
"Account": "steamwarebot@outlook.it", "Account": "steamwarebot@outlook.it",
"Password": "siamoInViaNazionale93", "Password": "siamoInViaNazionale93!",
"SenderEmail": "steamwarebot@outlook.it", "SenderEmail": "steamwarebot@outlook.it",
"SenderName": "Steamware Email BOT" "SenderName": "Steamware Email BOT"
} }
} }
}, },
"SetupOpt": { "SetupOpt": {
"CheckAdmUser": false,
"DisableIdentMigrate": true, "DisableIdentMigrate": true,
"DisableWDCMigrate": true "DisableWDCMigrate": true
}, },
"RuntimeOpt": { "RuntimeOpt": {
"WaitReloadSvg": 200,
"VetoRemoveProcessing": 5, "VetoRemoveProcessing": 5,
"MaxDayCalcCache": 7, "MaxDayCalcCache": 7,
"BaseUrl": "/WDC/UI", "BaseUrl": "/WDC/UI",
@@ -53,5 +52,7 @@
"CompoBaseDirs": { "CompoBaseDirs": {
"CurrCompoDir": "\\\\IIS04\\WebDoorSync\\CurrentComp\\Compo", "CurrCompoDir": "\\\\IIS04\\WebDoorSync\\CurrentComp\\Compo",
"NewCompoDir": "\\\\IIS04\\WebDoorSync\\NewComp\\Compo" "NewCompoDir": "\\\\IIS04\\WebDoorSync\\NewComp\\Compo"
//"CurrCompoDir": "J:\\WebDoorSync\\CurrentComp\\Compo",
//"NewCompoDir": "J:\\WebDoorSync\\NewComp\\Compo"
} }
} }