105 Commits

Author SHA1 Message Date
Samuele Locatelli 2cae5693e7 Update display x mostrare buttons x import ordini (solo segnaposto) 2025-05-13 16:30:00 +02:00
Samuele Locatelli ea1e37055b Update conf redis sentinel 2025-05-13 16:28:52 +02:00
Samuele Locatelli 221f7c03fd Merge commit '37986b0bcba62ef5e87e21438892c8fc21e15c07' into develop 2024-08-05 16:23:38 +02:00
Samuele Locatelli 885b4b78b2 fix commento 2024-08-05 16:23:23 +02:00
Emmanuele Sassi 37986b0bcb - eliminato controllo chiave
- aggiunto try su cancellazione file
2024-08-05 16:22:17 +02:00
Samuele Locatelli 670b71841d inserito riferimento x dove restituire tipo elaborazione svg/3dm... 2024-06-27 16:33:00 +02:00
Samuele Locatelli 225ee35143 Aggiunta commentata in CameraSrv x recuperare DDF fisso... 2024-06-27 16:30:39 +02:00
Samuele Locatelli 93906b747e Update struttura display btn/preview 2024-06-27 16:11:27 +02:00
Samuele Locatelli 4cde37cd5f Inserita gestione tipo richiesta (svg/3dm)
Rimesso bottone x export 3d con timeout x risposta calcolo
2024-06-27 15:34:15 +02:00
Samuele Locatelli 1ed9ab4af9 Merge tag 'Add3dPreview02' into develop
Fix icone HW
2024-06-20 16:23:29 +02:00
Samuele Locatelli f612613977 Merge branch 'release/Add3dPreview02' 2024-06-20 16:23:19 +02:00
Samuele Locatelli 96366e26e7 Fix icone HW 2024-06-20 16:22:36 +02:00
Samuele Locatelli 2ac91927dc Merge tag 'Add3dPreview01' into develop
Aggiunta disabilitazione pulsante 3D viewer
2024-06-20 15:35:54 +02:00
Samuele Locatelli 6400e37944 Merge branch 'release/Add3dPreview01' 2024-06-20 15:35:36 +02:00
Samuele Locatelli 1d9f550a02 Fix btn visibility x 3D 2024-06-20 15:35:15 +02:00
Samuele Locatelli db7d0466f2 Merge tag 'AddCompoMgmtDelete05' into develop
Fix selezione generic + fix gestione pulizia folder
2024-06-20 13:15:41 +02:00
Samuele Locatelli 3fd9ef8383 Merge branch 'release/AddCompoMgmtDelete05' 2024-06-20 13:15:31 +02:00
Samuele Locatelli 795b60ee86 Fix pulizia folder + fix selezione cartelle generic 2024-06-20 13:15:12 +02:00
Samuele Locatelli f7182715e5 Merge tag 'AddCompoMgmtDelete04' into develop
Aggiunto svuotamento cache dopo rilettura componenti x evitare
riscrittura dati eliminati
2024-06-20 12:04:29 +02:00
Samuele Locatelli 7547cc7035 Merge branch 'release/AddCompoMgmtDelete04' 2024-06-20 12:02:58 +02:00
Samuele Locatelli 99ee856340 Forza svuotamento cache dopo update componenti 2024-06-20 12:02:43 +02:00
Samuele Locatelli b02b9ccbf7 Merge tag 'AddCompoMgmtDelete03' into develop
Aggiunto caso gestione dir inesistente in file missing
2024-06-20 09:37:30 +02:00
Samuele Locatelli 71e5fa0674 Merge branch 'release/AddCompoMgmtDelete03' 2024-06-20 09:37:16 +02:00
Samuele Locatelli ad772b8160 Aggiunta verifica e creazione directory non esistente alla creazione missing files 2024-06-20 09:37:01 +02:00
Samuele Locatelli 8737eefd31 Merge tag 'AddCompoMgmtDelete02' into develop
Completata gestione Compo: missing, delete, log
2024-06-20 09:12:29 +02:00
Samuele Locatelli 9d0c29358d Merge branch 'release/AddCompoMgmtDelete02' 2024-06-20 09:12:09 +02:00
Samuele Locatelli 49f6114b67 Clean & update compo completed 2024-06-20 09:11:51 +02:00
Samuele Locatelli b723109f4e update gestione dizionario (da completare) 2024-06-19 18:29:18 +02:00
Samuele Locatelli 852d17ed0e Preparata procedura fix missing (da testare) 2024-06-19 18:24:04 +02:00
Samuele Locatelli 4329ab8552 Merge tag 'AddCompoMgmtDelete01' into develop
Primo step gestione componenti in modalità delete
2024-06-19 16:57:50 +02:00
Samuele Locatelli ecb40ab66f Merge branch 'release/AddCompoMgmtDelete01' 2024-06-19 16:57:39 +02:00
Samuele Locatelli 1d82e2ba05 Aggiunto conteggio componenti missing tra DB e FS 2024-06-19 16:57:18 +02:00
Samuele Locatelli e1dc3215a1 Merge tag 'AddDebugMode' into develop
Aggiunta debug mode + check delete componenti
2024-06-19 09:26:17 +02:00
Samuele Locatelli e7665ff1e0 Merge branch 'release/AddDebugMode' 2024-06-19 09:26:00 +02:00
Samuele Locatelli e1addcf11b Aggiunta possibilità "autoapprovazione" pdf SE
- superadmin
-url con ?config=debug
2024-06-19 09:25:24 +02:00
Samuele Locatelli 85259f334c Fix gfestione eliminazione componenti 2024-06-19 09:24:51 +02:00
Samuele Locatelli 7bda460b7b Update conf in prod x WDC su aree nextcloud 2024-05-10 18:10:09 +02:00
Samuele Locatelli 56aea1cc2c Merge tag 'FixHealthCheckIIs01' into develop
Update gestione check health
2024-05-09 19:07:04 +02:00
Samuele Locatelli 716cdc4a61 Merge branch 'release/FixHealthCheckIIs01' 2024-05-09 19:06:33 +02:00
Samuele Locatelli 69c02fdb8a typo 2024-05-09 19:06:02 +02:00
Samuele Locatelli 613339b662 nota auth check health 2024-05-09 19:05:50 +02:00
Samuele Locatelli 4f4a0ec2b4 Test commento sezione startup.cs 2024-05-09 17:22:10 +02:00
Samuele Locatelli f273aaaf5a Update conf start HealthCheck serv 2024-05-09 16:41:57 +02:00
Samuele Locatelli a0bbf356a9 Merge tag 'FixTypoHeathSrvName' into develop
Sistemazione nomi servizi health
2024-05-09 13:10:44 +02:00
Samuele Locatelli facd44c6f5 Merge branch 'release/FixTypoHeathSrvName' 2024-05-09 13:10:34 +02:00
Samuele Locatelli e534651bf3 Fix nome servizi healthcheck 2024-05-09 13:10:06 +02:00
Samuele Locatelli 74b08ceefc Merge tag 'FixPdfReviewAndClose01' into develop
Fix auto close + messaggi
2024-04-26 12:08:21 +02:00
Samuele Locatelli e798a764de Merge branch 'release/FixPdfReviewAndClose01' 2024-04-26 12:08:15 +02:00
Samuele Locatelli 30529d0825 Fix chiusura preview PDF + colore pdf preview 2024-04-26 12:07:28 +02:00
Samuele Locatelli 7bebc6e8ea Fix confirm solo ove necessario 2024-04-26 10:00:25 +02:00
Samuele Locatelli 6b82975b9d Fix auto-close on confirm 2024-04-26 09:54:07 +02:00
Samuele Locatelli f5298172e6 Merge tag 'AddHealthCheck04' into develop
Update con aggiunta health x SRV/API
2024-04-24 18:21:52 +02:00
Samuele Locatelli 2a9a1f4882 Merge branch 'release/AddHealthCheck04' 2024-04-24 18:21:42 +02:00
Samuele Locatelli 6f513809de Add API health services 2024-04-24 18:21:13 +02:00
Samuele Locatelli 9ef952de54 Merge tag 'AddHealthCheck03' into develop
Completato check su DB x num rec tabelle
2024-04-23 17:06:33 +02:00
Samuele Locatelli 67b8464c5f Merge branch 'release/AddHealthCheck03' 2024-04-23 17:06:23 +02:00
Samuele Locatelli fbdddc0eee Completato check conteggio record DB 2024-04-23 17:06:09 +02:00
Samuele Locatelli 88b4e8686d Merge tag 'AddHealthCheck02' into develop
Fix ping a DB con instance + fix SqlSelect
2024-04-23 16:13:03 +02:00
Samuele Locatelli cedbd9931e Merge branch 'release/AddHealthCheck02' 2024-04-23 16:12:51 +02:00
Samuele Locatelli 43187d8d29 Update x stato healthy con ping a db con instance 2024-04-23 16:12:35 +02:00
Samuele Locatelli d0f8a94d36 Merge tag 'AddHealthCheck01' into develop
Test aggiunta health check page (base, incompleta)
2024-04-23 15:52:27 +02:00
Samuele Locatelli fd91e8fe19 Merge branch 'release/AddHealthCheck01' 2024-04-23 15:52:05 +02:00
Samuele Locatelli df73a17126 Prima bozza pagina health check x WDC 2024-04-23 15:50:16 +02:00
Samuele Locatelli a38b0aa9cb Update pèer pubblicazione WebAPI su IIS01/02 2024-04-23 11:36:30 +02:00
Samuele Locatelli 316c028c86 Merge tag 'FixDeployIIS01-IIS02' into develop
Update per test deploy IIS01/IIS02
2024-04-23 11:32:13 +02:00
Samuele Locatelli dcb51b7763 Merge branch 'release/FixDeployIIS01-IIS02' 2024-04-23 11:31:24 +02:00
Samuele Locatelli aeb52a3576 Update conf x deploy IIS01 + IIS02 in OVH 2024-04-23 11:29:43 +02:00
Samuele Locatelli 452e316851 Fix update e delete door in display 2024-04-23 11:19:03 +02:00
Samuele Locatelli a45a7390c3 Refresh 2024-04-23 09:24:22 +02:00
Samuele Locatelli c020e5fff3 Aggiunta gestione file statici esterni x PDF (ccon folders!) 2024-04-23 09:23:59 +02:00
Samuele Locatelli 366ed08fb4 Aggiunto componente view PDF viewer con doc calcolato 2024-04-23 09:23:30 +02:00
Samuele Locatelli 9465c859f9 - Aggiunta apertura PDF anche quando approvato
- fix colori pdf in less file
2024-04-23 09:23:02 +02:00
Samuele Locatelli f4b6112a77 aggiunto deploy test su prod WDC 2024-04-23 09:20:53 +02:00
Samuele Locatelli 474f480198 Merge tag 'FixDcaAdminAuth02' into develop
Fix gestione loadDataSmall --> nuovo componente
2024-04-19 09:39:16 +02:00
Samuele Locatelli 931abece6f Merge branch 'release/FixDcaAdminAuth02' 2024-04-19 09:39:01 +02:00
Samuele Locatelli 5b5d04cd5f Fix riferimenti loadData (vecchio) 2024-04-19 09:38:36 +02:00
Samuele Locatelli c202b7d387 Merge tag 'FixDcaAdminAuth' into develop
Fix auth x DcaAdmin in prod
2024-04-19 09:32:57 +02:00
Samuele Locatelli 69179e4af0 Merge branch 'release/FixDcaAdminAuth' 2024-04-19 09:32:48 +02:00
Samuele Locatelli 7b28b543e8 Update permessi DcaAdmin x mostrare componenti UI 2024-04-19 09:32:05 +02:00
Samuele Locatelli 71f1cb1246 Merge tag 'FixSentinelLocalhost' into develop
Fix release sentinel on localhost
2024-03-16 12:15:43 +01:00
Samuele Locatelli 01a50dbfec Merge branch 'release/FixSentinelLocalhost' 2024-03-16 12:15:31 +01:00
Samuele Locatelli bff4251fbe Sentinel on localhost 2024-03-16 12:14:10 +01:00
Samuele Locatelli 7b6443e4d4 fix conf x API su nuovo redis sentinel 2024-03-15 15:37:08 +01:00
Samuele Locatelli ce122ba296 Test conf IIS01 x nuovo cluster redis 2024-03-15 15:29:03 +01:00
Samuele Locatelli 101429cf11 Merge tag 'FixPagination03' into develop
Fix reset numero pagina in cambio numrec 2 displ
2024-03-11 14:32:05 +01:00
Samuele Locatelli 7cad7d00e7 Merge branch 'release/FixPagination03' 2024-03-11 14:31:54 +01:00
Samuele Locatelli ba447558d4 Fix reset numPage 2024-03-11 14:31:40 +01:00
Samuele Locatelli 337a4252f9 Merge tag 'FixPagination02' into develop
Fix favicon
2024-03-11 14:27:18 +01:00
Samuele Locatelli c8098edb97 Merge branch 'release/FixPagination02' 2024-03-11 14:27:13 +01:00
Samuele Locatelli cc9a1a8342 Fix favicon 2024-03-11 14:26:53 +01:00
Samuele Locatelli d860bbbed5 Merge tag 'FixPagination01' into develop
Fix paginazione
2024-03-11 14:16:03 +01:00
Samuele Locatelli a5b134e32b Merge branch 'release/FixPagination01' 2024-03-11 14:15:57 +01:00
Samuele Locatelli da742620b0 Fix paginazione 2024-03-11 14:15:38 +01:00
Samuele Locatelli 7bc955365f Merge tag 'FixRecalcOnMissing03' into develop
Update e fix x ricalcolo
2024-03-11 12:51:32 +01:00
Samuele Locatelli 706a9bce17 Merge branch 'release/FixRecalcOnMissing03' 2024-03-11 12:51:23 +01:00
Samuele Locatelli ab5757d0bd Completo fix x reload e calcolo corretto DDF in caso di sovrapposizione richieste 2024-03-11 12:51:04 +01:00
Samuele Locatelli 2fa5a0df16 Update serializzatore DDF x evitare race conditions 2024-03-11 10:47:39 +01:00
Samuele Locatelli cba8ceb688 Merge tag 'FixRecalcOnMissing02' into develop
Fix ricalcolo immagini (sperabilmente)
2024-03-09 11:55:33 +01:00
Samuele Locatelli 7b007f6ca5 Merge branch 'release/FixRecalcOnMissing02' 2024-03-09 11:55:21 +01:00
Samuele Locatelli a67691278b Update gestione filtraggio x ricalcolo SVG 2024-03-09 11:54:32 +01:00
Samuele Locatelli 7d3e1533fd Merge tag 'FixRecalcOnMissing01' into develop
Fix recalc su missing svg con semaforo
2024-03-09 09:27:31 +01:00
Samuele Locatelli 084973df66 Merge branch 'release/FixRecalcOnMissing01' 2024-03-09 09:27:13 +01:00
Samuele Locatelli 179565d47d fix staging conf 2024-03-09 09:26:38 +01:00
Samuele Locatelli c35eb00002 Semaforo (maybe) x evitare doppio ricalcolo 2024-03-08 19:10:19 +01:00
Samuele Locatelli 16248e2346 update conf x ricalcolo SVG 2024-03-08 19:01:18 +01:00
112 changed files with 2786 additions and 1323 deletions
+18 -11
View File
@@ -99,6 +99,9 @@ WDC.Api:staging:
stage: staging
tags:
- win
environment:
name: staging
url: https://iis01.egalware.com/WDC/SRV/
variables:
APP_NAME: WebDoorCreator.API
SOL_NAME: WebDoorCreator.UI
@@ -120,7 +123,7 @@ WDC.UI:staging:
- win
environment:
name: staging
url: https://iis01.egalware.com/GPW/WDC.UI
url: https://iis01.egalware.com/WDC/UI/
variables:
APP_NAME: WebDoorCreator.UI
SOL_NAME: WebDoorCreator.UI
@@ -133,8 +136,6 @@ WDC.UI:staging:
script:
- 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
## 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 ----------
WDC.Api:deploy:
@@ -143,7 +144,7 @@ WDC.Api:deploy:
- win
environment:
name: production
url: https://seriate.egalware.com/GPW/WDC.UI
url: https://wdc.egalware.com/SRV/
variables:
APP_NAME: WebDoorCreator.API
SOL_NAME: WebDoorCreator.UI
@@ -155,15 +156,18 @@ WDC.Api:deploy:
- dotnet restore "$env:SOL_NAME.sln"
script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
# IIS OVH PROD
- 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
#- 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
# IIS OVH IIS01
- dotnet publish -p:PublishProfile=IIS-OVH-IIS01.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 OVH IIS02
- dotnet publish -p:PublishProfile=IIS-OVH-IIS02.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
WDC.UI:deploy:
stage: deploy
tags:
- win
environment:
name: production
url: https://wdc.egalware.com/UI/
variables:
APP_NAME: WebDoorCreator.UI
SOL_NAME: WebDoorCreator.UI
@@ -175,11 +179,14 @@ WDC.UI:deploy:
- dotnet restore "$env:SOL_NAME.sln"
script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
# IIS OVH PROD
- 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 OVH IIS01
- dotnet publish -p:PublishProfile=IIS-OVH-IIS01.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 OVH IIS02
- dotnet publish -p:PublishProfile=IIS-OVH-IIS02.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
#- 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 ----------
WDC.Api:release:
stage: release
Binary file not shown.
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>WebDoorCreator - Egalware</i>
<h4>Version: 0.9.2403.0411</h4>
<h4>Version: 0.9.2505.1316</h4>
<br /> Release note:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
0.9.2403.0411
0.9.2505.1316
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>0.9.2403.0411</version>
<version>0.9.2505.1316</version>
<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>
<mandatory>false</mandatory>
@@ -71,16 +71,6 @@ namespace WebDoorCreator.API.Controllers
}
}
}
#if false
var mySvg = SvgDocument.FromSvg<SvgDocument>(svgContent);
//result = System.Text.Encoding.UTF8.GetBytes(svgContent);
var myBmp = mySvg.Draw();
using (var stream = new MemoryStream())
{
img.Save(stream, System.Drawing.Imaging.ImageFormat.Png);
result= stream.ToArray();
}
#endif
}
return File(result, "image/png");
}
@@ -196,7 +196,7 @@ namespace WebDoorCreator.API.Controllers
/// </summary>
/// <returns></returns>
[HttpGet("TakeNextItems")]
public async Task<Dictionary<string, string>> TakeProcessingItems(int numItems = 10)
public async Task<Dictionary<string, CalcReqtDTO>> TakeProcessingItems(int numItems = 10)
{
var actQueue = await QDataServ.TakeProcessingItems(numItems);
Log.Debug($"Eseguito TakeProcessingItems per {numItems} items");
+95
View File
@@ -0,0 +1,95 @@
using Microsoft.Extensions.Diagnostics.HealthChecks;
using NLog;
using System.Net.NetworkInformation;
using WebDoorCreator.Data;
namespace WebDoorCreator.API.Health
{
public class Checks
{
#region Public Methods
public static async Task<HealthCheckResult> ConfigCount(IConfiguration _config)
{
string description = "Try check Config table";
var healthCheckData = new Dictionary<string, object>();
using (WDCDataContext localDbCtx = new WDCDataContext(_config))
{
var dbCount = localDbCtx
.DbSetConfig
.Count();
if (dbCount > 0)
{
description = $"Check Config table, found {dbCount} records";
healthCheckData.Add("Count", dbCount);
return HealthCheckResult.Healthy(description, healthCheckData);
}
}
await Task.Delay(1);
return HealthCheckResult.Unhealthy(description + $" NO RECORD found", null, healthCheckData);
}
public static async Task<HealthCheckResult> DoorsCount(IConfiguration _config)
{
string description = "Try check DOOR table";
var healthCheckData = new Dictionary<string, object>();
using (WDCDataContext localDbCtx = new WDCDataContext(_config))
{
var dbCount = localDbCtx
.DbSetDoor
.Count();
if (dbCount > 0)
{
description = $"Check DOOR table, found {dbCount} records";
healthCheckData.Add("Count", dbCount);
return HealthCheckResult.Healthy(description, healthCheckData);
}
}
await Task.Delay(1);
return HealthCheckResult.Unhealthy(description + $" NO RECORD found", null, healthCheckData);
}
public static async Task<HealthCheckResult> OrdersCount(IConfiguration _config)
{
string description = "Try check ORDER table";
var healthCheckData = new Dictionary<string, object>();
using (WDCDataContext localDbCtx = new WDCDataContext(_config))
{
var dbCount = localDbCtx
.DbSetOrders
.Count();
if (dbCount > 0)
{
description = $"Check ORDER table, found {dbCount} records";
healthCheckData.Add("Count", dbCount);
return HealthCheckResult.Healthy(description, healthCheckData);
}
}
await Task.Delay(1);
return HealthCheckResult.Unhealthy(description + $" NO RECORD found", null, healthCheckData);
}
public static async Task<HealthCheckResult> PingCheck(string hostName)
{
var description = $"Ping to {hostName}";
var healthCheckData = new Dictionary<string, object>();
using (var thePing = new Ping())
{
var pingResult = await thePing.SendPingAsync(hostName);
healthCheckData.Add("RoundTripMS", pingResult.RoundtripTime);
healthCheckData.Add("ActualIPAddress", pingResult.Address.ToString());
if (pingResult.Status == IPStatus.Success)
{
description += $" - {pingResult.RoundtripTime}ms";
return HealthCheckResult.Healthy(description, healthCheckData);
}
}
return HealthCheckResult.Unhealthy(description + $" {hostName}", null, healthCheckData);
}
#endregion Public Methods
}
}
+80 -14
View File
@@ -1,5 +1,9 @@
using HealthChecks.UI.Client;
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
using Microsoft.AspNetCore.Identity.UI.Services;
using Microsoft.AspNetCore.Localization;
using Microsoft.CodeAnalysis.FlowAnalysis;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using StackExchange.Redis;
using StackExchange.Redis.Extensions.Core.Configuration;
using StackExchange.Redis.Extensions.Newtonsoft;
@@ -14,6 +18,7 @@ var builder = WebApplication.CreateBuilder(args);
// configuration setup
ConfigurationManager configuration = builder.Configuration;
// Redis
var connStringRedis = configuration.GetConnectionString("Redis");
if (string.IsNullOrEmpty(connStringRedis))
@@ -30,6 +35,67 @@ builder.Services.AddControllers();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
// APP MAIN setup
string connectionString = configuration.GetConnectionString("WDC.DB") ?? "";
string dbServerAddr = "127.0.0.1";
if (string.IsNullOrEmpty(connectionString))
{
connectionString = "Server=SQL2016DEV;Database=WebDoorCreator; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=WebDoorCreator.SRV;";
}
else
{
if (connectionString.Contains("Server"))
{
bool trovato = false;
var dbTokens = connectionString.Split(";");
int numTok = dbTokens.Count();
int idx = 0;
while (!trovato && idx < numTok)
{
if (dbTokens[idx].StartsWith("Server="))
{
// rimuovo la chaive Server...
dbServerAddr = dbTokens[idx].Replace("Server=", "");
// se ci fosse un nome (tipo \\sqlexpress) rimuovo...
if (dbServerAddr.Contains("\\"))
{
int sIdx = dbServerAddr.IndexOf("\\");
dbServerAddr = dbServerAddr.Substring(0, sIdx);
}
trovato = true;
}
idx++;
}
}
}
// healthchecks
builder.Services.AddHealthChecks()
.AddSqlServer(connectionString, healthQuery: "SELECT 1;", name: "SqlServer", failureStatus: HealthStatus.Degraded, tags: new string[] { "DB", "MsSql" })
.AddAsyncCheck($"DB PING ({dbServerAddr})", () => WebDoorCreator.API.Health.Checks.PingCheck(dbServerAddr))
.AddAsyncCheck($"Redis PING ({redisSrvAddr})", () => WebDoorCreator.API.Health.Checks.PingCheck(redisSrvAddr))
// 512 MB max allocated memory
.AddProcessAllocatedMemoryHealthCheck(512, "Max Process memory (<512MB)", failureStatus: HealthStatus.Degraded)
.AddRedis(connStringRedis, "Redis", failureStatus: HealthStatus.Degraded)
.AddAsyncCheck($"Config Table", () => WebDoorCreator.API.Health.Checks.ConfigCount(configuration))
.AddAsyncCheck($"Orders Table", () => WebDoorCreator.API.Health.Checks.OrdersCount(configuration))
.AddAsyncCheck($"Doors Table", () => WebDoorCreator.API.Health.Checks.DoorsCount(configuration))
;
#if false
builder.Services
.AddHealthChecksUI(s =>
{
s.AddHealthCheckEndpoint("WDC_API_HC", "health");
s.SetEvaluationTimeInSeconds(60);
s.SetMinimumSecondsBetweenFailureNotifications(120);
s.SetApiMaxActiveRequests(5);
s.SetHeaderText("WDC.API Health Check Status");
})
.AddInMemoryStorage();
#endif
// abilitazione x email management con MailKit
//builder.Services.AddTransient<IEmailSender, MailKitEmailSender>();
builder.Services.AddSingleton<IEmailSender, MailKitEmailSender>();
@@ -74,24 +140,24 @@ if (app.Environment.IsDevelopment() || app.Environment.IsStaging())
app.UseSwaggerUI();
}
//// cultura IT...
//var supportedCultures = new[]{
// new CultureInfo("it-IT")
// };
//app.UseRequestLocalization(new RequestLocalizationOptions
//{
// DefaultRequestCulture = new RequestCulture("it-IT"),
// SupportedCultures = supportedCultures,
// FallBackToParentCultures = false
//});
//CultureInfo.DefaultThreadCurrentCulture = CultureInfo.CreateSpecificCulture("it-IT");
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
// config healthcheck: https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/health-checks
// prende tutti i predicati
app.MapHealthChecks("/health", new HealthCheckOptions
{
Predicate = _ => true,
ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse
});
// nasconde tutti i dettagli
app.MapHealthChecks("/health/live", new HealthCheckOptions
{
Predicate = _ => false
});
app.Run();
@@ -8,7 +8,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish>https://wdc.egalware.com/SRV/swagger/index.html</SiteUrlToLaunchAfterPublish>
<SiteUrlToLaunchAfterPublish>https://wdc.egalware.com/UI/swagger/index.html</SiteUrlToLaunchAfterPublish>
<ExcludeApp_Data>false</ExcludeApp_Data>
<ProjectGuid>c2109e71-4eae-4167-9052-175123ccc2bc</ProjectGuid>
<SelfContained>false</SelfContained>
@@ -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-04-19T17:27:31.3742108Z;False|2024-04-19T16:51:43.3272308+02:00;False|2024-04-19T16:41:46.2086401+02:00;False|2024-04-19T16:41:31.3019711+02:00;False|2024-04-19T16:08:22.4275238+02:00;False|2024-04-19T16:05:18.6039531+02:00;False|2024-04-19T15:59:02.0838144+02:00;True|2024-02-15T19:34:35.8362293+01:00;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>
@@ -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/swagger/index.html</SiteUrlToLaunchAfterPublish>
<ExcludeApp_Data>false</ExcludeApp_Data>
<ProjectGuid>c2109e71-4eae-4167-9052-175123ccc2bc</ProjectGuid>
<SelfContained>false</SelfContained>
<MSDeployServiceURL>https://wdc-w-iis-02.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-04-19T17:27:31.3742108Z;False|2024-04-19T16:51:43.3272308+02:00;False|2024-04-19T16:41:46.2086401+02:00;False|2024-04-19T16:41:31.3019711+02:00;False|2024-04-19T16:08:22.4275238+02:00;False|2024-04-19T16:05:18.6039531+02:00;False|2024-04-19T15:59:02.0838144+02:00;True|2024-02-15T19:34:35.8362293+01:00;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>
@@ -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/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>Default Web Site/WDC/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+sBAAAANAh+Q4GwYESjv9I3Vz/gKgAAAAACAAAAAAADZgAAwAAAABAAAAAZCj4Je1goQrORLePgnlVVAAAAAASAAACgAAAAEAAAAGZfY+EFaA+HwqpXWVf0/JgYAAAAz5wRfMtrjB7GbijGZUlW6g9q8ulJwQecFAAAADgQDtnMlYLrSQDGZI7Dg2OKfUhu</EncryptedPassword>
<History>True|2024-04-19T17:25:01.4640398Z;False|2024-04-19T19:21:34.3241722+02:00;False|2024-04-19T19:15:31.0848527+02:00;False|2024-04-19T19:11:09.2511710+02:00;False|2024-04-19T19:09:49.4254115+02:00;False|2024-04-19T19:08:44.7222054+02:00;False|2024-04-19T19:01:26.7064709+02:00;False|2024-04-19T18:59:58.4177224+02:00;False|2024-04-19T18:59:10.9459272+02:00;False|2024-04-19T16:51:43.3272308+02:00;False|2024-04-19T16:41:46.2086401+02:00;False|2024-04-19T16:41:31.3019711+02:00;False|2024-04-19T16:08:22.4275238+02:00;False|2024-04-19T16:05:18.6039531+02:00;False|2024-04-19T15:59:02.0838144+02:00;True|2024-02-15T19:34:35.8362293+01:00;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>
@@ -1,13 +0,0 @@
<?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>
+17 -3
View File
@@ -8,7 +8,9 @@
</PropertyGroup>
<ItemGroup>
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS-OVH-PROD.pubxml" />
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS-OVH-IIS01.pubxml" />
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS-OVH-IIS02.pubxml" />
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS-OVH-PROD-test.pubxml" />
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS-PROD.pubxml" />
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS01.pubxml" />
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS02.pubxml" />
@@ -16,14 +18,26 @@
</ItemGroup>
<ItemGroup>
<None Include="Properties\PublishProfiles\IIS-OVH-PROD.pubxml.user" />
<None Include="Properties\PublishProfiles\IIS-OVH-IIS02.pubxml.user" />
<None Include="Properties\PublishProfiles\IIS-OVH-PROD-test.pubxml.user" />
<None Include="Properties\PublishProfiles\IIS-OVH-IIS01.pubxml.user" />
<None Include="Properties\PublishProfiles\IIS-PROD.pubxml.user" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="AspNetCore.HealthChecks.Redis" Version="6.0.4" />
<PackageReference Include="AspNetCore.HealthChecks.SqlServer" Version="6.0.2" />
<PackageReference Include="AspNetCore.HealthChecks.System" Version="6.0.5" />
<PackageReference Include="AspNetCore.HealthChecks.UI" Version="6.0.5" />
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="6.0.5" />
<PackageReference Include="AspNetCore.HealthChecks.UI.Core" Version="6.0.5" />
<PackageReference Include="AspNetCore.HealthChecks.UI.InMemory.Storage" Version="6.0.5" />
<PackageReference Include="AspNetCore.HealthChecks.Uris" Version="6.0.3" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="6.0.29" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions" Version="6.0.29" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NLog" Version="5.2.2" />
<PackageReference Include="SkiaSharp" Version="2.88.3" />
<PackageReference Include="SkiaSharp" Version="2.88.8" />
<PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="2.88.3" />
<PackageReference Include="StackExchange.Redis" Version="2.6.122" />
<PackageReference Include="StackExchange.Redis.Extensions.AspNetCore" Version="9.1.0" />
+2 -2
View File
@@ -7,8 +7,8 @@
},
"AllowedHosts": "*",
"ConnectionStrings": {
"Redis": "nkcredis.steamware.net:6379, DefaultDatabase=11, connectTimeout=5000, syncTimeout=5000, asyncTimeout=5000, abortConnect=false, ssl=false, password=BtN9Py1wtLfLRvmzWnOPJ7RytDM+CLiVsJ/16zduNTlV8IOPGNrtzJSXPUnImA5PqmUMhKaUqo9NdHIG",
"WDC.DB": "Server=SQL2016DEV;Database=WebDoorCreator; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=WebDoorCreator.UI;"
"Redis": "redis.ufficio:26379,serviceName=devel, DefaultDatabase=11, connectTimeout=5000, syncTimeout=5000, asyncTimeout=5000, abortConnect=false, ssl=false",
"WDC.DB": "Server=SQL2016DEV;Database=WebDoorCreator; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=WebDoorCreator.SRV;"
},
"ExternalProviders": {
"MailKit": {
+1
View File
@@ -19,6 +19,7 @@ Public Module ConstIni
' File con dati di licenza
Public Const LIC_FILE_NAME As String = "WebDoorCreator.CamSrv.lic"
Public Const S_LICENCE As String = "Licence"
Public Const K_LOCKID As String = "LockId"
Public Const K_KEY As String = "Key"
' File di log generale
+49 -24
View File
@@ -921,10 +921,23 @@ Public Class ProcMan
End If
End If
If m_bCheckOrder Then
Dim LastRequest As Dictionary(Of String, String) = currWDC.queueList(1)
Dim LastRequest As Dictionary(Of String, CalcReqtDTO) = currWDC.queueList(1)
If LastRequest.Count > 0 Then
MyThreadData.SetThreadOperation(ThreadOperations.FoundRequest)
MyThreadData.SetCurrRequest(LastRequest.First())
' ToDo !!!
' gestione cablata x soli svg...
' da qui implementazione svg/3dm...
If LastRequest.First().Value.MimeType = "3dm" Then
End If
Dim ConvItem As KeyValuePair(Of String, String)
ConvItem = New KeyValuePair(Of String, String)(LastRequest.First().Key, LastRequest.First().Value.DDF)
MyThreadData.SetCurrRequest(ConvItem)
' vecchia versione
'MyThreadData.SetCurrRequest(LastRequest.First())
Dim Item As KeyValuePair(Of String, String) = MyThreadData.CurrRequest
Dim bOk As Boolean = Not IsNothing(Item)
If bOk Then
@@ -937,7 +950,10 @@ Public Class ProcMan
' elimino vecchi
If Not IsNothing(fileList) Then
For Each sFile In fileList
File.Delete(sFile)
Try
File.Delete(sFile)
Catch ex As Exception
End Try
Next
End If
@@ -981,12 +997,16 @@ Public Class ProcMan
MyThreadData.SetThreadOperation(ThreadOperations.ReadingSvg)
' verifico esistenza file svg e lo carico
bOk = GetFileContent(Path.ChangeExtension(sDdfPath, "svg"), fContent)
' !!! ToDo: inserire TIPO di richiesta secondo quanto ricevuto....
' invio risposta
currRes.Validated = MyThreadData.nProcResult = 0 AndAlso bOk
currRes.DoorIdVers = Item.Key
' per ora cablato a svg, prendere da MimeType richiesta...
currRes.MimeType = "svg"
' se NON fosse validato --> messo il messaggio...
If (currRes.Validated) Then
currRes.SvgGen = fContent
currRes.RawContent = fContent
Else
bOk = GetFileContent(Path.ChangeExtension(sDdfPath, "txt"), fContent)
currRes.ErrorMsg = fContent
@@ -1297,22 +1317,27 @@ Public Class ProcMan
Private Sub ProcMan_Load(sender As Object, e As EventArgs) Handles MyBase.Load
m_IniFilePath = AppDomain.CurrentDomain.BaseDirectory & INI_FILE_NAME
ManageInstance()
' Imposto tipo di chiave
EgtSetLockType(KEY_TYPE.HW)
' Leggo e imposto chiave di protezione
Dim sLicFileName As String = String.Empty
GetPrivateProfileString(S_GENERAL, K_LICENCE, LIC_FILE_NAME, sLicFileName, m_IniFilePath)
Dim sLicFile As String = AppDomain.CurrentDomain.BaseDirectory & sLicFileName
Dim sKey As String = String.Empty
EgtUILib.GetPrivateProfileString(S_LICENCE, K_KEY, "", sKey, sLicFile)
EgtSetKey(sKey)
Dim bNetHwKey As Boolean = (GetPrivateProfileInt(S_GENERAL, K_NETKEY, 0, m_IniFilePath) = 1)
EgtSetNetHwKey(bNetHwKey)
' 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)
'' Imposto tipo di chiave
'EgtSetLockType(KEY_TYPE.HW)
'' Leggo e imposto chiave di protezione
'Dim sLicFileName As String = String.Empty
'GetPrivateProfileString(S_GENERAL, K_LICENCE, LIC_FILE_NAME, sLicFileName, m_IniFilePath)
'Dim sLicFile As String = AppDomain.CurrentDomain.BaseDirectory & sLicFileName
'Dim sKey As String = String.Empty
'EgtUILib.GetPrivateProfileString(S_LICENCE, K_KEY, "", sKey, sLicFile)
'EgtSetKey(sKey)
'Dim bNetHwKey As Boolean = (GetPrivateProfileInt(S_GENERAL, K_NETKEY, 0, m_IniFilePath) = 1)
'EgtSetNetHwKey(bNetHwKey)
'Dim sLockId As String = ""
'EgtUILib.GetPrivateProfileString(S_LICENCE, K_LOCKID, "", sLockId, sLicFile)
'If Not String.IsNullOrEmpty(sLockId) Then
' Dim x = EgtSetLockId(sLockId)
'End If
'' 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
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 &
@@ -1322,10 +1347,10 @@ Public Class ProcMan
(ChrW(97 - 1 + My.Application.Info.Version.Build)).ToString() &
My.Application.Info.Version.Revision.ToString()
EgtInit(0, m_sLogFile, sLogMsg)
If Not bKey Then
MessageBox.Show("No licences available!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End
End If
'If Not bKey Then
' MessageBox.Show("No licences available!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
' End
'End If
' leggo sorgente richieste rest da ini
GetPrivateProfileString(S_GENERAL, K_BASEIP, "", baseIp, m_IniFilePath)
+2
View File
@@ -24,8 +24,10 @@ namespace WebDoorCreator.Core
public static readonly string CALC_REQ_ERRS = $"{BASE_HASH}:CalcRequests:Errors";
public static readonly string CALC_REQ_PEND = $"{BASE_HASH}:CalcRequests:Pending";
public static readonly string CALC_REQ_PROC = $"{BASE_HASH}:CalcRequests:Processing";
public static readonly string CALC_REQ_TYPE = $"{BASE_HASH}:CalcRequests:Type";
public static readonly string CALC_REQ_DDF_CACHE = $"{BASE_HASH}:CalcRequests:CacheDDF";
public static readonly string CALC_REQ_SVG_CACHE = $"{BASE_HASH}:CalcRequests:CacheSVG";
public static readonly string CALC_REQ_VETO_REC = $"{BASE_HASH}:CalcRequests:VetoRecalc";
public static readonly string DOOR_TPL_LIST = $"{BASE_HASH}:Template:DoorList";
// REDIS KEY dati x registrazione statistiche esecuzione
@@ -158,7 +158,6 @@ namespace WebDoorCreator.Data.Controllers
public void Dispose()
{
// Clear database context
//Log.Info("Dispose di GWMSController");
}
/// <summary>
@@ -930,6 +929,11 @@ namespace WebDoorCreator.Data.Controllers
.Database
.ExecuteSqlRaw("exec dbo.stp_ListVal_Import");
// stored x pulizia folder rimaste in giro
storedRes = localDbCtx
.Database
.ExecuteSqlRaw("exec dbo.stp_ListVal_FixDix");
fatto = true;
}
catch (Exception exc)
+6 -6
View File
@@ -37,7 +37,7 @@ namespace WebDoorCreator.Data.DDF
{
string outDdf = "";
try
{
{
DoorOpsDTO CurrentDoorOp = new DoorOpsDTO();
EdgesDto CurrentEdges = new EdgesDto();
SizeDto CurrentSize = new SizeDto();
@@ -46,10 +46,13 @@ namespace WebDoorCreator.Data.DDF
FinishingDto CurrentFinishing = new FinishingDto();
DDFDto CurrentConf = new DDFDto();
ListValuesModel CurrentCompoOrder = new ListValuesModel();
Dictionary<string, List<Dictionary<string, string>>> dictDoorOP = new Dictionary<string, List<Dictionary<string, string>>>();
Dictionary<string, Dictionary<string, string>> dictBaseDoorOp = new Dictionary<string, Dictionary<string, string>>();
Dictionary<string, Dictionary<string, string>> dictBaseSwing = new Dictionary<string, Dictionary<string, string>>();
// per prima cosa popolo gli oggetti di appoggio...
dictDoorOP = new Dictionary<string, List<Dictionary<string, string>>>();
var i = 0;
foreach (var item in listOp.Where(x=>x.ObjectId != "Size" && x.ObjectId != "Profiles" && x.ObjectId != "Swing" && x.ObjectId != "Properties" && x.ObjectId != "Finishing"))
foreach (var item in listOp.Where(x => x.ObjectId != "Size" && x.ObjectId != "Profiles" && x.ObjectId != "Swing" && x.ObjectId != "Properties" && x.ObjectId != "Finishing"))
{
var deserialized = JsonConvert.DeserializeObject<Dictionary<string, string>>(item.JsoncActVal!);
if (deserialized != null)
@@ -122,7 +125,7 @@ namespace WebDoorCreator.Data.DDF
}
i++;
}
CurrentSize.size = dictBaseDoorOp;
CurrentSize.size = dictBaseDoorOp;
string sizeSer = CurrentSize.GetSerialized(RemDoorOp);
//dictBaseDoorOp.Clear();
foreach (var item in listOp.Where(x => x.ObjectId == "Swing"))
@@ -148,9 +151,6 @@ namespace WebDoorCreator.Data.DDF
#region Protected Properties
protected Dictionary<string, List<Dictionary<string, string>>> dictDoorOP { get; set; } = new Dictionary<string, List<Dictionary<string, string>>>();
protected Dictionary<string, Dictionary<string, string>> dictBaseDoorOp { get; set; } = new Dictionary<string, Dictionary<string, string>>();
protected Dictionary<string, Dictionary<string, string>> dictBaseSwing { get; set; } = new Dictionary<string, Dictionary<string, string>>();
protected List<string> FootRows { get; set; } = new List<string>();
protected string FormatVers { get; set; } = "0";
protected List<string> HeadRows { get; set; } = new List<string>();
+23
View File
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WebDoorCreator.Data.DTO
{
/// <summary>
/// Oggetto contenitore richiesta calcolo
/// </summary>
public class CalcReqtDTO
{
/// <summary>
/// DDF file content (origin)
/// </summary>
public string DDF { get; set; } = "";
/// <summary>
/// MimeType (out) requested: svg / 3dm...
/// </summary>
public string MimeType { get; set; } = "";
}
}
+6 -2
View File
@@ -24,9 +24,13 @@ namespace WebDoorCreator.Data.DTO
/// </summary>
public string ErrorMsg { get; set; } = "";
/// <summary>
/// SVG generated
/// Object RAW generated output ( was SvgGen )
/// </summary>
public string SvgGen { get; set; } = "";
public string RawContent { get; set; } = "";
/// <summary>
/// MimeType: svg / 3dm...
/// </summary>
public string MimeType { get; set; } = "";
/// <summary>
/// Artifats path (ex 3d zip/pack)
/// </summary>
-1
View File
@@ -35,7 +35,6 @@ namespace WebDoorCreator.Data.DTO
}
if (item.Contains("Separator"))
{
//sb.Remove(item);
sb.AppendLine(" ");
}
}
+5 -6
View File
@@ -28,6 +28,11 @@ namespace WebDoorCreator.Data
#region Public Methods
/// <summary>
/// Invio messaggio sul canale + salvataggio in cache REDIS
/// </summary>
/// <param name="memKey">Chiave REDIS x salvare valore</param>
/// <param name="message"></param>
public bool saveAndSendMessage(string memKey, string message)
{
bool answ = false;
@@ -119,12 +124,6 @@ namespace WebDoorCreator.Data
}
#endregion Private Methods
/// <summary>
/// Invio messaggio sul canale + salvataggio in cache REDIS
/// </summary>
/// <param name="memKey">Chiave REDIS x salvare valore</param>
/// <param name="message"></param>
}
public class PubSubEventArgs : EventArgs
+154 -49
View File
@@ -188,21 +188,6 @@ namespace WebDoorCreator.Data.Services
answ = $"{rawData}";
}
}
#if false
// se non trovata --> missing!
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...
string missingFilePath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/images", "MissingOrange.svg");
if (File.Exists(missingFilePath))
{
answ = File.ReadAllText(missingFilePath);
}
}
#endif
return answ;
}
@@ -214,7 +199,7 @@ namespace WebDoorCreator.Data.Services
public string DoorGetMissingSvg()
{
string answ = missingSvgContent;
if(string.IsNullOrEmpty(answ))
if (string.IsNullOrEmpty(answ))
{
// fix dati img missing...
missingFilePath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/images", "MissingOrange.svg");
@@ -223,10 +208,41 @@ namespace WebDoorCreator.Data.Services
missingSvgContent = File.ReadAllText(missingFilePath);
answ = missingSvgContent;
}
}
}
return answ;
}
/// <summary>
/// Cerca nei VetoProc se ci sia x porta corrente
/// </summary>
/// <param name="DoorId"></param>
/// <returns></returns>
public async Task<string> DoorProcVetoGetAsync(int DoorId)
{
string answ = "";
// recupero da REDIS
var currVetoKey = new RedisKey($"{Constants.CALC_REQ_VETO_REC}:{DoorId}");
var rawData = await redisDb.StringGetAsync(currVetoKey);
if (rawData.HasValue)
{
answ = $"{rawData}";
}
return answ;
}
/// <summary>
/// imposta un VetoProc x porta corrente x 1 sec
/// </summary>
/// <param name="DoorId">ID porta da vietare x ricalcolo</param>
/// <param name="msVeto">Durata veto in ms</param>
/// <returns></returns>
public async Task DoorProcVetoSetAsync(int DoorId, int msVeto)
{
// recupero da REDIS
var currVetoKey = new RedisKey($"{Constants.CALC_REQ_VETO_REC}:{DoorId}");
var rawData = await redisDb.StringSetAsync(currVetoKey, $"{DoorId}", TimeSpan.FromMilliseconds(msVeto));
}
/// <summary>
/// Remove for single hash record
/// </summary>
@@ -340,7 +356,6 @@ namespace WebDoorCreator.Data.Services
public async Task<long> NumRequestDone()
{
long numReq = 0;
string source = "REDIS";
Dictionary<string, string> dictResult = new Dictionary<string, string>();
// cerco da cache
RedisKey currKey = new RedisKey(Constants.CALC_REQ_DONE);
@@ -365,7 +380,6 @@ namespace WebDoorCreator.Data.Services
public async Task<long> NumRequestErrors()
{
long numReq = 0;
string source = "REDIS";
Dictionary<string, string> dictResult = new Dictionary<string, string>();
// cerco da cache
RedisKey currKey = new RedisKey(Constants.CALC_REQ_ERRS);
@@ -390,7 +404,6 @@ namespace WebDoorCreator.Data.Services
public async Task<long> NumRequestPending()
{
long numReq = 0;
string source = "REDIS";
Dictionary<string, string> dictResult = new Dictionary<string, string>();
// cerco da cache
RedisKey currKey = new RedisKey(Constants.CALC_REQ_PEND);
@@ -415,7 +428,6 @@ namespace WebDoorCreator.Data.Services
public async Task<long> NumRequestProcessing()
{
long numReq = 0;
string source = "REDIS";
Dictionary<string, string> dictResult = new Dictionary<string, string>();
// cerco da cache
RedisKey currKey = new RedisKey(Constants.CALC_REQ_PROC);
@@ -551,7 +563,7 @@ namespace WebDoorCreator.Data.Services
}
/// <summary>
/// Restitusice gli errori della porta in oggetto
/// Rimuove info della porta in oggetto
/// </summary>
/// <param name="doorIdVers">formato DoorId:Versione</param>
/// <returns></returns>
@@ -560,6 +572,7 @@ namespace WebDoorCreator.Data.Services
await DoorRefreshRemove($"{doorId}");
await RequestDoneRemove($"{doorId}");
await RequestErrRemove($"{doorId}");
await RequestTypeRemove($"{doorId}");
await RequestPendingRemove($"{doorId}");
await RequestProcessingRemove($"{doorId}");
@@ -755,7 +768,7 @@ namespace WebDoorCreator.Data.Services
}
/// <summary>
/// Upsert for single hash record
/// Upsert for single hash record of req pending
/// </summary>
/// <returns>Dictionary of DoorId, saveVersNumb</returns>
public async Task<long> RequestPendingUpsert(string doorId, string vers)
@@ -823,6 +836,73 @@ namespace WebDoorCreator.Data.Services
return numReq;
}
/// <summary>
/// Get list of request type
/// </summary>
/// <returns>Dictionary of DoorId, saveVersNumb</returns>
public async Task<Dictionary<string, string>> RequestType()
{
long numReq = 0;
Dictionary<string, string> dictResult = new Dictionary<string, string>();
// cerco da cache
RedisKey currKey = new RedisKey(Constants.CALC_REQ_TYPE);
Stopwatch sw = new Stopwatch();
if (logTimingEnable)
{
sw.Start();
}
numReq = redisDb.HashLength(currKey);
if (numReq > 0)
{
var rawData = await redisDb.HashGetAllAsync(currKey);
foreach (var item in rawData)
{
dictResult.Add($"{item.Name}", $"{item.Value}");
}
}
if (logTimingEnable)
{
sw.Stop();
// gestione statistiche
await ProcStatLog("RequestType", sw.Elapsed, 1, 10);
}
return dictResult;
}
/// <summary>
/// Remove for single hash record from TYPE hash table
/// </summary>
/// <returns>Dictionary of DoorId, saveVersNumb</returns>
public async Task<bool> RequestTypeRemove(string doorId)
{
RedisKey currKey = new RedisKey(Constants.CALC_REQ_TYPE);
bool fatto = await RedHashRemove(currKey, doorId);
return fatto;
}
/// <summary>
/// Upsert for single hash record of TYPE
/// </summary>
/// <returns>Dictionary of DoorId, Type proc requested</returns>
public async Task<bool> RequestTypeUpsert(string doorId, string type)
{
RedisKey currKey = new RedisKey(Constants.CALC_REQ_TYPE);
long numReq = 0;
bool answ = false;
if (!string.IsNullOrEmpty(type))
{
numReq = await RedHashUpsert(currKey, doorId, type);
answ = numReq > 0;
}
// se vuoto --> rimuovo!
else
{
await RedHashRemove(currKey, doorId);
answ = true;
}
return answ;
}
/// <summary>
/// Reset to queue request all processing/processed data
/// </summary>
@@ -862,6 +942,14 @@ namespace WebDoorCreator.Data.Services
await RequestDoneRemove(item.Name!);
fatto = true;
}
// svuoto in blocco hashatble tipo richieste...
currKey = new RedisKey(Constants.CALC_REQ_TYPE);
rawData = await redisDb.HashGetAllAsync(currKey);
foreach (var item in rawData)
{
await RequestTypeRemove(item.Name!);
fatto = true;
}
if (logTimingEnable)
{
sw.Stop();
@@ -890,11 +978,11 @@ namespace WebDoorCreator.Data.Services
foreach (var item in rawData)
{
// se è nell'elenco...
if (DoorIdList.Contains(item.Name.ToString()))
if (DoorIdList.Contains($"{item.Name}"))
{
await RequestPendingUpsert(item.Name!, item.Value!);
await RequestProcessingRemove(item.Name!);
listDone.Add(item.Name.ToString());
listDone.Add($"{item.Name}");
}
}
// cerco le richieste con errori
@@ -903,11 +991,11 @@ namespace WebDoorCreator.Data.Services
foreach (var item in rawData)
{
// se è nell'elenco...
if (DoorIdList.Contains(item.Name.ToString()))
if (DoorIdList.Contains($"{item.Name}"))
{
await RequestPendingUpsert(item.Name!, item.Value!);
await RequestErrRemove(item.Name!);
listDone.Add(item.Name.ToString());
listDone.Add($"{item.Name}");
}
}
// cerco le richieste processed
@@ -916,20 +1004,25 @@ namespace WebDoorCreator.Data.Services
foreach (var item in rawData)
{
// se è nell'elenco...
if (DoorIdList.Contains(item.Name.ToString()))
if (DoorIdList.Contains($"{item.Name}"))
{
await RequestPendingUpsert(item.Name!, item.Value!);
await RequestDoneRemove(item.Name!);
listDone.Add(item.Name.ToString());
listDone.Add($"{item.Name}");
}
}
#if false
// calcolo eventuali porte NON ancora richieste...
foreach (var item in listDone)
// svuoto hashatble tipo richieste...
currKey = new RedisKey(Constants.CALC_REQ_TYPE);
rawData = await redisDb.HashGetAllAsync(currKey);
foreach (var item in rawData)
{
DoorIdList.Remove(item);
// se è nell'elenco...
if (DoorIdList.Contains($"{item.Name}"))
{
await RequestTypeRemove(item.Name!);
listDone.Add($"{item.Name}");
}
}
#endif
if (logTimingEnable)
{
sw.Stop();
@@ -1005,12 +1098,12 @@ namespace WebDoorCreator.Data.Services
// se template --> no scadenza
if (doorIsTpl)
{
await redisDb.StringSetAsync(currSvgKey, calcTask.SvgGen);
await redisDb.StringSetAsync(currSvgKey, calcTask.RawContent);
}
else
{
// 2024.02.15 salvo in cache x 2 settimane, fare 1+ mesi?!?
await redisDb.StringSetAsync(currSvgKey, calcTask.SvgGen, DblWeekLongCache);
await redisDb.StringSetAsync(currSvgKey, calcTask.RawContent, DblWeekLongCache);
}
// elimino dalle code proc/err
await RequestProcessingRemove(sDoorId);
@@ -1053,8 +1146,9 @@ namespace WebDoorCreator.Data.Services
/// </summary>
/// <param name="DoorId"></param>
/// <param name="FullDDF">Contenuto completo del DDF</param>
/// <param name="MimeType">Tipo di file richeisto in OUT: svg / 3dm...</param>
/// <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, string? MimeType = "")
{
Stopwatch sw = new Stopwatch();
if (logTimingEnable)
@@ -1064,6 +1158,9 @@ namespace WebDoorCreator.Data.Services
string sDoorId = $"{DoorId}";
int currVers = await DoorCalcRev(sDoorId);
string sCurrVers = $"{currVers}";
// salvo il mimeType (se nullo è "svg")
string mimeType = MimeType ?? "";
await RequestTypeUpsert(sDoorId, mimeType);
// elimino da code errori (SE fosse presente)
await RequestErrRemove(sDoorId);
@@ -1159,11 +1256,11 @@ namespace WebDoorCreator.Data.Services
/// Get Queue request pending, removing from queue and putting on processing queue
/// </summary>
/// <returns>Dictionary of DoorId, saveVersNumb</returns>
public async Task<Dictionary<string, string>> TakeProcessingItems(int numItems)
public async Task<Dictionary<string, CalcReqtDTO>> TakeProcessingItems(int numItems)
{
int maxTake = Math.Min(10, numItems);
long numReq = 0;
Dictionary<string, string> dictResult = new Dictionary<string, string>();
Dictionary<string, CalcReqtDTO> dictResult = new Dictionary<string, CalcReqtDTO>();
// cerco da cache
RedisKey currKey = new RedisKey(Constants.CALC_REQ_PEND);
Stopwatch sw = new Stopwatch();
@@ -1193,7 +1290,17 @@ namespace WebDoorCreator.Data.Services
// recupero il DDF...
RedisKey currDdfKey = new RedisKey($"{Constants.CALC_REQ_DDF_CACHE}:{item.Name}:{item.Value}");
var rawDDF = await redisDb.StringGetAsync(currDdfKey);
dictResult.Add($"{item.Name}.{item.Value}", $"{rawDDF}");
// verifico il tpo richiesta, se non trovassi prendo "svg" default...
var curTypeKey = new RedisKey(Constants.CALC_REQ_TYPE);
var rawType = await RedHashGetString(curTypeKey, item.Name!, true);
string mimeType = string.IsNullOrEmpty(rawType) ? "svg" : $"{rawType}";
// preparo DTO
CalcReqtDTO currReq = new CalcReqtDTO()
{
MimeType = mimeType,
DDF = $"{rawDDF}"
};
dictResult.Add($"{item.Name}.{item.Value}", currReq);
if (maxTake <= 0)
{
break;
@@ -1256,7 +1363,7 @@ namespace WebDoorCreator.Data.Services
* se non trova riparte da 1
*
----------------------------------*/
int currVers = 1;
int currVers = 0;
string sCurrVers = "";
// per prima cosa controllo se ho GIA' in coda qualcosa come richieste
if (await NumRequestPending() > 0)
@@ -1267,13 +1374,11 @@ namespace WebDoorCreator.Data.Services
if (currPending.ContainsKey(sDoorId))
{
sCurrVers = currPending[sDoorId];
int.TryParse(sCurrVers, out currVers);
currVers++;
}
}
}
// cerco coda errori
if (await NumRequestErrors() > 0)
if (string.IsNullOrEmpty(sCurrVers) && await NumRequestErrors() > 0)
{
var currErrors = await RequestErr();
if (currErrors != null)
@@ -1281,13 +1386,11 @@ namespace WebDoorCreator.Data.Services
if (currErrors.ContainsKey(sDoorId))
{
sCurrVers = currErrors[sDoorId];
int.TryParse(sCurrVers, out currVers);
currVers++;
}
}
}
// cerco coda task completati
if (await NumRequestDone() > 0)
if (string.IsNullOrEmpty(sCurrVers) && await NumRequestDone() > 0)
{
var currDone = await RequestDone();
if (currDone != null)
@@ -1295,11 +1398,12 @@ namespace WebDoorCreator.Data.Services
if (currDone.ContainsKey(sDoorId))
{
sCurrVers = currDone[sDoorId];
int.TryParse(sCurrVers, out currVers);
currVers++;
}
}
}
// calcolo ed incremento
int.TryParse(sCurrVers, out currVers);
currVers++;
// inserisco in coda x calcoli
await RequestPendingUpsert(sDoorId, $"{currVers}");
// metto in coda "last calc" la porta corrente x pulizia successiva
@@ -1404,6 +1508,7 @@ namespace WebDoorCreator.Data.Services
/// Path dell'immagine "missing"
/// </summary>
private string missingFilePath = "";
/// <summary>
/// Contenuto SVG dell'immagine missing
/// </summary>
File diff suppressed because it is too large Load Diff
@@ -13,7 +13,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="EgwCoreLib.Utils" Version="1.4.2307.3111" />
<PackageReference Include="EgwCoreLib.Utils" Version="1.5.2402.2411" />
<PackageReference Include="MailKit" Version="3.5.0" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="6.0.27" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.27" />
+22
View File
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WebDoorCreator.SDK
{
/// Oggetto contenitore richiesta calcolo
/// </summary>
public class CalcReqtDTO
{
/// <summary>
/// DDF file content (origin)
/// </summary>
public string DDF { get; set; } = "";
/// <summary>
/// MimeType (out) requested: svg / 3dm...
/// </summary>
public string MimeType { get; set; } = "";
}
}
+6 -2
View File
@@ -24,9 +24,13 @@ namespace WebDoorCreator.SDK
/// </summary>
public string ErrorMsg { get; set; } = "";
/// <summary>
/// SVG generated
/// Object RAW generated output ( was SvgGen )
/// </summary>
public string SvgGen { get; set; } = "";
public string RawContent { get; set; } = "";
/// <summary>
/// MimeType: svg / 3dm...
/// </summary>
public string MimeType { get; set; } = "";
/// <summary>
/// Articat path (ex 3d zip/pack)
/// </summary>
+3 -3
View File
@@ -125,9 +125,9 @@ namespace WebDoorCreator.SDK
/// <summary>
/// Elenco degli item da processare, nel formato DoorId, Vers
/// </summary>
public Dictionary<string, string> queueList(int maxNum)
public Dictionary<string, CalcReqtDTO> queueList(int maxNum)
{
Dictionary<string, string> returnData = new Dictionary<string, string>();
Dictionary<string, CalcReqtDTO> returnData = new Dictionary<string, CalcReqtDTO>();
Dictionary<string, string> parList = new Dictionary<string, string>()
{
{ "numItems", $"{maxNum}" }
@@ -135,7 +135,7 @@ namespace WebDoorCreator.SDK
var rawData = callUrlGet(urlTakeNextItems, parList);
if (!string.IsNullOrEmpty(rawData) && rawData != "ERR")
{
returnData = JsonConvert.DeserializeObject<Dictionary<string, string>>(rawData);
returnData = JsonConvert.DeserializeObject<Dictionary<string, CalcReqtDTO>>(rawData);
}
return returnData;
}
@@ -76,6 +76,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="CalcReqDTO.cs" />
<Compile Include="CalcResultDTO.cs" />
<Compile Include="ProcStats.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
@@ -2,9 +2,6 @@
@model RegisterModel
@inject WebDoorCreator.UI.Data.WDCVocabularyService WDCVService
@inject WebDoorCreator.UI.Data.WDCUserService WDCUService
@*@{
ViewData["Title"] = traduci("UI_10");
}*@
<div class="d-flex justify-content-center">
@@ -1,17 +1,25 @@
<div>
@if (B_doorOpUpd || true)
@if (B_doorOpUpd)
{
<button class="btn btn-success" @onclick="() => refreshSVG()"><i class="fa-solid fa-rotate-right"></i></button>
<a class="btn btn-warning" href="https://iis01.egalware.com/Test3D/Doors041122/EXB_0267100040/EXB_0267100040.html" target="_blank"><i class="fa-solid fa-cube"></i></a>
<button class="btn btn-success mx-1" @onclick="() => refreshSVG()"><i class="fa-solid fa-rotate-right"></i></button>
@if (IsErr)
{
<button class="btn btn-danger" @onclick="() => toggleErrors(true)"><i class="fa-solid fa-triangle-exclamation"></i></button>
<button class="btn btn-danger mx-1" @onclick="() => toggleErrors(true)"><i class="fa-solid fa-triangle-exclamation"></i></button>
}
}
else
{
<button class="btn btn-secondary"><i class="fa-solid fa-rotate-right"></i></button>
<button class="btn btn-secondary"><i class="fa-solid fa-cube"></i></button>
<button class="btn btn-secondary mx-1"><i class="fa-solid fa-rotate-right"></i></button>
}
@if (IsErr)
{
<button class="btn btn-secondary mx-1" disabled><i class="fa-solid fa-cube"></i></button>
}
else
{
@* <button class="btn btn-warning" href="https://iis01.egalware.com/Test3D/Doors041122/EXB_0267100040/EXB_0267100040.html" target="_blank"><i class="fa-solid fa-cube"></i></button> *@
<button class="btn btn-warning mx-1" @onclick="() => open3D()"><i class="fa-solid fa-cube"></i></button>
}
</div>
@@ -4,6 +4,7 @@ using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.DTO;
using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Data;
using static WebDoorCreator.UI.Components.SvgComp.DoorSvgObj;
namespace WebDoorCreator.UI.Components.Buttons
{
@@ -26,6 +27,10 @@ namespace WebDoorCreator.UI.Components.Buttons
[CascadingParameter]
public bool IsErr { get; set; } = false;
[Parameter]
public EventCallback<bool> EC_CalcRunning { get; set; }
#endregion Public Properties
#region Protected Properties
@@ -83,15 +88,6 @@ namespace WebDoorCreator.UI.Components.Buttons
await refreshSVG();
}
/// <summary>
/// Effettua Richiesta visione porta 3D
/// </summary>
/// <returns></returns>
protected async Task doReq3D()
{
await Task.Delay(1);
}
protected override void OnInitialized()
{
base.OnInitialized();
@@ -99,6 +95,7 @@ namespace WebDoorCreator.UI.Components.Buttons
bool remDoorOp = config.GetValue<bool>("ConfDDF:RemoveDoorOps");
var headRows = config.GetSection("ConfDDF:Header").Get<List<string>>();
var footRows = config.GetSection("ConfDDF:Footer").Get<List<string>>();
WaitOpen3d = config.GetValue<int>("ServerConf:WaitOpen3d");
currDdfConv = new WebDoorCreator.Data.DDF.Converter(vers, remDoorOp, headRows, footRows);
WDCRService.EA_UpdDoorOp += WDCRService_EA_UpdDoorOp;
}
@@ -109,11 +106,71 @@ namespace WebDoorCreator.UI.Components.Buttons
await Task.Delay(1);
}
/// <summary>
/// Apertura visualizzatore 3D della porta in oggetto
/// </summary>
/// <param name="orderId"></param>
/// <returns></returns>
protected async Task open3D()
{
await EC_CalcRunning.InvokeAsync(true);
// inserisco richiesta calcolo
await sendCalcReqForType("3dm");
// apro link in nuova pagina...
//var url = $"api/Report/GetOrderReport?OrderId={orderId}&Format=PDF";
var url = $"https://iis01.egalware.com/Test3D/TJSD/index_2.html?src=Door2.3dm";
//var url = $"https://iis01.egalware.com/Test3D/TJSD/index_2.html?src=D{idDoor:000000000000}.3dm";
// chiamo apertura via jscript in target _blank
// attendo per apertura WaitOpen3d ms
await Task.Delay(WaitOpen3d);
await EC_CalcRunning.InvokeAsync(false);
await Task.Delay(50);
await JSRuntime.InvokeAsync<object>("open", url, "_blank");
}
/// <summary>
/// Effettua generazione DDF + refresh SVG
/// </summary>
/// <returns></returns>
protected async Task refreshSVG()
{
// vuoto = svg
await sendCalcReqForType("");
}
protected async Task toggleErrors(bool show)
{
showModal = show;
await InvokeAsync(StateHasChanged);
}
#endregion Protected Methods
#region Private Fields
/// <summary>
/// tempo attesa apertura pagina 3d x tempo calcolo e ritorno
/// </summary>
private int WaitOpen3d = 500;
#endregion Private Fields
#region Private Properties
private bool showModal { get; set; } = false;
#endregion Private Properties
#region Private Methods
/// <summary>
/// salva ddf serializzato ed invia richiesta calcolo specifica
/// </summary>
/// <param name="mType"></param>
/// <returns></returns>
private async Task sendCalcReqForType(string mType)
{
List<DoorOpModel>? listOpAll = await WDCService.DoorOpGetByDoorId(idDoor);
if (listOpAll != null)
@@ -135,7 +192,7 @@ namespace WebDoorCreator.UI.Components.Buttons
string currDdf = currDdfConv.GetSerialized(listOp);
// versione corrente del DDF generato
int currVers = await QDataServ.SendCalcReq(idDoor, currDdf);
int currVers = await QDataServ.SendCalcReq(idDoor, currDdf, mType);
if (currVers > 0)
{
@@ -145,22 +202,6 @@ namespace WebDoorCreator.UI.Components.Buttons
}
}
protected async Task toggleErrors(bool show)
{
showModal = show;
await InvokeAsync(StateHasChanged);
}
#endregion Protected Methods
#region Private Properties
private bool showModal { get; set; } = false;
#endregion Private Properties
#region Private Methods
private async void WDCRService_EA_UpdDoorOp()
{
await InvokeAsync(() =>
@@ -1,6 +1,6 @@
@if (currVal == null)
{
<EgwCoreLib.Razor.LoadingDataSmall></EgwCoreLib.Razor.LoadingDataSmall>
<LoadingData DisplaySize="LoadingData.CtrlSize.Small"></LoadingData>
}
else
{
@@ -20,15 +20,15 @@
background: #FFF;
transform: translate(1.6rem, -1rem);
}
.btnPDFSuccess {
.btnPdfSuccess {
border-radius: 50%;
width: 3.5rem;
height: 3.5rem;
border: 5px solid #00838F;
background: #8E44AD;
background: #44AD8E;
transform: translate(25px, 12px);
}
.btnPDFPending {
.btnPdfPending {
border-radius: 50%;
width: 3.5rem;
height: 3.5rem;
@@ -20,13 +20,13 @@
transform: translate(1.6rem, -1rem);
}
.btnPDFSuccess {
.btnPdfSuccess {
.btnGen;
background: #8E44AD;
background: #44AD8E;
transform: translate(@xDelta, @yDelta);
}
.btnPDFPending {
.btnPdfPending {
.btnGen;
background: #F1C40F;
transform: translate(@xDelta, @yDelta);
@@ -1 +1 @@
.btnGen{border-radius:50%;width:3.5rem;height:3.5rem;border:5px solid #00838f;}.btnDelete{border-radius:50%;width:3.5rem;height:3.5rem;border:5px solid #00838f;background:#b71c1c;transform:translate(25px,-12px);}.btnClone{border-radius:50%;width:3.5rem;height:3.5rem;border:5px solid #00838f;background:#fff;transform:translate(1.6rem,-1rem);}.btnPDFSuccess{border-radius:50%;width:3.5rem;height:3.5rem;border:5px solid #00838f;background:#8e44ad;transform:translate(25px,12px);}.btnPDFPending{border-radius:50%;width:3.5rem;height:3.5rem;border:5px solid #00838f;background:#f1c40f;transform:translate(25px,12px);}.btnHighlight{border-radius:50%;width:3.5rem;height:3.5rem;border:5px solid #00838f;background:#03a9f4;transform:translate(1.6rem,1rem);}.btnHeadTail{width:100%;padding:.8rem 0 .8rem 0;background:none;border:0;}.btnConfirm{width:100%;padding:.8rem 0 .8rem 0;background:none;border:0;border-bottom:3px solid #000;}.btnHead{width:100%;padding:.8rem 0 .8rem 0;background:none;border:0;}.borderTop{border-top:7px solid #00838f;}.borderBottom{border-bottom:7px solid #00838f;width:100%;}.modal-dialog{overflow-y:initial!important;}.modal-body{height:18.75rem;overflow-y:auto;}.testata{width:100%;}select,input{border:0;border-bottom:2px solid #000;background:none;height:2rem;}i{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;font-size:1.1rem;}
.btnGen{border-radius:50%;width:3.5rem;height:3.5rem;border:5px solid #00838f;}.btnDelete{border-radius:50%;width:3.5rem;height:3.5rem;border:5px solid #00838f;background:#b71c1c;transform:translate(25px,-12px);}.btnClone{border-radius:50%;width:3.5rem;height:3.5rem;border:5px solid #00838f;background:#fff;transform:translate(1.6rem,-1rem);}.btnPdfSuccess{border-radius:50%;width:3.5rem;height:3.5rem;border:5px solid #00838f;background:#44ad8e;transform:translate(25px,12px);}.btnPdfPending{border-radius:50%;width:3.5rem;height:3.5rem;border:5px solid #00838f;background:#f1c40f;transform:translate(25px,12px);}.btnHighlight{border-radius:50%;width:3.5rem;height:3.5rem;border:5px solid #00838f;background:#03a9f4;transform:translate(1.6rem,1rem);}.btnHeadTail{width:100%;padding:.8rem 0 .8rem 0;background:none;border:0;}.btnConfirm{width:100%;padding:.8rem 0 .8rem 0;background:none;border:0;border-bottom:3px solid #000;}.btnHead{width:100%;padding:.8rem 0 .8rem 0;background:none;border:0;}.borderTop{border-top:7px solid #00838f;}.borderBottom{border-bottom:7px solid #00838f;width:100%;}.modal-dialog{overflow-y:initial!important;}.modal-body{height:18.75rem;overflow-y:auto;}.testata{width:100%;}select,input{border:0;border-bottom:2px solid #000;background:none;height:2rem;}i{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;font-size:1.1rem;}
@@ -1,11 +1,18 @@
<div class="" style="height:100%; width:100%; background: linear-gradient(#AFCFD1, #92B2C4);min-height: 50rem;">
<ButtonsDoorDef></ButtonsDoorDef>
@if (!string.IsNullOrEmpty(@SvgContent))
<ButtonsDoorDef EC_CalcRunning="SetCalcRunning"></ButtonsDoorDef>
@if (isRecalc)
{
<div style="align-items: center;display: flex;flex-wrap: wrap;justify-content: center;">
<div style="width: @doorW; max-height: 30rem;">
@svgPreview
<LoadingData DisplayMode="LoadingData.SpinMode.Growl" DisplaySize="LoadingData.CtrlSize.Large" Title="Render 3DM"></LoadingData>
}
else
{
if (!string.IsNullOrEmpty(@SvgContent))
{
<div style="align-items: center;display: flex;flex-wrap: wrap;justify-content: center;">
<div style="width: @doorW; max-height: 30rem;">
@svgPreview
</div>
</div>
</div>
}
}
</div>
@@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Components;
using NLog;
using WebDoorCreator.Data.DbModels;
namespace WebDoorCreator.UI.Components.DoorDef
{
@@ -7,8 +8,6 @@ namespace WebDoorCreator.UI.Components.DoorDef
{
#region Public Properties
private static Logger Log = LogManager.GetCurrentClassLogger();
[Parameter]
public string doorW { get; set; } = "";
@@ -16,22 +15,41 @@ namespace WebDoorCreator.UI.Components.DoorDef
public string SvgContent
{
get => _svgContent;
set
{
_svgContent = value;
}
set { _svgContent = value; }
}
protected string _svgContent { get; set; } = "";
#endregion Public Properties
#region Protected Properties
protected string _svgContent { get; set; } = "";
protected MarkupString svgPreview
{
get => (MarkupString)SvgContent;
}
#endregion Protected Properties
#region Protected Methods
protected async Task SetCalcRunning(bool isRunning)
{
isRecalc = isRunning;
await InvokeAsync(StateHasChanged);
}
#endregion Protected Methods
#region Private Fields
private static Logger Log = LogManager.GetCurrentClassLogger();
/// <summary>
/// Variabile stato recalc x mostrare attesa..
/// </summary>
private bool isRecalc = false;
#endregion Private Fields
}
}
@@ -34,7 +34,7 @@
<div class="d-flex justify-content-between">
<div class=" py-1">
<HwSvgObj LineColor="#CFD8DC" LineWidth="8" ObjH="200" ObjW="700" EC_ExeFunct="()=> RecalcSVGs()" ObjId="Svg" ItemName="Recalc all the SVGs" ItemCount="0" ShowPlus="true" PlusOpacity="0%" BgColorFrom='@hexConverter("#2ECC71", 5)' BgColorTo="#2ECC71" ImagePath="images/icons/arrows-rotate-solid.svg"></HwSvgObj>
<HwSvgObj LineColor="#CFD8DC" LineWidth="8" ObjH="200" ObjW="700" EC_ExeFunct="()=> RecalcSVGs(false)" ObjId="Svg" ItemName="Recalc all the SVGs" ItemCount="0" ShowPlus="true" PlusOpacity="0%" BgColorFrom='@hexConverter("#2ECC71", 5)' BgColorTo="#2ECC71" ImagePath="images/icons/arrows-rotate-solid.svg"></HwSvgObj>
</div>
@if (isAddNew)
{
@@ -124,7 +124,7 @@
<div class="row">
@if (DoorsList == null || DoorsList.Count == 0)
{
<LoadingDataSmall></LoadingDataSmall>
<LoadingData DisplaySize="LoadingData.CtrlSize.Small"></LoadingData>
}
else
{
@@ -7,10 +7,11 @@ using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Components.SvgComp;
using WebDoorCreator.UI.Data;
using static WebDoorCreator.UI.Data.WDCRefreshService;
namespace WebDoorCreator.UI.Components.DoorMan
{
public partial class DoorList
public partial class DoorList:IDisposable
{
#region Public Properties
@@ -55,6 +56,8 @@ namespace WebDoorCreator.UI.Components.DoorMan
protected List<DoorOpModel> doorOps2Add = new List<DoorOpModel>();
protected string[] hexVals = new string[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f" };
#endregion Protected Fields
#region Protected Properties
@@ -149,6 +152,7 @@ namespace WebDoorCreator.UI.Components.DoorMan
var door = DoorsList?.Where(x => x.DoorId == doorId).FirstOrDefault();
await InvokeAsync(StateHasChanged);
await E_CurrDoor.InvokeAsync(door);
NavManager.NavigateTo(NavManager.Uri, true);
}
}
@@ -253,6 +257,25 @@ namespace WebDoorCreator.UI.Components.DoorMan
return answ;
}
protected string hexConverter(string hexColor, int delta)
{
string answ = "";
if (hexColor != "" && hexColor != null)
{
var noHash = hexColor.Substring(1, hexColor.Length - 1);
StringBuilder sb = new StringBuilder();
foreach (var val in noHash)
{
sb.Append(newHexVal(val, delta));
}
answ = $"#{sb.ToString()}";
}
return answ;
}
protected async Task modalClose(bool isClose)
{
await Task.Delay(1);
@@ -260,15 +283,62 @@ namespace WebDoorCreator.UI.Components.DoorMan
await ReloadData();
}
protected string newHexVal(char str2Check, int delta)
{
string answ = "";
int runIdx = 0;
foreach (var item in hexVals)
{
if (item.ToLower() == str2Check.ToString().ToLower())
{
int currValIndex = Array.IndexOf(hexVals, item);
runIdx = currValIndex + delta;
runIdx = runIdx <= 15 ? runIdx : 15;
answ = hexVals[runIdx];
}
}
return answ;
}
protected override void OnInitialized()
{
WaitReloadSvg = Configuration.GetValue<int>("RuntimeOpt:WaitReloadSvg");
WDCRService.EA_OrderChanged += WDCRService_EA_OrderChanged;
}
protected override async Task OnParametersSetAsync()
{
await ReloadData();
if (!actFilter.Equals(lastFilt))
{
lastFilt = actFilter.clone();
await ReloadData();
}
}
[Inject]
protected WDCRefreshService WDCRService { get; set; } = null!;
public void Dispose()
{
WDCRService.EA_OrderChanged -= WDCRService_EA_OrderChanged;
}
private async void WDCRService_EA_OrderChanged(object? sender, EventArgs e)
{
// recupero dati
OrdEventArgs currArgs = (OrdEventArgs)e;
// se ordine corrente --> rileggo pagina...
if ( currArgs != null && currArgs.OrderId == currOrderId)
{
await ReloadData();
#if false
// ricarico...
NavManager.NavigateTo(NavManager.Uri, true);
#endif
}
}
/// <summary>
/// Esecuzione ricalcolo SVG
/// </summary>
protected async void RecalcSVGs()
protected async void RecalcSVGs(bool force)
{
isRecalc = true;
// recupero elenco porte come list interi...
@@ -287,23 +357,31 @@ namespace WebDoorCreator.UI.Components.DoorMan
// chiamo reset richieste
var list2Proc = await QDService.ResetQueueByDoorList(doorIdList);
// se ho porte da processare --> chiamo save...
string currDDF = "";
int currDoorId = 0;
int currVers = 0;
foreach (var item in list2Proc)
if (force)
{
currDoorId = 0;
currVers = 0;
int.TryParse(item, out currDoorId);
if (currDoorId > 0)
// se ho porte da processare --> chiamo save...
string currDDF = "";
int currDoorId = 0;
int currVers = 0;
foreach (var item in list2Proc)
{
currDDF = await WDService.DoorOpGetDDF(currDoorId);
// versione corrente del DDF generato
currVers = await QDService.SendCalcReq(currDoorId, currDDF);
currDoorId = 0;
currVers = 0;
int.TryParse(item, out currDoorId);
if (currDoorId > 0)
{
currDDF = await WDService.DoorOpGetDDF(currDoorId);
// versione corrente del DDF generato
currVers = await QDService.SendCalcReq(currDoorId, currDDF);
}
}
}
else
{
// attesa prima di ricaricare 200/500 ms...
await Task.Delay(DoorsList.Count * (WaitReloadSvg / 3) * rnd.Next(900, 1200) / 1000);
}
}
isRecalc = false;
NavManager.NavigateTo(NavManager.Uri, true);
@@ -373,17 +451,6 @@ namespace WebDoorCreator.UI.Components.DoorMan
}
}
}
#if false
if (DoorsList != null)
{
var currDoor = DoorsList.FirstOrDefault();
if (currDoor?.OrderNav != null)
{
//orderStatus = currDoor.OrderNav.Status;
}
}
#endif
}
}
}
@@ -410,7 +477,6 @@ namespace WebDoorCreator.UI.Components.DoorMan
var door = DoorsList.Where(x => x.DoorId == doorId).FirstOrDefault();
if (door != null)
{
//currDoor = door;
await E_CurrDoorModal.InvokeAsync(door);
}
}
@@ -444,6 +510,14 @@ namespace WebDoorCreator.UI.Components.DoorMan
#endregion Protected Methods
#region Private Fields
private DoorsSelectFilter lastFilt = new DoorsSelectFilter() { CurrPage = -1 };
private Random rnd = new Random();
private int WaitReloadSvg = 100;
#endregion Private Fields
#region Private Properties
private int _totalCount { get; set; } = 0;
@@ -480,44 +554,5 @@ namespace WebDoorCreator.UI.Components.DoorMan
}
#endregion Private Properties
protected string[] hexVals = new string[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f" };
protected string newHexVal(char str2Check, int delta)
{
string answ = "";
int runIdx = 0;
foreach (var item in hexVals)
{
if (item.ToLower() == str2Check.ToString().ToLower())
{
int currValIndex = Array.IndexOf(hexVals, item);
runIdx = currValIndex + delta;
runIdx = runIdx <= 15 ? runIdx : 15;
answ = hexVals[runIdx];
}
}
return answ;
}
protected string hexConverter(string hexColor, int delta)
{
string answ = "";
if (hexColor != "" && hexColor != null)
{
var noHash = hexColor.Substring(1, hexColor.Length - 1);
StringBuilder sb = new StringBuilder();
foreach (var val in noHash)
{
sb.Append(newHexVal(val, delta));
}
answ = $"#{sb.ToString()}";
}
return answ;
}
}
}
@@ -9,7 +9,7 @@
@if (!CurrDoor.Equals(CurrDoorClone))
{
<button class="btn btn-secondary" type="button" @onclick="()=>ReloadData()">Cancel <i class="fa-solid fa-rotate-left"></i></button>
<button class="btn btn-success" type="button" @onclick="()=>UpdateDoor(true)">Update <i class="fa-solid fa-check"></i></button>
<button class="btn btn-success" type="button" @onclick="()=>UpdateDoor()">Update <i class="fa-solid fa-check"></i></button>
}
</div>
<div>
@@ -11,9 +11,6 @@ namespace WebDoorCreator.UI.Components.DoorMan
{
#region Public Properties
protected DoorModel CurrDoor { get; set; } = new DoorModel();
protected DoorModel CurrDoorClone { get; set; } = new DoorModel();
[Parameter]
public int CurrDoorId { get; set; } = 0;
@@ -25,41 +22,19 @@ namespace WebDoorCreator.UI.Components.DoorMan
[Parameter]
public EventCallback<bool> E_isChange { get; set; }
[Parameter]
public bool isTplPage { get; set; } = false;
[Parameter]
public int OrderId { get; set; } = 0;
public List<OrderModel> OrdersCompList { get; set; } = new List<OrderModel>();
[Parameter]
public string UserName { get; set; } = "";
[Parameter]
public int OrderStatus { get; set; } = 10;
[Parameter]
public bool isTplPage { get; set; } = false;
protected int DoorQty
{
get => CurrDoor.Quantity;
set
{
if (value >= 0)
{
CurrDoor.Quantity = value;
}
}
}
protected decimal DoorUnitCost
{
get => CurrDoor.UnitCost;
set
{
if (value >= 0)
{
CurrDoor.UnitCost = value;
}
}
}
[Parameter]
public string UserName { get; set; } = "";
#endregion Public Properties
@@ -76,7 +51,8 @@ namespace WebDoorCreator.UI.Components.DoorMan
protected IConfiguration config { get; set; } = null!;
protected WebDoorCreator.Data.DDF.Converter currDdfConv { get; set; } = null!;
protected DoorModel CurrDoor { get; set; } = new DoorModel();
protected DoorModel CurrDoorClone { get; set; } = new DoorModel();
protected DDFDto CurrentConf { get; set; } = new DDFDto();
protected int doorQty
@@ -85,8 +61,32 @@ namespace WebDoorCreator.UI.Components.DoorMan
set => CurrDoor.Quantity = value;
}
protected int DoorQty
{
get => CurrDoor.Quantity;
set
{
if (value >= 0)
{
CurrDoor.Quantity = value;
}
}
}
protected string DoorSvgContent { get; set; } = "";
protected decimal DoorUnitCost
{
get => CurrDoor.UnitCost;
set
{
if (value >= 0)
{
CurrDoor.UnitCost = value;
}
}
}
protected bool IsErr { get; set; } = false;
[Inject]
@@ -108,6 +108,9 @@ namespace WebDoorCreator.UI.Components.DoorMan
get => WDCUService.userRole;
}
[Inject]
protected WDCRefreshService WDCRService { get; set; } = null!;
[Inject]
protected WDCUserService WDCUService { get; set; } = null!;
@@ -118,28 +121,6 @@ namespace WebDoorCreator.UI.Components.DoorMan
#region Protected Methods
protected void modDoorQty(bool isAdd)
{
if (isAdd)
{
DoorQty++;
}
else
{
DoorQty--;
}
}
protected async Task UpdateDoor(bool isAdd)
{
//var done = await WDService.DoorModQty(doorQty, CurrDoor.OrderId, CurrDoor.DoorId, isAdd);
var done = await WDService.DoorUpsert(CurrDoor);
if (done)
{
await ReloadData();
}
}
/// <summary>
/// Clona la porta selezionata con annesse door operations
/// </summary>
@@ -178,11 +159,27 @@ namespace WebDoorCreator.UI.Components.DoorMan
var done = await WDService.DoorUpsert(CurrDoor);
if (done)
{
// chiamo update ordine...
WDCRService.ReportOrderChanged(OrderId);
await ReloadData();
// chiudo modale
await closeModal();
}
}
}
protected void modDoorQty(bool isAdd)
{
if (isAdd)
{
DoorQty++;
}
else
{
DoorQty--;
}
}
protected override async Task OnInitializedAsync()
{
await Task.Delay(1);
@@ -309,6 +306,17 @@ namespace WebDoorCreator.UI.Components.DoorMan
}
}
protected async Task UpdateDoor()
{
var done = await WDService.DoorUpsert(CurrDoor);
if (done)
{
// chiamo update ordine...
WDCRService.ReportOrderChanged(OrderId);
await ReloadData();
}
}
#endregion Protected Methods
}
}
@@ -51,7 +51,7 @@
{
<select @bind="@TypeSel" class="form-select">
<option value="*">-- All Types --</option>
@foreach (var item in ListType)
@foreach (var item in ListType.OrderBy(x => x))
{
<option value="@item">@item</option>
}
@@ -65,23 +65,33 @@
@if (files2Chk.Where(x => x.Value.action).ToList().Count > 0)
{
<div class="w-100 text-center">
<button @onclick="()=>doSave()" class="btn btn-success btn-lg">Save</button>
<button @onclick="()=>doSave()" class="btn btn-success btn-lg px-3">Apply Changes</button>
</div>
}
}
</div>
<div class="col-4 text-end">
@if (searchRecords != null && searchRecords.Count() > 0)
{
<div class="text-nowrap">
<div class="btn-group w-50" role="group">
<button type="button" class="btn btn-sm col-3 btn-secondary" disabled>FILTER BY: </button>
<button type="button" class="btn btn-sm col-3 @filtBtnAddCss()" @onclick="()=>filtBtnSet(Core.Enum.fileStatus.add)">Add</button>
<button type="button" class="btn btn-sm col-3 @filtBtnUpdCss()" @onclick="()=>filtBtnSet(Core.Enum.fileStatus.mod)">Update</button>
<button type="button" class="btn btn-sm col-3 @filtBtnRemCss()" @onclick="()=>filtBtnSet(Core.Enum.fileStatus.rem)">Delete</button>
</div>
<div class="d-flex justify-content-between">
<div>
@if (numTplMissing > 0)
{
<button type="button" class="btn btn-sm btn-success" @onclick="()=>fixMissing()" title="Fix missing components template file">FIX @tplMissing missing</button>
}
else
{
<button type="button" class="btn btn-sm btn-outline-success" @onclick="()=>updateNumMissing()" title="Check missing template">@tplMissing missing</button>
}
</div>
}
@if (searchRecords != null && searchRecords.Count() > 0 && !isLoading)
{
<div class="text-nowrap btn-group w-75" role="group">
<button type="button" class="btn btn-sm col-3 btn-outline-dark" disabled>Show:</button>
<button type="button" class="btn btn-sm col-3 @filtBtnCssAdd" @onclick="()=>filtBtnToggle(Core.Enum.fileStatus.add)">Add</button>
<button type="button" class="btn btn-sm col-3 @filtBtnCssUpd" @onclick="()=>filtBtnToggle(Core.Enum.fileStatus.mod)">Update</button>
<button type="button" class="btn btn-sm col-3 @filtBtnCssRem" @onclick="()=>filtBtnToggle(Core.Enum.fileStatus.rem)">Delete</button>
</div>
}
</div>
</div>
</div>
@@ -137,7 +147,8 @@ else if (files2Chk != null && files2Chk.Count() > 0)
<td class="col-5" colspan="4" data-bs-toggle="modal" data-bs-target="#fileDiffModal" @onclick="()=>showDiff(item, item.Value.status)"></td>
}
<td class="col-2 text-center">
<button class="btn @btnCssClass(item.Value.status, item.Value.action)" @onclick="()=>changeDoAct(item)" disabled="@(item.Value.status== Core.Enum.fileStatus.rem)">@btnTxt(item.Value.status) &nbsp; <i class="@btnIcon(item.Value.status)"></i></button>
<button class="btn @btnCssClass(item.Value.status, item.Value.action)" @onclick="()=>changeDoAct(item)">@btnTxt(item.Value.status) &nbsp; <i class="@btnIcon(item.Value.status)"></i></button>
@* <button class="btn @btnCssClass(item.Value.status, item.Value.action)" @onclick="()=>changeDoAct(item)" disabled="@(item.Value.status== Core.Enum.fileStatus.rem)">@btnTxt(item.Value.status) &nbsp; <i class="@btnIcon(item.Value.status)"></i></button> *@
</td>
@if (item.Value.status == Core.Enum.fileStatus.rem || item.Value.status == Core.Enum.fileStatus.mod)
{
@@ -164,7 +175,7 @@ else if (files2Chk != null && files2Chk.Count() > 0)
}
</tbody>
</table>
}
else if (files2Chk == null || files2Chk.Count() == 0)
@@ -1,3 +1,4 @@
using k8s.Models;
using Microsoft.AspNetCore.Components;
using NLog;
using WebDoorCreator.Data.DbModels;
@@ -19,6 +20,30 @@ namespace WebDoorCreator.UI.Components.FilesMan
#endregion Public Properties
#region Public Methods
public static string getFolder(string key)
{
string answ = "";
if (key.Contains("\\"))
{
answ = key.Split("\\")[1];
}
return answ;
}
public static string getType(string key)
{
string answ = "";
if (key.Contains("\\"))
{
answ = key.Split("\\")[0];
}
return answ;
}
#endregion Public Methods
#region Protected Fields
protected static Logger Log = LogManager.GetCurrentClassLogger();
@@ -31,7 +56,7 @@ namespace WebDoorCreator.UI.Components.FilesMan
protected bool _showAdd { get; set; } = true;
protected bool _showDel { get; set; } = false;
protected bool _showRem { get; set; } = true;
protected bool _showUpd { get; set; } = true;
@@ -42,9 +67,24 @@ namespace WebDoorCreator.UI.Components.FilesMan
protected double expTime { get; set; } = 6;
protected bool isLoading { get; set; } = false;
protected bool isDrawing { get; set; } = false;
protected string filtBtnCssAdd
{
get => showAdd ? "btn-primary" : "btn-secondary";
}
protected string filtBtnCssRem
{
get => showRem ? "btn-danger" : "btn-secondary";
}
protected string filtBtnCssUpd
{
get => showUpd ? "btn-warning" : "btn-secondary";
}
protected bool isDrawing { get; set; } = false;
protected bool isLoading { get; set; } = false;
protected List<string> ListType { get; set; } = new List<string>();
protected int numSteps { get; set; } = 4;
protected bool show { get; set; } = false;
@@ -65,10 +105,10 @@ namespace WebDoorCreator.UI.Components.FilesMan
get => NumFileNew > 0;
}
protected bool showDel
protected bool showRem
{
get => _showDel;
set => _showDel = value;
get => _showRem;
set => _showRem = value;
}
protected bool showUpd
@@ -77,10 +117,33 @@ namespace WebDoorCreator.UI.Components.FilesMan
set => _showUpd = value;
}
protected string tplMissing
{
get => numTplMissing >= 0 ? $"{numTplMissing}" : "???";
}
protected string txtDx { get; set; } = "";
protected string txtSx { get; set; } = "";
protected string TypeSel
{
get => _typeSel;
set
{
if (_typeSel != value)
{
_typeSel = value;
ReloadData().ConfigureAwait(false);
//var pUpd = Task.Run(async () =>
//{
// await InvokeAsync(ReloadData);
//});
//pUpd.Wait();
}
}
}
[Inject]
protected WebDoorCreatorService WDCService { get; set; } = null!;
@@ -153,10 +216,10 @@ namespace WebDoorCreator.UI.Components.FilesMan
protected async Task doSave()
{
await Task.Delay(1);
//var sb = new StringBuilder();
sendDataVal = 0;
isDrawing = true;
isLoading = true;
sendDataVal = 0;
await Task.Delay(1);
var updTask1 = Task.Run(() =>
{
files2Save = searchRecords.Where(x => x.Value.action).ToDictionary(x => x.Key, x => x.Value);
@@ -177,14 +240,17 @@ namespace WebDoorCreator.UI.Components.FilesMan
if (item.Value.status == Core.Enum.fileStatus.add)
{
File.Copy($"{rootPathNew}\\{item.Key}", $"{rootPathCur}\\{item.Key}");
Log.Info($"Add new Compo: {rootPathNew}\\{item.Key}");
}
else if (item.Value.status == Core.Enum.fileStatus.mod)
{
ReplaceFile($"{rootPathNew}\\{item.Key}", $"{rootPathCur}\\{item.Key}");
Log.Info($"Updated Compo: {rootPathNew}\\{item.Key}");
}
else if (item.Value.status == Core.Enum.fileStatus.rem)
{
File.Delete($"{rootPathCur}\\{item.Key}");
Log.Info($"Removed Compo: {rootPathNew}\\{item.Key}");
}
}
}
@@ -196,6 +262,11 @@ namespace WebDoorCreator.UI.Components.FilesMan
await WDCService.ListValuesLuaNgeInsert(rootPathCur);
});
await updTask2;
Log.Info($"DB Updated for Compo changes!");
sendDataVal = 45;
// svuoto cache!
await WDCService.FlushCustomPattern("Cache");
sendDataVal = 50;
await doScan(true, true);
sendDataVal = 90;
}
@@ -208,12 +279,16 @@ namespace WebDoorCreator.UI.Components.FilesMan
/// <returns></returns>
protected async Task doScan(bool scanCur, bool scanNew)
{
files2Chk.Clear();
searchRecords.Clear();
ListType = new List<string>();
Log.Info($"Component scan started by user {WDCUService.userId}");
isDrawing = true;
isLoading = true;
files2Chk.Clear();
searchRecords.Clear();
stats2show.Clear();
stats2show.Add(Core.Enum.fileStatus.add);
stats2show.Add(Core.Enum.fileStatus.mod);
stats2show.Add(Core.Enum.fileStatus.rem);
ListType = new List<string>();
Log.Info($"Component scan started by user {WDCUService.userId}");
sendDataVal = 0;
var updTask1 = Task.Run(async () =>
await WDCService.populateHws()
@@ -256,11 +331,10 @@ namespace WebDoorCreator.UI.Components.FilesMan
{
item.Value.status = Core.Enum.fileStatus.rem;
searchRecords.Add(item.Key, item.Value);
checkItemType(item);
}
searchRecords = searchRecords.Where(x => x.Value.status > 0).ToDictionary(x => x.Key, x => x.Value);
stats2show.Add(Core.Enum.fileStatus.add);
stats2show.Add(Core.Enum.fileStatus.mod);
searchRecords = searchRecords.Where(x => x.Value.status != Core.Enum.fileStatus.none).ToDictionary(x => x.Key, x => x.Value);
await ReloadData();
sendDataVal = 100;
isLoading = false;
@@ -272,63 +346,7 @@ namespace WebDoorCreator.UI.Components.FilesMan
Log.Info($"Component scan COMPLETED");
}
private void checkItemType(KeyValuePair<string, FileDTO> item)
{
string type = getType(item.Key);
if (!ListType.Contains(type))
{
ListType.Add(type);
}
}
public static string getType(string key)
{
string answ = "";
if (key.Contains("\\"))
{
answ = key.Split("\\")[0];
}
return answ;
}
public static string getFolder(string key)
{
string answ = "";
if (key.Contains("\\"))
{
answ = key.Split("\\")[1];
}
return answ;
}
protected string filtBtnAddCss()
{
string answ = "";
if (showAdd)
{
answ = "btn-primary";
}
else
{
answ = "btn-secondary";
}
return answ;
}
protected string filtBtnRemCss()
{
string answ = "";
if (showDel)
{
answ = "btn-danger";
}
else
{
answ = "btn-secondary";
}
return answ;
}
protected async Task filtBtnSet(Core.Enum.fileStatus fileStat)
protected async Task filtBtnToggle(Core.Enum.fileStatus fileStat)
{
switch (fileStat)
{
@@ -357,12 +375,12 @@ namespace WebDoorCreator.UI.Components.FilesMan
break;
case Core.Enum.fileStatus.rem:
showDel = !showDel;
if (showDel && !stats2show.Contains(Core.Enum.fileStatus.rem))
showRem = !showRem;
if (showRem && !stats2show.Contains(Core.Enum.fileStatus.rem))
{
stats2show.Add(Core.Enum.fileStatus.rem);
}
else if (!showDel && stats2show.Contains(Core.Enum.fileStatus.rem))
else if (!showRem && stats2show.Contains(Core.Enum.fileStatus.rem))
{
stats2show.Remove(Core.Enum.fileStatus.rem);
}
@@ -371,18 +389,16 @@ namespace WebDoorCreator.UI.Components.FilesMan
await ReloadData();
}
protected string filtBtnUpdCss()
/// <summary>
/// Sistema i componenti missing creando file (vuoti) corrispondenti a quanto trovato sul DB
/// </summary>
/// <returns></returns>
protected async Task fixMissing()
{
string answ = "";
if (showUpd)
{
answ = "btn-warning";
}
else
{
answ = "btn-secondary";
}
return answ;
isLoading = true;
bool done = await WDCService.CompoFixMissing(rootPathCur);
numTplMissing = await WDCService.CompoCountMissing(rootPathCur);
isLoading = false;
}
protected override async Task OnParametersSetAsync()
@@ -390,22 +406,6 @@ namespace WebDoorCreator.UI.Components.FilesMan
await ReloadData();
}
protected string TypeSel
{
get => _typeSel;
set
{
if (_typeSel != value)
{
_typeSel = value;
ReloadData().ConfigureAwait(false);
}
}
}
private string _typeSel { get; set; } = "*";
protected List<string> ListType { get; set; } = new List<string>();
protected async Task ReloadData()
{
isDrawing = true;
@@ -465,24 +465,28 @@ namespace WebDoorCreator.UI.Components.FilesMan
}
}
/// <summary>
/// verifica numero template missing x eventuale fix con creazione nuovi file vuoti
/// </summary>
/// <returns></returns>
protected async Task updateNumMissing()
{
isLoading = true;
numTplMissing = await WDCService.CompoCountMissing(rootPathCur);
isLoading = false;
}
#endregion Protected Methods
#region Private Fields
private Dictionary<string, FileDTO> files2Chk = new Dictionary<string, FileDTO>();
private Dictionary<string, FileDTO> files2Save = new Dictionary<string, FileDTO>();
private string scanMsg = "CLICK TO SCAN";
private Dictionary<string, FileDTO> searchRecords = new Dictionary<string, FileDTO>();
private int sendDataMaxVal = 100;
private int sendDataVal = 0;
private List<Core.Enum.fileStatus> stats2show = new List<Core.Enum.fileStatus>();
private string titleMsg = "Scanning directories";
#endregion Private Fields
@@ -490,8 +494,8 @@ namespace WebDoorCreator.UI.Components.FilesMan
#region Private Properties
private bool _selUns { get; set; } = false;
private int _totalCount { get; set; } = -1;
private string _typeSel { get; set; } = "*";
private int currPage
{
@@ -519,6 +523,8 @@ namespace WebDoorCreator.UI.Components.FilesMan
set => actFilter.NumRec = value;
}
private int numTplMissing { get; set; } = -1;
private string rootPathCur
{
get => configuration.GetValue<string>("CompoBaseDirs:CurrCompoDir");
@@ -556,6 +562,15 @@ namespace WebDoorCreator.UI.Components.FilesMan
#region Private Methods
private void checkItemType(KeyValuePair<string, FileDTO> item)
{
string type = getType(item.Key);
if (!ListType.Contains(type))
{
ListType.Add(type);
}
}
/// <summary>
/// Recupera i dati files current,
/// </summary>
@@ -15,7 +15,7 @@
</div>
@if (isLoading)
{
<LoadingDataSmall></LoadingDataSmall>
<LoadingData DisplaySize="LoadingData.CtrlSize.Small"></LoadingData>
}
else
{
@@ -18,7 +18,7 @@ namespace WebDoorCreator.UI.Components.FilesMan
protected Dictionary<string, Dictionary<string, string>>? vocLemmasTEMP { get; set; } = null;
protected Dictionary<string, string> vocLemmasTEMP2Dict { get; set; } = new Dictionary<string, string>();
protected bool showList { get; set; } = false;
protected bool showList { get; set; } = true;//false;
protected bool isLoading { get; set; } = false;
protected async override Task OnParametersSetAsync()
{
@@ -22,17 +22,13 @@
</Authorized>
</AuthorizeView>
<!--Hiding to non-SuperAdmin users the option to manage the application -->
<AuthorizeView Roles="SuperAdmin, Admin, CompAdmin" Context="MenuHide">
<AuthorizeView Roles="SuperAdmin, DcaAdmin, CompAdmin" Context="MenuHide">
<Authorized>
<div class="nav-item px-1 align-items-center">
<NavLink class="nav-link text-nowrap" href="UserAdmin">
<span class="bi bi-people pe-2" aria-hidden="true"></span> @translate("UI_02")
</NavLink>
</div>
</Authorized>
</AuthorizeView>
<AuthorizeView Roles="SuperAdmin" Context="MenuHide">
<Authorized>
<div class="nav-item px-1 align-items-center">
<NavLink class="nav-link text-nowrap" href="TemplateMan">
<span class="fa-solid fa-paint-roller pe-2" aria-hidden="true"></span> Template Management
@@ -45,8 +41,7 @@
</div>
</Authorized>
</AuthorizeView>
<!--help finale-->
<AuthorizeView Roles="SuperAdmin" Context="MenuHide">
<AuthorizeView Roles="SuperAdmin, DcaAdmin" Context="MenuHide">
<Authorized>
<div class="nav-item px-1 align-items-center">
<NavLink class="nav-link text-nowrap" href="SuperAdmin">
@@ -55,6 +50,7 @@
</div>
</Authorized>
</AuthorizeView>
<!--help finale-->
<AuthorizeView Context="MenuHide">
<Authorized>
<div class="nav-item px-1 align-items-center">
@@ -1,6 +1,6 @@
@if (isLoading)
{
<EgwCoreLib.Razor.LoadingDataSmall></EgwCoreLib.Razor.LoadingDataSmall>
<LoadingData DisplaySize="LoadingData.CtrlSize.Small"></LoadingData>
}
else
{
@@ -101,6 +101,11 @@ namespace WebDoorCreator.UI.Components.Hardware
[Inject]
protected WDCVocabularyService WDVService { get; set; } = null!;
[Inject]
protected NavigationManager NavMan { get; set; } = null!;
[Inject]
protected WDCUserService WDCUService { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
@@ -225,6 +230,14 @@ namespace WebDoorCreator.UI.Components.Hardware
JsoncConfigVal = jsonDef,
JsoncActVal = jsonAct
};
// se debug + superadmin --> auto confirm
if (autoApprove)
{
doorOpToAdd.userConfirm = UserId;
doorOpToAdd.DtConfirm = DateTime.Now;
}
listOp.Add(doorOpToAdd);
// salvo Door OP associate
bool fatto = await WDCService.DoorOpInsert(DoorId, listOp);
@@ -239,6 +252,7 @@ namespace WebDoorCreator.UI.Components.Hardware
}
}
}
private bool autoApprove = false;
/// <summary>
/// Gestione update da oggetto sottostante
@@ -261,12 +275,26 @@ namespace WebDoorCreator.UI.Components.Hardware
DoorOp2ModList.Add(currItem);
}
}
/// <summary>
/// Blazor: get query parm from the URL
/// </summary>
/// <param name="parmName"></param>
/// <returns></returns>
protected string GetQueryParm(string parmName)
{
var uriBuilder = new UriBuilder(NavMan.Uri);
var q = System.Web.HttpUtility.ParseQueryString(uriBuilder.Query);
return q[parmName] ?? "";
}
protected override async Task OnInitializedAsync()
{
await Task.Delay(1);
var currMode = GetQueryParm("currMode");
if (!string.IsNullOrEmpty(currMode) && WDCUService.userRole == "SuperAdmin")
{
autoApprove = currMode.Equals("debug");
}
WDCRefresh.EA_ConfDoorOp += WDCRefresh_EA_ConfDoorOp;
//return base.OnInitializedAsync();
}
protected override async Task OnParametersSetAsync()
@@ -9,9 +9,11 @@ else
<div class="text-center d-flex justify-content-between px-2 mb-3">
@if (DoorOpInst.userConfirm != "" && DoorOpInst.DtConfirm != null)
{
<button class="btnPDFSuccess">
<i class="fa-solid fa-file-pdf"></i>
</button>
<NavLink href="@pathFinder(DoorOpInst.DoorOpId, false)" target="_blank" title="Review PDF">
<button class="btnPdfSuccess">
<i class="fa-solid fa-file-pdf"></i>
</button>
</NavLink>
}
<div>
<h5>@($"{@getTrad(DoorOpInst.ObjectId)} #{instanceN}")</h5>
@@ -158,8 +160,8 @@ else
}
else
{
<NavLink href="@pathFinder(DoorOpInst.DoorOpId)" target="_blank">
<button class="btnPDFPending">
<NavLink href="@pathFinder(DoorOpInst.DoorOpId, true)" target="_blank">
<button class="btnPdfPending">
<i class="fa-solid fa-file-pdf"></i>
</button>
</NavLink>
@@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using Newtonsoft.Json;
using NLog;
using System;
using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Data;
@@ -90,6 +91,10 @@ namespace WebDoorCreator.UI.Components.Hardware
protected List<ListValuesModel>? listValuesFiles { get; set; } = null!;
protected List<ListValuesModel>? listValuesFname { get; set; } = null!;
protected List<ListValuesModel>? listValuesHW { get; set; } = null!;
[Inject]
protected NavigationManager NavMan { get; set; } = null!;
protected List<string> ordListVal { get; set; } = new List<string>();
[Inject]
@@ -142,6 +147,9 @@ namespace WebDoorCreator.UI.Components.Hardware
[Inject]
protected WebDoorCreatorService WDCService { get; set; } = null!;
[Inject]
protected WDCUserService WDCUService { get; set; } = null!;
[Inject]
protected WDCVocabularyService WDVService { get; set; } = null!;
@@ -199,6 +207,12 @@ namespace WebDoorCreator.UI.Components.Hardware
// salvo i NUOVI valori...
DoorOpInst.CurrVals = dictValCurr;
DoorOpInst.GraphicParams = graphicParams;
// se debug + superadmin --> auto confirm
if (autoApprove && string.IsNullOrEmpty(DoorOpInst.userConfirm))
{
DoorOpInst.userConfirm = WDCUService.userId;
DoorOpInst.DtConfirm = DateTime.Now;
}
// salvo!
List<DoorOpModel> doorOpUpd = new List<DoorOpModel>() { DoorOpInst };
await WDCService.DoorOpUpdate(doorOpUpd);
@@ -211,6 +225,18 @@ namespace WebDoorCreator.UI.Components.Hardware
}
}
/// <summary>
/// Blazor: get query parm from the URL
/// </summary>
/// <param name="parmName"></param>
/// <returns></returns>
protected string GetQueryParm(string parmName)
{
var uriBuilder = new UriBuilder(NavMan.Uri);
var q = System.Web.HttpUtility.ParseQueryString(uriBuilder.Query);
return q[parmName] ?? "";
}
protected string getTrad(string objId)
{
string answ = "";
@@ -235,6 +261,12 @@ namespace WebDoorCreator.UI.Components.Hardware
hasChanged = currSer != origSer;
if (hasChanged)
{
// se debug + superadmin --> auto confirm
if (autoApprove && string.IsNullOrEmpty(DoorOpInst.userConfirm))
{
DoorOpInst.userConfirm = WDCUService.userId;
DoorOpInst.DtConfirm = DateTime.Now;
}
DoorOpInst.JsoncActVal = JsonConvert.SerializeObject(dictValCurr);
Task.Run(async () =>
{
@@ -256,6 +288,11 @@ namespace WebDoorCreator.UI.Components.Hardware
protected override void OnInitialized()
{
base.OnInitialized();
var currMode = GetQueryParm("currMode");
if (!string.IsNullOrEmpty(currMode) && WDCUService.userRole == "SuperAdmin")
{
autoApprove = currMode.Equals("debug");
}
string vers = config.GetValue<string>("ConfDDF:VersNumber");
bool remDoorOp = config.GetValue<bool>("ConfDDF:RemoveDoorOps");
var headRows = config.GetSection("ConfDDF:Header").Get<List<string>>();
@@ -328,6 +365,7 @@ namespace WebDoorCreator.UI.Components.Hardware
#region Private Fields
private static Logger Log = LogManager.GetCurrentClassLogger();
private bool autoApprove = false;
#endregion Private Fields
@@ -350,9 +388,9 @@ namespace WebDoorCreator.UI.Components.Hardware
await SetSelectedData();
}
private string pathFinder(int id)
private string pathFinder(int id, bool reqConf)
{
string answ = $"HwPdfConfirm?doorOpId={id}&doorId={DoorOpInst.DoorId}&objectId={DoorOpInst.ObjectId}";
string answ = $"HwPdfConfirm?doorOpId={id}&doorId={DoorOpInst.DoorId}&objectId={DoorOpInst.ObjectId}&reqConf={reqConf}";
return answ;
}
@@ -385,11 +423,11 @@ namespace WebDoorCreator.UI.Components.Hardware
if (tempListFilesTempl!.Count != 0)
{
listValuesFiles = tempListFilesTempl.Where(x => x.Value.Contains(folderName)).ToList();
listValuesFiles = tempListFilesTempl.Where(x => x.Value.Contains($"{folderName}\\")).ToList();
}
else if (tempListFilesSh!.Count != 0)
{
listValuesFiles = tempListFilesSh!.Where(x => x.Value.Contains(folderName)).ToList();
listValuesFiles = tempListFilesSh!.Where(x => x.Value.Contains($"{folderName}\\")).ToList();
}
try
{
@@ -1,7 +1,7 @@
.btnPDF {
border-radius: 50%;
width: 1.5rem;
height: 1.5rem;
width: 1.6rem;
height: 1.6rem;
border: 2px solid #00838F;
z-index: 99999;
}
@@ -30,15 +30,16 @@
background: #FFF;
/*transform: translate(1.6rem, -1rem);*/
}
.btnPDFSuccess {
.btnPdfSuccess {
border-radius: 50%;
width: 1.5rem;
height: 1.5rem;
width: 1.6rem;
height: 1.6rem;
border: 2px solid #00838F;
z-index: 99999;
background: #8E44AD;
background: #44AD8E;
color: #FFFFFF;
}
.btnPDFPending {
.btnPdfPending {
border-radius: 50%;
width: 3.5rem;
height: 3.5rem;
@@ -46,7 +47,7 @@
z-index: 99999;
background: #F1C40F;
}
.btnPDFSuccess > i {
.btnPdfSuccess > i {
font-size: 0.8rem;
}
.btnHighlight {
@@ -3,8 +3,8 @@
.btnPDF {
border-radius: 50%;
width: 1.5rem;
height: 1.5rem;
width: 1.6rem;
height: 1.6rem;
border: 2px solid #00838F;
z-index: 99999;
}
@@ -29,18 +29,19 @@
/*transform: translate(1.6rem, -1rem);*/
}
.btnPDFSuccess {
.btnPdfSuccess {
.btnPDF;
background: #8E44AD;
background: #44AD8E;
color: #FFFFFF;
}
.btnPDFPending {
.btnPdfPending {
.btnGen;
background: #F1C40F;
//transform: translate(20.3rem, 1rem);
}
.btnPDFSuccess > i {
.btnPdfSuccess > i {
font-size: 0.8rem;
}
@@ -1 +1 @@
.btnPDF{border-radius:50%;width:1.5rem;height:1.5rem;border:2px solid #00838f;z-index:99999;}.btnGen{border-radius:50%;width:3.5rem;height:3.5rem;border:5px solid #00838f;z-index:99999;}.btnDelete{border-radius:50%;width:3.5rem;height:3.5rem;border:5px solid #00838f;z-index:99999;background:#b71c1c;}.btnClone{border-radius:50%;width:3.5rem;height:3.5rem;border:5px solid #00838f;z-index:99999;background:#fff;}.btnPDFSuccess{border-radius:50%;width:1.5rem;height:1.5rem;border:2px solid #00838f;z-index:99999;background:#8e44ad;}.btnPDFPending{border-radius:50%;width:3.5rem;height:3.5rem;border:5px solid #00838f;z-index:99999;background:#f1c40f;}.btnPDFSuccess>i{font-size:.8rem;}.btnHighlight{border-radius:50%;width:3.5rem;height:3.5rem;border:5px solid #00838f;z-index:99999;background:#03a9f4;transform:translate(10.3rem,-8rem);}.btnCancel{border-radius:50%;width:3.5rem;height:3.5rem;border:5px solid #00838f;z-index:99999;background:var(--colorCode);}.btnSave{border-radius:50%;width:3.5rem;height:3.5rem;border:5px solid #00838f;z-index:99999;background:var(--colorCode);}.btnHeadTail{width:100%;padding:.8rem 0 .8rem 0;background:none;border:0;}.btnConfirm{width:100%;padding:.8rem 0 .8rem 0;background:none;border:0;border-bottom:3px solid #000;}.btnHead{width:100%;padding:.8rem 0 .8rem 0;background:none;border:0;}.borderTop{border-top:7px solid #00838f;}.borderBottom{border-bottom:7px solid #00838f;width:100%;}.modal-dialog{overflow-y:initial!important;}.modal-body{height:18.75rem;overflow-y:auto;}.testata{width:100%;}select,input{border:0;border-bottom:2px solid #000;background:none;height:2rem;}i{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;font-size:1.1rem;}.blue{background:#3652d9;}.grey{background:#7f8c8d;opacity:50%;}.circle{width:1rem;height:1rem;border-radius:50%;box-shadow:0 0 1px 1px #0000001a;}.pulse{animation:pulse-animation 2s infinite;}@keyframes pulse-animation{0%{box-shadow:0 0 0 0 rgba(0,0,0,.2);}100%{box-shadow:0 0 0 20px rgba(0,0,0,0);}}
.btnPDF{border-radius:50%;width:1.6rem;height:1.6rem;border:2px solid #00838f;z-index:99999;}.btnGen{border-radius:50%;width:3.5rem;height:3.5rem;border:5px solid #00838f;z-index:99999;}.btnDelete{border-radius:50%;width:3.5rem;height:3.5rem;border:5px solid #00838f;z-index:99999;background:#b71c1c;}.btnClone{border-radius:50%;width:3.5rem;height:3.5rem;border:5px solid #00838f;z-index:99999;background:#fff;}.btnPdfSuccess{border-radius:50%;width:1.6rem;height:1.6rem;border:2px solid #00838f;z-index:99999;background:#44ad8e;color:#fff;}.btnPdfPending{border-radius:50%;width:3.5rem;height:3.5rem;border:5px solid #00838f;z-index:99999;background:#f1c40f;}.btnPdfSuccess>i{font-size:.8rem;}.btnHighlight{border-radius:50%;width:3.5rem;height:3.5rem;border:5px solid #00838f;z-index:99999;background:#03a9f4;transform:translate(10.3rem,-8rem);}.btnCancel{border-radius:50%;width:3.5rem;height:3.5rem;border:5px solid #00838f;z-index:99999;background:var(--colorCode);}.btnSave{border-radius:50%;width:3.5rem;height:3.5rem;border:5px solid #00838f;z-index:99999;background:var(--colorCode);}.btnHeadTail{width:100%;padding:.8rem 0 .8rem 0;background:none;border:0;}.btnConfirm{width:100%;padding:.8rem 0 .8rem 0;background:none;border:0;border-bottom:3px solid #000;}.btnHead{width:100%;padding:.8rem 0 .8rem 0;background:none;border:0;}.borderTop{border-top:7px solid #00838f;}.borderBottom{border-bottom:7px solid #00838f;width:100%;}.modal-dialog{overflow-y:initial!important;}.modal-body{height:18.75rem;overflow-y:auto;}.testata{width:100%;}select,input{border:0;border-bottom:2px solid #000;background:none;height:2rem;}i{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;font-size:1.1rem;}.blue{background:#3652d9;}.grey{background:#7f8c8d;opacity:50%;}.circle{width:1rem;height:1rem;border-radius:50%;box-shadow:0 0 1px 1px #0000001a;}.pulse{animation:pulse-animation 2s infinite;}@keyframes pulse-animation{0%{box-shadow:0 0 0 0 rgba(0,0,0,.2);}100%{box-shadow:0 0 0 20px rgba(0,0,0,0);}}
@@ -1,5 +1,5 @@
<div class="p-5">
<DoorList currOrderId="@OrderView!.OrderId" orderTotCost="@OrderView!.TotCost" E_CurrDoor="SetCurrDoor" E_CurrDoorModal="SetCurrDoorModal" updateRecordCount="UpdateTotCount" actFilter="@currFilter"></DoorList>
<DoorList currOrderId="@CurrOrdId" orderTotCost="@OrderView!.TotCost" E_CurrDoor="SetCurrDoor" E_CurrDoorModal="SetCurrDoorModal" updateRecordCount="UpdateTotCount" actFilter="@currFilter"></DoorList>
<div class="mt-4">
<EgwCoreLib.Razor.DataPager @ref="pagerDoors" PageSize="@numRecord" currPage="@currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="@totalCount" showLoading="@isLoading" PageSizeList="@pageSizeList" />
</div>
@@ -1,9 +1,11 @@
using EgwCoreLib.Razor;
using Blazored.SessionStorage;
using EgwCoreLib.Razor;
using Microsoft.AspNetCore.Components;
using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.DTO;
using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Data;
using static WebDoorCreator.UI.Data.WDCRefreshService;
namespace WebDoorCreator.UI.Components.Order
{
@@ -23,6 +25,16 @@ namespace WebDoorCreator.UI.Components.Order
[Parameter]
public OrderStatusViewModel? OrderView { get; set; }
protected int CurrOrdId { get; set; } = 0;
protected override void OnParametersSet()
{
if (OrderView != null)
{
CurrOrdId = OrderView.OrderId;
}
}
public string userId
{
get
@@ -33,6 +45,12 @@ namespace WebDoorCreator.UI.Components.Order
#endregion Public Properties
#region Protected Fields
protected DataPager? pagerDoors = null!;
@@ -47,7 +65,7 @@ namespace WebDoorCreator.UI.Components.Order
protected DoorsSelectFilter currFilter { get; set; } = new DoorsSelectFilter();
/// <summary>
/// Unit di misura selezionata
/// Unita' di misura selezionata
/// </summary>
protected string currMeaUnit { get; set; } = "mm";
@@ -103,9 +121,17 @@ namespace WebDoorCreator.UI.Components.Order
currPage = newNum;
}
protected override void OnInitialized()
protected override async Task OnInitializedAsync()
{
numRecord = 16;
string rawVal = await sessStorage.GetItemAsStringAsync("doorsSelFilt");
if (!string.IsNullOrEmpty(rawVal))
{
currFilter = await sessStorage.GetItemAsync<DoorsSelectFilter>("doorsSelFilt");
}
else
{
numRecord = 16;
}
}
protected async Task SetCurrDoor(DoorModel door)
@@ -144,7 +170,10 @@ namespace WebDoorCreator.UI.Components.Order
private int currPage
{
get => currFilter.CurrPage;
set => currFilter.CurrPage = value;
set
{
currFilter.CurrPage = value;
}
}
private bool isLoading { get; set; } = false;
@@ -152,7 +181,15 @@ namespace WebDoorCreator.UI.Components.Order
private int numRecord
{
get => currFilter.NumRec;
set => currFilter.NumRec = value;
set
{
if (currFilter.NumRec != value)
{
currFilter.NumRec = value;
currPage = 1;
InvokeAsync(() => sessStorage.SetItemAsync<DoorsSelectFilter>("doorsSelFilt", currFilter));
}
}
}
private string searchValue
@@ -161,6 +198,9 @@ namespace WebDoorCreator.UI.Components.Order
set => currFilter.searchValue = value;
}
[Inject]
private ISessionStorageService sessStorage { get; set; } = null!;
#endregion Private Properties
}
}
@@ -39,11 +39,11 @@ else
@if (isEdit && item.OrderId == currOrderId)
{
<button class="btn btn-sm btn-success" @onclick="()=>editConfirm()" title="Save Order"><i class="fa-regular fa-floppy-disk"></i> Save</button>
<button class="btn btn-sm btn-secondary" @onclick="()=>editCancel()" title="Save Order"><i class="fa-solid fa-rotate-left"></i> Cancel</button>
<button class="btn btn-sm btn-secondary" @onclick="()=>editCancel()" title="Cancel Order"><i class="fa-solid fa-rotate-left"></i> Cancel</button>
}
else
{
<button class="btn btn-sm btn-primary me-1" @onclick="()=>setOrd2Show(item.OrderId)" title="Order detail"><i class="fa-solid fa-magnifying-glass"></i></button>
<button class="btn btn-sm btn-primary me-1" @onclick="()=>setOrd2Show(item.OrderId, true)" title="Order detail"><i class="fa-solid fa-magnifying-glass"></i></button>
<AuthorizeView Roles="SuperAdmin, DcaAdmin, DcaOrdMan, DcaProj" Context="OrderEdit">
<Authorized>
@if (item.OrderStatus < 30 || WDCUService.userRole == "DcaAdmin" || WDCUService.userRole == "SuperAdmin")
@@ -7,6 +7,7 @@ using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Data;
using static WebDoorCreator.Core.Enum;
using static WebDoorCreator.UI.Data.WDCRefreshService;
namespace WebDoorCreator.UI.Components.Order
{
@@ -76,7 +77,9 @@ namespace WebDoorCreator.UI.Components.Order
}
protected string currUser { get; set; } = "";
protected bool isEdit { get; set; } = false;
protected bool isModRole { get; set; } = false;
[Inject]
@@ -89,8 +92,11 @@ namespace WebDoorCreator.UI.Components.Order
protected NavigationManager NavManager { get; set; } = null!;
protected bool ordByCode { get; set; } = false;
protected bool ordByDate { get; set; } = false;
protected int screenX { get; set; } = 0;
protected int screenY { get; set; } = 0;
protected List<string>? userClaims
@@ -185,21 +191,6 @@ namespace WebDoorCreator.UI.Components.Order
return answ;
}
protected string getOrderStatusLabel(int orderStat)
{
string answ = "";
if (ListValuesAll != null)
{
var currOrdStat = ListValuesAll.Where(x => int.Parse(x.Value) == orderStat).FirstOrDefault();
if (currOrdStat != null)
{
answ = currOrdStat.Label;
}
}
return answ;
}
protected string getOrderStatusColor(int orderStat)
{
string answ = "";
@@ -216,6 +207,22 @@ namespace WebDoorCreator.UI.Components.Order
return answ;
}
protected string getOrderStatusLabel(int orderStat)
{
string answ = "";
if (ListValuesAll != null)
{
var currOrdStat = ListValuesAll.Where(x => int.Parse(x.Value) == orderStat).FirstOrDefault();
if (currOrdStat != null)
{
answ = currOrdStat.Label;
}
}
return answ;
}
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
@@ -224,7 +231,7 @@ namespace WebDoorCreator.UI.Components.Order
if (localOrdId != 0)
{
await setOrd2Show(localOrdId);
await setOrd2Show(localOrdId, false);
}
}
}
@@ -267,16 +274,27 @@ namespace WebDoorCreator.UI.Components.Order
return $"api/Report/GetOrderReport?OrderId={orderId}&Format=PDF";
}
protected async Task setOrd2Show(int orderId)
protected async Task setOrd2Show(int orderId, bool doSave)
{
await Task.Delay(1);
if (ListOrdersStatus == null && !isLoading)
{
await ReloadData();
}
else
{
await Task.Delay(200);
}
if (ListOrdersStatus != null)
{
var chosenOrd = ListOrdersStatus.Where(x => x.OrderId == orderId).FirstOrDefault();
if (chosenOrd != null)
{
Ord2Show = chosenOrd;
await localStorage.SetItemAsync("OrderId", orderId);
if (doSave)
{
await localStorage.SetItemAsync("OrderId", orderId);
}
await E_SetOrd2Show.InvokeAsync(chosenOrd);
}
}
@@ -321,10 +339,15 @@ namespace WebDoorCreator.UI.Components.Order
#region Private Fields
private DateTime dateLimit = new DateTime(2000, 1, 1);
private bool isLoading = false;
private Dictionary<int, string> ListCompany = new Dictionary<int, string>();
private List<OrderStatusViewModel>? ListOrdersStatus = null;
private List<ListValuesModel>? ListValuesAll = null;
private List<OrderStatusViewModel>? SearchRecords = null;
private bool sortAsc = true;
private string sortField = "";
@@ -406,6 +429,7 @@ namespace WebDoorCreator.UI.Components.Order
private async Task ReloadData()
{
isLoading = true;
ListOrdersStatus = null;
var domani = DateTime.Today.AddDays(1);
@@ -502,7 +526,6 @@ namespace WebDoorCreator.UI.Components.Order
}
break;
case "OrdStatus":
if (sortAsc)
{
@@ -514,7 +537,6 @@ namespace WebDoorCreator.UI.Components.Order
}
break;
case "Qty":
if (sortAsc)
{
@@ -533,8 +555,7 @@ namespace WebDoorCreator.UI.Components.Order
}
}
}
await Task.Delay(1);
isLoading = false;
await InvokeAsync(StateHasChanged);
}
@@ -25,7 +25,7 @@
</div>
<div class="mt-2">
<EgwCoreLib.Razor.DataPager @ref="pagerOrderHP" PageSize="@numRecord" currPage="@currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="@totalCount" showLoading="@isLoading" />
<EgwCoreLib.Razor.DataPager @ref="pagerOrderHP" PageSize="@numRecord" currPage="@currPage" numRecordChanged="SetNumRec" numPageChanged="SetPage" totalCount="@totalCount" showLoading="@isLoading" />
</div>
</div>
}
@@ -1,10 +1,12 @@
using Blazored.LocalStorage;
using Blazored.SessionStorage;
using EgwCoreLib.Razor;
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Data;
using static WebDoorCreator.UI.Data.WDCRefreshService;
namespace WebDoorCreator.UI.Components.Order
{
@@ -12,12 +14,12 @@ namespace WebDoorCreator.UI.Components.Order
{
#region Public Properties
[CascadingParameter]
public bool isTplPage { get; set; } = false;
[Parameter]
public EventCallback<AspNetUsers> E_currUser { get; set; }
[CascadingParameter]
public bool isTplPage { get; set; } = false;
public string userId
{
get
@@ -26,8 +28,6 @@ namespace WebDoorCreator.UI.Components.Order
}
}
[Inject]
protected WDCVocabularyService WDCVService { get; set; } = null!;
#endregion Public Properties
@@ -38,6 +38,7 @@ namespace WebDoorCreator.UI.Components.Order
WDCUService.EA_UserCurrCompany -= OnNewUserCurrComp;
}
public async void OnNewUserCurrComp()
{
await Task.Delay(1);
@@ -52,12 +53,21 @@ namespace WebDoorCreator.UI.Components.Order
#region Protected Fields
protected string _doorExtCode = "";
protected int _doorQuantity = 0;
protected string _orderCodExt = "";
protected string _orderDescr = "";
protected bool cloneReq = false;
protected string Lingua = "EN";
protected bool newOrdReq = false;
protected int ordIdOrig = 0;
protected DataPager? pagerOrderHP = null!;
#endregion Protected Fields
@@ -65,12 +75,19 @@ namespace WebDoorCreator.UI.Components.Order
#region Protected Properties
protected DoorModel? currDoor { get; set; } = null;
protected DoorModel? currDoorModal { get; set; } = null;
protected int currParentId { get; set; } = 0;
protected OrderSelectFilter currFilter { get; set; } = new OrderSelectFilter();
protected int CurrLevel { get; set; } = 1;
protected int currOrderId { get; set; } = 0;
protected int currParentId { get; set; } = 0;
protected AspNetUsers? currUser { get; set; } = null;
protected bool doorChange { get; set; } = false;
protected string doorExtCode
@@ -86,7 +103,9 @@ namespace WebDoorCreator.UI.Components.Order
}
protected List<DoorModel>? DoorsList { get; set; } = null;
protected string goToDefPage { get; set; } = "";
protected bool isModRole { get; set; } = false;
[Inject]
@@ -125,47 +144,21 @@ namespace WebDoorCreator.UI.Components.Order
protected List<UsersViewModel>? UsersList { get; set; } = null;
[Inject]
protected WDCVocabularyService VocService { get; set; } = null!;
[Inject]
protected WDCUserService WDCUService { get; set; } = null!;
[Inject]
protected WebDoorCreatorService WDService { get; set; } = null!;
protected WDCVocabularyService WDCVService { get; set; } = null!;
[Inject]
protected WDCVocabularyService VocService { get; set; } = null!;
protected WebDoorCreatorService WDService { get; set; } = null!;
#endregion Protected Properties
private List<ListValuesModel>? ListValuesAll = null;
#region Protected Methods
protected string translate(string lemma)
{
return VocService.Traduci(WDCUService.currLanguage ?? "EN", lemma);
}
/// <summary>
/// Traduzione condizionale
/// </summary>
/// <param name="condition">valore condizione</param>
/// <param name="lemmaCF">lemma caso FALSE</param>
/// <param name="lemmaCT">lemma caso TRUE</param>
/// <returns></returns>
protected string translOpt(bool condition, string lemmaCF, string lemmaCT)
{
string answ = "";
if (condition)
{
answ = VocService.Traduci(WDCUService.currLanguage ?? "EN", lemmaCT);
}
else
{
answ = VocService.Traduci(WDCUService.currLanguage ?? "EN", lemmaCF);
}
return answ;
}
protected string Lingua = "EN";
protected async Task addNewOrder(string userName, bool saveAsTemplate)
{
@@ -282,16 +275,61 @@ namespace WebDoorCreator.UI.Components.Order
currDoor = null;
}
protected void ForceReload(int newNum)
protected void SetNumRec(int newNum)
{
currPage = 1;
numRecord = newNum;
}
protected void ForceReloadPage(int newNum)
protected void SetPage(int newNum)
{
currPage = newNum;
}
protected string getOrderStatusColor(int orderStat)
{
string answ = "";
if (ListValuesAll != null)
{
var currOrdStat = ListValuesAll.Where(x => int.Parse(x.Value) == orderStat).FirstOrDefault();
if (currOrdStat != null)
{
answ = currOrdStat.DefaultVal;
}
}
return answ;
}
protected string getOrderStatusLabel(int orderStat)
{
string answ = "";
if (ListValuesAll != null)
{
var currOrdStat = ListValuesAll.Where(x => int.Parse(x.Value) == orderStat).FirstOrDefault();
if (currOrdStat != null)
{
answ = currOrdStat.Label;
}
}
return answ.ToUpper();
}
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
string rawVal = await sessStorage.GetItemAsStringAsync("ordSelFilt");
if (!string.IsNullOrEmpty(rawVal))
{
currFilter = await sessStorage.GetItemAsync<OrderSelectFilter>("ordSelFilt");
}
}
}
protected override async Task OnInitializedAsync()
{
await Task.Delay(1);
@@ -300,6 +338,7 @@ namespace WebDoorCreator.UI.Components.Order
WDCUService.EA_UserCurrCompany += OnNewUserCurrComp;
}
protected async Task ReloadData()
{
DoorsList = await WDService.DoorGetByOrderId(currOrderId);
@@ -388,6 +427,32 @@ namespace WebDoorCreator.UI.Components.Order
StateHasChanged();
}
protected string translate(string lemma)
{
return VocService.Traduci(WDCUService.currLanguage ?? "EN", lemma);
}
/// <summary>
/// Traduzione condizionale
/// </summary>
/// <param name="condition">valore condizione</param>
/// <param name="lemmaCF">lemma caso FALSE</param>
/// <param name="lemmaCT">lemma caso TRUE</param>
/// <returns></returns>
protected string translOpt(bool condition, string lemmaCF, string lemmaCT)
{
string answ = "";
if (condition)
{
answ = VocService.Traduci(WDCUService.currLanguage ?? "EN", lemmaCT);
}
else
{
answ = VocService.Traduci(WDCUService.currLanguage ?? "EN", lemmaCF);
}
return answ;
}
protected void UpdateTotCount(int newTotCount)
{
totalCount = newTotCount;
@@ -395,6 +460,12 @@ namespace WebDoorCreator.UI.Components.Order
#endregion Protected Methods
#region Private Fields
private List<ListValuesModel>? ListValuesAll = null;
#endregion Private Fields
#region Private Properties
private int currPage
@@ -423,7 +494,14 @@ namespace WebDoorCreator.UI.Components.Order
private int numRecord
{
get => currFilter.NumRec;
set => currFilter.NumRec = value;
set
{
if (currFilter.NumRec != value)
{
currFilter.NumRec = value;
InvokeAsync(() => sessStorage.SetItemAsync<OrderSelectFilter>("ordSelFilt", currFilter));
}
}
}
private int orderStatus
@@ -438,39 +516,11 @@ namespace WebDoorCreator.UI.Components.Order
set => currFilter.searchValue = value;
}
[Inject]
private ISessionStorageService sessStorage { get; set; } = null!;
#endregion Private Properties
protected string getOrderStatusLabel(int orderStat)
{
string answ = "";
if (ListValuesAll != null)
{
var currOrdStat = ListValuesAll.Where(x => int.Parse(x.Value) == orderStat).FirstOrDefault();
if (currOrdStat != null)
{
answ = currOrdStat.Label;
}
}
return answ.ToUpper();
}
protected string getOrderStatusColor(int orderStat)
{
string answ = "";
if (ListValuesAll != null)
{
var currOrdStat = ListValuesAll.Where(x => int.Parse(x.Value) == orderStat).FirstOrDefault();
if (currOrdStat != null)
{
answ = currOrdStat.DefaultVal;
}
}
return answ;
}
#region Private Methods
private async Task doCalcSVG(int orderId)
@@ -515,6 +565,7 @@ namespace WebDoorCreator.UI.Components.Order
await Task.Delay(1);
await InvokeAsync(() => StateHasChanged());
currFilter = newParams;
await sessStorage.SetItemAsync<OrderSelectFilter>("ordSelFilt", newParams);
isLoading = false;
}
@@ -7,7 +7,7 @@
<rect x="0" y="0" width="100%" height="100%" fill="#34495E"></rect>
<image href="@ImagePath" height="100%" width="100%" clip-path="url(#theClippingPath)"></image>
<path d="@PathLineData" stroke="@LineColor" stroke-width="@LineWidth" fill="none" />
<g transform="translate(0,@(ObjH/4))">
<g transform="translate(0,@(ObjH/8))">
<foreignObject width="@(ObjW/2)" height="@(ObjH/2)">
<div class="row text-white text-center">
<div style="@TitleStyle" class="text-uppercase">
@@ -18,11 +18,23 @@
</div>
@if (isLogged)
{
<div class="mt-5">
<button class="btn btn-lg btn-primary rounded-pill p-3 px-4 text-uppercase" @onclick="() => raiseEvent()">
<div class="mt-5" style="font-size: 30px;">
@* <button class="btn btn-lg btn-primary rounded-pill p-3 px-4 text-uppercase" @onclick="() => raiseEvent(null)">
@ButtonText
</button>
</div>
</button> *@
@if (ButtonsList != null && ButtonsList.Count > 0)
{
foreach (var item in ButtonsList)
{
<button class="mx-2 my-3 @item.Css" @onclick="() => raiseEvent(item.RetPage)" title="@item.Title">
@item.Text&nbsp; <i class="@item.Icon"></i>
@* <div class="small">
@item.BtnDescript
</div> *@
</button>
}
}
</div>
}
</div>
</foreignObject>
@@ -19,7 +19,10 @@ namespace WebDoorCreator.UI.Components.SvgComp
public string ButtonText { get; set; } = "Button Text";
[Parameter]
public EventCallback<bool> EC_ExeFunct { get; set; }
public List<ButtonData> ButtonsList { get; set; } = new List<ButtonData>();
[Parameter]
public EventCallback<string> EC_ExeFunct { get; set; }
[Parameter]
public string ImagePath { get; set; } = "images/DOORBG.png";
@@ -72,6 +75,18 @@ namespace WebDoorCreator.UI.Components.SvgComp
}
}
public class ButtonData
{
public string Css { get; set; } = "btn btn-lg btn-primary rounded-pill p-3 px-4 text-uppercase";
public string Text { get; set; } = "Button";
public string Title { get; set; } = "Button Suggestion";
public string Descript { get; set; } = "...";
public string Icon { get; set; } = "fa fa-home";
public string RetPage { get; set; } = "home";
}
protected List<PointData> PathLine { get; set; } = null!;
protected string PathLineData
@@ -97,7 +112,7 @@ namespace WebDoorCreator.UI.Components.SvgComp
protected void execFunc()
{
EC_ExeFunct.InvokeAsync(true);
EC_ExeFunct.InvokeAsync("");
}
protected override void OnParametersSet()
@@ -157,9 +172,10 @@ namespace WebDoorCreator.UI.Components.SvgComp
#endregion Public Properties
}
protected async Task raiseEvent()
protected async Task raiseEvent(string? retPage)
{
await EC_ExeFunct.InvokeAsync(true);
retPage = retPage ?? "Home";
await EC_ExeFunct.InvokeAsync(retPage);
}
#endregion Protected Classes
@@ -24,7 +24,7 @@
</div>
@if (DoorsList == null || DoorsList.Count == 0)
{
<LoadingDataSmall></LoadingDataSmall>
<LoadingData DisplaySize="LoadingData.CtrlSize.Small"></LoadingData>
}
else
{
@@ -15,16 +15,18 @@ namespace WebDoorCreator.UI.Controllers
public DoorImageController(IConfiguration configuration, QueueDataService cQDService, WebDoorCreatorService cWDCService)
{
Log.Info("Starting DoorImageController");
Log.Trace("Starting DoorImageController");
_configuration = configuration;
WaitReloadSvg = _configuration.GetValue<int>("RuntimeOpt:WaitReloadSvg");
QDService = cQDService;
WDService = cWDCService;
Log.Info("Avviato DoorImageController");
Log.Trace("Avviato DoorImageController");
}
#endregion Public Constructors
private Random rnd = new Random();
#region Public Methods
// GET: api/DoorImage
@@ -41,8 +43,25 @@ namespace WebDoorCreator.UI.Controllers
// se fosse vuoto...
if (string.IsNullOrEmpty(svgContent))
{
// richiede ricalcolo img
svgContent = await SendRecalcReq(DoorId);
string vetoReq = await QDService.DoorProcVetoGetAsync(DoorId);
if (string.IsNullOrEmpty(vetoReq))
{
await QDService.DoorProcVetoSetAsync(DoorId, WaitReloadSvg * 20);
// richiede ricalcolo img
await SendRecalcReq(DoorId);
// attende ...
await Task.Delay(WaitReloadSvg);
// riprova lettura
svgContent = await QDService.DoorGetLastSvg(DoorId);
}
else
{
// attesa causale per vedere SE riesce a leggere ugualmente...faccio rand (4..10)*wait reload...
await Task.Delay(WaitReloadSvg * rnd.Next(4, 10));
// riprovo lettura
svgContent = await QDService.DoorGetLastSvg(DoorId);
}
}
// se fosse vuoto...
if (string.IsNullOrEmpty(svgContent))
@@ -79,27 +98,22 @@ namespace WebDoorCreator.UI.Controllers
/// </summary>
/// <param name="DoorId"></param>
/// <returns></returns>
private async Task<string> SendRecalcReq(int DoorId)
private async Task 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)
{
// richiede ricalcolo img
List<string> doorIdList = new List<string>() { $"{DoorId}" };
// chiamo reset richieste
var list2Proc = await QDService.ResetQueueByDoorList(doorIdList);
await Task.Delay(WaitReloadSvg);
// recupero DDF ed invio x processing
string currDDF = await WDService.DoorOpGetDDF(DoorId);
// versione corrente del DDF generato
int currVers = await QDService.SendCalcReq(DoorId, currDDF);
await Task.Delay(WaitReloadSvg);
}
// attende ...
await Task.Delay(WaitReloadSvg);
// riprova lettura
answ = await QDService.DoorGetLastSvg(DoorId);
return answ;
}
#endregion Private Methods
+62 -20
View File
@@ -1,5 +1,8 @@
using Microsoft.AspNetCore.Components;
using WebDoorCreator.Data;
using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.Services;
using static Org.BouncyCastle.Math.EC.ECCurve;
namespace WebDoorCreator.UI.Data
{
@@ -7,35 +10,30 @@ namespace WebDoorCreator.UI.Data
{
#region Public Events
public event Action EA_UpdDoorOp = null!;
public event EventHandler EA_ConfDoorOp = delegate { };
public event EventHandler EA_OrderChanged = delegate { };
public event Action EA_UpdDoorOp = null!;
#endregion Public Events
#region Public Properties
public bool isDoorOpUpd
{
get => _isDoorOpUpd;
set
{
_isDoorOpUpd = value;
reportDoorOpUpd();
_isDoorOpUpd = value;
reportDoorOpUpd();
}
}
#endregion Public Properties
#region Protected Methods
#region Public Methods
protected void reportDoorOpUpd()
{
if (EA_UpdDoorOp != null)
{
EA_UpdDoorOp?.Invoke();
}
}
public void ReportDoorOpConf(int doorId, int doorOpId, string objId)
{
DOPEventArgs currOpr = new DOPEventArgs()
@@ -50,19 +48,63 @@ namespace WebDoorCreator.UI.Data
EA_ConfDoorOp(this, currOpr);
}
}
public void ReportOrderChanged(int orderId)
{
OrdEventArgs currOpr = new OrdEventArgs()
{
OrderId = orderId
};
// se qualcuno ascolta sollevo evento nuovo valore...
if (EA_OrderChanged != null)
{
EA_OrderChanged(this, currOpr);
}
}
#endregion Public Methods
#region Public Classes
public class DOPEventArgs : EventArgs
{
#region Public Properties
public int DoorId { get; set; } = 0;
public int DoorOpId { get; set; } = 0;
public string ObjectId { get; set; } = "";
#endregion Public Properties
}
public class OrdEventArgs : EventArgs
{
#region Public Properties
public int OrderId { get; set; } = 0;
#endregion Public Properties
}
#endregion Public Classes
#region Protected Methods
protected void reportDoorOpUpd()
{
if (EA_UpdDoorOp != null)
{
EA_UpdDoorOp?.Invoke();
}
}
#endregion Protected Methods
#region Private Properties
private bool _isDoorOpUpd { get; set; } = false;
private bool _isDoorOpConf { get; set; } = false;
#endregion Private Properties
private bool _isDoorOpUpd { get; set; } = false;
public class DOPEventArgs : EventArgs
{
public int DoorId { get; set; } = 0;
public int DoorOpId { get; set; } = 0;
public string ObjectId { get; set; } = "";
}
#endregion Private Properties
}
}
+102
View File
@@ -0,0 +1,102 @@
using Microsoft.Extensions.Diagnostics.HealthChecks;
using NLog;
using System.Net.NetworkInformation;
using WebDoorCreator.Data;
using WebDoorCreator.UI.Components.Users;
namespace WebDoorCreator.UI.Health
{
public class Checks
{
#region Public Methods
public static async Task<HealthCheckResult> ConfigCount(IConfiguration _config)
{
string description = "Try check Config table";
var healthCheckData = new Dictionary<string, object>();
using (WDCDataContext localDbCtx = new WDCDataContext(_config))
{
var dbCount = localDbCtx
.DbSetConfig
.Count();
if (dbCount > 0)
{
description = $"Check Config table, found {dbCount} records";
healthCheckData.Add("Count", dbCount);
return HealthCheckResult.Healthy(description, healthCheckData);
}
}
await Task.Delay(1);
return HealthCheckResult.Unhealthy(description + $" NO RECORD found", null, healthCheckData);
}
public static async Task<HealthCheckResult> DoorsCount(IConfiguration _config)
{
string description = "Try check DOOR table";
var healthCheckData = new Dictionary<string, object>();
using (WDCDataContext localDbCtx = new WDCDataContext(_config))
{
var dbCount = localDbCtx
.DbSetDoor
.Count();
if (dbCount > 0)
{
description = $"Check DOOR table, found {dbCount} records";
healthCheckData.Add("Count", dbCount);
return HealthCheckResult.Healthy(description, healthCheckData);
}
}
await Task.Delay(1);
return HealthCheckResult.Unhealthy(description + $" NO RECORD found", null, healthCheckData);
}
public static async Task<HealthCheckResult> OrdersCount(IConfiguration _config)
{
string description = "Try check ORDER table";
var healthCheckData = new Dictionary<string, object>();
using (WDCDataContext localDbCtx = new WDCDataContext(_config))
{
var dbCount = localDbCtx
.DbSetOrders
.Count();
if (dbCount > 0)
{
description = $"Check ORDER table, found {dbCount} records";
healthCheckData.Add("Count", dbCount);
return HealthCheckResult.Healthy(description, healthCheckData);
}
}
await Task.Delay(1);
return HealthCheckResult.Unhealthy(description + $" NO RECORD found", null, healthCheckData);
}
public static async Task<HealthCheckResult> PingCheck(string hostName)
{
var description = $"Ping to {hostName}";
var healthCheckData = new Dictionary<string, object>();
using (var thePing = new Ping())
{
var pingResult = await thePing.SendPingAsync(hostName);
healthCheckData.Add("RoundTripMS", pingResult.RoundtripTime);
healthCheckData.Add("ActualIPAddress", pingResult.Address.ToString());
if (pingResult.Status == IPStatus.Success)
{
description += $" - {pingResult.RoundtripTime}ms";
return HealthCheckResult.Healthy(description, healthCheckData);
}
}
return HealthCheckResult.Unhealthy(description + $" {hostName}", null, healthCheckData);
}
#endregion Public Methods
#region Private Fields
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
}
}
+3 -2
View File
@@ -1,5 +1,6 @@
@page "/ForceReload"
<h3>Refreshing Data</h3>
<LoadingData Title="Reloading Data" DisplayMode="LoadingData.SpinMode.Growl" DisplaySize="LoadingData.CtrlSize.Large"></LoadingData>
<LoadingData></LoadingData>
<ProgressDisplay Title="@titleMsg" CurrVal="@currVal" NextVal="@nextVal" MaxVal="@maxVal" ExpTimeMSec="100"></ProgressDisplay>
+20 -1
View File
@@ -23,12 +23,31 @@ namespace WebDoorCreator.UI.Pages
protected override async Task OnInitializedAsync()
{
currVal = 0;
nextVal = 1;
await Task.Delay(100);
currVal++;
nextVal++;
await WDService.FlushCustomPattern("Cache");
await Task.Delay(1);
currVal++;
nextVal++;
await Task.Delay(200);
currVal++;
nextVal++;
await WDCVService.ReloadVoc();
currVal++;
nextVal++;
await Task.Delay(200);
currVal++;
nextVal++;
NavManager.NavigateTo("OrdersHomePage", true);
}
private int currVal = 0;
private int nextVal = 1;
private int maxVal = 6;
private string titleMsg = "Clearing cache...";
#endregion Protected Methods
}
}
+18 -7
View File
@@ -3,13 +3,24 @@
@if (currDoorOp != null)
{
<div>
<div class="col-10 text-center mb-2">
Please press
<button class="btn btn-outline-dark" style="cursor: pointer;" @onclick="()=>doConfirm()">
CONFIRM
</button>
after reading the whole Document
<div class="col-12 text-center mb-2">
@if (reqConf)
{
<button class="btn btn-outline-dark" style="cursor: pointer;" @onclick="()=>doConfirm()">
Press <b>HERE to CONFIRM</b> after reading the whole Document
</button>
}
else
{
<button class="btn btn-outline-primary" style="cursor: pointer;" @onclick="()=>doClose()">
Press <b>here</b> to close the Document
</button>
}
</div>
<div class="bg-light p-1">
@* <b>@docUrl</b> *@
<PdfDisplay Width="100%" PdfUrl="@docUrl" HeightList="@heightList"></PdfDisplay>
</div>
<embed src="Docs/1001.pdf" width="100%" height="800px" />
</div>
}
+111 -1
View File
@@ -1,27 +1,48 @@
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.WebUtilities;
using Microsoft.JSInterop;
using Newtonsoft.Json;
using System.Text;
using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Data;
using static Org.BouncyCastle.Math.EC.ECCurve;
namespace WebDoorCreator.UI.Pages
{
public partial class HwPdfConfirm
{
#region Protected Fields
protected int doorId = 0;
protected string objectId = "";
#endregion Protected Fields
#region Protected Properties
protected List<DoorOpModel> allDoorOps { get; set; } = new List<DoorOpModel>();
[Inject]
protected IConfiguration config { get; set; } = null!;
protected WebDoorCreator.Data.DDF.Converter currDdfConv { get; set; } = null!;
protected DoorOpModel currDoorOp { get; set; } = new DoorOpModel();
protected int doorOpId { get; set; } = 0;
[Inject]
protected IJSRuntime JSRuntime { get; set; } = null!;
[Inject]
protected NavigationManager NavManager { get; set; } = null!;
[Inject]
protected QueueDataService QDataServ { get; set; } = null!;
protected bool reqConf { get; set; } = false;
protected string userLang
{
get => WDCUService.currLanguage ?? "EN";
@@ -33,12 +54,17 @@ namespace WebDoorCreator.UI.Pages
[Inject]
protected WDCUserService WDCUService { get; set; } = null!;
[Inject]
protected WDCRefreshService WDRService { get; set; } = null!;
[Inject]
protected WebDoorCreatorService WDService { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
protected bool checkIfConf()
{
bool answ = false;
@@ -63,6 +89,14 @@ namespace WebDoorCreator.UI.Pages
return answ;
}
protected async Task doClose()
{
// ora chiudo!
await Task.Delay(50);
await JSRuntime.InvokeVoidAsync("window.close");
await Task.Delay(50);
}
protected async Task doConfirm()
{
currDoorOp.userConfirm = WDCUService.userId;
@@ -71,12 +105,32 @@ namespace WebDoorCreator.UI.Pages
var doorOps2Save = new List<DoorOpModel>() { currDoorOp };
var done = await WDService.DoorOpUpdate(doorOps2Save);
if (done)
{
// ricalcola!
await refreshSVG();
// piccola attesa..
await Task.Delay(50);
// riporto update...
WDRService.ReportDoorOpConf(doorId, doorOpId, objectId);
// ora chiudo!
await Task.Delay(50);
await JSRuntime.InvokeVoidAsync("window.close");
await Task.Delay(50);
}
}
protected override void OnInitialized()
{
base.OnInitialized();
string vers = config.GetValue<string>("ConfDDF:VersNumber");
bool remDoorOp = config.GetValue<bool>("ConfDDF:RemoveDoorOps");
var headRows = config.GetSection("ConfDDF:Header").Get<List<string>>();
var footRows = config.GetSection("ConfDDF:Footer").Get<List<string>>();
currDdfConv = new WebDoorCreator.Data.DDF.Converter(vers, remDoorOp, headRows, footRows);
}
protected override async Task OnInitializedAsync()
{
await Task.Delay(1);
@@ -91,6 +145,10 @@ namespace WebDoorCreator.UI.Pages
{
int.TryParse(sDoorId, out doorId);
}
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("reqConf", out var sReqConf))
{
reqConf = bool.Parse(sReqConf);
}
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("doorOpId", out var sDoorOpId))
{
doorOpId = int.Parse(sDoorOpId);
@@ -98,14 +156,66 @@ namespace WebDoorCreator.UI.Pages
}
}
/// <summary>
/// Effettua generazione DDF + refresh SVG
/// </summary>
/// <returns></returns>
protected async Task refreshSVG()
{
List<DoorOpModel>? listOpAll = await WDService.DoorOpGetByDoorId(doorId);
if (listOpAll != null)
{
List<string> ordListVal = new List<string>();
List<DoorOpModel> listOp = listOpAll.Where(x => x.userConfirm != "" && x.DtConfirm != null).ToList();
if (listOp != null)
{
// chiamo metodo x avere DDF serializzato
var CurrentCompoOrder = await WDService.ListValuesGetAll("*", "Hardware");
if (CurrentCompoOrder != null)
{
foreach (var item in CurrentCompoOrder.OrderBy(x => x.Ordinal).ToList())
{
ordListVal.Add(item.TableName);
}
}
listOp = listOp.OrderBy(d => ordListVal.IndexOf(d.ObjectId)).ToList();
string currDdf = currDdfConv.GetSerialized(listOp);
// versione corrente del DDF generato
int currVers = await QDataServ.SendCalcReq(doorId, currDdf);
}
}
}
protected async Task ReloadData()
{
currDoorOp = await WDService.DoorOpGetById(doorOpId);
docUrl = "Docs/1001.pdf";
if (currDoorOp != null)
{
allDoorOps = await WDService.DoorOpGetByDoorId(currDoorOp.DoorId);
if (currDoorOp.CurrVals.ContainsKey("template"))
{
docUrl = $"docs/{objectId}/{currDoorOp.CurrVals["template"]}.pdf";
}
}
await Task.Delay(1);
// fin finale caratteri! space Stripe: " " --> "_"
docUrl = docUrl.Replace(" ", "_").Replace(@"\", "/");
}
#endregion Protected Methods
#region Private Fields
private string docUrl = "";
#endregion Private Fields
#region Private Properties
private Dictionary<string, string> heightList { get; set; } = new Dictionary<string, string>() { { "200", "200px" }, { "400", "400px" }, { "600", "600px" }, { "800", "800px" }, { "1000", "1000px" }, { "1200", "1200px" }, { "1400", "1400px" } };
#endregion Private Properties
}
}
+1 -1
View File
@@ -8,7 +8,7 @@
<div class="shadow-lg">
<AuthorizeView>
<Authorized>
<HomeCard ObjH="1080" ObjW="1920" StartPoint="850" LineWidth="18" TitleText="Web Door Creator" BodyText="The new way to create doors" ImagePath="images/HeroSecDoor.png" EC_ExeFunct="changePage" ButtonText="@translate("UI_00")" isLogged="true"></HomeCard>
<HomeCard ObjH="1080" ObjW="1920" StartPoint="850" LineWidth="18" TitleText="Web Door Creator" BodyText="The new way to create doors" ImagePath="images/HeroSecDoor.png" EC_ExeFunct="changePage" ButtonText="@translate("UI_00")" isLogged="true" ButtonsList="@BtnList"></HomeCard>
</Authorized>
<NotAuthorized>
<HomeCard ObjH="1080" ObjW="1920" StartPoint="850" LineWidth="18" TitleText="Web Door Creator" BodyText="The new way to create doors" ImagePath="images/HeroSecDoor.png" EC_ExeFunct="changePage" ButtonText="@translate("UI_00")" isLogged="false"></HomeCard>
+41 -1
View File
@@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Components;
using WebDoorCreator.UI.Components.SvgComp;
using WebDoorCreator.UI.Data;
namespace WebDoorCreator.UI.Pages
@@ -21,7 +22,46 @@ namespace WebDoorCreator.UI.Pages
return answ;
}
protected async Task changePage(bool newPage)
protected List<HomeCard.ButtonData> BtnList { get; set; } = new List<HomeCard.ButtonData>();
protected override void OnInitialized()
{
BtnList = new List<HomeCard.ButtonData>();
BtnList.Add(new HomeCard.ButtonData
{
Text = "Import Orders",
Css = "btn btn-lg btn-primary rounded-pill py-3 px-5 text-uppercase fs-3",
Icon = "fa-regular fa-file-code",
Title = "Go To Import page for third-party order import",
Descript = "Import from CSV, XML, Json",
RetPage = "ImportOrders"
});
BtnList.Add(new HomeCard.ButtonData
{
Text = "Manage Orders",
Css = "btn btn-lg btn-primary rounded-pill py-3 px-5 text-uppercase fs-3",
Icon = "fa-solid fa-cart-shopping",
Title = "Go To Order Management page",
Descript = "",
RetPage = "OrdersHomePage"
});
BtnList.Add(new HomeCard.ButtonData
{
Text = "Design Doors",
Css = "btn btn-lg btn-primary rounded-pill py-3 px-5 text-uppercase fs-3",
Icon = "fa-solid fa-door-open",
Title = "Go To Door Design Page",
Descript = "",
RetPage = "DoorDesignPage"
});
}
/// <summary>
/// Route to desider page
/// </summary>
/// <param name="newPage"></param>
/// <returns></returns>
protected async Task changePage(string newPage)
{
await Task.Delay(1);
NavManager.NavigateTo("OrdersHomePage");
@@ -0,0 +1,99 @@
@page "/ModeSelector"
<div class="d-flex justify-content-between">
<div class="px-2">
<div class="card shadow" style="width: 20rem; height:22rem;">
<div class="card-header d-flex py-3 fs-1 justify-content-evenly">
<div class="px-2">
<i class="fa-regular fa-file-excel"></i>
</div>
<div class="px-2">
<i class="fa-solid fa-file-csv"></i>
</div>
<div class="px-2">
<i class="fa-regular fa-file-code"></i>
</div>
</div>
<div class="card-body">
<h5 class="card-title">Order Import</h5>
<p class="card-text">Order import from external third party programs for standard-featured doors.</p>
<p>Format recognized: CSV, XML and Json.</p>
</div>
<div class="card-footer">
<a href="#" class="btn btn-primary">Go To Order Import</a>
</div>
</div>
</div>
<div class="px-2">
<div class="card shadow" style="width: 20rem; height:22rem;">
<div class="card-header d-flex py-3 fs-1 justify-content-evenly">
<div class="px-2">
<i class="fa-solid fa-cart-shopping"></i>
</div>
<div class="px-2">
<i class="fa-solid fa-cart-plus"></i>
</div>
<div class="px-2">
<i class="fa-solid fa-cart-arrow-down"></i>
</div>
</div>
<div class="card-body">
<h5 class="card-title">Order Manage</h5>
<p class="card-text">Create and manage orders choosing from door models and template available on the platform or already defined.</p>
</div>
<div class="card-footer">
<a href="#" class="btn btn-primary">Go To Order Manager</a>
</div>
</div>
</div>
<div class="px-2">
<div class="card shadow" style="width: 20rem; height:22rem;">
<div class="card-header d-flex py-3 fs-1 justify-content-evenly">
<div class="px-2">
<i class="fa-solid fa-door-open"></i>
</div>
<div class="px-2">
<i class="fa-solid fa-dungeon"></i>
</div>
<div class="px-2">
<i class="fa-solid fa-door-closed"></i>
</div>
</div>
<div class="card-body">
<h5 class="card-title">Door Modeling</h5>
<p class="card-text">Create your unique door model, validate the design and get 2D and 3D preview.</p>
<p>Choose materials, hardware, special working, ...</p>
</div>
<div class="card-footer">
<a href="#" class="btn btn-primary">Go To Door Modeler</a>
</div>
</div>
</div>
<div class="px-2">
<div class="card shadow" style="width: 20rem; height:22rem;">
<div class="card-header d-flex py-3 fs-1 justify-content-evenly">
<div class="px-2">
<i class="fa-solid fa-gears"></i>
</div>
<div class="px-2">
<i class="fa-solid fa-users-gear"></i>
</div>
<div class="px-2">
<i class="fa-solid fa-gear"></i>
</div>
</div>
<div class="card-body">
<h5 class="card-title">Advanced Tasks</h5>
<p class="card-text">Manage advanced task like template and catalog management, advanced search, ....</p>
</div>
<div class="card-footer">
<a href="#" class="btn btn-primary">Go To Advanced.</a>
</div>
</div>
</div>
</div>
@code {
}
+39 -35
View File
@@ -1,48 +1,54 @@
@page "/SuperAdmin"
@using WebDoorCreator.UI.Components
<AuthorizeView Roles="SuperAdmin, DcaAdmin">
<Authorized>
<div class="d-flex justify-content-around">
<div class="btn-group">
<button @onclick="() => SetMode(AdminMode.Company)" class="btn px-5 @cssMode(AdminMode.Company)">Company</button>
@*<button @onclick="() => SetMode(AdminMode.Interface)" class="btn px-5 @cssMode(AdminMode.Interface)">Interface</button>*@
<button @onclick="() => SetMode(AdminMode.Component)" class="btn px-5 @cssMode(AdminMode.Component)">Components</button>
</div>
</div>
<div class="d-flex justify-content-around">
<div class="btn-group">
<button @onclick="() => SetMode(AdminMode.Company)" class="btn px-5 @cssMode(AdminMode.Company)">Company</button>
<AuthorizeView Roles="SuperAdmin">
<Authorized>
<button @onclick="() => SetMode(AdminMode.Interface)" class="btn px-5 @cssMode(AdminMode.Interface)">Interface</button>
</Authorized>
</AuthorizeView>
<button @onclick="() => SetMode(AdminMode.Component)" class="btn px-5 @cssMode(AdminMode.Component)">Components</button>
</div>
</div>
<div class="cardShadow mt-2 p-2">
<div class="cardShadow mt-2 p-2">
@if (CurrMode == AdminMode.Company)
{
<div class="p-2">
@if (CurrMode == AdminMode.Company)
{
<div class="p-2">
<AuthorizeView Roles="SuperAdmin">
<Authorized>
<div class="mb-3 text-end">
<button type="button" class="btn btn-sm btn-success" @onclick="()=>clearFields()" data-bs-toggle="modal" data-bs-target="#newCompModal">
<i class="fa-solid fa-plus"></i> Add new company
</button>
</div>
<CompanyList E_currCompany="catchCurrComp"></CompanyList>
</div>
}
else if (CurrMode == AdminMode.Interface)
{
<div class="p-2">
<VocRefresh lang="EN"></VocRefresh>
</div>
}
else if (CurrMode == AdminMode.Component)
{
@*<HwMan></HwMan>*@
<div class="p-2">
<CompoCompare updateRecordCount="UpdateTotCount" actFilter="@currFilter"></CompoCompare>
<div>
<EgwCoreLib.Razor.DataPager @ref="pagerCompoFiles" PageSize="@numRecord" currPage="@currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="@totalCount" showLoading="@isLoading" />
</div>
</div>
}
</Authorized>
</AuthorizeView>
<CompanyList E_currCompany="catchCurrComp"></CompanyList>
</div>
}
else if (CurrMode == AdminMode.Interface)
{
<div class="p-2">
<VocRefresh lang="EN"></VocRefresh>
</div>
}
else if (CurrMode == AdminMode.Component)
{
@*<HwMan></HwMan>*@
<div class="p-2">
<CompoCompare updateRecordCount="UpdateTotCount" actFilter="@currFilter"></CompoCompare>
<div>
<EgwCoreLib.Razor.DataPager @ref="pagerCompoFiles" PageSize="@numRecord" currPage="@currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="@totalCount" showLoading="@isLoading" />
</div>
</div>
}
</div>
@*
@*
<div class="">
<div class="d-flex justify-content-between">
<div class="pb-0 d-flex justify-content-start">
@@ -87,8 +93,6 @@
}
</div>
</div>*@
</Authorized>
</AuthorizeView>
<!-- Modal Company -->
+1 -1
View File
@@ -9,7 +9,7 @@ using WebDoorCreator.UI.Data;
namespace WebDoorCreator.UI.Pages
{
[Authorize(Roles = "SuperAdmin")]
[Authorize(Roles = "SuperAdmin, DcaAdmin")]
public partial class SuperAdmin
{
#region Protected Fields
+1 -1
View File
@@ -1,6 +1,6 @@
@page "/TemplateMan"
<AuthorizeView Roles="SuperAdmin" Context="MenuHide">
<AuthorizeView Roles="SuperAdmin, DcaAdmin, CompAdmin" Context="MenuHide">
<Authorized>
<CascadingValue Value="true">
<OrdersDoorsDoorDef></OrdersDoorsDoorDef>
+2 -2
View File
@@ -120,7 +120,7 @@ else
<button class="input-group-text" @onclick="resetSearch"><i class="fa-solid fa-xmark"></i></button>
</div>
<div class="input-group">
<AuthorizeView Roles="SuperAdmin, Admin, CompAdmin">
<AuthorizeView Roles="SuperAdmin, DcaAdmin, CompAdmin">
<Authorized>
<span class="input-group-text"><i class="fas fa-user-tag"></i></span>
<select class="form-select" @bind="@FiltUserRole">
@@ -136,7 +136,7 @@ else
</AuthorizeView>
</div>
<div class="input-group">
<AuthorizeView Roles="SuperAdmin, Admin, CompAdmin">
<AuthorizeView Roles="SuperAdmin, DcaAdmin, CompAdmin">
<Authorized>
<span class="input-group-text"><i class="fa-solid fa-building"></i></span>
@if (@context.User.IsInRole("SuperAdmin") || @context.User.IsInRole("DcaAdmin"))
+1 -1
View File
@@ -12,7 +12,7 @@ using NLog;
namespace WebDoorCreator.UI.Pages
{
[Authorize(Roles = "SuperAdmin, Admin, CompAdmin")]
[Authorize(Roles = "SuperAdmin, DcaAdmin, CompAdmin")]
public partial class UserAdmin : ComponentBase, IDisposable
{
#region Public Fields
+2 -62
View File
@@ -11,16 +11,14 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"] - WebDoorCreator.UI</title>
@*<link rel="stylesheet" href="~/css/bootstrap/bootstrap.min.css" />*@
<link rel="stylesheet" href="~/lib/bootstrap-icons/font/bootstrap-icons.min.css" />
<link rel="stylesheet" href="~/lib/font-awesome/css/all.min.css" />
@*<link rel="stylesheet" href="~/css/site.css" />*@
<link rel="shortcut icon" href="images/favicon.ico" />
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="~/css/site.min.css" />
<link rel="stylesheet" href="~/WebDoorCreator.UI.styles.css" />
<component type="typeof(HeadOutlet)" render-mode="ServerPrerendered" />
<environment include="Development">
<link rel="stylesheet" href="~/Identity/lib/bootstrap/dist/css/bootstrap.css" />
<link rel="stylesheet" href="~/Identity/css/site.css" />
@@ -34,25 +32,6 @@
</environment>
</head>
<body>
@*<header>
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow">
<div class="navbar-collapse collapse d-sm-inline-flex flex-sm-row-reverse">
@{
var result = Engine.FindView(ViewContext, "_LoginPartial", isMainPage: false);
}
@if (result.Success)
{
await Html.RenderPartialAsync("_LoginPartial");
}
else
{
throw new InvalidOperationException("The default Identity UI layout requires a partial view '_LoginPartial' " +
"usually located at '/Pages/_LoginPartial' or at '/Views/Shared/_LoginPartial' to work. Based on your configuration " +
$"we have looked at it in the following locations: {System.Environment.NewLine}{string.Join(System.Environment.NewLine, result.SearchedLocations)}.");
}
</div>
</nav>
</header>*@
<div id="blazor-error-ui">
<environment include="Staging,Production">
An error has occurred. This application may no longer respond until reloaded.
@@ -67,51 +46,12 @@
@RenderBody()
</div>
@*<div class="fixed-bottom bottom-row px-2">
<div class="row bg-dark text-light">
<div class="col-5 pe-0 text-left">
<b>Web Door Creator @(DateTime.Today.Year)</b>
</div>
<div class="col-7 ps-0 text-end">
<span class="small">@($"{DateTime.Now:HH:mm:ss}")</span> | Powered by: <a class="text-light" href="https://www.egalware.com/" target="_blank"><img class="img-fluid" width="16" src="~/images/LogoEgw.png" /> Egalware </a>
</div>
</div>
</div>*@
@*<footer class="footer border-top pl-3 text-muted">
<div class="d-flex justify-content-between w-100 px-4">
&copy; 2023 - WebDoorCreator.UI
</div>
</footer>*@
@*<environment include="Development">
<script src="/lib/jquery/dist/jquery.js"></script>
<script src="~/Identity/lib/bootstrap/dist/js/bootstrap.bundle.js"></script>
<script src="~/Identity/js/site.js" asp-append-version="true"></script>
</environment>
<environment exclude="Development">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"
asp-fallback-src="~/Identity/lib/jquery/dist/jquery.min.js"
asp-fallback-test="window.jQuery"
crossorigin="anonymous"
integrity="sha384-ZvpUoO/+PpLXR1lu4jmpXWu80pZlYUAfxl5NsBMWOEPSjUn/6Z/hRTt8+pR6L4N2">
</script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/js/bootstrap.bundle.min.js"
asp-fallback-src="~/Identity/lib/bootstrap/dist/js/bootstrap.bundle.min.js"
asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal"
crossorigin="anonymous"
integrity="sha384-U1DAWAznBHeqEIlVSCgzq+c9gqGAJn5c/t99JyeKa9xxaYpSvHU5awsuZVVFIhvj">
</script>
<script src="~/Identity/js/site.js" asp-append-version="true"></script>
</environment>*@
<script src="~/Identity/lib/jquery/dist/jquery.min.js"></script>
<script src="~/lib/bootstrap/js/bootstrap.bundle.js"></script>
<script src="~/Identity/js/site.js" asp-append-version="true"></script>
<script src="~/lib/SiteHelper.js" asp-append-version="true"></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({
+102 -7
View File
@@ -1,13 +1,14 @@
using Blazored.LocalStorage;
using Blazored.SessionStorage;
using Microsoft.AspNetCore.Components;
using HealthChecks.UI.Client;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.UI;
using Microsoft.AspNetCore.Identity.UI.Services;
using Microsoft.AspNetCore.Localization;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using Microsoft.Extensions.FileProviders;
using StackExchange.Redis;
using System.Globalization;
using System.Text.Json.Serialization;
@@ -16,19 +17,80 @@ using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Areas.Identity;
using WebDoorCreator.UI.Data;
var builder = WebApplication.CreateBuilder(args);
var builder = WebApplication.CreateBuilder(args);
// configuration setup
ConfigurationManager configuration = builder.Configuration;
Microsoft.Extensions.Configuration.ConfigurationManager configuration = builder.Configuration;
// AspNetCore Identity setup
var connectionString = builder.Configuration.GetConnectionString("Identity.DB");
// REDIS setup
string connStringRedis = configuration.GetConnectionString("Redis");
if (string.IsNullOrEmpty(connStringRedis))
{
connStringRedis = "localhost:6379, DefaultDatabase=11, connectTimeout=5000, syncTimeout=5000, asyncTimeout=5000, abortConnect=false, ssl=false";
}
string redisSrvAddr = connStringRedis.Substring(0, connStringRedis.IndexOf(":"));
// avvio oggetto shared x redis...
var redisMultiplexer = ConnectionMultiplexer.Connect(connStringRedis);
// AspNetCore Identity setup
var connectionString = configuration.GetConnectionString("Identity.DB");
string dbServerAddr = "127.0.0.1";
if (string.IsNullOrEmpty(connectionString))
{
connectionString = "Server=SQL2016DEV;Database=WebDoorCreator; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=WebDoorCreator.SRV;";
}
else
{
if (connectionString.Contains("Server"))
{
bool trovato = false;
var dbTokens = connectionString.Split(";");
int numTok = dbTokens.Count();
int idx = 0;
while (!trovato && idx < numTok)
{
if (dbTokens[idx].StartsWith("Server="))
{
// rimuovo la chaive Server...
dbServerAddr = dbTokens[idx].Replace("Server=", "");
// se ci fosse un nome (tipo \\sqlexpress) rimuovo...
if (dbServerAddr.Contains("\\"))
{
int sIdx = dbServerAddr.IndexOf("\\");
dbServerAddr = dbServerAddr.Substring(0, sIdx);
}
trovato = true;
}
idx++;
}
}
}
// healthchecks
builder.Services.AddHealthChecks()
.AddSqlServer(connectionString, healthQuery: "SELECT 1;", name: "SqlServer", failureStatus: HealthStatus.Degraded, tags: new string[] { "DB", "MsSql" })
.AddAsyncCheck($"DB PING ({dbServerAddr})", () => WebDoorCreator.UI.Health.Checks.PingCheck(dbServerAddr))
.AddAsyncCheck($"Redis PING ({redisSrvAddr})", () => WebDoorCreator.UI.Health.Checks.PingCheck(redisSrvAddr))
// 512 MB max allocated memory
.AddProcessAllocatedMemoryHealthCheck(512, "Max Process memory (<512MB)", failureStatus: HealthStatus.Degraded)
.AddRedis(connStringRedis, "Redis", failureStatus: HealthStatus.Degraded)
.AddAsyncCheck($"Config Table", () => WebDoorCreator.UI.Health.Checks.ConfigCount(configuration))
.AddAsyncCheck($"Orders Table", () => WebDoorCreator.UI.Health.Checks.OrdersCount(configuration))
.AddAsyncCheck($"Doors Table", () => WebDoorCreator.UI.Health.Checks.DoorsCount(configuration))
;
#if false
builder.Services
.AddHealthChecksUI(s =>
{
s.AddHealthCheckEndpoint("WDC_UI_HC", "health");
s.SetEvaluationTimeInSeconds(60);
s.SetMinimumSecondsBetweenFailureNotifications(120);
s.SetApiMaxActiveRequests(5);
s.SetHeaderText("WDC.UI Health Check Status");
})
.AddInMemoryStorage();
#endif
// abilitazione x email management con MailKit
builder.Services.AddTransient<IEmailSender, MailKitEmailSender>();
builder.Services.Configure<MailKitEmailSenderOptions>(options =>
@@ -102,6 +164,22 @@ app.UseHttpsRedirection();
app.UseStaticFiles();
// gestione static files: https://learn.microsoft.com/en-us/aspnet/core/fundamentals/static-files?view=aspnetcore-8.0
string BasePathPdf = configuration.GetValue<string>("ServerConf:BasePathPdf") ?? configuration.GetValue<string>("OptConf:BasePathPdf") ?? "";
if (!string.IsNullOrEmpty(BasePathPdf))
{
// verifico esista folder disegni
if (Directory.Exists(BasePathPdf))
{
// gestione cartella x PDF
app.UseStaticFiles(new StaticFileOptions
{
FileProvider = new PhysicalFileProvider(BasePathPdf),
RequestPath = "/docs",
});
}
}
app.UseRouting();
app.UseAuthentication();
@@ -109,6 +187,23 @@ app.UseAuthorization();
app.MapControllers();
app.MapBlazorHub();
// config healthcheck: https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/health-checks
// prende tutti i predicati
app.MapHealthChecks("/health", new HealthCheckOptions
{
Predicate = _ => true,
ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse
});
// opzionalmente si puo' aggiungere richiesta AUTH
//.RequireAuthorization();
// nasconde tutti i dettagli
app.MapHealthChecks("/health/live", new HealthCheckOptions
{
Predicate = _ => false
});
app.MapFallbackToPage("/_Host");
app.Run();
@@ -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-02.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>
+17 -5
View File
@@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<Version>0.9.2403.0411</Version>
<Version>0.9.2505.1316</Version>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>aspnet-WebDoorCreator.UI-dfe95fed-1398-4144-bd43-8b3a765d6608</UserSecretsId>
</PropertyGroup>
@@ -13,7 +13,8 @@
</ItemGroup>
<ItemGroup>
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS-OVH-PROD.pubxml" />
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS-OVH-IIS01.pubxml" />
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS-OVH-IIS02.pubxml" />
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS-PROD.pubxml" />
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS01.pubxml" />
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS02.pubxml" />
@@ -36,11 +37,19 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="AspNetCore.HealthChecks.Redis" Version="6.0.4" />
<PackageReference Include="AspNetCore.HealthChecks.SqlServer" Version="6.0.2" />
<PackageReference Include="AspNetCore.HealthChecks.System" Version="6.0.5" />
<PackageReference Include="AspNetCore.HealthChecks.UI" Version="6.0.5" />
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="6.0.5" />
<PackageReference Include="AspNetCore.HealthChecks.UI.Core" Version="6.0.5" />
<PackageReference Include="AspNetCore.HealthChecks.UI.InMemory.Storage" Version="6.0.5" />
<PackageReference Include="AspNetCore.HealthChecks.Uris" Version="6.0.3" />
<PackageReference Include="Blazored.LocalStorage" Version="4.3.0" />
<PackageReference Include="Blazored.SessionStorage" Version="2.3.0" />
<PackageReference Include="DiffMatchPatch" Version="1.0.3" />
<PackageReference Include="EgwCoreLib.Razor" Version="1.4.2308.216" />
<PackageReference Include="EgwCoreLib.Utils" Version="1.4.2307.3111" />
<PackageReference Include="EgwCoreLib.Razor" Version="1.5.2402.2411" />
<PackageReference Include="EgwCoreLib.Utils" Version="1.5.2402.2411" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="6.0.27" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.27" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="6.0.27" />
@@ -49,6 +58,8 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="6.0.29" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions" Version="6.0.29" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.14" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NLog" Version="5.2.2" />
@@ -69,7 +80,8 @@
<ItemGroup>
<None Include="compilerconfig.json" />
<None Include="Properties\PublishProfiles\IIS-OVH-PROD.pubxml.user" />
<None Include="Properties\PublishProfiles\IIS-OVH-IIS02.pubxml.user" />
<None Include="Properties\PublishProfiles\IIS-OVH-IIS01.pubxml.user" />
<None Include="Properties\PublishProfiles\IIS-PROD.pubxml.user" />
<None Include="Properties\PublishProfiles\IIS01.pubxml.user" />
<None Include="Properties\PublishProfiles\IIS02.pubxml.user" />
@@ -15,8 +15,15 @@
"MaxDayCalcCache": 28,
"BaseUrl": "/UI"
},
"ServerConf": {
//"BasePathPdf": "U:\\WebDoorSync\\WdcPdf",
"BasePathPdf": "U:\\nextcloud.egalware\\ABH\\WdcPdf",
"WaitOpen3d": 1000
},
"CompoBaseDirs": {
"CurrCompoDir": "U:\\WebDoorSync\\CurrentComp\\Compo",
"NewCompoDir": "U:\\WebDoorSync\\NewComp\\Compo"
//"CurrCompoDir": "U:\\WebDoorSync\\CurrentComp\\Compo",
//"NewCompoDir": "U:\\WebDoorSync\\NewComp\\Compo",
"CurrCompoDir": "U:\\nextcloud.egalware\\CalcData\\CurrentComp\\Compo",
"NewCompoDir": "U:\\nextcloud.egalware\\CalcData\\NewComp\\Compo"
}
}
+1 -3
View File
@@ -7,9 +7,7 @@
}
},
"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;"
"Redis": "redis.ufficio:26379,serviceName=devel, DefaultDatabase=11, connectTimeout=5000, syncTimeout=5000, asyncTimeout=5000, abortConnect=false, ssl=false"
},
"RuntimeOpt": {
"MaxDayCalcCache": 7,
+6 -2
View File
@@ -7,7 +7,7 @@
},
"AllowedHosts": "*",
"ConnectionStrings": {
"Redis": "nkcredis.steamware.net:6379, DefaultDatabase=11, connectTimeout=5000, syncTimeout=5000, asyncTimeout=5000, abortConnect=false, ssl=false, password=BtN9Py1wtLfLRvmzWnOPJ7RytDM+CLiVsJ/16zduNTlV8IOPGNrtzJSXPUnImA5PqmUMhKaUqo9NdHIG",
"Redis": "redis.ufficio:26379,serviceName=devel, DefaultDatabase=11, connectTimeout=5000, syncTimeout=5000, asyncTimeout=5000, abortConnect=false, ssl=false",
"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;"
},
@@ -28,8 +28,12 @@
"DisableIdentMigrate": true,
"DisableWDCMigrate": true
},
"ServerConf": {
"BasePathPdf": "\\\\IIS04\\WebDoorSync\\WdcPdf",
"WaitOpen3d": 800
},
"RuntimeOpt": {
"WaitReloadSvg": 200,
"WaitReloadSvg": 100,
"VetoRemoveProcessing": 5,
"MaxDayCalcCache": 7,
"BaseUrl": "/WDC/UI",
+4
View File
@@ -130,5 +130,9 @@
{
"outputFile": "Components/FilesMan/CompoCompare.razor.css",
"inputFile": "Components/FilesMan/CompoCompare.razor.less"
},
{
"outputFile": "Components/DoorDef/DoorDefSizingSI.razor.css",
"inputFile": "Components/DoorDef/DoorDefSizingSI.razor.less"
}
]
@@ -4,7 +4,7 @@
<title>{WINDOW_TITLE} {PAGETITLE}</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="{LOCATION_STYLESHEET}" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="~/favicon.ico" type="image/x-icon" />
</head>
<frameset cols="{WIDTH_LEFT},{WIDTH_RIGHT}">
<frame src="{SRC_LEFT}" title="{TITLE_LEFT}" name="{NAME_LEFT}" id="{NAME_LEFT}" marginwidth="0" marginheight="0" scrolling="auto" />

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 211 KiB

After

Width:  |  Height:  |  Size: 133 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 562 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 168 KiB

After

Width:  |  Height:  |  Size: 49 KiB

Some files were not shown because too many files have changed in this diff Show More