1 Commits

Author SHA1 Message Date
Emmanuele Sassi 37986b0bcb - eliminato controllo chiave
- aggiunto try su cancellazione file
2024-08-05 16:22:17 +02:00
107 changed files with 1316 additions and 3285 deletions
+10 -21
View File
@@ -99,9 +99,6 @@ WDC.Api:staging:
stage: staging stage: staging
tags: tags:
- win - win
environment:
name: staging
url: https://iis01.egalware.com/WDC/SRV/
variables: variables:
APP_NAME: WebDoorCreator.API APP_NAME: WebDoorCreator.API
SOL_NAME: WebDoorCreator.UI SOL_NAME: WebDoorCreator.UI
@@ -114,8 +111,6 @@ WDC.Api:staging:
script: script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj - dotnet build $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj - dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
## IIS 02
#- dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
WDC.UI:staging: WDC.UI:staging:
stage: staging stage: staging
@@ -123,7 +118,7 @@ WDC.UI:staging:
- win - win
environment: environment:
name: staging name: staging
url: https://iis01.egalware.com/WDC/UI/ url: https://iis01.egalware.com/GPW/WDC.UI
variables: variables:
APP_NAME: WebDoorCreator.UI APP_NAME: WebDoorCreator.UI
SOL_NAME: WebDoorCreator.UI SOL_NAME: WebDoorCreator.UI
@@ -144,7 +139,7 @@ WDC.Api:deploy:
- win - win
environment: environment:
name: production name: production
url: https://wdc.egalware.com/SRV/ url: https://seriate.egalware.com/GPW/WDC.UI
variables: variables:
APP_NAME: WebDoorCreator.API APP_NAME: WebDoorCreator.API
SOL_NAME: WebDoorCreator.UI SOL_NAME: WebDoorCreator.UI
@@ -156,18 +151,15 @@ WDC.Api:deploy:
- dotnet restore "$env:SOL_NAME.sln" - dotnet restore "$env:SOL_NAME.sln"
script: script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj - dotnet build $env:APP_NAME/$env:APP_NAME.csproj
# IIS OVH IIS01 # IIS 02
- 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 - 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
# IIS OVH IIS02 # IIS PROD
- 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 - dotnet publish -p:PublishProfile=IIS-PROD.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
WDC.UI:deploy: WDC.UI:deploy:
stage: deploy stage: deploy
tags: tags:
- win - win
environment:
name: production
url: https://wdc.egalware.com/UI/
variables: variables:
APP_NAME: WebDoorCreator.UI APP_NAME: WebDoorCreator.UI
SOL_NAME: WebDoorCreator.UI SOL_NAME: WebDoorCreator.UI
@@ -179,13 +171,10 @@ WDC.UI:deploy:
- dotnet restore "$env:SOL_NAME.sln" - dotnet restore "$env:SOL_NAME.sln"
script: script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj - dotnet build $env:APP_NAME/$env:APP_NAME.csproj
# IIS OVH IIS01 # IIS EXT
- 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 - 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
# IIS OVH IIS02 # IIS INT
- 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 - 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 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 ---------- # ---------- RELEASE ----------
WDC.Api:release: WDC.Api:release:
Binary file not shown.
+1 -1
View File
@@ -1,6 +1,6 @@
<body> <body>
<i>WebDoorCreator - Egalware</i> <i>WebDoorCreator - Egalware</i>
<h4>Version: 0.9.2406.2015</h4> <h4>Version: 0.9.2401.0415</h4>
<br /> Release note: <br /> Release note:
<ul> <ul>
<li> <li>
+1 -1
View File
@@ -1 +1 @@
0.9.2406.2015 0.9.2401.0415
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<item> <item>
<version>0.9.2406.2015</version> <version>0.9.2401.0415</version>
<url>http://nexus.steamware.net/repository/SWS/WDC/stable/WDC.UI.zip</url> <url>http://nexus.steamware.net/repository/SWS/WDC/stable/WDC.UI.zip</url>
<changelog>http://nexus.steamware.net/repository/SWS/WDC/stable/ChangeLog.html</changelog> <changelog>http://nexus.steamware.net/repository/SWS/WDC/stable/ChangeLog.html</changelog>
<mandatory>false</mandatory> <mandatory>false</mandatory>
@@ -5,10 +5,9 @@ using Svg;
using Svg.Skia; using Svg.Skia;
using System.Drawing; using System.Drawing;
using WebDoorCreator.Data.Services; using WebDoorCreator.Data.Services;
#if false #if false
using SkiaSharp; using SkiaSharp;
using Svg.Skia; using Svg.Skia;
#endif #endif
namespace WebDoorCreator.API.Controllers namespace WebDoorCreator.API.Controllers
@@ -19,13 +18,11 @@ namespace WebDoorCreator.API.Controllers
{ {
#region Public Constructors #region Public Constructors
public DoorImageController(IConfiguration configuration, QueueDataService cQDService, WebDoorCreatorService cWDCService) public DoorImageController(IConfiguration configuration, QueueDataService DataService)
{ {
Log.Info("Starting DoorImageController"); Log.Info("Starting DoorImageController");
_configuration = configuration; _configuration = configuration;
WaitReloadSvg = _configuration.GetValue<int>("RuntimeOpt:WaitReloadSvg"); QDataServ = DataService;
QDService = cQDService;
WDService = cWDCService;
Log.Info("Avviato DoorImageController"); Log.Info("Avviato DoorImageController");
} }
@@ -40,24 +37,12 @@ namespace WebDoorCreator.API.Controllers
return "OK"; return "OK";
} }
[HttpGet("GetImage.png")] [HttpGet("GetImage.png")]
public async Task<IActionResult> GetImagePng(int DoorId) public async Task<IActionResult> GetImagePng(int DoorId)
{ {
byte[] result = new byte[0]; byte[] result = new byte[0];
string svgContent = await QDService.DoorGetLastSvg(DoorId); string svgContent = await QDataServ.DoorGetLastSvg(DoorId);
// se fosse vuoto...
if (string.IsNullOrEmpty(svgContent))
{
// richiede ricalcolo img
svgContent = await SendRecalcReq(DoorId);
}
// se fosse vuoto...
if (string.IsNullOrEmpty(svgContent))
{
// legge img vuota
svgContent = QDService.DoorGetMissingSvg();
}
// ora prosegue con conversione...
if (!string.IsNullOrEmpty(svgContent)) if (!string.IsNullOrEmpty(svgContent))
{ {
using (var svg = new SKSvg()) using (var svg = new SKSvg())
@@ -88,15 +73,7 @@ namespace WebDoorCreator.API.Controllers
[HttpGet("GetImage.svg")] [HttpGet("GetImage.svg")]
public async Task<IActionResult> GetImageSvg(int DoorId) public async Task<IActionResult> GetImageSvg(int DoorId)
{ {
string svgContent = await QDService.DoorGetLastSvg(DoorId); string svgContent = await QDataServ.DoorGetLastSvg(DoorId);
// se fosse vuoto...
if (string.IsNullOrEmpty(svgContent))
{
// richiede ricalcolo img
await SendRecalcReq(DoorId);
// legge img vuota
svgContent = QDService.DoorGetMissingSvg();
}
var result = System.Text.Encoding.UTF8.GetBytes(svgContent); var result = System.Text.Encoding.UTF8.GetBytes(svgContent);
return File(result, "image/svg+xml"); return File(result, "image/svg+xml");
} }
@@ -109,48 +86,18 @@ namespace WebDoorCreator.API.Controllers
private static Logger Log = LogManager.GetCurrentClassLogger(); private static Logger Log = LogManager.GetCurrentClassLogger();
private int WaitReloadSvg = 100;
#endregion Private Fields #endregion Private Fields
#region Private Properties #region Private Properties
private QueueDataService QDService { get; set; } = null!; private QueueDataService QDataServ { get; set; } = null!;
private WebDoorCreatorService WDService { get; set; } = null!;
#endregion Private Properties #endregion Private Properties
#region Private Methods #region Private Methods
/// <summary>
/// Invio richiesta ricalcolo porta
/// </summary>
/// <param name="DoorId"></param>
/// <returns></returns>
private async Task<string> SendRecalcReq(int DoorId)
{
string answ = "";
// richiede ricalcolo img
List<string> doorIdList = new List<string>() { $"{DoorId}" };
// chiamo reset richieste
var list2Proc = await QDService.ResetQueueByDoorList(doorIdList);
// recupero DDF ed invio x processing
if (DoorId > 0)
{
string currDDF = await WDService.DoorOpGetDDF(DoorId);
// versione corrente del DDF generato
int currVers = await QDService.SendCalcReq(DoorId, currDDF);
}
// attende ...
await Task.Delay(WaitReloadSvg);
// riprova lettura
answ = await QDService.DoorGetLastSvg(DoorId);
return answ;
}
#endregion Private Methods #endregion Private Methods
} }
} }
@@ -1,7 +1,5 @@
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using NLog; using NLog;
using System.Diagnostics;
using WebDoorCreator.Core;
using WebDoorCreator.Data.DTO; using WebDoorCreator.Data.DTO;
using WebDoorCreator.Data.Services; using WebDoorCreator.Data.Services;
@@ -15,20 +13,11 @@ namespace WebDoorCreator.API.Controllers
public QueueController(IConfiguration configuration, QueueDataService DataService, WebDoorCreatorService _WDService) public QueueController(IConfiguration configuration, QueueDataService DataService, WebDoorCreatorService _WDService)
{ {
Log.Info("Starting QueueController");
_configuration = configuration; _configuration = configuration;
logTimingEnable = configuration.GetValue<bool>("RuntimeOpt:LogTimingEnable");
QDataServ = DataService; QDataServ = DataService;
WDService = _WDService; WDService = _WDService;
// aggiungo.. Log.Info("Avviato QueueController");
string statName = "QueueController";
bool doWrite = QDataServ.StatUpsert(statName, new TimeSpan(), 5).Result;
// se campione "pieno"...
if (doWrite)
{
// recupero e resetto
ExecStats statRec = QDataServ.StatReset(statName).Result;
Log.Trace($"Avviato QueueController x {statRec.NumCall}");
}
} }
#endregion Public Constructors #endregion Public Constructors
@@ -144,7 +133,6 @@ namespace WebDoorCreator.API.Controllers
string answ = "NA"; string answ = "NA";
bool fatto = await QDataServ.SaveProcessingResult(calcResults); bool fatto = await QDataServ.SaveProcessingResult(calcResults);
answ = fatto ? "OK" : "NO"; answ = fatto ? "OK" : "NO";
Log.Debug("Eseguito SaveProcResult");
return answ; return answ;
} }
@@ -155,11 +143,6 @@ namespace WebDoorCreator.API.Controllers
[HttpGet("StatusList")] [HttpGet("StatusList")]
public async Task<Dictionary<string, Dictionary<string, string>>> StatusList() public async Task<Dictionary<string, Dictionary<string, string>>> StatusList()
{ {
Stopwatch sw = new Stopwatch();
if (logTimingEnable)
{
sw.Start();
}
Dictionary<string, Dictionary<string, string>> answ = new Dictionary<string, Dictionary<string, string>>(); Dictionary<string, Dictionary<string, string>> answ = new Dictionary<string, Dictionary<string, string>>();
var actPend = await QDataServ.RequestPending(); var actPend = await QDataServ.RequestPending();
answ.Add("pending", actPend); answ.Add("pending", actPend);
@@ -172,20 +155,6 @@ namespace WebDoorCreator.API.Controllers
var actDone = await QDataServ.RequestDone(); var actDone = await QDataServ.RequestDone();
answ.Add("done", actDone); answ.Add("done", actDone);
if (logTimingEnable)
{
sw.Stop();
// aggiungo..
string statName = "StatusList";
bool doWrite = await QDataServ.StatUpsert(statName, sw.Elapsed, 5);
// se campione "pieno"...
if (doWrite)
{
// recupero e resetto
ExecStats statRec = await QDataServ.StatReset(statName);
Log.Info($"Eseguito {statName} x {statRec.NumCall} | {statRec.AvgTime.TotalMilliseconds:N3}ms");
}
}
return answ; return answ;
} }
@@ -199,7 +168,6 @@ namespace WebDoorCreator.API.Controllers
public async Task<Dictionary<string, string>> TakeProcessingItems(int numItems = 10) public async Task<Dictionary<string, string>> TakeProcessingItems(int numItems = 10)
{ {
var actQueue = await QDataServ.TakeProcessingItems(numItems); var actQueue = await QDataServ.TakeProcessingItems(numItems);
Log.Debug($"Eseguito TakeProcessingItems per {numItems} items");
return actQueue; return actQueue;
} }
@@ -207,10 +175,9 @@ namespace WebDoorCreator.API.Controllers
#region Private Fields #region Private Fields
private static Logger Log = LogManager.GetCurrentClassLogger(); private static IConfiguration _configuration = null!;
private IConfiguration _configuration = null!;
private bool logTimingEnable = false; private static Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields #endregion Private Fields
-95
View File
@@ -1,95 +0,0 @@
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
}
}
+14 -80
View File
@@ -1,9 +1,5 @@
using HealthChecks.UI.Client;
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
using Microsoft.AspNetCore.Identity.UI.Services; using Microsoft.AspNetCore.Identity.UI.Services;
using Microsoft.AspNetCore.Localization; using Microsoft.AspNetCore.Localization;
using Microsoft.CodeAnalysis.FlowAnalysis;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using StackExchange.Redis; using StackExchange.Redis;
using StackExchange.Redis.Extensions.Core.Configuration; using StackExchange.Redis.Extensions.Core.Configuration;
using StackExchange.Redis.Extensions.Newtonsoft; using StackExchange.Redis.Extensions.Newtonsoft;
@@ -18,7 +14,6 @@ var builder = WebApplication.CreateBuilder(args);
// configuration setup // configuration setup
ConfigurationManager configuration = builder.Configuration; ConfigurationManager configuration = builder.Configuration;
// Redis // Redis
var connStringRedis = configuration.GetConnectionString("Redis"); var connStringRedis = configuration.GetConnectionString("Redis");
if (string.IsNullOrEmpty(connStringRedis)) if (string.IsNullOrEmpty(connStringRedis))
@@ -35,67 +30,6 @@ builder.Services.AddControllers();
builder.Services.AddEndpointsApiExplorer(); builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(); 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 // abilitazione x email management con MailKit
//builder.Services.AddTransient<IEmailSender, MailKitEmailSender>(); //builder.Services.AddTransient<IEmailSender, MailKitEmailSender>();
builder.Services.AddSingleton<IEmailSender, MailKitEmailSender>(); builder.Services.AddSingleton<IEmailSender, MailKitEmailSender>();
@@ -140,24 +74,24 @@ if (app.Environment.IsDevelopment() || app.Environment.IsStaging())
app.UseSwaggerUI(); 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.UseHttpsRedirection();
app.UseAuthorization(); app.UseAuthorization();
app.MapControllers(); 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(); app.Run();
@@ -1,27 +0,0 @@
<?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>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>
@@ -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-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>
@@ -1,27 +0,0 @@
<?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>
@@ -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-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>
@@ -1,27 +0,0 @@
<?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>
@@ -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+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 -20
View File
@@ -8,9 +8,6 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<_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\IIS-PROD.pubxml" />
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS01.pubxml" /> <_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS01.pubxml" />
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS02.pubxml" /> <_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS02.pubxml" />
@@ -18,26 +15,13 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<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" /> <None Include="Properties\PublishProfiles\IIS-PROD.pubxml.user" />
</ItemGroup> </ItemGroup>
<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="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NLog" Version="5.2.2" /> <PackageReference Include="NLog" Version="5.2.2" />
<PackageReference Include="SkiaSharp" Version="2.88.8" /> <PackageReference Include="SkiaSharp" Version="2.88.3" />
<PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="2.88.3" /> <PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="2.88.3" />
<PackageReference Include="StackExchange.Redis" Version="2.6.122" /> <PackageReference Include="StackExchange.Redis" Version="2.6.122" />
<PackageReference Include="StackExchange.Redis.Extensions.AspNetCore" Version="9.1.0" /> <PackageReference Include="StackExchange.Redis.Extensions.AspNetCore" Version="9.1.0" />
@@ -54,9 +38,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Update="logs\.placeholder.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Reports\Report.rdlc"> <None Update="Reports\Report.rdlc">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>
@@ -6,7 +6,7 @@
} }
}, },
"ConnectionStrings": { "ConnectionStrings": {
"Redis": "wdc-u-redis-01.ovh:6379, DefaultDatabase=12, connectTimeout=5000, syncTimeout=5000, asyncTimeout=5000, abortConnect=false, ssl=false, password=BtN9Py1wtLfLRvmzWnOPJ7RytDM+CLiVsJ/16zduNTlV8IOPGNrtzJSXPUnImA5PqmUMhKaUqo9NdHIG", "Redis": "nkcredis.steamware.net:6379, DefaultDatabase=12, connectTimeout=5000, syncTimeout=5000, asyncTimeout=5000, abortConnect=false, ssl=false, password=BtN9Py1wtLfLRvmzWnOPJ7RytDM+CLiVsJ/16zduNTlV8IOPGNrtzJSXPUnImA5PqmUMhKaUqo9NdHIG",
"WDC.DB": "Server=WDC-W-SQL-01\\SQLEXPRESS;Database=DCA_WebDoorCreator; User ID=steamware;Password=viadante16; integrated security=False; MultipleActiveResultSets=True; App=WebDoorCreator.UI;" "WDC.DB": "Server=SQL2016PROD;Database=DCA_WebDoorCreator; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=WebDoorCreator.UI;"
} }
} }
+5 -8
View File
@@ -7,8 +7,8 @@
}, },
"AllowedHosts": "*", "AllowedHosts": "*",
"ConnectionStrings": { "ConnectionStrings": {
"Redis": "localhost:26379,serviceName=devel, DefaultDatabase=11, connectTimeout=5000, syncTimeout=5000, asyncTimeout=5000, abortConnect=false, ssl=false", "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.SRV;" "WDC.DB": "Server=SQL2016DEV;Database=WebDoorCreator; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=WebDoorCreator.UI;"
}, },
"ExternalProviders": { "ExternalProviders": {
"MailKit": { "MailKit": {
@@ -24,13 +24,10 @@
}, },
"MailDest": { "MailDest": {
"Admin": "samuele@steamware.net", "Admin": "samuele@steamware.net",
"ProjCheck": "samuele.locatelli@egalware.com", "ProjCheck": "samuele.locatelli@egalware.com,mara.baroni@egalware.com",
"TimbCheck": "samuele.locatelli@egalware.com" "TimbCheck": "samuele.locatelli@egalware.com,mara.baroni@egalware.com"
}, },
"RuntimeOpt": { "RuntimeOpt": {
"WaitReloadSvg": 200, "VetoRemoveProcessing": 5
"VetoRemoveProcessing": 5,
"StatSampleSize": 30,
"LogTimingEnable": true
} }
} }
+1
View File
@@ -19,6 +19,7 @@ Public Module ConstIni
' File con dati di licenza ' File con dati di licenza
Public Const LIC_FILE_NAME As String = "WebDoorCreator.CamSrv.lic" Public Const LIC_FILE_NAME As String = "WebDoorCreator.CamSrv.lic"
Public Const S_LICENCE As String = "Licence" Public Const S_LICENCE As String = "Licence"
Public Const K_LOCKID As String = "LockId"
Public Const K_KEY As String = "Key" Public Const K_KEY As String = "Key"
' File di log generale ' File di log generale
+29 -21
View File
@@ -937,7 +937,10 @@ Public Class ProcMan
' elimino vecchi ' elimino vecchi
If Not IsNothing(fileList) Then If Not IsNothing(fileList) Then
For Each sFile In fileList For Each sFile In fileList
File.Delete(sFile) Try
File.Delete(sFile)
Catch ex As Exception
End Try
Next Next
End If End If
@@ -1297,22 +1300,27 @@ Public Class ProcMan
Private Sub ProcMan_Load(sender As Object, e As EventArgs) Handles MyBase.Load Private Sub ProcMan_Load(sender As Object, e As EventArgs) Handles MyBase.Load
m_IniFilePath = AppDomain.CurrentDomain.BaseDirectory & INI_FILE_NAME m_IniFilePath = AppDomain.CurrentDomain.BaseDirectory & INI_FILE_NAME
ManageInstance() ManageInstance()
' Imposto tipo di chiave '' Imposto tipo di chiave
EgtSetLockType(KEY_TYPE.HW) 'EgtSetLockType(KEY_TYPE.HW)
' Leggo e imposto chiave di protezione '' Leggo e imposto chiave di protezione
Dim sLicFileName As String = String.Empty 'Dim sLicFileName As String = String.Empty
GetPrivateProfileString(S_GENERAL, K_LICENCE, LIC_FILE_NAME, sLicFileName, m_IniFilePath) 'GetPrivateProfileString(S_GENERAL, K_LICENCE, LIC_FILE_NAME, sLicFileName, m_IniFilePath)
Dim sLicFile As String = AppDomain.CurrentDomain.BaseDirectory & sLicFileName 'Dim sLicFile As String = AppDomain.CurrentDomain.BaseDirectory & sLicFileName
Dim sKey As String = String.Empty 'Dim sKey As String = String.Empty
EgtUILib.GetPrivateProfileString(S_LICENCE, K_KEY, "", sKey, sLicFile) 'EgtUILib.GetPrivateProfileString(S_LICENCE, K_KEY, "", sKey, sLicFile)
EgtSetKey(sKey) 'EgtSetKey(sKey)
Dim bNetHwKey As Boolean = (GetPrivateProfileInt(S_GENERAL, K_NETKEY, 0, m_IniFilePath) = 1) 'Dim bNetHwKey As Boolean = (GetPrivateProfileInt(S_GENERAL, K_NETKEY, 0, m_IniFilePath) = 1)
EgtSetNetHwKey(bNetHwKey) 'EgtSetNetHwKey(bNetHwKey)
' Recupero livello e opzioni della chiave 'Dim sLockId As String = ""
Dim nKeyLevel As Integer = 0 'EgtUILib.GetPrivateProfileString(S_LICENCE, K_LOCKID, "", sLockId, sLicFile)
Dim nKeyOptions As Integer = 0 'If Not String.IsNullOrEmpty(sLockId) Then
Dim bKey As Boolean = EgtGetKeyLevel(9935, 2505, 1, nKeyLevel) And ' Dim x = EgtSetLockId(sLockId)
EgtGetKeyOptions(9935, 2505, 1, nKeyOptions) '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 ' Inizializzazione generale di EgtInterface
m_sLogFile = AppDomain.CurrentDomain.BaseDirectory & GENLOG_FILE_NAME.Replace("#", m_nInstance.ToString()) m_sLogFile = AppDomain.CurrentDomain.BaseDirectory & GENLOG_FILE_NAME.Replace("#", m_nInstance.ToString())
Dim sLogMsg As String = "User " & Environment.MachineName & "\" & Environment.UserName & " (" & m_nInstance.ToString() & ")" & vbLf & Dim sLogMsg As String = "User " & Environment.MachineName & "\" & Environment.UserName & " (" & m_nInstance.ToString() & ")" & vbLf &
@@ -1322,10 +1330,10 @@ Public Class ProcMan
(ChrW(97 - 1 + My.Application.Info.Version.Build)).ToString() & (ChrW(97 - 1 + My.Application.Info.Version.Build)).ToString() &
My.Application.Info.Version.Revision.ToString() My.Application.Info.Version.Revision.ToString()
EgtInit(0, m_sLogFile, sLogMsg) EgtInit(0, m_sLogFile, sLogMsg)
If Not bKey Then 'If Not bKey Then
MessageBox.Show("No licences available!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error) ' MessageBox.Show("No licences available!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End ' End
End If 'End If
' leggo sorgente richieste rest da ini ' leggo sorgente richieste rest da ini
GetPrivateProfileString(S_GENERAL, K_BASEIP, "", baseIp, m_IniFilePath) GetPrivateProfileString(S_GENERAL, K_BASEIP, "", baseIp, m_IniFilePath)
+1 -4
View File
@@ -26,11 +26,8 @@ namespace WebDoorCreator.Core
public static readonly string CALC_REQ_PROC = $"{BASE_HASH}:CalcRequests:Processing"; public static readonly string CALC_REQ_PROC = $"{BASE_HASH}:CalcRequests:Processing";
public static readonly string CALC_REQ_DDF_CACHE = $"{BASE_HASH}:CalcRequests:CacheDDF"; 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_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"; public static readonly string DOOR_TPL_LIST = $"{BASE_HASH}:Template:DoorList";
// REDIS KEY dati x registrazione statistiche esecuzione
public static readonly string STATS_DATA = $"{BASE_HASH}:CallStats";
// REDIS Channels messaggi x QueueMan (verso UI/srv) // REDIS Channels messaggi x QueueMan (verso UI/srv)
public static readonly string CALC_REQ_QUEUE = $"CalcRequest"; public static readonly string CALC_REQ_QUEUE = $"CalcRequest";
-50
View File
@@ -1,50 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WebDoorCreator.Core
{
public class ExecStats
{
/// <summary>
/// Numero chiamate registrate
/// </summary>
public int NumCall { get; set; } = 0;
/// <summary>
/// Durata totale chiamate
/// </summary>
public TimeSpan TotalTime { get; set; } = new TimeSpan(0, 0, 0);
/// <summary>
/// Tempo medio (calcolato)
/// </summary>
[NotMapped]
public TimeSpan AvgTime
{
get
{
TimeSpan answ = TotalTime;
if (NumCall > 1)
{
answ = TotalTime / NumCall;
}
return answ;
}
}
/// <summary>
/// Init classe
/// </summary>
/// <param name="numCall"></param>
/// <param name="duration"></param>
public ExecStats(int numCall, TimeSpan duration)
{
this.NumCall = numCall;
this.TotalTime = duration;
}
}
}
@@ -15,7 +15,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.27" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.14" />
<PackageReference Include="NLog" Version="5.2.2" /> <PackageReference Include="NLog" Version="5.2.2" />
<PackageReference Include="ReportViewerCore.NETCore" Version="15.1.17" /> <PackageReference Include="ReportViewerCore.NETCore" Version="15.1.17" />
<PackageReference Include="ToDataTable" Version="0.1.2" /> <PackageReference Include="ToDataTable" Version="0.1.2" />
@@ -158,6 +158,7 @@ namespace WebDoorCreator.Data.Controllers
public void Dispose() public void Dispose()
{ {
// Clear database context // Clear database context
//Log.Info("Dispose di GWMSController");
} }
/// <summary> /// <summary>
@@ -929,11 +930,6 @@ namespace WebDoorCreator.Data.Controllers
.Database .Database
.ExecuteSqlRaw("exec dbo.stp_ListVal_Import"); .ExecuteSqlRaw("exec dbo.stp_ListVal_Import");
// stored x pulizia folder rimaste in giro
storedRes = localDbCtx
.Database
.ExecuteSqlRaw("exec dbo.stp_ListVal_FixDix");
fatto = true; fatto = true;
} }
catch (Exception exc) catch (Exception exc)
+6 -6
View File
@@ -37,7 +37,7 @@ namespace WebDoorCreator.Data.DDF
{ {
string outDdf = ""; string outDdf = "";
try try
{ {
DoorOpsDTO CurrentDoorOp = new DoorOpsDTO(); DoorOpsDTO CurrentDoorOp = new DoorOpsDTO();
EdgesDto CurrentEdges = new EdgesDto(); EdgesDto CurrentEdges = new EdgesDto();
SizeDto CurrentSize = new SizeDto(); SizeDto CurrentSize = new SizeDto();
@@ -46,13 +46,10 @@ namespace WebDoorCreator.Data.DDF
FinishingDto CurrentFinishing = new FinishingDto(); FinishingDto CurrentFinishing = new FinishingDto();
DDFDto CurrentConf = new DDFDto(); DDFDto CurrentConf = new DDFDto();
ListValuesModel CurrentCompoOrder = new ListValuesModel(); 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... // per prima cosa popolo gli oggetti di appoggio...
dictDoorOP = new Dictionary<string, List<Dictionary<string, string>>>(); dictDoorOP = new Dictionary<string, List<Dictionary<string, string>>>();
var i = 0; 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!); var deserialized = JsonConvert.DeserializeObject<Dictionary<string, string>>(item.JsoncActVal!);
if (deserialized != null) if (deserialized != null)
@@ -125,7 +122,7 @@ namespace WebDoorCreator.Data.DDF
} }
i++; i++;
} }
CurrentSize.size = dictBaseDoorOp; CurrentSize.size = dictBaseDoorOp;
string sizeSer = CurrentSize.GetSerialized(RemDoorOp); string sizeSer = CurrentSize.GetSerialized(RemDoorOp);
//dictBaseDoorOp.Clear(); //dictBaseDoorOp.Clear();
foreach (var item in listOp.Where(x => x.ObjectId == "Swing")) foreach (var item in listOp.Where(x => x.ObjectId == "Swing"))
@@ -151,6 +148,9 @@ namespace WebDoorCreator.Data.DDF
#region Protected Properties #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 List<string> FootRows { get; set; } = new List<string>();
protected string FormatVers { get; set; } = "0"; protected string FormatVers { get; set; } = "0";
protected List<string> HeadRows { get; set; } = new List<string>(); protected List<string> HeadRows { get; set; } = new List<string>();
+1
View File
@@ -35,6 +35,7 @@ namespace WebDoorCreator.Data.DTO
} }
if (item.Contains("Separator")) if (item.Contains("Separator"))
{ {
//sb.Remove(item);
sb.AppendLine(" "); sb.AppendLine(" ");
} }
} }
+138 -451
View File
@@ -2,7 +2,6 @@
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Newtonsoft.Json; using Newtonsoft.Json;
using NLog; using NLog;
using NLog.LayoutRenderers.Wrappers;
using StackExchange.Redis; using StackExchange.Redis;
using System.Diagnostics; using System.Diagnostics;
using WebDoorCreator.Core; using WebDoorCreator.Core;
@@ -46,14 +45,6 @@ namespace WebDoorCreator.Data.Services
}; };
// leggo conf speciali // leggo conf speciali
vetoRemoveProcSec = _configuration.GetValue<int>("RuntimeOpt:VetoRemoveProcessing"); vetoRemoveProcSec = _configuration.GetValue<int>("RuntimeOpt:VetoRemoveProcessing");
logTimingEnable = configuration.GetValue<bool>("RuntimeOpt:LogTimingEnable");
statSampleSize = configuration.GetValue<int>("RuntimeOpt:StatSampleSize");
// fix dati img missing...
missingFilePath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/images", "MissingOrange.svg");
if (File.Exists(missingFilePath))
{
missingSvgContent = File.ReadAllText(missingFilePath);
}
Log.Info("QueueDataService started!"); Log.Info("QueueDataService started!");
} }
@@ -188,61 +179,19 @@ namespace WebDoorCreator.Data.Services
answ = $"{rawData}"; answ = $"{rawData}";
} }
} }
return answ; // se non trovata --> missing!
}
/// <summary>
/// Restituisce SVG dell'immagine missing...
/// </summary>
/// <param name="DoorId"></param>
/// <returns></returns>
public string DoorGetMissingSvg()
{
string answ = missingSvgContent;
if (string.IsNullOrEmpty(answ)) if (string.IsNullOrEmpty(answ))
{ {
// fix dati img missing... // leggo missing standard...
missingFilePath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/images", "MissingOrange.svg"); string missingFilePath = Path.Combine(System.IO.Directory.GetCurrentDirectory(), "wwwroot/images", "MissingOrange.svg");
if (File.Exists(missingFilePath)) if (File.Exists(missingFilePath))
{ {
missingSvgContent = File.ReadAllText(missingFilePath); answ = File.ReadAllText(missingFilePath);
answ = missingSvgContent;
} }
} }
return answ; 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> /// <summary>
/// Remove for single hash record /// Remove for single hash record
/// </summary> /// </summary>
@@ -260,15 +209,13 @@ namespace WebDoorCreator.Data.Services
/// <returns>Dictionary of DoorId, saveVersNumb</returns> /// <returns>Dictionary of DoorId, saveVersNumb</returns>
public async Task<Dictionary<string, string>> DoorRefreshStatus() public async Task<Dictionary<string, string>> DoorRefreshStatus()
{ {
string source = "REDIS";
long numReq = 0; long numReq = 0;
Dictionary<string, string> dictResult = new Dictionary<string, string>(); Dictionary<string, string> dictResult = new Dictionary<string, string>();
// cerco da cache // cerco da cache
RedisKey currKey = new RedisKey(Constants.LAST_DOOR_REFR_KEY); RedisKey currKey = new RedisKey(Constants.LAST_DOOR_REFR_KEY);
Stopwatch sw = new Stopwatch(); Stopwatch stopWatch = new Stopwatch();
if (logTimingEnable) stopWatch.Start();
{
sw.Start();
}
numReq = redisDb.HashLength(currKey); numReq = redisDb.HashLength(currKey);
if (numReq > 0) if (numReq > 0)
{ {
@@ -278,12 +225,9 @@ namespace WebDoorCreator.Data.Services
dictResult.Add($"{item.Name}", $"{item.Value}"); dictResult.Add($"{item.Name}", $"{item.Value}");
} }
} }
if (logTimingEnable) stopWatch.Stop();
{ TimeSpan ts = stopWatch.Elapsed;
sw.Stop(); Log.Debug($"DoorRefreshStatus | {source} in: {ts.TotalMilliseconds} ms");
// gestione statistiche
await ProcStatLog("DoorRefreshStatus", sw.Elapsed, 1, 0.3);
}
return dictResult; return dictResult;
} }
@@ -321,7 +265,7 @@ namespace WebDoorCreator.Data.Services
{ {
bool found = false; bool found = false;
RedisKey currKey = new RedisKey(Constants.DOOR_TPL_LIST); RedisKey currKey = new RedisKey(Constants.DOOR_TPL_LIST);
var rawVal = await RedHashGetString(currKey, DoorId, true); var rawVal = await RedHashGetString(currKey, DoorId);
found = !string.IsNullOrEmpty(rawVal) && (rawVal == DoorId); found = !string.IsNullOrEmpty(rawVal) && (rawVal == DoorId);
return found; return found;
} }
@@ -360,18 +304,12 @@ namespace WebDoorCreator.Data.Services
Dictionary<string, string> dictResult = new Dictionary<string, string>(); Dictionary<string, string> dictResult = new Dictionary<string, string>();
// cerco da cache // cerco da cache
RedisKey currKey = new RedisKey(Constants.CALC_REQ_DONE); RedisKey currKey = new RedisKey(Constants.CALC_REQ_DONE);
Stopwatch sw = new Stopwatch(); Stopwatch stopWatch = new Stopwatch();
if (logTimingEnable) stopWatch.Start();
{
sw.Start();
}
numReq = await redisDb.HashLengthAsync(currKey); numReq = await redisDb.HashLengthAsync(currKey);
if (logTimingEnable) stopWatch.Stop();
{ TimeSpan ts = stopWatch.Elapsed;
sw.Stop(); Log.Debug($"NumRequestDone | {source} in: {ts.TotalMilliseconds} ms");
// gestione statistiche
await ProcStatLog("NumRequestDone", sw.Elapsed, 2, 10);
}
return numReq; return numReq;
} }
@@ -385,18 +323,12 @@ namespace WebDoorCreator.Data.Services
Dictionary<string, string> dictResult = new Dictionary<string, string>(); Dictionary<string, string> dictResult = new Dictionary<string, string>();
// cerco da cache // cerco da cache
RedisKey currKey = new RedisKey(Constants.CALC_REQ_ERRS); RedisKey currKey = new RedisKey(Constants.CALC_REQ_ERRS);
Stopwatch sw = new Stopwatch(); Stopwatch stopWatch = new Stopwatch();
if (logTimingEnable) stopWatch.Start();
{
sw.Start();
}
numReq = await redisDb.HashLengthAsync(currKey); numReq = await redisDb.HashLengthAsync(currKey);
if (logTimingEnable) stopWatch.Stop();
{ TimeSpan ts = stopWatch.Elapsed;
sw.Stop(); Log.Debug($"NumRequestErrors | {source} in: {ts.TotalMilliseconds} ms");
// gestione statistiche
await ProcStatLog("NumRequestErrors", sw.Elapsed, 2, 10);
}
return numReq; return numReq;
} }
@@ -410,18 +342,12 @@ namespace WebDoorCreator.Data.Services
Dictionary<string, string> dictResult = new Dictionary<string, string>(); Dictionary<string, string> dictResult = new Dictionary<string, string>();
// cerco da cache // cerco da cache
RedisKey currKey = new RedisKey(Constants.CALC_REQ_PEND); RedisKey currKey = new RedisKey(Constants.CALC_REQ_PEND);
Stopwatch sw = new Stopwatch(); Stopwatch stopWatch = new Stopwatch();
if (logTimingEnable) stopWatch.Start();
{
sw.Start();
}
numReq = await redisDb.HashLengthAsync(currKey); numReq = await redisDb.HashLengthAsync(currKey);
if (logTimingEnable) stopWatch.Stop();
{ TimeSpan ts = stopWatch.Elapsed;
sw.Stop(); Log.Debug($"NumRequestPending | {source} in: {ts.TotalMilliseconds} ms");
// gestione statistiche
await ProcStatLog("NumRequestPending", sw.Elapsed, 2, 10);
}
return numReq; return numReq;
} }
@@ -435,18 +361,12 @@ namespace WebDoorCreator.Data.Services
Dictionary<string, string> dictResult = new Dictionary<string, string>(); Dictionary<string, string> dictResult = new Dictionary<string, string>();
// cerco da cache // cerco da cache
RedisKey currKey = new RedisKey(Constants.CALC_REQ_PROC); RedisKey currKey = new RedisKey(Constants.CALC_REQ_PROC);
Stopwatch sw = new Stopwatch(); Stopwatch stopWatch = new Stopwatch();
if (logTimingEnable) stopWatch.Start();
{
sw.Start();
}
numReq = await redisDb.HashLengthAsync(currKey); numReq = await redisDb.HashLengthAsync(currKey);
if (logTimingEnable) stopWatch.Stop();
{ TimeSpan ts = stopWatch.Elapsed;
sw.Stop(); Log.Debug($"NumRequestProcessing | {source} in: {ts.TotalMilliseconds} ms");
// gestione statistiche
await ProcStatLog("NumRequestProcessing", sw.Elapsed, 2, 10);
}
return numReq; return numReq;
} }
@@ -459,11 +379,8 @@ namespace WebDoorCreator.Data.Services
public async Task<int> RedHashGetInt(RedisKey currKey, string chiave) public async Task<int> RedHashGetInt(RedisKey currKey, string chiave)
{ {
int result = 0; int result = 0;
Stopwatch sw = new Stopwatch(); Stopwatch stopWatch = new Stopwatch();
if (logTimingEnable) stopWatch.Start();
{
sw.Start();
}
var hasVal = await redisDb.HashExistsAsync(currKey, chiave); var hasVal = await redisDb.HashExistsAsync(currKey, chiave);
if (hasVal) if (hasVal)
{ {
@@ -473,12 +390,9 @@ namespace WebDoorCreator.Data.Services
int.TryParse($"{rawRes}", out result); int.TryParse($"{rawRes}", out result);
} }
} }
if (logTimingEnable) stopWatch.Stop();
{ TimeSpan ts = stopWatch.Elapsed;
sw.Stop(); Log.Trace($"RedHashGetInt | {currKey} | in: {ts.TotalMilliseconds} ms");
// gestione statistiche
await ProcStatLog("RedHashGetInt", sw.Elapsed, 0, 0.3);
}
return result; return result;
} }
@@ -487,16 +401,12 @@ namespace WebDoorCreator.Data.Services
/// </summary> /// </summary>
/// <param name="currKey">Redis Key for Hashlist</param> /// <param name="currKey">Redis Key for Hashlist</param>
/// <param name="chiave">Requested key on list</param> /// <param name="chiave">Requested key on list</param>
/// <param name="doTimeLog">Execute time log processing</param>
/// <returns>Value as string</returns> /// <returns>Value as string</returns>
public async Task<string> RedHashGetString(RedisKey currKey, string chiave, bool doTimeLog) public async Task<string> RedHashGetString(RedisKey currKey, string chiave)
{ {
string result = ""; string result = "";
Stopwatch sw = new Stopwatch(); Stopwatch stopWatch = new Stopwatch();
if (logTimingEnable && doTimeLog) stopWatch.Start();
{
sw.Start();
}
var hasVal = await redisDb.HashExistsAsync(currKey, chiave); var hasVal = await redisDb.HashExistsAsync(currKey, chiave);
if (hasVal) if (hasVal)
{ {
@@ -506,12 +416,9 @@ namespace WebDoorCreator.Data.Services
result = $"{rawRes}"; result = $"{rawRes}";
} }
} }
if (logTimingEnable && doTimeLog) stopWatch.Stop();
{ TimeSpan ts = stopWatch.Elapsed;
sw.Stop(); Log.Trace($"RedHashGetString | {currKey} | in: {ts.TotalMilliseconds} ms");
// gestione statistiche
await ProcStatLog("RedHashGetString", sw.Elapsed, 0, 0.3);
}
return result; return result;
} }
@@ -524,48 +431,15 @@ namespace WebDoorCreator.Data.Services
public async Task<bool> RedHashRemove(RedisKey currKey, string chiave) public async Task<bool> RedHashRemove(RedisKey currKey, string chiave)
{ {
bool fatto = false; bool fatto = false;
Stopwatch sw = new Stopwatch(); Stopwatch stopWatch = new Stopwatch();
if (logTimingEnable) stopWatch.Start();
{
sw.Start();
}
fatto = await redisDb.HashDeleteAsync(currKey, chiave); fatto = await redisDb.HashDeleteAsync(currKey, chiave);
if (logTimingEnable) stopWatch.Stop();
{ TimeSpan ts = stopWatch.Elapsed;
sw.Stop(); Log.Trace($"RedHashRemove | {currKey} | in: {ts.TotalMilliseconds} ms");
// gestione statistiche
await ProcStatLog("RedHashRemove", sw.Elapsed, 0, 0.3);
}
return fatto; return fatto;
} }
/// <summary>
/// Effettua upsert in HasList redis
/// </summary>
/// <param name="currKey">Chiave redis della Hashlist</param>
/// <param name="chiave">Chiave nella HashList</param>
/// <param name="valore">Valore da salvare</param>
/// <param name="doTimeLog">Gestione log time abilitata</param>
/// <returns>Num record nella HashList</returns>
public async Task<long> RedHashUpsert(RedisKey currKey, string chiave, string valore, bool doTimeLog = true)
{
long numReq = 0;
Stopwatch sw = new Stopwatch();
if (logTimingEnable && doTimeLog)
{
sw.Start();
}
await redisDb.HashSetAsync(currKey, chiave, valore);
numReq = await redisDb.HashLengthAsync(currKey);
if (logTimingEnable && doTimeLog)
{
sw.Stop();
// gestione statistiche
await ProcStatLog("RedHashUpsert", sw.Elapsed, 0, 0.3);
}
return numReq;
}
/// <summary> /// <summary>
/// Restitusice gli errori della porta in oggetto /// Restitusice gli errori della porta in oggetto
/// </summary> /// </summary>
@@ -588,15 +462,13 @@ namespace WebDoorCreator.Data.Services
/// <returns>Dictionary of DoorId, saveVersNumb</returns> /// <returns>Dictionary of DoorId, saveVersNumb</returns>
public async Task<Dictionary<string, string>> RequestDone() public async Task<Dictionary<string, string>> RequestDone()
{ {
string source = "REDIS";
long numReq = 0; long numReq = 0;
Dictionary<string, string> dictResult = new Dictionary<string, string>(); Dictionary<string, string> dictResult = new Dictionary<string, string>();
// cerco da cache // cerco da cache
RedisKey currKey = new RedisKey(Constants.CALC_REQ_DONE); RedisKey currKey = new RedisKey(Constants.CALC_REQ_DONE);
Stopwatch sw = new Stopwatch(); Stopwatch stopWatch = new Stopwatch();
if (logTimingEnable) stopWatch.Start();
{
sw.Start();
}
numReq = redisDb.HashLength(currKey); numReq = redisDb.HashLength(currKey);
if (numReq > 0) if (numReq > 0)
{ {
@@ -606,12 +478,9 @@ namespace WebDoorCreator.Data.Services
dictResult.Add($"{item.Name}", $"{item.Value}"); dictResult.Add($"{item.Name}", $"{item.Value}");
} }
} }
if (logTimingEnable) stopWatch.Stop();
{ TimeSpan ts = stopWatch.Elapsed;
sw.Stop(); Log.Debug($"RequestDone | {source} in: {ts.TotalMilliseconds} ms");
// gestione statistiche
await ProcStatLog("RequestDone", sw.Elapsed, 1, 10);
}
return dictResult; return dictResult;
} }
@@ -622,15 +491,13 @@ namespace WebDoorCreator.Data.Services
/// <returns></returns> /// <returns></returns>
public async Task<Dictionary<string, string>> RequestDoneGetSingle(int DoorId) public async Task<Dictionary<string, string>> RequestDoneGetSingle(int DoorId)
{ {
string source = "REDIS";
long numReq = 0; long numReq = 0;
Dictionary<string, string> dictResult = new Dictionary<string, string>(); Dictionary<string, string> dictResult = new Dictionary<string, string>();
// cerco da cache // cerco da cache
RedisKey currKey = new RedisKey(Constants.CALC_REQ_DONE); RedisKey currKey = new RedisKey(Constants.CALC_REQ_DONE);
Stopwatch sw = new Stopwatch(); Stopwatch stopWatch = new Stopwatch();
if (logTimingEnable) stopWatch.Start();
{
sw.Start();
}
numReq = redisDb.HashLength(currKey); numReq = redisDb.HashLength(currKey);
if (numReq > 0) if (numReq > 0)
{ {
@@ -640,12 +507,9 @@ namespace WebDoorCreator.Data.Services
dictResult.Add($"{DoorId}", $"{rawData}"); dictResult.Add($"{DoorId}", $"{rawData}");
} }
} }
if (logTimingEnable) stopWatch.Stop();
{ TimeSpan ts = stopWatch.Elapsed;
sw.Stop(); Log.Debug($"RequestDoneGetSingle | {source} in: {ts.TotalMilliseconds} ms");
// gestione statistiche
await ProcStatLog("RequestDoneGetSingle", sw.Elapsed, 1, 0.3);
}
return dictResult; return dictResult;
} }
@@ -677,15 +541,13 @@ namespace WebDoorCreator.Data.Services
/// <returns>Dictionary of DoorId, saveVersNumb</returns> /// <returns>Dictionary of DoorId, saveVersNumb</returns>
public async Task<Dictionary<string, string>> RequestErr() public async Task<Dictionary<string, string>> RequestErr()
{ {
string source = "REDIS";
long numReq = 0; long numReq = 0;
Dictionary<string, string> dictResult = new Dictionary<string, string>(); Dictionary<string, string> dictResult = new Dictionary<string, string>();
// cerco da cache // cerco da cache
RedisKey currKey = new RedisKey(Constants.CALC_REQ_ERRS); RedisKey currKey = new RedisKey(Constants.CALC_REQ_ERRS);
Stopwatch sw = new Stopwatch(); Stopwatch stopWatch = new Stopwatch();
if (logTimingEnable) stopWatch.Start();
{
sw.Start();
}
numReq = redisDb.HashLength(currKey); numReq = redisDb.HashLength(currKey);
if (numReq > 0) if (numReq > 0)
{ {
@@ -695,12 +557,9 @@ namespace WebDoorCreator.Data.Services
dictResult.Add($"{item.Name}", $"{item.Value}"); dictResult.Add($"{item.Name}", $"{item.Value}");
} }
} }
if (logTimingEnable) stopWatch.Stop();
{ TimeSpan ts = stopWatch.Elapsed;
sw.Stop(); Log.Debug($"RequestErr | {source} in: {ts.TotalMilliseconds} ms");
// gestione statistiche
await ProcStatLog("RequestErr", sw.Elapsed, 1, 10);
}
return dictResult; return dictResult;
} }
@@ -732,15 +591,13 @@ namespace WebDoorCreator.Data.Services
/// <returns>Dictionary of DoorId, saveVersNumb</returns> /// <returns>Dictionary of DoorId, saveVersNumb</returns>
public async Task<Dictionary<string, string>> RequestPending() public async Task<Dictionary<string, string>> RequestPending()
{ {
string source = "REDIS";
long numReq = 0; long numReq = 0;
Dictionary<string, string> dictResult = new Dictionary<string, string>(); Dictionary<string, string> dictResult = new Dictionary<string, string>();
// cerco da cache // cerco da cache
RedisKey currKey = new RedisKey(Constants.CALC_REQ_PEND); RedisKey currKey = new RedisKey(Constants.CALC_REQ_PEND);
Stopwatch sw = new Stopwatch(); Stopwatch stopWatch = new Stopwatch();
if (logTimingEnable) stopWatch.Start();
{
sw.Start();
}
numReq = redisDb.HashLength(currKey); numReq = redisDb.HashLength(currKey);
if (numReq > 0) if (numReq > 0)
{ {
@@ -750,12 +607,9 @@ namespace WebDoorCreator.Data.Services
dictResult.Add($"{item.Name}", $"{item.Value}"); dictResult.Add($"{item.Name}", $"{item.Value}");
} }
} }
if (logTimingEnable) stopWatch.Stop();
{ TimeSpan ts = stopWatch.Elapsed;
sw.Stop(); Log.Debug($"RequestPending | {source} in: {ts.TotalMilliseconds} ms");
// gestione statistiche
await ProcStatLog("RequestPending", sw.Elapsed, 1, 10);
}
return dictResult; return dictResult;
} }
@@ -787,15 +641,13 @@ namespace WebDoorCreator.Data.Services
/// <returns>Dictionary of DoorId, saveVersNumb</returns> /// <returns>Dictionary of DoorId, saveVersNumb</returns>
public async Task<Dictionary<string, string>> RequestProcessing() public async Task<Dictionary<string, string>> RequestProcessing()
{ {
string source = "REDIS";
long numReq = 0; long numReq = 0;
Dictionary<string, string> dictResult = new Dictionary<string, string>(); Dictionary<string, string> dictResult = new Dictionary<string, string>();
// cerco da cache // cerco da cache
RedisKey currKey = new RedisKey(Constants.CALC_REQ_PROC); RedisKey currKey = new RedisKey(Constants.CALC_REQ_PROC);
Stopwatch sw = new Stopwatch(); Stopwatch stopWatch = new Stopwatch();
if (logTimingEnable) stopWatch.Start();
{
sw.Start();
}
numReq = redisDb.HashLength(currKey); numReq = redisDb.HashLength(currKey);
if (numReq > 0) if (numReq > 0)
{ {
@@ -805,12 +657,9 @@ namespace WebDoorCreator.Data.Services
dictResult.Add($"{item.Name}", $"{item.Value}"); dictResult.Add($"{item.Name}", $"{item.Value}");
} }
} }
if (logTimingEnable) stopWatch.Stop();
{ TimeSpan ts = stopWatch.Elapsed;
sw.Stop(); Log.Debug($"RequestProcessing | {source} in: {ts.TotalMilliseconds} ms");
// gestione statistiche
await ProcStatLog("RequestProcessing", sw.Elapsed, 1, 10);
}
return dictResult; return dictResult;
} }
@@ -846,11 +695,9 @@ namespace WebDoorCreator.Data.Services
public async Task<bool> ResetQueue() public async Task<bool> ResetQueue()
{ {
bool fatto = false; bool fatto = false;
Stopwatch sw = new Stopwatch(); await Task.Delay(1);
if (logTimingEnable) Stopwatch stopWatch = new Stopwatch();
{ stopWatch.Start();
sw.Start();
}
// cerco le richieste processing // cerco le richieste processing
RedisKey currKey = new RedisKey(Constants.CALC_REQ_PROC); RedisKey currKey = new RedisKey(Constants.CALC_REQ_PROC);
var rawData = await redisDb.HashGetAllAsync(currKey); var rawData = await redisDb.HashGetAllAsync(currKey);
@@ -878,12 +725,9 @@ namespace WebDoorCreator.Data.Services
await RequestDoneRemove(item.Name!); await RequestDoneRemove(item.Name!);
fatto = true; fatto = true;
} }
if (logTimingEnable) stopWatch.Stop();
{ TimeSpan ts = stopWatch.Elapsed;
sw.Stop(); Log.Debug($"ResetQueue | REDIS EXEC in: {ts.TotalMilliseconds} ms");
// gestione statistiche
await ProcStatLog("ResetQueue", sw.Elapsed, 1, 0.3);
}
return fatto; return fatto;
} }
@@ -895,11 +739,8 @@ namespace WebDoorCreator.Data.Services
{ {
int num2proc = DoorIdList.Count; int num2proc = DoorIdList.Count;
List<string> listDone = new List<string>(); List<string> listDone = new List<string>();
Stopwatch sw = new Stopwatch(); Stopwatch stopWatch = new Stopwatch();
if (logTimingEnable) stopWatch.Start();
{
sw.Start();
}
// cerco le richieste processing // cerco le richieste processing
RedisKey currKey = new RedisKey(Constants.CALC_REQ_PROC); RedisKey currKey = new RedisKey(Constants.CALC_REQ_PROC);
var rawData = await redisDb.HashGetAllAsync(currKey); var rawData = await redisDb.HashGetAllAsync(currKey);
@@ -946,11 +787,9 @@ namespace WebDoorCreator.Data.Services
DoorIdList.Remove(item); DoorIdList.Remove(item);
} }
#endif #endif
if (logTimingEnable) stopWatch.Stop();
{ TimeSpan ts = stopWatch.Elapsed;
sw.Stop(); Log.Debug($"ResetQueueByDoorList | doors #: {num2proc} --> {DoorIdList.Count} | EXEC in: {ts.TotalMilliseconds} ms");
Log.Debug($"ResetQueueByDoorList | doors #: {num2proc} --> {DoorIdList.Count} | EXEC in: {sw.Elapsed.TotalMilliseconds} ms");
}
return DoorIdList; return DoorIdList;
} }
@@ -962,11 +801,8 @@ namespace WebDoorCreator.Data.Services
{ {
bool fatto = false; bool fatto = false;
await Task.Delay(1); await Task.Delay(1);
Stopwatch sw = new Stopwatch(); Stopwatch stopWatch = new Stopwatch();
if (logTimingEnable) stopWatch.Start();
{
sw.Start();
}
// cerco le richieste processing // cerco le richieste processing
RedisKey currKey = new RedisKey(Constants.CALC_REQ_PROC); RedisKey currKey = new RedisKey(Constants.CALC_REQ_PROC);
RedisKey currVetoKey = new RedisKey($"{Constants.CALC_REQ_PROC}:0"); RedisKey currVetoKey = new RedisKey($"{Constants.CALC_REQ_PROC}:0");
@@ -983,12 +819,9 @@ namespace WebDoorCreator.Data.Services
fatto = true; fatto = true;
} }
} }
if (logTimingEnable) stopWatch.Stop();
{ TimeSpan ts = stopWatch.Elapsed;
sw.Stop(); Log.Debug($"ResetQueueProcessing | REDIS EXEC in: {ts.TotalMilliseconds} ms");
// gestione statistiche
await ProcStatLog("ResetQueueProcessing", sw.Elapsed, 1, 10);
}
return fatto; return fatto;
} }
@@ -1025,8 +858,7 @@ namespace WebDoorCreator.Data.Services
} }
else else
{ {
// 2024.02.15 salvo in cache x 2 settimane, fare 1+ mesi?!? await redisDb.StringSetAsync(currSvgKey, calcTask.SvgGen, WeekLongCache);
await redisDb.StringSetAsync(currSvgKey, calcTask.SvgGen, DblWeekLongCache);
} }
// elimino dalle code proc/err // elimino dalle code proc/err
await RequestProcessingRemove(sDoorId); await RequestProcessingRemove(sDoorId);
@@ -1072,11 +904,8 @@ namespace WebDoorCreator.Data.Services
/// <returns>indice/versione del calcolo DDF</returns> /// <returns>indice/versione del calcolo DDF</returns>
public async Task<int> SendCalcReq(int DoorId, string FullDDF) public async Task<int> SendCalcReq(int DoorId, string FullDDF)
{ {
Stopwatch sw = new Stopwatch(); Stopwatch stopWatch = new Stopwatch();
if (logTimingEnable) stopWatch.Start();
{
sw.Start();
}
string sDoorId = $"{DoorId}"; string sDoorId = $"{DoorId}";
int currVers = await DoorCalcRev(sDoorId); int currVers = await DoorCalcRev(sDoorId);
string sCurrVers = $"{currVers}"; string sCurrVers = $"{currVers}";
@@ -1086,91 +915,18 @@ namespace WebDoorCreator.Data.Services
// salvo nell'archivio REDIS delle porte il DDF corrente (key=doorId.versNumb), potrebbe // salvo nell'archivio REDIS delle porte il DDF corrente (key=doorId.versNumb), potrebbe
// venire buono anche x eventuale UNDO... // venire buono anche x eventuale UNDO...
RedisKey currDdfKey = new RedisKey($"{Constants.CALC_REQ_DDF_CACHE}:{sDoorId}:{sCurrVers}"); RedisKey currDdfKey = new RedisKey($"{Constants.CALC_REQ_DDF_CACHE}:{sDoorId}:{sCurrVers}");
await redisDb.StringSetAsync(currDdfKey, FullDDF, DblWeekLongCache); await redisDb.StringSetAsync(currDdfKey, FullDDF, WeekLongCache);
// invio sul canale dei messaggi il numero di items in coda attuali x chiedere esecuzione... // invio sul canale dei messaggi il numero di items in coda attuali x chiedere esecuzione...
long numPending = await NumRequestPending(); long numPending = await NumRequestPending();
bool answ = CalcReqPipe.saveAndSendMessage(Constants.LAST_CALC_REQ_KEY, $"{numPending}"); bool answ = CalcReqPipe.saveAndSendMessage(Constants.LAST_CALC_REQ_KEY, $"{numPending}");
if (logTimingEnable) stopWatch.Stop();
{ TimeSpan ts = stopWatch.Elapsed;
sw.Stop(); Log.Debug($"SendCalcReq | DoorId: {DoorId} enqueued in: {ts.TotalMilliseconds} ms");
Log.Debug($"SendCalcReq | DoorId: {DoorId} enqueued in: {sw.Elapsed.TotalMilliseconds} ms");
}
return currVers; return currVers;
} }
/// <summary>
/// Restituisce dati statistica richiesta
/// </summary>
/// <param name="statName">Nome statistica</param>
/// <returns></returns>
public async Task<ExecStats> StatGetAsync(string statName)
{
ExecStats answ = new ExecStats(0, new TimeSpan());
RedisKey currKey = new RedisKey(Constants.STATS_DATA);
// cerco nella hashTable...
var rawData = await RedHashGetString(currKey, statName, false);
// se c'è rileggo ed aggiorno
if (!string.IsNullOrEmpty(rawData))
{
var currStat = JsonConvert.DeserializeObject<ExecStats>(rawData);
if (currStat != null)
{
answ = currStat;
}
}
return answ;
}
/// <summary>
/// Resetta dati statistica esecuzione x log restituendo i valori precedentemente contenuti
/// </summary>
/// <param name="statName">Nome statistica</param>
/// <returns></returns>
public async Task<ExecStats> StatReset(string statName)
{
RedisKey currKey = new RedisKey(Constants.STATS_DATA);
ExecStats answ = await StatGetAsync(statName);
// ora rimuovo valore
await RedHashRemove(currKey, statName);
return answ;
}
/// <summary>
/// Effettua upsert dati statistica esecuzione x log
/// </summary>
/// <param name="statName">Nome statistica</param>
/// <param name="duration">Durata esecuzione come timespan</param>
/// <param name="evMultipl">moltiplicatore soglia x log statistica (default = 1)</param>
/// <returns></returns>
public async Task<bool> StatUpsert(string statName, TimeSpan duration, double evMultipl)
{
bool answ = false;
RedisKey currKey = new RedisKey(Constants.STATS_DATA);
// cerco nella hashTable...
var rawData = await RedHashGetString(currKey, statName, false);
// di default inizializzo a null...
ExecStats newStat = new ExecStats(1, duration);
// se c'è rileggo ed aggiorno
if (!string.IsNullOrEmpty(rawData))
{
var currStat = JsonConvert.DeserializeObject<ExecStats>(rawData);
if (currStat != null)
{
currStat.NumCall++;
currStat.TotalTime += duration;
newStat = currStat;
}
}
// ora aggiorno su redis
rawData = JsonConvert.SerializeObject(newStat);
var numRec = await RedHashUpsert(currKey, statName, rawData, false);
// verifico se da considerare superato limite sample
answ = newStat.NumCall >= (int)(statSampleSize * evMultipl);
return answ;
}
/// <summary> /// <summary>
/// Get Queue request pending, removing from queue and putting on processing queue /// Get Queue request pending, removing from queue and putting on processing queue
/// </summary> /// </summary>
@@ -1182,11 +938,8 @@ namespace WebDoorCreator.Data.Services
Dictionary<string, string> dictResult = new Dictionary<string, string>(); Dictionary<string, string> dictResult = new Dictionary<string, string>();
// cerco da cache // cerco da cache
RedisKey currKey = new RedisKey(Constants.CALC_REQ_PEND); RedisKey currKey = new RedisKey(Constants.CALC_REQ_PEND);
Stopwatch sw = new Stopwatch(); Stopwatch stopWatch = new Stopwatch();
if (logTimingEnable) stopWatch.Start();
{
sw.Start();
}
// calcolo il totale delle richieste pending // calcolo il totale delle richieste pending
numReq = redisDb.HashLength(currKey); numReq = redisDb.HashLength(currKey);
if (numReq > 0) if (numReq > 0)
@@ -1218,12 +971,9 @@ namespace WebDoorCreator.Data.Services
// sblocco // sblocco
queueLock = false; queueLock = false;
} }
if (logTimingEnable) stopWatch.Stop();
{ TimeSpan ts = stopWatch.Elapsed;
sw.Stop(); Log.Debug($"TakeProcessingItems | REDIS in: {ts.TotalMilliseconds} ms");
// gestione statistiche
await ProcStatLog("TakeProcessingItems", sw.Elapsed, 1, 0.3);
}
return dictResult; return dictResult;
} }
@@ -1232,9 +982,7 @@ namespace WebDoorCreator.Data.Services
#region Protected Fields #region Protected Fields
protected const string rKeyCalcOreFase = "Check:OreFasi"; protected const string rKeyCalcOreFase = "Check:OreFasi";
protected const string rKeyFasiAct = "Check:FasiAct"; protected const string rKeyFasiAct = "Check:FasiAct";
protected const string rKeyProjAct = "Check:ProjAct"; protected const string rKeyProjAct = "Check:ProjAct";
/// <summary> /// <summary>
@@ -1243,7 +991,6 @@ namespace WebDoorCreator.Data.Services
protected const int shortTTL = 60 * 5; protected const int shortTTL = 60 * 5;
protected int idxSim = 0; protected int idxSim = 0;
protected Random rnd = new Random(); protected Random rnd = new Random();
#endregion Protected Fields #endregion Protected Fields
@@ -1272,7 +1019,7 @@ namespace WebDoorCreator.Data.Services
* se non trova riparte da 1 * se non trova riparte da 1
* *
----------------------------------*/ ----------------------------------*/
int currVers = 0; int currVers = 1;
string sCurrVers = ""; string sCurrVers = "";
// per prima cosa controllo se ho GIA' in coda qualcosa come richieste // per prima cosa controllo se ho GIA' in coda qualcosa come richieste
if (await NumRequestPending() > 0) if (await NumRequestPending() > 0)
@@ -1283,11 +1030,13 @@ namespace WebDoorCreator.Data.Services
if (currPending.ContainsKey(sDoorId)) if (currPending.ContainsKey(sDoorId))
{ {
sCurrVers = currPending[sDoorId]; sCurrVers = currPending[sDoorId];
int.TryParse(sCurrVers, out currVers);
currVers++;
} }
} }
} }
// cerco coda errori // cerco coda errori
if (string.IsNullOrEmpty(sCurrVers) && await NumRequestErrors() > 0) if (await NumRequestErrors() > 0)
{ {
var currErrors = await RequestErr(); var currErrors = await RequestErr();
if (currErrors != null) if (currErrors != null)
@@ -1295,11 +1044,13 @@ namespace WebDoorCreator.Data.Services
if (currErrors.ContainsKey(sDoorId)) if (currErrors.ContainsKey(sDoorId))
{ {
sCurrVers = currErrors[sDoorId]; sCurrVers = currErrors[sDoorId];
int.TryParse(sCurrVers, out currVers);
currVers++;
} }
} }
} }
// cerco coda task completati // cerco coda task completati
if (string.IsNullOrEmpty(sCurrVers) && await NumRequestDone() > 0) if (await NumRequestDone() > 0)
{ {
var currDone = await RequestDone(); var currDone = await RequestDone();
if (currDone != null) if (currDone != null)
@@ -1307,12 +1058,11 @@ namespace WebDoorCreator.Data.Services
if (currDone.ContainsKey(sDoorId)) if (currDone.ContainsKey(sDoorId))
{ {
sCurrVers = currDone[sDoorId]; sCurrVers = currDone[sDoorId];
int.TryParse(sCurrVers, out currVers);
currVers++;
} }
} }
} }
// calcolo ed incremento
int.TryParse(sCurrVers, out currVers);
currVers++;
// inserisco in coda x calcoli // inserisco in coda x calcoli
await RequestPendingUpsert(sDoorId, $"{currVers}"); await RequestPendingUpsert(sDoorId, $"{currVers}");
// metto in coda "last calc" la porta corrente x pulizia successiva // metto in coda "last calc" la porta corrente x pulizia successiva
@@ -1336,6 +1086,26 @@ namespace WebDoorCreator.Data.Services
return answ; return answ;
} }
/// <summary>
/// Effettua upsert in HasList redis
/// </summary>
/// <param name="currKey">Chiave redis della Hashlist</param>
/// <param name="chiave">Chiave nella HashList</param>
/// <param name="valore">Valore da salvare</param>
/// <returns>Num record nella HashList</returns>
protected async Task<long> RedHashUpsert(RedisKey currKey, string chiave, string valore)
{
long numReq = 0;
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
await redisDb.HashSetAsync(currKey, chiave, valore);
numReq = await redisDb.HashLengthAsync(currKey);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"RedHashUpsert | {currKey} | in: {ts.TotalMilliseconds} ms");
return numReq;
}
/// <summary> /// <summary>
/// Salvataggio chiave in redis /// Salvataggio chiave in redis
/// </summary> /// </summary>
@@ -1346,7 +1116,8 @@ namespace WebDoorCreator.Data.Services
protected async Task<bool> setRSV(string rKey, string rVal, int ttlSec) protected async Task<bool> setRSV(string rKey, string rVal, int ttlSec)
{ {
bool fatto = false; bool fatto = false;
fatto = await redisDb.StringSetAsync(rKey, rVal, TimeSpan.FromSeconds(ttlSec)); await redisDb.StringSetAsync(rKey, rVal, TimeSpan.FromSeconds(ttlSec));
fatto = true;
return fatto; return fatto;
} }
@@ -1360,7 +1131,8 @@ namespace WebDoorCreator.Data.Services
protected async Task<bool> setRSV(string rKey, int rValInt, int ttlSec) protected async Task<bool> setRSV(string rKey, int rValInt, int ttlSec)
{ {
bool fatto = false; bool fatto = false;
fatto = await redisDb.StringSetAsync(rKey, rValInt, TimeSpan.FromSeconds(ttlSec)); await redisDb.StringSetAsync(rKey, rValInt, TimeSpan.FromSeconds(ttlSec));
fatto = true;
return fatto; return fatto;
} }
@@ -1381,16 +1153,8 @@ namespace WebDoorCreator.Data.Services
#region Private Fields #region Private Fields
private static IConfiguration _configuration = null!; private static IConfiguration _configuration = null!;
private static JsonSerializerSettings? JSSettings; private static JsonSerializerSettings? JSSettings;
private static Logger Log = LogManager.GetCurrentClassLogger(); private static Logger Log = LogManager.GetCurrentClassLogger();
/// <summary>
/// Dimensione campione da registrare e trascrivere in log
/// </summary>
private static int statSampleSize = 1;
private readonly IEmailSender _emailSender; private readonly IEmailSender _emailSender;
/// <summary> /// <summary>
@@ -1408,21 +1172,6 @@ namespace WebDoorCreator.Data.Services
/// </summary> /// </summary>
private int cacheTtlShort = 60 * 1; private int cacheTtlShort = 60 * 1;
/// <summary>
/// abilitazione time log con stopwatch
/// </summary>
private bool logTimingEnable = false;
/// <summary>
/// Path dell'immagine "missing"
/// </summary>
private string missingFilePath = "";
/// <summary>
/// Contenuto SVG dell'immagine missing
/// </summary>
private string missingSvgContent = "";
/// <summary> /// <summary>
/// Oggetto per connessione a REDIS /// Oggetto per connessione a REDIS
/// </summary> /// </summary>
@@ -1445,14 +1194,6 @@ namespace WebDoorCreator.Data.Services
get => TimeSpan.FromHours(24); get => TimeSpan.FromHours(24);
} }
/// <summary>
/// Durata cache di 2 settimane/15gg
/// </summary>
private TimeSpan DblWeekLongCache
{
get => TimeSpan.FromHours(24 * 15 * rnd.Next(1000, 1100) / 1000);
}
/// <summary> /// <summary>
/// Durata cache lunga (+ perturbazione percentuale +/-10%) /// Durata cache lunga (+ perturbazione percentuale +/-10%)
/// </summary> /// </summary>
@@ -1528,60 +1269,6 @@ namespace WebDoorCreator.Data.Services
return answ; return answ;
} }
/// <summary>
/// Processa log statistiche:
/// - accumula dati
/// - se superata soglia (soglia x evMultipl) registra log
/// </summary>
/// <param name="statName">nome statistica</param>
/// <param name="elapsed">durata evento tracciato</param>
/// <param name="logLevReq">
/// livello richiesto: 0:trace, 1:debug, 2:info, 3:warn, 4:error, 5: fatal, 6: off
/// </param>
/// <param name="evMultipl">moltiplicatore soglia x log statistica (default = 1)</param>
/// <returns></returns>
private async Task ProcStatLog(string statName, TimeSpan elapsed, int logLevReq, double evMultipl)
{
bool doWrite = await StatUpsert(statName, elapsed, evMultipl);
if (doWrite)
{
// recupero e resetto
ExecStats statRec = await StatReset(statName);
string logMsg = $"Eseguito {statName} x {statRec.NumCall} | {statRec.AvgTime.TotalMilliseconds:N3}ms";
switch (logLevReq)
{
case 0:
Log.Trace(logMsg);
break;
case 1:
Log.Debug(logMsg);
break;
case 2:
Log.Info(logMsg);
break;
case 3:
Log.Warn(logMsg);
break;
case 4:
Log.Error(logMsg);
break;
case 5:
Log.Fatal(logMsg);
break;
case 6:
default:
Log.Error(logMsg);
break;
}
}
}
#endregion Private Methods #endregion Private Methods
} }
} }
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -15,11 +15,11 @@ namespace WebDoorCreator.Data
// Default seeded users // Default seeded users
builder.HasData( builder.HasData(
// SuperAdmins // SuperAdmins
getNewTestRec("zaccaria.majid@egalware.com", "th1sIsTh3R1vrOfThNgt98"),
getNewTestRec("samuele.locatelli@egalware.com", "th1sIsTh3R1vrOfThNgt96"), getNewTestRec("samuele.locatelli@egalware.com", "th1sIsTh3R1vrOfThNgt96"),
getNewTestRec("emmanuele.sassi@egalware.com", "th1sIsTh3R1vrOfThNgt98!"),
// Admin // Admin
getNewTestRec("marco.locatelli@egalware.com", "th1sIsTh3R1vrOfThNgt94"), getNewTestRec("zaccaria.majid01@egalware.com", "th1sIsTh3R1vrOfThNgt94"),
getNewTestRec("samuele@steamware.net", "th1sIsTh3R1vrOfThNgt92") getNewTestRec("zaccaria.majid02@egalware.com", "th1sIsTh3R1vrOfThNgt92")
); );
} }
+8 -4
View File
@@ -15,10 +15,15 @@ namespace WebDoorCreator.Data
{ {
#region Public Constructors #region Public Constructors
#if false
public WDCDataContext()
{
}
#endif
public WDCDataContext(IConfiguration configuration) public WDCDataContext(IConfiguration configuration)
{ {
Log.Trace("WDCDataContext starting 01A"); Log.Info("WDCDataContext starting 01A");
_configuration = configuration; _configuration = configuration;
try try
{ {
@@ -33,7 +38,7 @@ namespace WebDoorCreator.Data
public WDCDataContext(DbContextOptions<WDCDataContext> options, IConfiguration configuration) : base(options) public WDCDataContext(DbContextOptions<WDCDataContext> options, IConfiguration configuration) : base(options)
{ {
Log.Trace("WDCDataContext starting 01B"); Log.Info("WDCDataContext starting 01B");
_configuration = configuration; _configuration = configuration;
// verifico SE devo eseguire la migration del DB IDENT... // verifico SE devo eseguire la migration del DB IDENT...
bool disableMigrate = _configuration.GetValue<bool>("SetupOpt:DisableWDCMigrate"); bool disableMigrate = _configuration.GetValue<bool>("SetupOpt:DisableWDCMigrate");
@@ -108,7 +113,7 @@ namespace WebDoorCreator.Data
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{ {
Log.Trace("WDCDataContext starting 02"); Log.Info("WDCDataContext starting 02");
if (!optionsBuilder.IsConfigured) if (!optionsBuilder.IsConfigured)
{ {
string connString = _configuration.GetConnectionString("WDC.DB"); string connString = _configuration.GetConnectionString("WDC.DB");
@@ -129,7 +134,6 @@ namespace WebDoorCreator.Data
// hierarchId eliminato // hierarchId eliminato
optionsBuilder.UseSqlServer("Server=SQL2016DEV;Database=WebDoorCreator;Trusted_Connection=True;"); optionsBuilder.UseSqlServer("Server=SQL2016DEV;Database=WebDoorCreator;Trusted_Connection=True;");
} }
Log.Trace("WDCDataContext starting 03");
} }
} }
@@ -13,13 +13,13 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="EgwCoreLib.Utils" Version="1.5.2402.2411" /> <PackageReference Include="EgwCoreLib.Utils" Version="1.4.2307.3111" />
<PackageReference Include="MailKit" Version="3.5.0" /> <PackageReference Include="MailKit" Version="3.5.0" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="6.0.27" /> <PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="6.0.14" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.27" /> <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.14" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="6.0.27" /> <PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="6.0.14" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.27" /> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.14" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.27"> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.14">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
@@ -3,14 +3,13 @@
@attribute [IgnoreAntiforgeryToken] @attribute [IgnoreAntiforgeryToken]
@inject SignInManager<IdentityUser> SignInManager @inject SignInManager<IdentityUser> SignInManager
@functions { @functions {
public async Task<IActionResult> OnPost(string returnUrl = null) public async Task<IActionResult> OnPost()
{ {
returnUrl ??= Url.Content("~/");
if (SignInManager.IsSignedIn(User)) if (SignInManager.IsSignedIn(User))
{ {
await SignInManager.SignOutAsync(); await SignInManager.SignOutAsync();
} }
return Redirect(returnUrl); return Redirect("~/");
} }
} }
@@ -93,10 +93,7 @@ namespace WebDoorCreator.UI.Areas.Identity.Pages.Account
public async Task OnGetAsync(string returnUrl = null) public async Task OnGetAsync(string returnUrl = null)
{ {
if (_configuration.GetValue<bool>("SetupOpt:CheckAdmUser")) await CheckSuperAdmin();
{
await CheckSuperAdmin();
}
if (!string.IsNullOrEmpty(ErrorMessage)) if (!string.IsNullOrEmpty(ErrorMessage))
{ {
ModelState.AddModelError(string.Empty, ErrorMessage); ModelState.AddModelError(string.Empty, ErrorMessage);
@@ -114,7 +111,7 @@ namespace WebDoorCreator.UI.Areas.Identity.Pages.Account
private async Task CheckSuperAdmin() private async Task CheckSuperAdmin()
{ {
//se non ci fosse --> creo samuele come superadmin //se non ci fosse --> creo samuele come superadmin
string superUser = "samuele.locatelli@egalware.com"; string superUser = "zaccaria.majid01@egalware.com";
string superPwd = "viaDante16!"; string superPwd = "viaDante16!";
string ADMIN_ROLE = "SuperAdmin"; string ADMIN_ROLE = "SuperAdmin";
var user = await _userManager.FindByEmailAsync(superUser); var user = await _userManager.FindByEmailAsync(superUser);
@@ -167,7 +164,7 @@ namespace WebDoorCreator.UI.Areas.Identity.Pages.Account
var result = await _signInManager.PasswordSignInAsync(Input.Email, Input.Password, Input.RememberMe, lockoutOnFailure: false); var result = await _signInManager.PasswordSignInAsync(Input.Email, Input.Password, Input.RememberMe, lockoutOnFailure: false);
if (result.Succeeded) if (result.Succeeded)
{ {
_logger.LogInformation($"{Input.Email} | User logged in."); _logger.LogInformation("User logged in.");
return LocalRedirect(returnUrl); return LocalRedirect(returnUrl);
} }
if (result.RequiresTwoFactor) if (result.RequiresTwoFactor)
@@ -12,8 +12,5 @@
} }
<li class="nav-item"><a class="nav-link @ManageNavPages.TwoFactorAuthenticationNavClass(ViewContext)" id="two-factor" asp-page="./TwoFactorAuthentication">Two-factor authentication</a></li> <li class="nav-item"><a class="nav-link @ManageNavPages.TwoFactorAuthenticationNavClass(ViewContext)" id="two-factor" asp-page="./TwoFactorAuthentication">Two-factor authentication</a></li>
<li class="nav-item"><a class="nav-link @ManageNavPages.PersonalDataNavClass(ViewContext)" id="personal-data" asp-page="./PersonalData">Personal data</a></li> <li class="nav-item"><a class="nav-link @ManageNavPages.PersonalDataNavClass(ViewContext)" id="personal-data" asp-page="./PersonalData">Personal data</a></li>
@{ <li class="nav-item bg-dark rounded p-2"><a class="text-light text-decoration-none" id="personal-data" href="/WDC/UI/"><i class="fa-solid fa-arrow-left-long"></i> &nbsp; Back to Main page</a></li>
string baseUrl = Url.Content("~/");
<li class="nav-item bg-dark rounded p-2"><a class="text-light text-decoration-none" id="personal-data" href="@baseUrl"><i class="fa-solid fa-arrow-left-long"></i> &nbsp; Back to Main page</a></li>
}
</ul> </ul>
@@ -2,6 +2,9 @@
@model RegisterModel @model RegisterModel
@inject WebDoorCreator.UI.Data.WDCVocabularyService WDCVService @inject WebDoorCreator.UI.Data.WDCVocabularyService WDCVService
@inject WebDoorCreator.UI.Data.WDCUserService WDCUService @inject WebDoorCreator.UI.Data.WDCUserService WDCUService
@*@{
ViewData["Title"] = traduci("UI_10");
}*@
<div class="d-flex justify-content-center"> <div class="d-flex justify-content-center">
@@ -4,26 +4,24 @@
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
<ul class="navbar-nav"> <ul class="navbar-nav">
@if (SignInManager.IsSignedIn(User)) @if (SignInManager.IsSignedIn(User))
{ {
string baseUrl = Url.Content("~/"); <li class="nav-item">
<li class="nav-item"> <a class="nav-link text-dark" asp-area="Identity" asp-page="/Account/Manage/Index" title="Manage">Hello @User.Identity?.Name!</a>
<a class="nav-link text-dark" asp-area="Identity" asp-page="@($"{baseUrl}/Account/Manage/Index")" title="Manage">Hello @User.Identity?.Name!</a> </li>
</li> <li class="nav-item">
<li class="nav-item"> <form class="form-inline" asp-area="Identity" asp-page="/Account/Logout" asp-route-returnUrl="/" method="post">
<form class="form-inline" asp-area="Identity" asp-page="@($"{baseUrl}/Account/Logout")" asp-route-returnUrl="/" method="post"> <button type="submit" class="nav-link btn btn-link text-dark">Logout</button>
<button type="submit" class="nav-link btn btn-link text-dark">Logout</button> </form>
</form> </li>
</li> }
} else
else {
{ <li class="nav-item">
string baseUrl = Url.Content("~/"); <a class="nav-link text-dark" asp-area="Identity" asp-page="/Account/Register">Register</a>
<li class="nav-item"> </li>
<a class="nav-link text-dark" asp-area="Identity" asp-page="@($"{baseUrl}/Account/Register")">Register</a> <li class="nav-item">
</li> <a class="nav-link text-dark" asp-area="Identity" asp-page="/Account/Login">Login</a>
<li class="nav-item"> </li>
<a class="nav-link text-dark" asp-area="Identity" asp-page="@($"{baseUrl}/Account/Login")">Login</a> }
</li>
}
</ul> </ul>
@@ -1,9 +1,8 @@
<div> <div>
@if (B_doorOpUpd) @if (B_doorOpUpd || true)
{ {
<button class="btn btn-success" @onclick="() => refreshSVG()"><i class="fa-solid fa-rotate-right"></i></button> <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-warning" href="https://iis01.egalware.com/Test3D/Doors041122/EXB_0267100040/EXB_0267100040.html" target="_blank"><i class="fa-solid fa-cube"></i></button>
@if (IsErr) @if (IsErr)
{ {
<button class="btn btn-danger" @onclick="() => toggleErrors(true)"><i class="fa-solid fa-triangle-exclamation"></i></button> <button class="btn btn-danger" @onclick="() => toggleErrors(true)"><i class="fa-solid fa-triangle-exclamation"></i></button>
@@ -12,7 +11,7 @@
else 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-rotate-right"></i></button>
<button class="btn btn-secondary" disabled><i class="fa-solid fa-cube"></i></button> <button class="btn btn-secondary"><i class="fa-solid fa-cube"></i></button>
} }
</div> </div>
@@ -1,6 +1,6 @@
@if (currVal == null) @if (currVal == null)
{ {
<LoadingData DisplaySize="LoadingData.CtrlSize.Small"></LoadingData> <EgwCoreLib.Razor.LoadingDataSmall></EgwCoreLib.Razor.LoadingDataSmall>
} }
else else
{ {
@@ -20,15 +20,15 @@
background: #FFF; background: #FFF;
transform: translate(1.6rem, -1rem); transform: translate(1.6rem, -1rem);
} }
.btnPdfSuccess { .btnPDFSuccess {
border-radius: 50%; border-radius: 50%;
width: 3.5rem; width: 3.5rem;
height: 3.5rem; height: 3.5rem;
border: 5px solid #00838F; border: 5px solid #00838F;
background: #44AD8E; background: #8E44AD;
transform: translate(25px, 12px); transform: translate(25px, 12px);
} }
.btnPdfPending { .btnPDFPending {
border-radius: 50%; border-radius: 50%;
width: 3.5rem; width: 3.5rem;
height: 3.5rem; height: 3.5rem;
@@ -20,13 +20,13 @@
transform: translate(1.6rem, -1rem); transform: translate(1.6rem, -1rem);
} }
.btnPdfSuccess { .btnPDFSuccess {
.btnGen; .btnGen;
background: #44AD8E; background: #8E44AD;
transform: translate(@xDelta, @yDelta); transform: translate(@xDelta, @yDelta);
} }
.btnPdfPending { .btnPDFPending {
.btnGen; .btnGen;
background: #F1C40F; background: #F1C40F;
transform: translate(@xDelta, @yDelta); 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:#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;} .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;}
@@ -11,16 +11,6 @@ namespace WebDoorCreator.UI.Components.DoorDef
{ {
public partial class DoorDefinition : IDisposable public partial class DoorDefinition : IDisposable
{ {
#region Public Properties
[Parameter]
public int idDoor { get; set; } = 0;
[Parameter]
public int idOrd { get; set; } = 0;
#endregion Public Properties
#region Public Methods #region Public Methods
public void Dispose() public void Dispose()
@@ -28,7 +18,7 @@ namespace WebDoorCreator.UI.Components.DoorDef
ListBaseDoorOp = null; ListBaseDoorOp = null;
currOrder = null; currOrder = null;
WDCUService.EA_CurrLanguage -= WDUService_EA_CurrLanguage; WDCUService.EA_CurrLanguage -= WDUService_EA_CurrLanguage;
QDService.CalcDonePipe.EA_NewMessage -= CalcDonePipe_EA_NewMessage; QDataServ.CalcDonePipe.EA_NewMessage -= CalcDonePipe_EA_NewMessage;
} }
#endregion Public Methods #endregion Public Methods
@@ -36,14 +26,14 @@ namespace WebDoorCreator.UI.Components.DoorDef
#region Protected Properties #region Protected Properties
protected bool B_doorOpUpd { get; set; } = false; protected bool B_doorOpUpd { get; set; } = false;
[Inject]
protected IConfiguration configuration { get; set; } = null!;
protected OrderStatusViewModel? currOrder { get; set; } = null;
protected string DoorSvgContent { get; set; } = ""; protected string DoorSvgContent { get; set; } = "";
protected string ErrCode { get; set; } = "ERRORE"; protected string ErrCode { get; set; } = "ERRORE";
[Parameter]
public int idDoor { get; set; } = 0;
[Parameter]
public int idOrd { get; set; } = 0;
protected bool isDoorOpConf { get; set; } = false; protected bool isDoorOpConf { get; set; } = false;
protected bool IsErr { get; set; } = false; protected bool IsErr { get; set; } = false;
@@ -53,11 +43,12 @@ namespace WebDoorCreator.UI.Components.DoorDef
[Inject] [Inject]
protected NavigationManager NavManager { get; set; } = null!; protected NavigationManager NavManager { get; set; } = null!;
protected int orderStat { get; set; } = 10; protected OrderStatusViewModel? currOrder { get; set; } = null;
protected bool paramChanged { get; set; } = false; protected bool paramChanged { get; set; } = false;
[Inject] [Inject]
protected QueueDataService QDService { get; set; } = null!; protected QueueDataService QDataServ { get; set; } = null!;
protected string userLang { get; set; } = "EN"; protected string userLang { get; set; } = "EN";
@@ -74,6 +65,8 @@ namespace WebDoorCreator.UI.Components.DoorDef
#region Protected Methods #region Protected Methods
protected int orderStat { get; set; } = 10;
protected async Task catchParamChange(bool ParamChanged) protected async Task catchParamChange(bool ParamChanged)
{ {
await Task.Delay(1); await Task.Delay(1);
@@ -99,7 +92,7 @@ namespace WebDoorCreator.UI.Components.DoorDef
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
WaitReloadSvg = configuration.GetValue<int>("RuntimeOpt:WaitReloadSvg"); await Task.Delay(1);
var uri = NavManager.ToAbsoluteUri(NavManager.Uri); var uri = NavManager.ToAbsoluteUri(NavManager.Uri);
//if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("idOrd", out var _idOrd) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("idDoor", out var _idDoor)) //if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("idOrd", out var _idOrd) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("idDoor", out var _idDoor))
//{ //{
@@ -108,7 +101,7 @@ namespace WebDoorCreator.UI.Components.DoorDef
//} //}
await ReloadData(); await ReloadData();
WDCUService.EA_CurrLanguage += WDUService_EA_CurrLanguage; WDCUService.EA_CurrLanguage += WDUService_EA_CurrLanguage;
QDService.CalcDonePipe.EA_NewMessage += CalcDonePipe_EA_NewMessage; QDataServ.CalcDonePipe.EA_NewMessage += CalcDonePipe_EA_NewMessage;
WDCRService.EA_UpdDoorOp += WDService_EA_DoorOpUpdated; WDCRService.EA_UpdDoorOp += WDService_EA_DoorOpUpdated;
} }
@@ -119,20 +112,7 @@ namespace WebDoorCreator.UI.Components.DoorDef
currOrder = null; currOrder = null;
await Task.Delay(1); await Task.Delay(1);
// cerco img porta... // cerco img porta...
DoorSvgContent = await QDService.DoorGetLastSvg(idDoor); DoorSvgContent = await QDataServ.DoorGetLastSvg(idDoor);
// se fosse vuoto...
if (string.IsNullOrEmpty(DoorSvgContent))
{
// richiede ricalcolo img
DoorSvgContent = await SendRecalcReq(idDoor);
}
// se fosse vuoto...
if (string.IsNullOrEmpty(DoorSvgContent))
{
// legge img vuota
DoorSvgContent = QDService.DoorGetMissingSvg();
}
// recupero altri dati // recupero altri dati
var ListRecordDoorOp = await WDService.DoorOpGetByDoorId(idDoor); var ListRecordDoorOp = await WDService.DoorOpGetByDoorId(idDoor);
if (ListRecordDoorOp != null) if (ListRecordDoorOp != null)
@@ -152,7 +132,7 @@ namespace WebDoorCreator.UI.Components.DoorDef
if (ListOrdersStatus != null) if (ListOrdersStatus != null)
{ {
currOrder = ListOrdersStatus.Where(x => x.OrderId == idOrd).FirstOrDefault(); currOrder = ListOrdersStatus.Where(x => x.OrderId == idOrd).FirstOrDefault();
if (currOrder != null) if(currOrder != null)
{ {
orderStat = currOrder.OrderStatus; orderStat = currOrder.OrderStatus;
} }
@@ -182,8 +162,6 @@ namespace WebDoorCreator.UI.Components.DoorDef
private static Logger Log = LogManager.GetCurrentClassLogger(); private static Logger Log = LogManager.GetCurrentClassLogger();
private int WaitReloadSvg = 100;
#endregion Private Fields #endregion Private Fields
#region Private Properties #region Private Properties
@@ -219,16 +197,16 @@ namespace WebDoorCreator.UI.Components.DoorDef
doorSvgVers = doorSvgVers.Replace(".", ":"); doorSvgVers = doorSvgVers.Replace(".", ":");
} }
// fix ./: // fix ./:
var hasErr = await QDService.DoorErrExists(doorSvgVers); var hasErr = await QDataServ.DoorErrExists(doorSvgVers);
if (hasErr) if (hasErr)
{ {
var messErr = await QDService.DoorErrGet(doorSvgVers); var messErr = await QDataServ.DoorErrGet(doorSvgVers);
IsErr = true; IsErr = true;
ErrCode = messErr; ErrCode = messErr;
} }
else else
{ {
DoorSvgContent = await QDService.DoorSvgGet(doorSvgVers); DoorSvgContent = await QDataServ.DoorSvgGet(doorSvgVers);
} }
await Task.Run(async () => await InvokeAsync(StateHasChanged)); await Task.Run(async () => await InvokeAsync(StateHasChanged));
@@ -236,34 +214,6 @@ namespace WebDoorCreator.UI.Components.DoorDef
} }
} }
/// <summary>
/// Invio richiesta ricalcolo porta
/// </summary>
/// <param name="DoorId"></param>
/// <returns></returns>
private async Task<string> SendRecalcReq(int DoorId)
{
string answ = "";
// richiede ricalcolo img
List<string> doorIdList = new List<string>() { $"{DoorId}" };
// chiamo reset richieste
var list2Proc = await QDService.ResetQueueByDoorList(doorIdList);
// recupero DDF ed invio x processing
if (DoorId > 0)
{
string currDDF = await WDService.DoorOpGetDDF(DoorId);
// versione corrente del DDF generato
int currVers = await QDService.SendCalcReq(DoorId, currDDF);
}
// attende ...
await Task.Delay(WaitReloadSvg);
// riprova lettura
answ = await QDService.DoorGetLastSvg(DoorId);
return answ;
}
private void WDService_EA_DoorOpUpdated() private void WDService_EA_DoorOpUpdated()
{ {
B_doorOpUpd = WDCRService.isDoorOpUpd; B_doorOpUpd = WDCRService.isDoorOpUpd;
@@ -34,7 +34,7 @@
<div class="d-flex justify-content-between"> <div class="d-flex justify-content-between">
<div class=" py-1"> <div class=" py-1">
<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> <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>
</div> </div>
@if (isAddNew) @if (isAddNew)
{ {
@@ -124,7 +124,7 @@
<div class="row"> <div class="row">
@if (DoorsList == null || DoorsList.Count == 0) @if (DoorsList == null || DoorsList.Count == 0)
{ {
<LoadingData DisplaySize="LoadingData.CtrlSize.Small"></LoadingData> <LoadingDataSmall></LoadingDataSmall>
} }
else else
{ {
@@ -7,11 +7,10 @@ using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.Services; using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Components.SvgComp; using WebDoorCreator.UI.Components.SvgComp;
using WebDoorCreator.UI.Data; using WebDoorCreator.UI.Data;
using static WebDoorCreator.UI.Data.WDCRefreshService;
namespace WebDoorCreator.UI.Components.DoorMan namespace WebDoorCreator.UI.Components.DoorMan
{ {
public partial class DoorList:IDisposable public partial class DoorList
{ {
#region Public Properties #region Public Properties
@@ -56,8 +55,6 @@ namespace WebDoorCreator.UI.Components.DoorMan
protected List<DoorOpModel> doorOps2Add = new List<DoorOpModel>(); 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 #endregion Protected Fields
#region Protected Properties #region Protected Properties
@@ -152,7 +149,6 @@ namespace WebDoorCreator.UI.Components.DoorMan
var door = DoorsList?.Where(x => x.DoorId == doorId).FirstOrDefault(); var door = DoorsList?.Where(x => x.DoorId == doorId).FirstOrDefault();
await InvokeAsync(StateHasChanged); await InvokeAsync(StateHasChanged);
await E_CurrDoor.InvokeAsync(door); await E_CurrDoor.InvokeAsync(door);
NavManager.NavigateTo(NavManager.Uri, true);
} }
} }
@@ -257,25 +253,6 @@ namespace WebDoorCreator.UI.Components.DoorMan
return answ; 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) protected async Task modalClose(bool isClose)
{ {
await Task.Delay(1); await Task.Delay(1);
@@ -283,62 +260,15 @@ namespace WebDoorCreator.UI.Components.DoorMan
await ReloadData(); 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() protected override async Task OnParametersSetAsync()
{ {
if (!actFilter.Equals(lastFilt)) await ReloadData();
{
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> /// <summary>
/// Esecuzione ricalcolo SVG /// Esecuzione ricalcolo SVG
/// </summary> /// </summary>
protected async void RecalcSVGs(bool force) protected async void RecalcSVGs()
{ {
isRecalc = true; isRecalc = true;
// recupero elenco porte come list interi... // recupero elenco porte come list interi...
@@ -348,40 +278,26 @@ namespace WebDoorCreator.UI.Components.DoorMan
.Select(x => $"{x.DoorId}") .Select(x => $"{x.DoorId}")
.ToList(); .ToList();
// solo se è template salvo nell'elenco... // faccio upsert porte nell'elenco door tipo template...
if (isTplPage) var numTplDoor = await QDService.DoorTplListUpsert(doorIdList);
{ // chiamo reset
// faccio upsert porte nell'elenco door tipo template...
var numTplDoor = await QDService.DoorTplListUpsert(doorIdList);
}
// chiamo reset richieste
var list2Proc = await QDService.ResetQueueByDoorList(doorIdList); var list2Proc = await QDService.ResetQueueByDoorList(doorIdList);
// se ho porte da processare --> chiamo save...
if (force) string currDDF = "";
int currDoorId = 0;
int currVers = 0;
foreach (var item in list2Proc)
{ {
// se ho porte da processare --> chiamo save... currDoorId = 0;
string currDDF = ""; currVers = 0;
int currDoorId = 0; int.TryParse(item, out currDoorId);
int currVers = 0; if (currDoorId > 0)
foreach (var item in list2Proc)
{ {
currDoorId = 0; currDDF = await WDService.DoorOpGetDDF(currDoorId);
currVers = 0; // versione corrente del DDF generato
int.TryParse(item, out currDoorId); currVers = await QDService.SendCalcReq(currDoorId, currDDF);
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; isRecalc = false;
NavManager.NavigateTo(NavManager.Uri, true); NavManager.NavigateTo(NavManager.Uri, true);
@@ -451,6 +367,17 @@ namespace WebDoorCreator.UI.Components.DoorMan
} }
} }
} }
#if false
if (DoorsList != null)
{
var currDoor = DoorsList.FirstOrDefault();
if (currDoor?.OrderNav != null)
{
//orderStatus = currDoor.OrderNav.Status;
}
}
#endif
} }
} }
} }
@@ -477,6 +404,7 @@ namespace WebDoorCreator.UI.Components.DoorMan
var door = DoorsList.Where(x => x.DoorId == doorId).FirstOrDefault(); var door = DoorsList.Where(x => x.DoorId == doorId).FirstOrDefault();
if (door != null) if (door != null)
{ {
//currDoor = door;
await E_CurrDoorModal.InvokeAsync(door); await E_CurrDoorModal.InvokeAsync(door);
} }
} }
@@ -510,14 +438,6 @@ namespace WebDoorCreator.UI.Components.DoorMan
#endregion Protected Methods #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 #region Private Properties
private int _totalCount { get; set; } = 0; private int _totalCount { get; set; } = 0;
@@ -554,5 +474,44 @@ namespace WebDoorCreator.UI.Components.DoorMan
} }
#endregion Private Properties #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)) @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-secondary" type="button" @onclick="()=>ReloadData()">Cancel <i class="fa-solid fa-rotate-left"></i></button>
<button class="btn btn-success" type="button" @onclick="()=>UpdateDoor()">Update <i class="fa-solid fa-check"></i></button> <button class="btn btn-success" type="button" @onclick="()=>UpdateDoor(true)">Update <i class="fa-solid fa-check"></i></button>
} }
</div> </div>
<div> <div>
@@ -11,6 +11,9 @@ namespace WebDoorCreator.UI.Components.DoorMan
{ {
#region Public Properties #region Public Properties
protected DoorModel CurrDoor { get; set; } = new DoorModel();
protected DoorModel CurrDoorClone { get; set; } = new DoorModel();
[Parameter] [Parameter]
public int CurrDoorId { get; set; } = 0; public int CurrDoorId { get; set; } = 0;
@@ -22,19 +25,41 @@ namespace WebDoorCreator.UI.Components.DoorMan
[Parameter] [Parameter]
public EventCallback<bool> E_isChange { get; set; } public EventCallback<bool> E_isChange { get; set; }
[Parameter]
public bool isTplPage { get; set; } = false;
[Parameter] [Parameter]
public int OrderId { get; set; } = 0; public int OrderId { get; set; } = 0;
public List<OrderModel> OrdersCompList { get; set; } = new List<OrderModel>(); public List<OrderModel> OrdersCompList { get; set; } = new List<OrderModel>();
[Parameter] [Parameter]
public int OrderStatus { get; set; } = 10; public string UserName { get; set; } = "";
[Parameter] [Parameter]
public string UserName { get; set; } = ""; 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;
}
}
}
#endregion Public Properties #endregion Public Properties
@@ -51,8 +76,7 @@ namespace WebDoorCreator.UI.Components.DoorMan
protected IConfiguration config { get; set; } = null!; protected IConfiguration config { get; set; } = null!;
protected WebDoorCreator.Data.DDF.Converter currDdfConv { 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 DDFDto CurrentConf { get; set; } = new DDFDto();
protected int doorQty protected int doorQty
@@ -61,32 +85,8 @@ namespace WebDoorCreator.UI.Components.DoorMan
set => CurrDoor.Quantity = value; set => CurrDoor.Quantity = value;
} }
protected int DoorQty
{
get => CurrDoor.Quantity;
set
{
if (value >= 0)
{
CurrDoor.Quantity = value;
}
}
}
protected string DoorSvgContent { get; set; } = ""; protected string DoorSvgContent { get; set; } = "";
protected decimal DoorUnitCost
{
get => CurrDoor.UnitCost;
set
{
if (value >= 0)
{
CurrDoor.UnitCost = value;
}
}
}
protected bool IsErr { get; set; } = false; protected bool IsErr { get; set; } = false;
[Inject] [Inject]
@@ -108,9 +108,6 @@ namespace WebDoorCreator.UI.Components.DoorMan
get => WDCUService.userRole; get => WDCUService.userRole;
} }
[Inject]
protected WDCRefreshService WDCRService { get; set; } = null!;
[Inject] [Inject]
protected WDCUserService WDCUService { get; set; } = null!; protected WDCUserService WDCUService { get; set; } = null!;
@@ -121,6 +118,28 @@ namespace WebDoorCreator.UI.Components.DoorMan
#region Protected Methods #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> /// <summary>
/// Clona la porta selezionata con annesse door operations /// Clona la porta selezionata con annesse door operations
/// </summary> /// </summary>
@@ -159,27 +178,11 @@ namespace WebDoorCreator.UI.Components.DoorMan
var done = await WDService.DoorUpsert(CurrDoor); var done = await WDService.DoorUpsert(CurrDoor);
if (done) if (done)
{ {
// chiamo update ordine...
WDCRService.ReportOrderChanged(OrderId);
await ReloadData();
// chiudo modale
await closeModal(); await closeModal();
} }
} }
} }
protected void modDoorQty(bool isAdd)
{
if (isAdd)
{
DoorQty++;
}
else
{
DoorQty--;
}
}
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
await Task.Delay(1); await Task.Delay(1);
@@ -306,17 +309,6 @@ 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 #endregion Protected Methods
} }
} }
@@ -51,7 +51,7 @@
{ {
<select @bind="@TypeSel" class="form-select"> <select @bind="@TypeSel" class="form-select">
<option value="*">-- All Types --</option> <option value="*">-- All Types --</option>
@foreach (var item in ListType.OrderBy(x => x)) @foreach (var item in ListType)
{ {
<option value="@item">@item</option> <option value="@item">@item</option>
} }
@@ -65,33 +65,23 @@
@if (files2Chk.Where(x => x.Value.action).ToList().Count > 0) @if (files2Chk.Where(x => x.Value.action).ToList().Count > 0)
{ {
<div class="w-100 text-center"> <div class="w-100 text-center">
<button @onclick="()=>doSave()" class="btn btn-success btn-lg px-3">Apply Changes</button> <button @onclick="()=>doSave()" class="btn btn-success btn-lg">Save</button>
</div> </div>
} }
} }
</div> </div>
<div class="col-4 text-end"> <div class="col-4 text-end">
<div class="d-flex justify-content-between"> @if (searchRecords != null && searchRecords.Count() > 0)
<div> {
@if (numTplMissing > 0) <div class="text-nowrap">
{ <div class="btn-group w-50" role="group">
<button type="button" class="btn btn-sm btn-success" @onclick="()=>fixMissing()" title="Fix missing components template file">FIX @tplMissing missing</button> <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>
else <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>
<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> }
</div> </div>
</div> </div>
@@ -147,8 +137,7 @@ 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-5" colspan="4" data-bs-toggle="modal" data-bs-target="#fileDiffModal" @onclick="()=>showDiff(item, item.Value.status)"></td>
} }
<td class="col-2 text-center"> <td class="col-2 text-center">
<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>
@* <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> </td>
@if (item.Value.status == Core.Enum.fileStatus.rem || item.Value.status == Core.Enum.fileStatus.mod) @if (item.Value.status == Core.Enum.fileStatus.rem || item.Value.status == Core.Enum.fileStatus.mod)
{ {
@@ -175,7 +164,7 @@ else if (files2Chk != null && files2Chk.Count() > 0)
} }
</tbody> </tbody>
</table> </table>
} }
else if (files2Chk == null || files2Chk.Count() == 0) else if (files2Chk == null || files2Chk.Count() == 0)
@@ -1,4 +1,3 @@
using k8s.Models;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
using NLog; using NLog;
using WebDoorCreator.Data.DbModels; using WebDoorCreator.Data.DbModels;
@@ -20,30 +19,6 @@ namespace WebDoorCreator.UI.Components.FilesMan
#endregion Public Properties #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 #region Protected Fields
protected static Logger Log = LogManager.GetCurrentClassLogger(); protected static Logger Log = LogManager.GetCurrentClassLogger();
@@ -56,7 +31,7 @@ namespace WebDoorCreator.UI.Components.FilesMan
protected bool _showAdd { get; set; } = true; protected bool _showAdd { get; set; } = true;
protected bool _showRem { get; set; } = true; protected bool _showDel { get; set; } = false;
protected bool _showUpd { get; set; } = true; protected bool _showUpd { get; set; } = true;
@@ -67,24 +42,9 @@ namespace WebDoorCreator.UI.Components.FilesMan
protected double expTime { get; set; } = 6; protected double expTime { get; set; } = 6;
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 bool isLoading { get; set; } = false;
protected List<string> ListType { get; set; } = new List<string>(); protected bool isDrawing { get; set; } = false;
protected int numSteps { get; set; } = 4; protected int numSteps { get; set; } = 4;
protected bool show { get; set; } = false; protected bool show { get; set; } = false;
@@ -105,10 +65,10 @@ namespace WebDoorCreator.UI.Components.FilesMan
get => NumFileNew > 0; get => NumFileNew > 0;
} }
protected bool showRem protected bool showDel
{ {
get => _showRem; get => _showDel;
set => _showRem = value; set => _showDel = value;
} }
protected bool showUpd protected bool showUpd
@@ -117,33 +77,10 @@ namespace WebDoorCreator.UI.Components.FilesMan
set => _showUpd = value; set => _showUpd = value;
} }
protected string tplMissing
{
get => numTplMissing >= 0 ? $"{numTplMissing}" : "???";
}
protected string txtDx { get; set; } = ""; protected string txtDx { get; set; } = "";
protected string txtSx { 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] [Inject]
protected WebDoorCreatorService WDCService { get; set; } = null!; protected WebDoorCreatorService WDCService { get; set; } = null!;
@@ -216,10 +153,10 @@ namespace WebDoorCreator.UI.Components.FilesMan
protected async Task doSave() protected async Task doSave()
{ {
isDrawing = true;
isLoading = true;
sendDataVal = 0;
await Task.Delay(1); await Task.Delay(1);
//var sb = new StringBuilder();
sendDataVal = 0;
isLoading = true;
var updTask1 = Task.Run(() => var updTask1 = Task.Run(() =>
{ {
files2Save = searchRecords.Where(x => x.Value.action).ToDictionary(x => x.Key, x => x.Value); files2Save = searchRecords.Where(x => x.Value.action).ToDictionary(x => x.Key, x => x.Value);
@@ -240,17 +177,14 @@ namespace WebDoorCreator.UI.Components.FilesMan
if (item.Value.status == Core.Enum.fileStatus.add) if (item.Value.status == Core.Enum.fileStatus.add)
{ {
File.Copy($"{rootPathNew}\\{item.Key}", $"{rootPathCur}\\{item.Key}"); 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) else if (item.Value.status == Core.Enum.fileStatus.mod)
{ {
ReplaceFile($"{rootPathNew}\\{item.Key}", $"{rootPathCur}\\{item.Key}"); ReplaceFile($"{rootPathNew}\\{item.Key}", $"{rootPathCur}\\{item.Key}");
Log.Info($"Updated Compo: {rootPathNew}\\{item.Key}");
} }
else if (item.Value.status == Core.Enum.fileStatus.rem) else if (item.Value.status == Core.Enum.fileStatus.rem)
{ {
File.Delete($"{rootPathCur}\\{item.Key}"); File.Delete($"{rootPathCur}\\{item.Key}");
Log.Info($"Removed Compo: {rootPathNew}\\{item.Key}");
} }
} }
} }
@@ -262,11 +196,6 @@ namespace WebDoorCreator.UI.Components.FilesMan
await WDCService.ListValuesLuaNgeInsert(rootPathCur); await WDCService.ListValuesLuaNgeInsert(rootPathCur);
}); });
await updTask2; await updTask2;
Log.Info($"DB Updated for Compo changes!");
sendDataVal = 45;
// svuoto cache!
await WDCService.FlushCustomPattern("Cache");
sendDataVal = 50;
await doScan(true, true); await doScan(true, true);
sendDataVal = 90; sendDataVal = 90;
} }
@@ -279,16 +208,12 @@ namespace WebDoorCreator.UI.Components.FilesMan
/// <returns></returns> /// <returns></returns>
protected async Task doScan(bool scanCur, bool scanNew) protected async Task doScan(bool scanCur, bool scanNew)
{ {
isDrawing = true;
isLoading = true;
files2Chk.Clear(); files2Chk.Clear();
searchRecords.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>(); ListType = new List<string>();
Log.Info($"Component scan started by user {WDCUService.userId}"); Log.Info($"Component scan started by user {WDCUService.userId}");
isDrawing = true;
isLoading = true;
sendDataVal = 0; sendDataVal = 0;
var updTask1 = Task.Run(async () => var updTask1 = Task.Run(async () =>
await WDCService.populateHws() await WDCService.populateHws()
@@ -331,10 +256,11 @@ namespace WebDoorCreator.UI.Components.FilesMan
{ {
item.Value.status = Core.Enum.fileStatus.rem; item.Value.status = Core.Enum.fileStatus.rem;
searchRecords.Add(item.Key, item.Value); searchRecords.Add(item.Key, item.Value);
checkItemType(item);
} }
searchRecords = searchRecords.Where(x => x.Value.status != Core.Enum.fileStatus.none).ToDictionary(x => x.Key, x => x.Value); 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);
await ReloadData(); await ReloadData();
sendDataVal = 100; sendDataVal = 100;
isLoading = false; isLoading = false;
@@ -346,7 +272,63 @@ namespace WebDoorCreator.UI.Components.FilesMan
Log.Info($"Component scan COMPLETED"); Log.Info($"Component scan COMPLETED");
} }
protected async Task filtBtnToggle(Core.Enum.fileStatus fileStat) 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)
{ {
switch (fileStat) switch (fileStat)
{ {
@@ -375,12 +357,12 @@ namespace WebDoorCreator.UI.Components.FilesMan
break; break;
case Core.Enum.fileStatus.rem: case Core.Enum.fileStatus.rem:
showRem = !showRem; showDel = !showDel;
if (showRem && !stats2show.Contains(Core.Enum.fileStatus.rem)) if (showDel && !stats2show.Contains(Core.Enum.fileStatus.rem))
{ {
stats2show.Add(Core.Enum.fileStatus.rem); stats2show.Add(Core.Enum.fileStatus.rem);
} }
else if (!showRem && stats2show.Contains(Core.Enum.fileStatus.rem)) else if (!showDel && stats2show.Contains(Core.Enum.fileStatus.rem))
{ {
stats2show.Remove(Core.Enum.fileStatus.rem); stats2show.Remove(Core.Enum.fileStatus.rem);
} }
@@ -389,16 +371,18 @@ namespace WebDoorCreator.UI.Components.FilesMan
await ReloadData(); await ReloadData();
} }
/// <summary> protected string filtBtnUpdCss()
/// Sistema i componenti missing creando file (vuoti) corrispondenti a quanto trovato sul DB
/// </summary>
/// <returns></returns>
protected async Task fixMissing()
{ {
isLoading = true; string answ = "";
bool done = await WDCService.CompoFixMissing(rootPathCur); if (showUpd)
numTplMissing = await WDCService.CompoCountMissing(rootPathCur); {
isLoading = false; answ = "btn-warning";
}
else
{
answ = "btn-secondary";
}
return answ;
} }
protected override async Task OnParametersSetAsync() protected override async Task OnParametersSetAsync()
@@ -406,6 +390,22 @@ namespace WebDoorCreator.UI.Components.FilesMan
await ReloadData(); 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() protected async Task ReloadData()
{ {
isDrawing = true; isDrawing = true;
@@ -465,28 +465,24 @@ 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 #endregion Protected Methods
#region Private Fields #region Private Fields
private Dictionary<string, FileDTO> files2Chk = new Dictionary<string, FileDTO>(); private Dictionary<string, FileDTO> files2Chk = new Dictionary<string, FileDTO>();
private Dictionary<string, FileDTO> files2Save = new Dictionary<string, FileDTO>(); private Dictionary<string, FileDTO> files2Save = new Dictionary<string, FileDTO>();
private string scanMsg = "CLICK TO SCAN"; private string scanMsg = "CLICK TO SCAN";
private Dictionary<string, FileDTO> searchRecords = new Dictionary<string, FileDTO>(); private Dictionary<string, FileDTO> searchRecords = new Dictionary<string, FileDTO>();
private int sendDataMaxVal = 100; private int sendDataMaxVal = 100;
private int sendDataVal = 0; private int sendDataVal = 0;
private List<Core.Enum.fileStatus> stats2show = new List<Core.Enum.fileStatus>(); private List<Core.Enum.fileStatus> stats2show = new List<Core.Enum.fileStatus>();
private string titleMsg = "Scanning directories"; private string titleMsg = "Scanning directories";
#endregion Private Fields #endregion Private Fields
@@ -494,8 +490,8 @@ namespace WebDoorCreator.UI.Components.FilesMan
#region Private Properties #region Private Properties
private bool _selUns { get; set; } = false; private bool _selUns { get; set; } = false;
private int _totalCount { get; set; } = -1; private int _totalCount { get; set; } = -1;
private string _typeSel { get; set; } = "*";
private int currPage private int currPage
{ {
@@ -523,8 +519,6 @@ namespace WebDoorCreator.UI.Components.FilesMan
set => actFilter.NumRec = value; set => actFilter.NumRec = value;
} }
private int numTplMissing { get; set; } = -1;
private string rootPathCur private string rootPathCur
{ {
get => configuration.GetValue<string>("CompoBaseDirs:CurrCompoDir"); get => configuration.GetValue<string>("CompoBaseDirs:CurrCompoDir");
@@ -562,15 +556,6 @@ namespace WebDoorCreator.UI.Components.FilesMan
#region Private Methods #region Private Methods
private void checkItemType(KeyValuePair<string, FileDTO> item)
{
string type = getType(item.Key);
if (!ListType.Contains(type))
{
ListType.Add(type);
}
}
/// <summary> /// <summary>
/// Recupera i dati files current, /// Recupera i dati files current,
/// </summary> /// </summary>
@@ -15,7 +15,7 @@
</div> </div>
@if (isLoading) @if (isLoading)
{ {
<LoadingData DisplaySize="LoadingData.CtrlSize.Small"></LoadingData> <LoadingDataSmall></LoadingDataSmall>
} }
else else
{ {
@@ -18,7 +18,7 @@ namespace WebDoorCreator.UI.Components.FilesMan
protected Dictionary<string, Dictionary<string, string>>? vocLemmasTEMP { get; set; } = null; protected Dictionary<string, Dictionary<string, string>>? vocLemmasTEMP { get; set; } = null;
protected Dictionary<string, string> vocLemmasTEMP2Dict { get; set; } = new Dictionary<string, string>(); protected Dictionary<string, string> vocLemmasTEMP2Dict { get; set; } = new Dictionary<string, string>();
protected bool showList { get; set; } = true;//false; protected bool showList { get; set; } = false;
protected bool isLoading { get; set; } = false; protected bool isLoading { get; set; } = false;
protected async override Task OnParametersSetAsync() protected async override Task OnParametersSetAsync()
{ {
@@ -22,13 +22,17 @@
</Authorized> </Authorized>
</AuthorizeView> </AuthorizeView>
<!--Hiding to non-SuperAdmin users the option to manage the application --> <!--Hiding to non-SuperAdmin users the option to manage the application -->
<AuthorizeView Roles="SuperAdmin, DcaAdmin, CompAdmin" Context="MenuHide"> <AuthorizeView Roles="SuperAdmin, Admin, CompAdmin" Context="MenuHide">
<Authorized> <Authorized>
<div class="nav-item px-1 align-items-center"> <div class="nav-item px-1 align-items-center">
<NavLink class="nav-link text-nowrap" href="UserAdmin"> <NavLink class="nav-link text-nowrap" href="UserAdmin">
<span class="bi bi-people pe-2" aria-hidden="true"></span> @translate("UI_02") <span class="bi bi-people pe-2" aria-hidden="true"></span> @translate("UI_02")
</NavLink> </NavLink>
</div> </div>
</Authorized>
</AuthorizeView>
<AuthorizeView Roles="SuperAdmin" Context="MenuHide">
<Authorized>
<div class="nav-item px-1 align-items-center"> <div class="nav-item px-1 align-items-center">
<NavLink class="nav-link text-nowrap" href="TemplateMan"> <NavLink class="nav-link text-nowrap" href="TemplateMan">
<span class="fa-solid fa-paint-roller pe-2" aria-hidden="true"></span> Template Management <span class="fa-solid fa-paint-roller pe-2" aria-hidden="true"></span> Template Management
@@ -41,7 +45,8 @@
</div> </div>
</Authorized> </Authorized>
</AuthorizeView> </AuthorizeView>
<AuthorizeView Roles="SuperAdmin, DcaAdmin" Context="MenuHide"> <!--help finale-->
<AuthorizeView Roles="SuperAdmin" Context="MenuHide">
<Authorized> <Authorized>
<div class="nav-item px-1 align-items-center"> <div class="nav-item px-1 align-items-center">
<NavLink class="nav-link text-nowrap" href="SuperAdmin"> <NavLink class="nav-link text-nowrap" href="SuperAdmin">
@@ -50,7 +55,6 @@
</div> </div>
</Authorized> </Authorized>
</AuthorizeView> </AuthorizeView>
<!--help finale-->
<AuthorizeView Context="MenuHide"> <AuthorizeView Context="MenuHide">
<Authorized> <Authorized>
<div class="nav-item px-1 align-items-center"> <div class="nav-item px-1 align-items-center">
@@ -117,16 +121,22 @@
<option>IT</option> <option>IT</option>
</select> </select>
</div> </div>
<hr />
</li> </li>
<li class="list-group-item"> <li class="list-group-item">
<NavLink href=@($"{baseUrl}/Identity/Account/Manage")> <div class="">
<button class="btn btn-sm btn-success w-100 fw-bold text-light text-decoration-none" style="">@translate("UI_06")</button> <NavLink class="nav-link text-nowrap" href=@($"{baseUrl}/Identity/Account/Manage")>
</NavLink> <button class="btn btn-sm btn-success w-100 fw-bold text-light text-decoration-none text-dark" style="">@translate("UI_06")</button>
</NavLink>
</div>
</li> </li>
<li class="list-group-item"> <li class="list-group-item">
<form method="post" action="@logoutUrl"> <div class="text-end">
<button type="submit" class="btn btn-sm btn-danger text-light w-100 fw-bold">Log out <i class="fa-solid fa-arrow-right-from-bracket"></i></button> <form method="post" action="@actionUrl">
</form> <button type="submit" class="btnLogout">Log out <i class="fa-solid fa-arrow-right-from-bracket"></i></button>
</form>
</div>
</li> </li>
</ul> </ul>
</div> </div>
@@ -148,7 +158,7 @@
</div> </div>
<div class="text-end text-nowrap px-3 py-2 d-flex justify-content-between"> <div class="text-end text-nowrap px-3 py-2 d-flex justify-content-between">
@*<a href="Identity/Account/Register" class="text-decoration-none text-dark">@translate("UI_08") &nbsp; &nbsp;</a>*@ @*<a href="Identity/Account/Register" class="text-decoration-none text-dark">@translate("UI_08") &nbsp; &nbsp;</a>*@
<a href="@($"{baseUrl}/Identity/Account/Login")" class="text-decoration-none text-dark">@translate("UI_09") </a> <a href="Identity/Account/Login" class="text-decoration-none text-dark">@translate("UI_09") </a>
</div> </div>
</nav> </nav>
</NotAuthorized> </NotAuthorized>
@@ -2,7 +2,6 @@ using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Authorization; using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using System.Security.Policy;
using WebDoorCreator.Data.DbModels; using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.Services; using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Data; using WebDoorCreator.UI.Data;
@@ -29,7 +28,6 @@ namespace WebDoorCreator.UI.Components.Gen
protected string baseUrl protected string baseUrl
{ {
// string baseUrl = Url.Content("~/");
get => configuration.GetValue<string>("RuntimeOpt:BaseUrl"); get => configuration.GetValue<string>("RuntimeOpt:BaseUrl");
} }
@@ -237,11 +235,20 @@ namespace WebDoorCreator.UI.Components.Gen
return answ; return answ;
} }
protected string logoutUrl protected string actionUrl
{ {
get get
{ {
return $"{baseUrl}/Identity/Account/LogOut"; string answ = "";
if (NavManager.Uri.Contains("/WDC/UI"))
{
answ = $"{baseUrl}/Identity/Account/LogOut";
}
else
{
answ = "/Identity/Account/LogOut";
}
return answ;
} }
} }
@@ -1,6 +1,6 @@
@if (isLoading) @if (isLoading)
{ {
<LoadingData DisplaySize="LoadingData.CtrlSize.Small"></LoadingData> <EgwCoreLib.Razor.LoadingDataSmall></EgwCoreLib.Razor.LoadingDataSmall>
} }
else else
{ {
@@ -101,11 +101,6 @@ namespace WebDoorCreator.UI.Components.Hardware
[Inject] [Inject]
protected WDCVocabularyService WDVService { get; set; } = null!; protected WDCVocabularyService WDVService { get; set; } = null!;
[Inject]
protected NavigationManager NavMan { get; set; } = null!;
[Inject]
protected WDCUserService WDCUService { get; set; } = null!;
#endregion Protected Properties #endregion Protected Properties
#region Protected Methods #region Protected Methods
@@ -230,14 +225,6 @@ namespace WebDoorCreator.UI.Components.Hardware
JsoncConfigVal = jsonDef, JsoncConfigVal = jsonDef,
JsoncActVal = jsonAct JsoncActVal = jsonAct
}; };
// se debug + superadmin --> auto confirm
if (autoApprove)
{
doorOpToAdd.userConfirm = UserId;
doorOpToAdd.DtConfirm = DateTime.Now;
}
listOp.Add(doorOpToAdd); listOp.Add(doorOpToAdd);
// salvo Door OP associate // salvo Door OP associate
bool fatto = await WDCService.DoorOpInsert(DoorId, listOp); bool fatto = await WDCService.DoorOpInsert(DoorId, listOp);
@@ -252,7 +239,6 @@ namespace WebDoorCreator.UI.Components.Hardware
} }
} }
} }
private bool autoApprove = false;
/// <summary> /// <summary>
/// Gestione update da oggetto sottostante /// Gestione update da oggetto sottostante
@@ -275,26 +261,12 @@ namespace WebDoorCreator.UI.Components.Hardware
DoorOp2ModList.Add(currItem); 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() protected override async Task OnInitializedAsync()
{ {
await Task.Delay(1); 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; WDCRefresh.EA_ConfDoorOp += WDCRefresh_EA_ConfDoorOp;
//return base.OnInitializedAsync();
} }
protected override async Task OnParametersSetAsync() protected override async Task OnParametersSetAsync()
@@ -9,11 +9,9 @@ else
<div class="text-center d-flex justify-content-between px-2 mb-3"> <div class="text-center d-flex justify-content-between px-2 mb-3">
@if (DoorOpInst.userConfirm != "" && DoorOpInst.DtConfirm != null) @if (DoorOpInst.userConfirm != "" && DoorOpInst.DtConfirm != null)
{ {
<NavLink href="@pathFinder(DoorOpInst.DoorOpId, false)" target="_blank" title="Review PDF"> <button class="btnPDFSuccess">
<button class="btnPdfSuccess"> <i class="fa-solid fa-file-pdf"></i>
<i class="fa-solid fa-file-pdf"></i> </button>
</button>
</NavLink>
} }
<div> <div>
<h5>@($"{@getTrad(DoorOpInst.ObjectId)} #{instanceN}")</h5> <h5>@($"{@getTrad(DoorOpInst.ObjectId)} #{instanceN}")</h5>
@@ -160,8 +158,8 @@ else
} }
else else
{ {
<NavLink href="@pathFinder(DoorOpInst.DoorOpId, true)" target="_blank"> <NavLink href="@pathFinder(DoorOpInst.DoorOpId)" target="_blank">
<button class="btnPdfPending"> <button class="btnPDFPending">
<i class="fa-solid fa-file-pdf"></i> <i class="fa-solid fa-file-pdf"></i>
</button> </button>
</NavLink> </NavLink>
@@ -2,7 +2,6 @@ using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop; using Microsoft.JSInterop;
using Newtonsoft.Json; using Newtonsoft.Json;
using NLog; using NLog;
using System;
using WebDoorCreator.Data.DbModels; using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.Services; using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Data; using WebDoorCreator.UI.Data;
@@ -91,10 +90,6 @@ namespace WebDoorCreator.UI.Components.Hardware
protected List<ListValuesModel>? listValuesFiles { get; set; } = null!; protected List<ListValuesModel>? listValuesFiles { get; set; } = null!;
protected List<ListValuesModel>? listValuesFname { get; set; } = null!; protected List<ListValuesModel>? listValuesFname { get; set; } = null!;
protected List<ListValuesModel>? listValuesHW { 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>(); protected List<string> ordListVal { get; set; } = new List<string>();
[Inject] [Inject]
@@ -147,9 +142,6 @@ namespace WebDoorCreator.UI.Components.Hardware
[Inject] [Inject]
protected WebDoorCreatorService WDCService { get; set; } = null!; protected WebDoorCreatorService WDCService { get; set; } = null!;
[Inject]
protected WDCUserService WDCUService { get; set; } = null!;
[Inject] [Inject]
protected WDCVocabularyService WDVService { get; set; } = null!; protected WDCVocabularyService WDVService { get; set; } = null!;
@@ -207,12 +199,6 @@ namespace WebDoorCreator.UI.Components.Hardware
// salvo i NUOVI valori... // salvo i NUOVI valori...
DoorOpInst.CurrVals = dictValCurr; DoorOpInst.CurrVals = dictValCurr;
DoorOpInst.GraphicParams = graphicParams; DoorOpInst.GraphicParams = graphicParams;
// se debug + superadmin --> auto confirm
if (autoApprove && string.IsNullOrEmpty(DoorOpInst.userConfirm))
{
DoorOpInst.userConfirm = WDCUService.userId;
DoorOpInst.DtConfirm = DateTime.Now;
}
// salvo! // salvo!
List<DoorOpModel> doorOpUpd = new List<DoorOpModel>() { DoorOpInst }; List<DoorOpModel> doorOpUpd = new List<DoorOpModel>() { DoorOpInst };
await WDCService.DoorOpUpdate(doorOpUpd); await WDCService.DoorOpUpdate(doorOpUpd);
@@ -225,18 +211,6 @@ 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) protected string getTrad(string objId)
{ {
string answ = ""; string answ = "";
@@ -261,12 +235,6 @@ namespace WebDoorCreator.UI.Components.Hardware
hasChanged = currSer != origSer; hasChanged = currSer != origSer;
if (hasChanged) 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); DoorOpInst.JsoncActVal = JsonConvert.SerializeObject(dictValCurr);
Task.Run(async () => Task.Run(async () =>
{ {
@@ -288,11 +256,6 @@ namespace WebDoorCreator.UI.Components.Hardware
protected override void OnInitialized() protected override void OnInitialized()
{ {
base.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"); string vers = config.GetValue<string>("ConfDDF:VersNumber");
bool remDoorOp = config.GetValue<bool>("ConfDDF:RemoveDoorOps"); bool remDoorOp = config.GetValue<bool>("ConfDDF:RemoveDoorOps");
var headRows = config.GetSection("ConfDDF:Header").Get<List<string>>(); var headRows = config.GetSection("ConfDDF:Header").Get<List<string>>();
@@ -365,7 +328,6 @@ namespace WebDoorCreator.UI.Components.Hardware
#region Private Fields #region Private Fields
private static Logger Log = LogManager.GetCurrentClassLogger(); private static Logger Log = LogManager.GetCurrentClassLogger();
private bool autoApprove = false;
#endregion Private Fields #endregion Private Fields
@@ -388,9 +350,9 @@ namespace WebDoorCreator.UI.Components.Hardware
await SetSelectedData(); await SetSelectedData();
} }
private string pathFinder(int id, bool reqConf) private string pathFinder(int id)
{ {
string answ = $"HwPdfConfirm?doorOpId={id}&doorId={DoorOpInst.DoorId}&objectId={DoorOpInst.ObjectId}&reqConf={reqConf}"; string answ = $"HwPdfConfirm?doorOpId={id}&doorId={DoorOpInst.DoorId}&objectId={DoorOpInst.ObjectId}";
return answ; return answ;
} }
@@ -423,11 +385,11 @@ namespace WebDoorCreator.UI.Components.Hardware
if (tempListFilesTempl!.Count != 0) 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) else if (tempListFilesSh!.Count != 0)
{ {
listValuesFiles = tempListFilesSh!.Where(x => x.Value.Contains($"{folderName}\\")).ToList(); listValuesFiles = tempListFilesSh!.Where(x => x.Value.Contains(folderName)).ToList();
} }
try try
{ {
@@ -1,7 +1,7 @@
.btnPDF { .btnPDF {
border-radius: 50%; border-radius: 50%;
width: 1.6rem; width: 1.5rem;
height: 1.6rem; height: 1.5rem;
border: 2px solid #00838F; border: 2px solid #00838F;
z-index: 99999; z-index: 99999;
} }
@@ -30,16 +30,15 @@
background: #FFF; background: #FFF;
/*transform: translate(1.6rem, -1rem);*/ /*transform: translate(1.6rem, -1rem);*/
} }
.btnPdfSuccess { .btnPDFSuccess {
border-radius: 50%; border-radius: 50%;
width: 1.6rem; width: 1.5rem;
height: 1.6rem; height: 1.5rem;
border: 2px solid #00838F; border: 2px solid #00838F;
z-index: 99999; z-index: 99999;
background: #44AD8E; background: #8E44AD;
color: #FFFFFF;
} }
.btnPdfPending { .btnPDFPending {
border-radius: 50%; border-radius: 50%;
width: 3.5rem; width: 3.5rem;
height: 3.5rem; height: 3.5rem;
@@ -47,7 +46,7 @@
z-index: 99999; z-index: 99999;
background: #F1C40F; background: #F1C40F;
} }
.btnPdfSuccess > i { .btnPDFSuccess > i {
font-size: 0.8rem; font-size: 0.8rem;
} }
.btnHighlight { .btnHighlight {
@@ -3,8 +3,8 @@
.btnPDF { .btnPDF {
border-radius: 50%; border-radius: 50%;
width: 1.6rem; width: 1.5rem;
height: 1.6rem; height: 1.5rem;
border: 2px solid #00838F; border: 2px solid #00838F;
z-index: 99999; z-index: 99999;
} }
@@ -29,19 +29,18 @@
/*transform: translate(1.6rem, -1rem);*/ /*transform: translate(1.6rem, -1rem);*/
} }
.btnPdfSuccess { .btnPDFSuccess {
.btnPDF; .btnPDF;
background: #44AD8E; background: #8E44AD;
color: #FFFFFF;
} }
.btnPdfPending { .btnPDFPending {
.btnGen; .btnGen;
background: #F1C40F; background: #F1C40F;
//transform: translate(20.3rem, 1rem); //transform: translate(20.3rem, 1rem);
} }
.btnPdfSuccess > i { .btnPDFSuccess > i {
font-size: 0.8rem; font-size: 0.8rem;
} }
@@ -1 +1 @@
.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);}} .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);}}
@@ -1,5 +1,5 @@
<div class="p-5"> <div class="p-5">
<DoorList currOrderId="@CurrOrdId" orderTotCost="@OrderView!.TotCost" E_CurrDoor="SetCurrDoor" E_CurrDoorModal="SetCurrDoorModal" updateRecordCount="UpdateTotCount" actFilter="@currFilter"></DoorList> <DoorList currOrderId="@OrderView!.OrderId" orderTotCost="@OrderView!.TotCost" E_CurrDoor="SetCurrDoor" E_CurrDoorModal="SetCurrDoorModal" updateRecordCount="UpdateTotCount" actFilter="@currFilter"></DoorList>
<div class="mt-4"> <div class="mt-4">
<EgwCoreLib.Razor.DataPager @ref="pagerDoors" PageSize="@numRecord" currPage="@currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="@totalCount" showLoading="@isLoading" PageSizeList="@pageSizeList" /> <EgwCoreLib.Razor.DataPager @ref="pagerDoors" PageSize="@numRecord" currPage="@currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="@totalCount" showLoading="@isLoading" PageSizeList="@pageSizeList" />
</div> </div>
@@ -1,11 +1,9 @@
using Blazored.SessionStorage; using EgwCoreLib.Razor;
using EgwCoreLib.Razor;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
using WebDoorCreator.Data.DbModels; using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.DTO; using WebDoorCreator.Data.DTO;
using WebDoorCreator.Data.Services; using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Data; using WebDoorCreator.UI.Data;
using static WebDoorCreator.UI.Data.WDCRefreshService;
namespace WebDoorCreator.UI.Components.Order namespace WebDoorCreator.UI.Components.Order
{ {
@@ -25,16 +23,6 @@ namespace WebDoorCreator.UI.Components.Order
[Parameter] [Parameter]
public OrderStatusViewModel? OrderView { get; set; } public OrderStatusViewModel? OrderView { get; set; }
protected int CurrOrdId { get; set; } = 0;
protected override void OnParametersSet()
{
if (OrderView != null)
{
CurrOrdId = OrderView.OrderId;
}
}
public string userId public string userId
{ {
get get
@@ -45,12 +33,6 @@ namespace WebDoorCreator.UI.Components.Order
#endregion Public Properties #endregion Public Properties
#region Protected Fields #region Protected Fields
protected DataPager? pagerDoors = null!; protected DataPager? pagerDoors = null!;
@@ -65,7 +47,7 @@ namespace WebDoorCreator.UI.Components.Order
protected DoorsSelectFilter currFilter { get; set; } = new DoorsSelectFilter(); protected DoorsSelectFilter currFilter { get; set; } = new DoorsSelectFilter();
/// <summary> /// <summary>
/// Unita' di misura selezionata /// Unit di misura selezionata
/// </summary> /// </summary>
protected string currMeaUnit { get; set; } = "mm"; protected string currMeaUnit { get; set; } = "mm";
@@ -121,17 +103,9 @@ namespace WebDoorCreator.UI.Components.Order
currPage = newNum; currPage = newNum;
} }
protected override async Task OnInitializedAsync() protected override void OnInitialized()
{ {
string rawVal = await sessStorage.GetItemAsStringAsync("doorsSelFilt"); numRecord = 16;
if (!string.IsNullOrEmpty(rawVal))
{
currFilter = await sessStorage.GetItemAsync<DoorsSelectFilter>("doorsSelFilt");
}
else
{
numRecord = 16;
}
} }
protected async Task SetCurrDoor(DoorModel door) protected async Task SetCurrDoor(DoorModel door)
@@ -170,10 +144,7 @@ namespace WebDoorCreator.UI.Components.Order
private int currPage private int currPage
{ {
get => currFilter.CurrPage; get => currFilter.CurrPage;
set set => currFilter.CurrPage = value;
{
currFilter.CurrPage = value;
}
} }
private bool isLoading { get; set; } = false; private bool isLoading { get; set; } = false;
@@ -181,15 +152,7 @@ namespace WebDoorCreator.UI.Components.Order
private int numRecord private int numRecord
{ {
get => currFilter.NumRec; get => currFilter.NumRec;
set set => currFilter.NumRec = value;
{
if (currFilter.NumRec != value)
{
currFilter.NumRec = value;
currPage = 1;
InvokeAsync(() => sessStorage.SetItemAsync<DoorsSelectFilter>("doorsSelFilt", currFilter));
}
}
} }
private string searchValue private string searchValue
@@ -198,9 +161,6 @@ namespace WebDoorCreator.UI.Components.Order
set => currFilter.searchValue = value; set => currFilter.searchValue = value;
} }
[Inject]
private ISessionStorageService sessStorage { get; set; } = null!;
#endregion Private Properties #endregion Private Properties
} }
} }
@@ -39,11 +39,11 @@ else
@if (isEdit && item.OrderId == currOrderId) @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-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="Cancel Order"><i class="fa-solid fa-rotate-left"></i> Cancel</button> <button class="btn btn-sm btn-secondary" @onclick="()=>editCancel()" title="Save Order"><i class="fa-solid fa-rotate-left"></i> Cancel</button>
} }
else else
{ {
<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> <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>
<AuthorizeView Roles="SuperAdmin, DcaAdmin, DcaOrdMan, DcaProj" Context="OrderEdit"> <AuthorizeView Roles="SuperAdmin, DcaAdmin, DcaOrdMan, DcaProj" Context="OrderEdit">
<Authorized> <Authorized>
@if (item.OrderStatus < 30 || WDCUService.userRole == "DcaAdmin" || WDCUService.userRole == "SuperAdmin") @if (item.OrderStatus < 30 || WDCUService.userRole == "DcaAdmin" || WDCUService.userRole == "SuperAdmin")
@@ -7,7 +7,6 @@ using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.Services; using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Data; using WebDoorCreator.UI.Data;
using static WebDoorCreator.Core.Enum; using static WebDoorCreator.Core.Enum;
using static WebDoorCreator.UI.Data.WDCRefreshService;
namespace WebDoorCreator.UI.Components.Order namespace WebDoorCreator.UI.Components.Order
{ {
@@ -77,9 +76,7 @@ namespace WebDoorCreator.UI.Components.Order
} }
protected string currUser { get; set; } = ""; protected string currUser { get; set; } = "";
protected bool isEdit { get; set; } = false; protected bool isEdit { get; set; } = false;
protected bool isModRole { get; set; } = false; protected bool isModRole { get; set; } = false;
[Inject] [Inject]
@@ -92,11 +89,8 @@ namespace WebDoorCreator.UI.Components.Order
protected NavigationManager NavManager { get; set; } = null!; protected NavigationManager NavManager { get; set; } = null!;
protected bool ordByCode { get; set; } = false; protected bool ordByCode { get; set; } = false;
protected bool ordByDate { get; set; } = false; protected bool ordByDate { get; set; } = false;
protected int screenX { get; set; } = 0; protected int screenX { get; set; } = 0;
protected int screenY { get; set; } = 0; protected int screenY { get; set; } = 0;
protected List<string>? userClaims protected List<string>? userClaims
@@ -191,6 +185,21 @@ namespace WebDoorCreator.UI.Components.Order
return answ; 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) protected string getOrderStatusColor(int orderStat)
{ {
string answ = ""; string answ = "";
@@ -207,22 +216,6 @@ namespace WebDoorCreator.UI.Components.Order
return answ; 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) protected override async Task OnAfterRenderAsync(bool firstRender)
{ {
if (firstRender) if (firstRender)
@@ -231,7 +224,7 @@ namespace WebDoorCreator.UI.Components.Order
if (localOrdId != 0) if (localOrdId != 0)
{ {
await setOrd2Show(localOrdId, false); await setOrd2Show(localOrdId);
} }
} }
} }
@@ -274,27 +267,16 @@ namespace WebDoorCreator.UI.Components.Order
return $"api/Report/GetOrderReport?OrderId={orderId}&Format=PDF"; return $"api/Report/GetOrderReport?OrderId={orderId}&Format=PDF";
} }
protected async Task setOrd2Show(int orderId, bool doSave) protected async Task setOrd2Show(int orderId)
{ {
await Task.Delay(1); await Task.Delay(1);
if (ListOrdersStatus == null && !isLoading)
{
await ReloadData();
}
else
{
await Task.Delay(200);
}
if (ListOrdersStatus != null) if (ListOrdersStatus != null)
{ {
var chosenOrd = ListOrdersStatus.Where(x => x.OrderId == orderId).FirstOrDefault(); var chosenOrd = ListOrdersStatus.Where(x => x.OrderId == orderId).FirstOrDefault();
if (chosenOrd != null) if (chosenOrd != null)
{ {
Ord2Show = chosenOrd; Ord2Show = chosenOrd;
if (doSave) await localStorage.SetItemAsync("OrderId", orderId);
{
await localStorage.SetItemAsync("OrderId", orderId);
}
await E_SetOrd2Show.InvokeAsync(chosenOrd); await E_SetOrd2Show.InvokeAsync(chosenOrd);
} }
} }
@@ -339,15 +321,10 @@ namespace WebDoorCreator.UI.Components.Order
#region Private Fields #region Private Fields
private DateTime dateLimit = new DateTime(2000, 1, 1); private DateTime dateLimit = new DateTime(2000, 1, 1);
private bool isLoading = false;
private Dictionary<int, string> ListCompany = new Dictionary<int, string>(); private Dictionary<int, string> ListCompany = new Dictionary<int, string>();
private List<OrderStatusViewModel>? ListOrdersStatus = null; private List<OrderStatusViewModel>? ListOrdersStatus = null;
private List<ListValuesModel>? ListValuesAll = null; private List<ListValuesModel>? ListValuesAll = null;
private List<OrderStatusViewModel>? SearchRecords = null; private List<OrderStatusViewModel>? SearchRecords = null;
private bool sortAsc = true; private bool sortAsc = true;
private string sortField = ""; private string sortField = "";
@@ -429,7 +406,6 @@ namespace WebDoorCreator.UI.Components.Order
private async Task ReloadData() private async Task ReloadData()
{ {
isLoading = true;
ListOrdersStatus = null; ListOrdersStatus = null;
var domani = DateTime.Today.AddDays(1); var domani = DateTime.Today.AddDays(1);
@@ -526,6 +502,7 @@ namespace WebDoorCreator.UI.Components.Order
} }
break; break;
case "OrdStatus": case "OrdStatus":
if (sortAsc) if (sortAsc)
{ {
@@ -537,6 +514,7 @@ namespace WebDoorCreator.UI.Components.Order
} }
break; break;
case "Qty": case "Qty":
if (sortAsc) if (sortAsc)
{ {
@@ -555,7 +533,8 @@ namespace WebDoorCreator.UI.Components.Order
} }
} }
} }
isLoading = false;
await Task.Delay(1);
await InvokeAsync(StateHasChanged); await InvokeAsync(StateHasChanged);
} }
@@ -25,7 +25,7 @@
</div> </div>
<div class="mt-2"> <div class="mt-2">
<EgwCoreLib.Razor.DataPager @ref="pagerOrderHP" PageSize="@numRecord" currPage="@currPage" numRecordChanged="SetNumRec" numPageChanged="SetPage" totalCount="@totalCount" showLoading="@isLoading" /> <EgwCoreLib.Razor.DataPager @ref="pagerOrderHP" PageSize="@numRecord" currPage="@currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="@totalCount" showLoading="@isLoading" />
</div> </div>
</div> </div>
} }
@@ -1,12 +1,10 @@
using Blazored.LocalStorage; using Blazored.LocalStorage;
using Blazored.SessionStorage;
using EgwCoreLib.Razor; using EgwCoreLib.Razor;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop; using Microsoft.JSInterop;
using WebDoorCreator.Data.DbModels; using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.Services; using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Data; using WebDoorCreator.UI.Data;
using static WebDoorCreator.UI.Data.WDCRefreshService;
namespace WebDoorCreator.UI.Components.Order namespace WebDoorCreator.UI.Components.Order
{ {
@@ -14,12 +12,12 @@ namespace WebDoorCreator.UI.Components.Order
{ {
#region Public Properties #region Public Properties
[Parameter]
public EventCallback<AspNetUsers> E_currUser { get; set; }
[CascadingParameter] [CascadingParameter]
public bool isTplPage { get; set; } = false; public bool isTplPage { get; set; } = false;
[Parameter]
public EventCallback<AspNetUsers> E_currUser { get; set; }
public string userId public string userId
{ {
get get
@@ -28,6 +26,8 @@ namespace WebDoorCreator.UI.Components.Order
} }
} }
[Inject]
protected WDCVocabularyService WDCVService { get; set; } = null!;
#endregion Public Properties #endregion Public Properties
@@ -38,7 +38,6 @@ namespace WebDoorCreator.UI.Components.Order
WDCUService.EA_UserCurrCompany -= OnNewUserCurrComp; WDCUService.EA_UserCurrCompany -= OnNewUserCurrComp;
} }
public async void OnNewUserCurrComp() public async void OnNewUserCurrComp()
{ {
await Task.Delay(1); await Task.Delay(1);
@@ -53,21 +52,12 @@ namespace WebDoorCreator.UI.Components.Order
#region Protected Fields #region Protected Fields
protected string _doorExtCode = ""; protected string _doorExtCode = "";
protected int _doorQuantity = 0; protected int _doorQuantity = 0;
protected string _orderCodExt = ""; protected string _orderCodExt = "";
protected string _orderDescr = ""; protected string _orderDescr = "";
protected bool cloneReq = false; protected bool cloneReq = false;
protected string Lingua = "EN";
protected bool newOrdReq = false; protected bool newOrdReq = false;
protected int ordIdOrig = 0; protected int ordIdOrig = 0;
protected DataPager? pagerOrderHP = null!; protected DataPager? pagerOrderHP = null!;
#endregion Protected Fields #endregion Protected Fields
@@ -75,19 +65,12 @@ namespace WebDoorCreator.UI.Components.Order
#region Protected Properties #region Protected Properties
protected DoorModel? currDoor { get; set; } = null; protected DoorModel? currDoor { get; set; } = null;
protected DoorModel? currDoorModal { get; set; } = null; protected DoorModel? currDoorModal { get; set; } = null;
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 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 AspNetUsers? currUser { get; set; } = null; protected AspNetUsers? currUser { get; set; } = null;
protected bool doorChange { get; set; } = false; protected bool doorChange { get; set; } = false;
protected string doorExtCode protected string doorExtCode
@@ -103,9 +86,7 @@ namespace WebDoorCreator.UI.Components.Order
} }
protected List<DoorModel>? DoorsList { get; set; } = null; protected List<DoorModel>? DoorsList { get; set; } = null;
protected string goToDefPage { get; set; } = ""; protected string goToDefPage { get; set; } = "";
protected bool isModRole { get; set; } = false; protected bool isModRole { get; set; } = false;
[Inject] [Inject]
@@ -144,21 +125,47 @@ namespace WebDoorCreator.UI.Components.Order
protected List<UsersViewModel>? UsersList { get; set; } = null; protected List<UsersViewModel>? UsersList { get; set; } = null;
[Inject]
protected WDCVocabularyService VocService { get; set; } = null!;
[Inject] [Inject]
protected WDCUserService WDCUService { get; set; } = null!; protected WDCUserService WDCUService { get; set; } = null!;
[Inject]
protected WDCVocabularyService WDCVService { get; set; } = null!;
[Inject] [Inject]
protected WebDoorCreatorService WDService { get; set; } = null!; protected WebDoorCreatorService WDService { get; set; } = null!;
[Inject]
protected WDCVocabularyService VocService { get; set; } = null!;
#endregion Protected Properties #endregion Protected Properties
private List<ListValuesModel>? ListValuesAll = null;
#region Protected Methods #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) protected async Task addNewOrder(string userName, bool saveAsTemplate)
{ {
@@ -275,61 +282,16 @@ namespace WebDoorCreator.UI.Components.Order
currDoor = null; currDoor = null;
} }
protected void SetNumRec(int newNum) protected void ForceReload(int newNum)
{ {
currPage = 1;
numRecord = newNum; numRecord = newNum;
} }
protected void SetPage(int newNum) protected void ForceReloadPage(int newNum)
{ {
currPage = 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() protected override async Task OnInitializedAsync()
{ {
await Task.Delay(1); await Task.Delay(1);
@@ -338,7 +300,6 @@ namespace WebDoorCreator.UI.Components.Order
WDCUService.EA_UserCurrCompany += OnNewUserCurrComp; WDCUService.EA_UserCurrCompany += OnNewUserCurrComp;
} }
protected async Task ReloadData() protected async Task ReloadData()
{ {
DoorsList = await WDService.DoorGetByOrderId(currOrderId); DoorsList = await WDService.DoorGetByOrderId(currOrderId);
@@ -427,32 +388,6 @@ namespace WebDoorCreator.UI.Components.Order
StateHasChanged(); 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) protected void UpdateTotCount(int newTotCount)
{ {
totalCount = newTotCount; totalCount = newTotCount;
@@ -460,12 +395,6 @@ namespace WebDoorCreator.UI.Components.Order
#endregion Protected Methods #endregion Protected Methods
#region Private Fields
private List<ListValuesModel>? ListValuesAll = null;
#endregion Private Fields
#region Private Properties #region Private Properties
private int currPage private int currPage
@@ -494,14 +423,7 @@ namespace WebDoorCreator.UI.Components.Order
private int numRecord private int numRecord
{ {
get => currFilter.NumRec; get => currFilter.NumRec;
set set => currFilter.NumRec = value;
{
if (currFilter.NumRec != value)
{
currFilter.NumRec = value;
InvokeAsync(() => sessStorage.SetItemAsync<OrderSelectFilter>("ordSelFilt", currFilter));
}
}
} }
private int orderStatus private int orderStatus
@@ -516,11 +438,39 @@ namespace WebDoorCreator.UI.Components.Order
set => currFilter.searchValue = value; set => currFilter.searchValue = value;
} }
[Inject]
private ISessionStorageService sessStorage { get; set; } = null!;
#endregion Private Properties #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 #region Private Methods
private async Task doCalcSVG(int orderId) private async Task doCalcSVG(int orderId)
@@ -565,7 +515,6 @@ namespace WebDoorCreator.UI.Components.Order
await Task.Delay(1); await Task.Delay(1);
await InvokeAsync(() => StateHasChanged()); await InvokeAsync(() => StateHasChanged());
currFilter = newParams; currFilter = newParams;
await sessStorage.SetItemAsync<OrderSelectFilter>("ordSelFilt", newParams);
isLoading = false; isLoading = false;
} }
@@ -24,7 +24,7 @@
</div> </div>
@if (DoorsList == null || DoorsList.Count == 0) @if (DoorsList == null || DoorsList.Count == 0)
{ {
<LoadingData DisplaySize="LoadingData.CtrlSize.Small"></LoadingData> <LoadingDataSmall></LoadingDataSmall>
} }
else else
{ {
@@ -11,113 +11,14 @@ namespace WebDoorCreator.UI.Controllers
[ApiController] [ApiController]
public class DoorImageController : ControllerBase public class DoorImageController : ControllerBase
{ {
#region Public Constructors
public DoorImageController(IConfiguration configuration, QueueDataService cQDService, WebDoorCreatorService cWDCService)
{
Log.Trace("Starting DoorImageController");
_configuration = configuration;
WaitReloadSvg = _configuration.GetValue<int>("RuntimeOpt:WaitReloadSvg");
QDService = cQDService;
WDService = cWDCService;
Log.Trace("Avviato DoorImageController");
}
#endregion Public Constructors
private Random rnd = new Random();
#region Public Methods
// GET: api/DoorImage
[HttpGet]
public string Get()
{
return "OK";
}
[HttpGet("GetImage.svg")] [HttpGet("GetImage.svg")]
public async Task<IActionResult> GetImage(int DoorId) public async Task<IActionResult> GetImage(int DoorId)
{ {
string svgContent = await QDService.DoorGetLastSvg(DoorId); string svgContent = await QDataServ.DoorGetLastSvg(DoorId);
// se fosse vuoto...
if (string.IsNullOrEmpty(svgContent))
{
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))
{
// legge img vuota
svgContent = QDService.DoorGetMissingSvg();
}
var result = System.Text.Encoding.UTF8.GetBytes(svgContent); var result = System.Text.Encoding.UTF8.GetBytes(svgContent);
return File(result, "image/svg+xml"); return File(result, "image/svg+xml");
} }
#endregion Public Methods
#region Private Fields
private static Logger Log = LogManager.GetCurrentClassLogger();
private IConfiguration _configuration = null!;
private int WaitReloadSvg = 100;
#endregion Private Fields
#region Private Properties
private QueueDataService QDService { get; set; } = null!;
private WebDoorCreatorService WDService { get; set; } = null!;
#endregion Private Properties
#region Private Methods
/// <summary>
/// Invio richiesta ricalcolo porta
/// </summary>
/// <param name="DoorId"></param>
/// <returns></returns>
private async Task SendRecalcReq(int DoorId)
{
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);
}
}
#endregion Private Methods
#if false #if false
[HttpGet("GetImage.png")] [HttpGet("GetImage.png")]
public async Task<IActionResult> GetImagePng(int DoorId) public async Task<IActionResult> GetImagePng(int DoorId)
@@ -132,7 +33,37 @@ namespace WebDoorCreator.UI.Controllers
result = Utils.ImageToByte2(myBmp); result = Utils.ImageToByte2(myBmp);
} }
return File(result, "image/png"); return File(result, "image/png");
} }
#endif #endif
// GET: api/DoorImage
[HttpGet]
public string Get()
{
return "OK";
}
public DoorImageController(IConfiguration configuration, QueueDataService DataService)
{
Log.Info("Starting DoorImageController");
_configuration = configuration;
QDataServ = DataService;
Log.Info("Avviato DoorImageController");
}
#region Private Fields
private static IConfiguration _configuration = null!;
private static Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
#region Private Properties
private QueueDataService QDataServ { get; set; } = null!;
#endregion Private Properties
} }
} }
+20 -62
View File
@@ -1,8 +1,5 @@
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
using WebDoorCreator.Data; using WebDoorCreator.Data;
using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.Services;
using static Org.BouncyCastle.Math.EC.ECCurve;
namespace WebDoorCreator.UI.Data namespace WebDoorCreator.UI.Data
{ {
@@ -10,30 +7,35 @@ namespace WebDoorCreator.UI.Data
{ {
#region Public Events #region Public Events
public event EventHandler EA_ConfDoorOp = delegate { };
public event EventHandler EA_OrderChanged = delegate { };
public event Action EA_UpdDoorOp = null!; public event Action EA_UpdDoorOp = null!;
public event EventHandler EA_ConfDoorOp = delegate { };
#endregion Public Events #endregion Public Events
#region Public Properties #region Public Properties
public bool isDoorOpUpd public bool isDoorOpUpd
{ {
get => _isDoorOpUpd; get => _isDoorOpUpd;
set set
{ {
_isDoorOpUpd = value; _isDoorOpUpd = value;
reportDoorOpUpd(); reportDoorOpUpd();
} }
} }
#endregion Public Properties #endregion Public Properties
#region Public Methods #region Protected Methods
protected void reportDoorOpUpd()
{
if (EA_UpdDoorOp != null)
{
EA_UpdDoorOp?.Invoke();
}
}
public void ReportDoorOpConf(int doorId, int doorOpId, string objId) public void ReportDoorOpConf(int doorId, int doorOpId, string objId)
{ {
DOPEventArgs currOpr = new DOPEventArgs() DOPEventArgs currOpr = new DOPEventArgs()
@@ -48,63 +50,19 @@ namespace WebDoorCreator.UI.Data
EA_ConfDoorOp(this, currOpr); 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 #endregion Protected Methods
#region Private Properties #region Private Properties
private bool _isDoorOpConf { get; set; } = false;
private bool _isDoorOpUpd { get; set; } = false; private bool _isDoorOpUpd { get; set; } = false;
private bool _isDoorOpConf { get; set; } = false;
#endregion Private Properties #endregion Private Properties
public class DOPEventArgs : EventArgs
{
public int DoorId { get; set; } = 0;
public int DoorOpId { get; set; } = 0;
public string ObjectId { get; set; } = "";
}
} }
} }
-102
View File
@@ -1,102 +0,0 @@
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
}
}
+2 -3
View File
@@ -1,6 +1,5 @@
@page "/ForceReload" @page "/ForceReload"
<LoadingData Title="Reloading Data" DisplayMode="LoadingData.SpinMode.Growl" DisplaySize="LoadingData.CtrlSize.Large"></LoadingData> <h3>Refreshing Data</h3>
<LoadingData></LoadingData>
<ProgressDisplay Title="@titleMsg" CurrVal="@currVal" NextVal="@nextVal" MaxVal="@maxVal" ExpTimeMSec="100"></ProgressDisplay>
+1 -20
View File
@@ -23,31 +23,12 @@ namespace WebDoorCreator.UI.Pages
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
currVal = 0;
nextVal = 1;
await Task.Delay(100);
currVal++;
nextVal++;
await WDService.FlushCustomPattern("Cache"); await WDService.FlushCustomPattern("Cache");
currVal++; await Task.Delay(1);
nextVal++;
await Task.Delay(200);
currVal++;
nextVal++;
await WDCVService.ReloadVoc(); await WDCVService.ReloadVoc();
currVal++;
nextVal++;
await Task.Delay(200);
currVal++;
nextVal++;
NavManager.NavigateTo("OrdersHomePage", true); NavManager.NavigateTo("OrdersHomePage", true);
} }
private int currVal = 0;
private int nextVal = 1;
private int maxVal = 6;
private string titleMsg = "Clearing cache...";
#endregion Protected Methods #endregion Protected Methods
} }
} }
+7 -18
View File
@@ -3,24 +3,13 @@
@if (currDoorOp != null) @if (currDoorOp != null)
{ {
<div> <div>
<div class="col-12 text-center mb-2"> <div class="col-10 text-center mb-2">
@if (reqConf) Please press
{ <button class="btn btn-outline-dark" style="cursor: pointer;" @onclick="()=>doConfirm()">
<button class="btn btn-outline-dark" style="cursor: pointer;" @onclick="()=>doConfirm()"> CONFIRM
Press <b>HERE to CONFIRM</b> after reading the whole Document </button>
</button> after reading the whole Document
}
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> </div>
<embed src="Docs/1001.pdf" width="100%" height="800px" />
</div> </div>
} }
+1 -111
View File
@@ -1,48 +1,27 @@
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.WebUtilities; using Microsoft.AspNetCore.WebUtilities;
using Microsoft.JSInterop;
using Newtonsoft.Json; using Newtonsoft.Json;
using System.Text;
using WebDoorCreator.Data.DbModels; using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.Services; using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Data; using WebDoorCreator.UI.Data;
using static Org.BouncyCastle.Math.EC.ECCurve;
namespace WebDoorCreator.UI.Pages namespace WebDoorCreator.UI.Pages
{ {
public partial class HwPdfConfirm public partial class HwPdfConfirm
{ {
#region Protected Fields
protected int doorId = 0; protected int doorId = 0;
protected string objectId = ""; protected string objectId = "";
#endregion Protected Fields
#region Protected Properties
protected List<DoorOpModel> allDoorOps { get; set; } = new List<DoorOpModel>(); 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 DoorOpModel currDoorOp { get; set; } = new DoorOpModel();
protected int doorOpId { get; set; } = 0; protected int doorOpId { get; set; } = 0;
[Inject]
protected IJSRuntime JSRuntime { get; set; } = null!;
[Inject] [Inject]
protected NavigationManager NavManager { get; set; } = null!; protected NavigationManager NavManager { get; set; } = null!;
[Inject]
protected QueueDataService QDataServ { get; set; } = null!;
protected bool reqConf { get; set; } = false;
protected string userLang protected string userLang
{ {
get => WDCUService.currLanguage ?? "EN"; get => WDCUService.currLanguage ?? "EN";
@@ -54,17 +33,12 @@ namespace WebDoorCreator.UI.Pages
[Inject] [Inject]
protected WDCUserService WDCUService { get; set; } = null!; protected WDCUserService WDCUService { get; set; } = null!;
[Inject] [Inject]
protected WDCRefreshService WDRService { get; set; } = null!; protected WDCRefreshService WDRService { get; set; } = null!;
[Inject] [Inject]
protected WebDoorCreatorService WDService { get; set; } = null!; protected WebDoorCreatorService WDService { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
protected bool checkIfConf() protected bool checkIfConf()
{ {
bool answ = false; bool answ = false;
@@ -89,14 +63,6 @@ namespace WebDoorCreator.UI.Pages
return answ; 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() protected async Task doConfirm()
{ {
currDoorOp.userConfirm = WDCUService.userId; currDoorOp.userConfirm = WDCUService.userId;
@@ -105,32 +71,12 @@ namespace WebDoorCreator.UI.Pages
var doorOps2Save = new List<DoorOpModel>() { currDoorOp }; var doorOps2Save = new List<DoorOpModel>() { currDoorOp };
var done = await WDService.DoorOpUpdate(doorOps2Save); var done = await WDService.DoorOpUpdate(doorOps2Save);
if (done) if (done)
{ {
// ricalcola!
await refreshSVG();
// piccola attesa..
await Task.Delay(50);
// riporto update...
WDRService.ReportDoorOpConf(doorId, doorOpId, objectId); 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() protected override async Task OnInitializedAsync()
{ {
await Task.Delay(1); await Task.Delay(1);
@@ -145,10 +91,6 @@ namespace WebDoorCreator.UI.Pages
{ {
int.TryParse(sDoorId, out doorId); 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)) if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("doorOpId", out var sDoorOpId))
{ {
doorOpId = int.Parse(sDoorOpId); doorOpId = int.Parse(sDoorOpId);
@@ -156,66 +98,14 @@ 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() protected async Task ReloadData()
{ {
currDoorOp = await WDService.DoorOpGetById(doorOpId); currDoorOp = await WDService.DoorOpGetById(doorOpId);
docUrl = "Docs/1001.pdf";
if (currDoorOp != null) if (currDoorOp != null)
{ {
allDoorOps = await WDService.DoorOpGetByDoorId(currDoorOp.DoorId); allDoorOps = await WDService.DoorOpGetByDoorId(currDoorOp.DoorId);
if (currDoorOp.CurrVals.ContainsKey("template"))
{
docUrl = $"docs/{objectId}/{currDoorOp.CurrVals["template"]}.pdf";
}
} }
// fin finale caratteri! space Stripe: " " --> "_" await Task.Delay(1);
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
} }
} }
+35 -39
View File
@@ -1,54 +1,48 @@
@page "/SuperAdmin" @page "/SuperAdmin"
@using WebDoorCreator.UI.Components @using WebDoorCreator.UI.Components
<div class="d-flex justify-content-around"> <AuthorizeView Roles="SuperAdmin, DcaAdmin">
<div class="btn-group"> <Authorized>
<button @onclick="() => SetMode(AdminMode.Company)" class="btn px-5 @cssMode(AdminMode.Company)">Company</button> <div class="d-flex justify-content-around">
<AuthorizeView Roles="SuperAdmin"> <div class="btn-group">
<Authorized> <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.Interface)" class="btn px-5 @cssMode(AdminMode.Interface)">Interface</button>*@
</Authorized> <button @onclick="() => SetMode(AdminMode.Component)" class="btn px-5 @cssMode(AdminMode.Component)">Components</button>
</AuthorizeView> </div>
<button @onclick="() => SetMode(AdminMode.Component)" class="btn px-5 @cssMode(AdminMode.Component)">Components</button> </div>
</div>
</div>
<div class="cardShadow mt-2 p-2"> <div class="cardShadow mt-2 p-2">
@if (CurrMode == AdminMode.Company) @if (CurrMode == AdminMode.Company)
{ {
<div class="p-2"> <div class="p-2">
<AuthorizeView Roles="SuperAdmin">
<Authorized>
<div class="mb-3 text-end"> <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"> <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 <i class="fa-solid fa-plus"></i> Add new company
</button> </button>
</div> </div>
</Authorized> <CompanyList E_currCompany="catchCurrComp"></CompanyList>
</AuthorizeView> </div>
<CompanyList E_currCompany="catchCurrComp"></CompanyList> }
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>
}
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="">
<div class="d-flex justify-content-between"> <div class="d-flex justify-content-between">
<div class="pb-0 d-flex justify-content-start"> <div class="pb-0 d-flex justify-content-start">
@@ -93,6 +87,8 @@
} }
</div> </div>
</div>*@ </div>*@
</Authorized>
</AuthorizeView>
<!-- Modal Company --> <!-- Modal Company -->
+1 -1
View File
@@ -9,7 +9,7 @@ using WebDoorCreator.UI.Data;
namespace WebDoorCreator.UI.Pages namespace WebDoorCreator.UI.Pages
{ {
[Authorize(Roles = "SuperAdmin, DcaAdmin")] [Authorize(Roles = "SuperAdmin")]
public partial class SuperAdmin public partial class SuperAdmin
{ {
#region Protected Fields #region Protected Fields
+1 -1
View File
@@ -1,6 +1,6 @@
@page "/TemplateMan" @page "/TemplateMan"
<AuthorizeView Roles="SuperAdmin, DcaAdmin, CompAdmin" Context="MenuHide"> <AuthorizeView Roles="SuperAdmin" Context="MenuHide">
<Authorized> <Authorized>
<CascadingValue Value="true"> <CascadingValue Value="true">
<OrdersDoorsDoorDef></OrdersDoorsDoorDef> <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> <button class="input-group-text" @onclick="resetSearch"><i class="fa-solid fa-xmark"></i></button>
</div> </div>
<div class="input-group"> <div class="input-group">
<AuthorizeView Roles="SuperAdmin, DcaAdmin, CompAdmin"> <AuthorizeView Roles="SuperAdmin, Admin, CompAdmin">
<Authorized> <Authorized>
<span class="input-group-text"><i class="fas fa-user-tag"></i></span> <span class="input-group-text"><i class="fas fa-user-tag"></i></span>
<select class="form-select" @bind="@FiltUserRole"> <select class="form-select" @bind="@FiltUserRole">
@@ -136,7 +136,7 @@ else
</AuthorizeView> </AuthorizeView>
</div> </div>
<div class="input-group"> <div class="input-group">
<AuthorizeView Roles="SuperAdmin, DcaAdmin, CompAdmin"> <AuthorizeView Roles="SuperAdmin, Admin, CompAdmin">
<Authorized> <Authorized>
<span class="input-group-text"><i class="fa-solid fa-building"></i></span> <span class="input-group-text"><i class="fa-solid fa-building"></i></span>
@if (@context.User.IsInRole("SuperAdmin") || @context.User.IsInRole("DcaAdmin")) @if (@context.User.IsInRole("SuperAdmin") || @context.User.IsInRole("DcaAdmin"))
+1 -1
View File
@@ -12,7 +12,7 @@ using NLog;
namespace WebDoorCreator.UI.Pages namespace WebDoorCreator.UI.Pages
{ {
[Authorize(Roles = "SuperAdmin, DcaAdmin, CompAdmin")] [Authorize(Roles = "SuperAdmin, Admin, CompAdmin")]
public partial class UserAdmin : ComponentBase, IDisposable public partial class UserAdmin : ComponentBase, IDisposable
{ {
#region Public Fields #region Public Fields
+62 -29
View File
@@ -11,14 +11,16 @@
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"] - WebDoorCreator.UI</title> <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/bootstrap-icons/font/bootstrap-icons.min.css" />
<link rel="stylesheet" href="~/lib/font-awesome/css/all.min.css" /> <link rel="stylesheet" href="~/lib/font-awesome/css/all.min.css" />
<link rel="shortcut icon" href="images/favicon.ico" /> @*<link rel="stylesheet" href="~/css/site.css" />*@
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="~/css/site.min.css" /> <link rel="stylesheet" href="~/css/site.min.css" />
<link rel="stylesheet" href="~/WebDoorCreator.UI.styles.css" /> <link rel="stylesheet" href="~/WebDoorCreator.UI.styles.css" />
<component type="typeof(HeadOutlet)" render-mode="ServerPrerendered" /> <component type="typeof(HeadOutlet)" render-mode="ServerPrerendered" />
<environment include="Development"> <environment include="Development">
<link rel="stylesheet" href="~/Identity/lib/bootstrap/dist/css/bootstrap.css" /> <link rel="stylesheet" href="~/Identity/lib/bootstrap/dist/css/bootstrap.css" />
<link rel="stylesheet" href="~/Identity/css/site.css" /> <link rel="stylesheet" href="~/Identity/css/site.css" />
@@ -32,6 +34,25 @@
</environment> </environment>
</head> </head>
<body> <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"> <div id="blazor-error-ui">
<environment include="Staging,Production"> <environment include="Staging,Production">
An error has occurred. This application may no longer respond until reloaded. An error has occurred. This application may no longer respond until reloaded.
@@ -46,38 +67,50 @@
@RenderBody() @RenderBody()
</div> </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="~/Identity/lib/jquery/dist/jquery.min.js"></script>
<script src="~/lib/bootstrap/js/bootstrap.bundle.js"></script> <script src="~/lib/bootstrap/js/bootstrap.bundle.js"></script>
<script src="~/Identity/js/site.js" asp-append-version="true"></script> <script src="~/Identity/js/site.js" asp-append-version="true"></script>
<script src="~/lib/SiteHelper.js" asp-append-version="true"></script> <script src="~/lib/SiteHelper.js" asp-append-version="true"></script>
<script src="_framework/blazor.server.js" autostart="false"></script> <script src="_framework/blazor.server.js"></script>
@*Gestione autoriconnessione: https://github.com/dotnet/aspnetcore/issues/38305 (vedere anche https://docs.microsoft.com/it-it/aspnet/core/blazor/fundamentals/signalr?view=aspnetcore-6.0#modify-the-reconnection-handler-blazor-server)*@
<script>
Blazor.start({
reconnectionOptions: {
maxRetries: 600,
retryIntervalMilliseconds: 1000
},
reconnectionHandler: {
onConnectionDown: (options, error) => console.error(error),
onConnectionUp: () => console.log("Client reconnected!")
}
}).then(() => {
Object.defineProperty(Blazor.defaultReconnectionHandler, '_reconnectionDisplay', {
get() {
return this.__reconnectionDisplay;
},
set(value) {
this.__reconnectionDisplay = {
show: () => value.show(),
update: (d) => value.update(d),
rejected: (d) => document.location.reload()
}
}
});
});
</script>
@await RenderSectionAsync("Scripts", required: false) @await RenderSectionAsync("Scripts", required: false)
</body> </body>
+7 -102
View File
@@ -1,14 +1,13 @@
using Blazored.LocalStorage; using Blazored.LocalStorage;
using Blazored.SessionStorage; using Blazored.SessionStorage;
using HealthChecks.UI.Client; using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Authorization; using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Diagnostics.HealthChecks; using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.UI;
using Microsoft.AspNetCore.Identity.UI.Services; using Microsoft.AspNetCore.Identity.UI.Services;
using Microsoft.AspNetCore.Localization; using Microsoft.AspNetCore.Localization;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using Microsoft.Extensions.FileProviders;
using StackExchange.Redis; using StackExchange.Redis;
using System.Globalization; using System.Globalization;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
@@ -17,80 +16,19 @@ using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Areas.Identity; using WebDoorCreator.UI.Areas.Identity;
using WebDoorCreator.UI.Data; using WebDoorCreator.UI.Data;
var builder = WebApplication.CreateBuilder(args); var builder = WebApplication.CreateBuilder(args);
// configuration setup // configuration setup
Microsoft.Extensions.Configuration.ConfigurationManager configuration = builder.Configuration; ConfigurationManager configuration = builder.Configuration;
// AspNetCore Identity setup
var connectionString = builder.Configuration.GetConnectionString("Identity.DB");
// REDIS setup // REDIS setup
string connStringRedis = configuration.GetConnectionString("Redis"); 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(":")); string redisSrvAddr = connStringRedis.Substring(0, connStringRedis.IndexOf(":"));
// avvio oggetto shared x redis... // avvio oggetto shared x redis...
var redisMultiplexer = ConnectionMultiplexer.Connect(connStringRedis); 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 // abilitazione x email management con MailKit
builder.Services.AddTransient<IEmailSender, MailKitEmailSender>(); builder.Services.AddTransient<IEmailSender, MailKitEmailSender>();
builder.Services.Configure<MailKitEmailSenderOptions>(options => builder.Services.Configure<MailKitEmailSenderOptions>(options =>
@@ -164,22 +102,6 @@ app.UseHttpsRedirection();
app.UseStaticFiles(); 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.UseRouting();
app.UseAuthentication(); app.UseAuthentication();
@@ -187,23 +109,6 @@ app.UseAuthorization();
app.MapControllers(); app.MapControllers();
app.MapBlazorHub(); 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.MapFallbackToPage("/_Host");
app.Run(); app.Run();
@@ -1,27 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<WebPublishMethod>MSDeploy</WebPublishMethod>
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish>https://wdc.egalware.com/UI/</SiteUrlToLaunchAfterPublish>
<ExcludeApp_Data>false</ExcludeApp_Data>
<ProjectGuid>c2109e71-4eae-4167-9052-175123ccc2bc</ProjectGuid>
<SelfContained>false</SelfContained>
<MSDeployServiceURL>https://wdc-w-iis-01.ovh:8172/MsDeploy.axd</MSDeployServiceURL>
<DeployIisAppPath>wdc.egalware.com/UI</DeployIisAppPath>
<RemoteSitePhysicalPath />
<SkipExtraFilesOnServer>false</SkipExtraFilesOnServer>
<MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
<EnableMSDeployBackup>true</EnableMSDeployBackup>
<EnableMsDeployAppOffline>true</EnableMsDeployAppOffline>
<UserName>steamware</UserName>
<_SavePWD>true</_SavePWD>
<_TargetId>IISWebDeploy</_TargetId>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
</Project>
@@ -1,12 +0,0 @@
<?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>
@@ -1,27 +0,0 @@
<?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>
@@ -1,12 +0,0 @@
<?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>
+109 -123
View File
@@ -3,139 +3,125 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<Version>0.9.2406.2015</Version> <Version>0.9.2401.0415</Version>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>aspnet-WebDoorCreator.UI-dfe95fed-1398-4144-bd43-8b3a765d6608</UserSecretsId> <UserSecretsId>aspnet-WebDoorCreator.UI-dfe95fed-1398-4144-bd43-8b3a765d6608</UserSecretsId>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Content Remove="compilerconfig.json" /> <Content Remove="compilerconfig.json" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS-OVH-IIS01.pubxml" /> <_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS-PROD.pubxml" />
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS-OVH-IIS02.pubxml" /> <_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS01.pubxml" />
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS-PROD.pubxml" /> <_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS02.pubxml" />
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS01.pubxml" /> <_WebToolingArtifacts Remove="Properties\PublishProfiles\IISProfile.pubxml" />
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS02.pubxml" /> </ItemGroup>
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IISProfile.pubxml" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="temp\Logo00.svg"> <Content Include="temp\Logo00.svg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </Content>
<Content Include="temp\Logo01.svg"> <Content Include="temp\Logo01.svg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </Content>
<Content Include="temp\Logo02.svg"> <Content Include="temp\Logo02.svg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </Content>
<Content Include="temp\Logo03.svg"> <Content Include="temp\Logo03.svg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </Content>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="AspNetCore.HealthChecks.Redis" Version="6.0.4" /> <PackageReference Include="Blazored.LocalStorage" Version="4.3.0" />
<PackageReference Include="AspNetCore.HealthChecks.SqlServer" Version="6.0.2" /> <PackageReference Include="Blazored.SessionStorage" Version="2.3.0" />
<PackageReference Include="AspNetCore.HealthChecks.System" Version="6.0.5" /> <PackageReference Include="DiffMatchPatch" Version="1.0.3" />
<PackageReference Include="AspNetCore.HealthChecks.UI" Version="6.0.5" /> <PackageReference Include="EgwCoreLib.Razor" Version="1.4.2308.216" />
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="6.0.5" /> <PackageReference Include="EgwCoreLib.Utils" Version="1.4.2307.3111" />
<PackageReference Include="AspNetCore.HealthChecks.UI.Core" Version="6.0.5" /> <PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="6.0.14" />
<PackageReference Include="AspNetCore.HealthChecks.UI.InMemory.Storage" Version="6.0.5" /> <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.14" />
<PackageReference Include="AspNetCore.HealthChecks.Uris" Version="6.0.3" /> <PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="6.0.14" />
<PackageReference Include="Blazored.LocalStorage" Version="4.3.0" /> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.14" />
<PackageReference Include="Blazored.SessionStorage" Version="2.3.0" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.14">
<PackageReference Include="DiffMatchPatch" Version="1.0.3" /> <PrivateAssets>all</PrivateAssets>
<PackageReference Include="EgwCoreLib.Razor" Version="1.5.2402.2411" /> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PackageReference Include="EgwCoreLib.Utils" Version="1.5.2402.2411" /> </PackageReference>
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="6.0.27" /> <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.14" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.27" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="6.0.27" /> <PackageReference Include="NLog" Version="5.2.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.27" /> <PackageReference Include="StackExchange.Redis" Version="2.6.122" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.27"> <PackageReference Include="YamlDotNet" Version="13.1.0" />
<PrivateAssets>all</PrivateAssets> </ItemGroup>
<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" />
<PackageReference Include="StackExchange.Redis" Version="2.6.122" />
<PackageReference Include="YamlDotNet" Version="13.1.0" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\WebDoorCreator.Core\WebDoorCreator.Core.csproj" /> <ProjectReference Include="..\WebDoorCreator.Core\WebDoorCreator.Core.csproj" />
<ProjectReference Include="..\WebDoorCreator.Data\WebDoorCreator.Data.csproj" /> <ProjectReference Include="..\WebDoorCreator.Data\WebDoorCreator.Data.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="Areas\Identity\Data\" /> <Folder Include="Areas\Identity\Data\" />
<Folder Include="Reports\" /> <Folder Include="Reports\" />
<Folder Include="wwwroot\DoorOpTypeImg\" /> <Folder Include="wwwroot\DoorOpTypeImg\" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="compilerconfig.json" /> <None Include="compilerconfig.json" />
<None Include="Properties\PublishProfiles\IIS-OVH-IIS02.pubxml.user" /> <None Include="Properties\PublishProfiles\IIS-PROD.pubxml.user" />
<None Include="Properties\PublishProfiles\IIS-OVH-IIS01.pubxml.user" /> <None Include="Properties\PublishProfiles\IIS01.pubxml.user" />
<None Include="Properties\PublishProfiles\IIS-PROD.pubxml.user" /> <None Include="Properties\PublishProfiles\IIS02.pubxml.user" />
<None Include="Properties\PublishProfiles\IIS01.pubxml.user" /> <None Include="Properties\PublishProfiles\IISProfile.pubxml.user" />
<None Include="Properties\PublishProfiles\IIS02.pubxml.user" /> </ItemGroup>
<None Include="Properties\PublishProfiles\IISProfile.pubxml.user" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<Content Update="wwwroot\images\icons\angles-left-solid.svg"> <Content Update="wwwroot\images\icons\angles-left-solid.svg">
<CopyToOutputDirectory>Never</CopyToOutputDirectory> <CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content> </Content>
<Content Update="wwwroot\images\icons\angles-right-solid.svg"> <Content Update="wwwroot\images\icons\angles-right-solid.svg">
<CopyToOutputDirectory>Never</CopyToOutputDirectory> <CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content> </Content>
<Content Update="wwwroot\images\icons\arrows-rotate-solid.svg"> <Content Update="wwwroot\images\icons\arrows-rotate-solid.svg">
<CopyToOutputDirectory>Never</CopyToOutputDirectory> <CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content> </Content>
<Content Update="wwwroot\images\icons\calculator-solid.svg"> <Content Update="wwwroot\images\icons\calculator-solid.svg">
<CopyToOutputDirectory>Never</CopyToOutputDirectory> <CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content> </Content>
<Content Update="wwwroot\images\icons\clipboard-regular.svg"> <Content Update="wwwroot\images\icons\clipboard-regular.svg">
<CopyToOutputDirectory>Never</CopyToOutputDirectory> <CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content> </Content>
<Content Update="wwwroot\images\icons\clone.svg"> <Content Update="wwwroot\images\icons\clone.svg">
<CopyToOutputDirectory>Never</CopyToOutputDirectory> <CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content> </Content>
<Content Update="wwwroot\images\icons\Exit.svg"> <Content Update="wwwroot\images\icons\Exit.svg">
<CopyToOutputDirectory>Never</CopyToOutputDirectory> <CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content> </Content>
<Content Update="wwwroot\images\icons\ExitWhite.svg"> <Content Update="wwwroot\images\icons\ExitWhite.svg">
<CopyToOutputDirectory>Never</CopyToOutputDirectory> <CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content> </Content>
<Content Update="wwwroot\images\icons\file-pdf-regular.svg"> <Content Update="wwwroot\images\icons\file-pdf-regular.svg">
<CopyToOutputDirectory>Never</CopyToOutputDirectory> <CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content> </Content>
<Content Update="wwwroot\images\icons\file.svg"> <Content Update="wwwroot\images\icons\file.svg">
<CopyToOutputDirectory>Never</CopyToOutputDirectory> <CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content> </Content>
<Content Update="wwwroot\images\icons\Plus.svg"> <Content Update="wwwroot\images\icons\Plus.svg">
<CopyToOutputDirectory>Never</CopyToOutputDirectory> <CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content> </Content>
<Content Update="wwwroot\images\icons\PlusWhite.svg"> <Content Update="wwwroot\images\icons\PlusWhite.svg">
<CopyToOutputDirectory>Never</CopyToOutputDirectory> <CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content> </Content>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Update="logs\.placeholder"> <None Update="logs\.placeholder">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>
<None Update="Reports\ReportOrder.rdlc"> <None Update="Reports\ReportOrder.rdlc">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>
</ItemGroup> </ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> <Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="powershell.exe -ExecutionPolicy Unrestricted -NoProfile -NonInteractive -File $(ProjectDir)\post-build.ps1 -ProjectDir $(ProjectDir) -ProjectPath $(ProjectPath)" /> <Exec Command="powershell.exe -ExecutionPolicy Unrestricted -NoProfile -NonInteractive -File $(ProjectDir)\post-build.ps1 -ProjectDir $(ProjectDir) -ProjectPath $(ProjectPath)" />
</Target> </Target>
</Project> </Project>
+8 -14
View File
@@ -6,23 +6,17 @@
"Microsoft.AspNetCore": "Warning" "Microsoft.AspNetCore": "Warning"
} }
}, },
"ConnectionStrings": {
"Redis": "wdc-u-redis-01.ovh:6379, DefaultDatabase=12, connectTimeout=5000, syncTimeout=5000, asyncTimeout=5000, abortConnect=false, ssl=false, password=BtN9Py1wtLfLRvmzWnOPJ7RytDM+CLiVsJ/16zduNTlV8IOPGNrtzJSXPUnImA5PqmUMhKaUqo9NdHIG",
"Identity.DB": "Server=WDC-W-SQL-01\\SQLEXPRESS;Database=DCA_WebDoorCreator; User ID=steamware;Password=viadante16; integrated security=False; MultipleActiveResultSets=True; App=WebDoorCreator.UI;",
"WDC.DB": "Server=WDC-W-SQL-01\\SQLEXPRESS;Database=DCA_WebDoorCreator; User ID=steamware;Password=viadante16; integrated security=False; MultipleActiveResultSets=True; App=WebDoorCreator.UI;"
},
"RuntimeOpt": { "RuntimeOpt": {
"MaxDayCalcCache": 28, "MaxDayCalcCache": 7,
"BaseUrl": "/UI" "BaseUrl": "/WDC/UI"
}, },
"ServerConf": { "ConnectionStrings": {
//"BasePathPdf": "U:\\WebDoorSync\\WdcPdf", "Redis": "nkcredis.steamware.net:6379, DefaultDatabase=12, connectTimeout=5000, syncTimeout=5000, asyncTimeout=5000, abortConnect=false, ssl=false, password=BtN9Py1wtLfLRvmzWnOPJ7RytDM+CLiVsJ/16zduNTlV8IOPGNrtzJSXPUnImA5PqmUMhKaUqo9NdHIG",
"BasePathPdf": "U:\\nextcloud.egalware\\ABH\\WdcPdf" "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;"
}, },
"CompoBaseDirs": { "CompoBaseDirs": {
//"CurrCompoDir": "U:\\WebDoorSync\\CurrentComp\\Compo", "CurrCompoDir": "J:\\WebDoorSync\\CurrentComp\\Compo",
//"NewCompoDir": "U:\\WebDoorSync\\NewComp\\Compo", "NewCompoDir": "J:\\WebDoorSync\\NewComp\\Compo"
"CurrCompoDir": "U:\\nextcloud.egalware\\CalcData\\CurrentComp\\Compo",
"NewCompoDir": "U:\\nextcloud.egalware\\CalcData\\NewComp\\Compo"
} }
} }
@@ -6,9 +6,6 @@
"Microsoft.AspNetCore": "Warning" "Microsoft.AspNetCore": "Warning"
} }
}, },
"ConnectionStrings": {
"Redis": "localhost:26379,serviceName=devel, DefaultDatabase=11, connectTimeout=5000, syncTimeout=5000, asyncTimeout=5000, abortConnect=false, ssl=false"
},
"RuntimeOpt": { "RuntimeOpt": {
"MaxDayCalcCache": 7, "MaxDayCalcCache": 7,
"BaseUrl": "/WDC/UI" "BaseUrl": "/WDC/UI"
+5 -9
View File
@@ -7,9 +7,12 @@
}, },
"AllowedHosts": "*", "AllowedHosts": "*",
"ConnectionStrings": { "ConnectionStrings": {
"Redis": "localhost:26379,serviceName=devel, DefaultDatabase=11, connectTimeout=5000, syncTimeout=5000, asyncTimeout=5000, abortConnect=false, ssl=false", "Redis": "nkcredis.steamware.net:6379, DefaultDatabase=11, connectTimeout=5000, syncTimeout=5000, asyncTimeout=5000, abortConnect=false, ssl=false, password=BtN9Py1wtLfLRvmzWnOPJ7RytDM+CLiVsJ/16zduNTlV8IOPGNrtzJSXPUnImA5PqmUMhKaUqo9NdHIG",
"Identity.DB": "Server=SQL2016DEV;Database=WebDoorCreator; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=WebDoorCreator.UI;", "Identity.DB": "Server=SQL2016DEV;Database=WebDoorCreator; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=WebDoorCreator.UI;",
"WDC.DB": "Server=SQL2016DEV;Database=WebDoorCreator; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=WebDoorCreator.UI;" "WDC.DB": "Server=SQL2016DEV;Database=WebDoorCreator; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=WebDoorCreator.UI;"
//"Redis": "nkcredis.steamware.net:6379, DefaultDatabase=12, connectTimeout=5000, syncTimeout=5000, asyncTimeout=5000, abortConnect=false, ssl=false, password=BtN9Py1wtLfLRvmzWnOPJ7RytDM+CLiVsJ/16zduNTlV8IOPGNrtzJSXPUnImA5PqmUMhKaUqo9NdHIG",
//"Identity.DB": "Server=SQL2016PROD;Database=DCA_WebDoorCreator; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=WebDoorCreator.UI;",
//"WDC.DB": "Server=SQL2016PROD;Database=DCA_WebDoorCreator; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=WebDoorCreator.UI;"
}, },
"ExternalProviders": { "ExternalProviders": {
"MailKit": { "MailKit": {
@@ -17,22 +20,17 @@
"Address": "smtp-mail.outlook.com", "Address": "smtp-mail.outlook.com",
"Port": "587", "Port": "587",
"Account": "steamwarebot@outlook.it", "Account": "steamwarebot@outlook.it",
"Password": "siamoInViaNazionale93!", "Password": "siamoInViaNazionale93",
"SenderEmail": "steamwarebot@outlook.it", "SenderEmail": "steamwarebot@outlook.it",
"SenderName": "Steamware Email BOT" "SenderName": "Steamware Email BOT"
} }
} }
}, },
"SetupOpt": { "SetupOpt": {
"CheckAdmUser": false,
"DisableIdentMigrate": true, "DisableIdentMigrate": true,
"DisableWDCMigrate": true "DisableWDCMigrate": true
}, },
"ServerConf": {
"BasePathPdf": "\\\\IIS04\\WebDoorSync\\WdcPdf"
},
"RuntimeOpt": { "RuntimeOpt": {
"WaitReloadSvg": 100,
"VetoRemoveProcessing": 5, "VetoRemoveProcessing": 5,
"MaxDayCalcCache": 7, "MaxDayCalcCache": 7,
"BaseUrl": "/WDC/UI", "BaseUrl": "/WDC/UI",
@@ -55,7 +53,5 @@
"CompoBaseDirs": { "CompoBaseDirs": {
"CurrCompoDir": "\\\\IIS04\\WebDoorSync\\CurrentComp\\Compo", "CurrCompoDir": "\\\\IIS04\\WebDoorSync\\CurrentComp\\Compo",
"NewCompoDir": "\\\\IIS04\\WebDoorSync\\NewComp\\Compo" "NewCompoDir": "\\\\IIS04\\WebDoorSync\\NewComp\\Compo"
//"CurrCompoDir": "J:\\WebDoorSync\\CurrentComp\\Compo",
//"NewCompoDir": "J:\\WebDoorSync\\NewComp\\Compo"
} }
} }
-4
View File
@@ -130,9 +130,5 @@
{ {
"outputFile": "Components/FilesMan/CompoCompare.razor.css", "outputFile": "Components/FilesMan/CompoCompare.razor.css",
"inputFile": "Components/FilesMan/CompoCompare.razor.less" "inputFile": "Components/FilesMan/CompoCompare.razor.less"
},
{
"outputFile": "Components/DoorDef/DoorDefSizingSI.razor.css",
"inputFile": "Components/DoorDef/DoorDefSizingSI.razor.less"
} }
] ]

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

@@ -4,7 +4,7 @@
<title>{WINDOW_TITLE} {PAGETITLE}</title> <title>{WINDOW_TITLE} {PAGETITLE}</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="{LOCATION_STYLESHEET}" /> <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> </head>
<frameset cols="{WIDTH_LEFT},{WIDTH_RIGHT}"> <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" /> <frame src="{SRC_LEFT}" title="{TITLE_LEFT}" name="{NAME_LEFT}" id="{NAME_LEFT}" marginwidth="0" marginheight="0" scrolling="auto" />
Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 133 KiB

After

Width:  |  Height:  |  Size: 211 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 562 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 168 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 135 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 199 KiB

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