This commit is contained in:
zaccaria.majid
2023-04-19 12:18:07 +02:00
13 changed files with 293 additions and 265 deletions
@@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Mvc;
using NLog;
using WebDoorCreator.API.Data;
using WebDoorCreator.Data.Services;
namespace WebDoorCreator.API.Controllers
{
@@ -14,7 +14,7 @@ namespace WebDoorCreator.API.Controllers
{
Log.Info("Starting QueueController");
_configuration = configuration;
QDService = DataService;
QDataServ = DataService;
Log.Info("Avviato QueueController");
}
@@ -29,7 +29,7 @@ namespace WebDoorCreator.API.Controllers
[HttpGet("ActPendingLenght")]
public async Task<long> ActPendingLenght()
{
long numQueue = await QDService.NumRequestPending();
long numQueue = await QDataServ.NumRequestPending();
return numQueue;
}
@@ -40,7 +40,7 @@ namespace WebDoorCreator.API.Controllers
[HttpGet("ActProcessingLenght")]
public async Task<long> ActProcessingLenght()
{
long numQueue = await QDService.NumRequestProcessing();
long numQueue = await QDataServ.NumRequestProcessing();
return numQueue;
}
@@ -107,7 +107,7 @@ namespace WebDoorCreator.API.Controllers
[HttpGet("ShowPending")]
public async Task<Dictionary<string, string>?> ShowPending()
{
var actQueue = await QDService.RequestPending();
var actQueue = await QDataServ.RequestPending();
return actQueue;
}
@@ -118,7 +118,7 @@ namespace WebDoorCreator.API.Controllers
[HttpGet("ShowProcessing")]
public async Task<Dictionary<string, string>> ShowProcessing()
{
var actQueue = await QDService.RequestProcessing();
var actQueue = await QDataServ.RequestProcessing();
return actQueue;
}
@@ -131,7 +131,7 @@ namespace WebDoorCreator.API.Controllers
[HttpGet("TakeProcessingItems")]
public async Task<Dictionary<string, string>> TakeProcessingItems(int numItems)
{
var actQueue = await QDService.TakeProcessingItems(numItems);
var actQueue = await QDataServ.TakeProcessingItems(numItems);
return actQueue;
}
@@ -147,7 +147,7 @@ namespace WebDoorCreator.API.Controllers
#region Private Properties
private QueueDataService QDService { get; set; } = null!;
private QueueDataService QDataServ { get; set; } = null!;
#endregion Private Properties
}
+1 -1
View File
@@ -5,8 +5,8 @@ using StackExchange.Redis.Extensions.Core.Configuration;
using StackExchange.Redis.Extensions.Newtonsoft;
using System.Globalization;
using System.Text.Json.Serialization;
using WebDoorCreator.API.Data;
using WebDoorCreator.Data;
using WebDoorCreator.Data.Services;
var builder = WebApplication.CreateBuilder(args);
+1 -1
View File
@@ -7,7 +7,7 @@
},
"AllowedHosts": "*",
"ConnectionStrings": {
"Redis": "localhost:6379,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.UI;"
},
"ExternalProviders": {
+87
View File
@@ -0,0 +1,87 @@
using Newtonsoft.Json;
using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.DTO;
namespace WebDoorCreator.Data.DDF
{
public class Converter
{
#region Public Constructors
/// <summary>
/// Init del convertitore secondo impostazioni standard
/// </summary>
/// <param name="vers"></param>
/// <param name="remDoorOp"></param>
/// <param name="headRows"></param>
/// <param name="footRows"></param>
public Converter(string vers, bool remDoorOp, List<string> headRows, List<string> footRows)
{
FormatVers = vers;
RemDoorOp = remDoorOp;
HeadRows = headRows;
FootRows = footRows;
}
#endregion Public Constructors
#region Public Methods
/// <summary>
/// Fornisce il DDF corrispondente all'elenco OP inviato, seocndo la conf del convertitore
/// </summary>
/// <param name="listOp"></param>
/// <returns></returns>
public string GetSerialized(List<DoorOpModel> listOp)
{
string outDdf = "";
try
{
DoorOpsDTO CurrentDoorOp = new DoorOpsDTO();
DDFDto CurrentConf = new DDFDto();
// per prima cosa popolo gli oggetti di appoggio...
dictDoorOP = new Dictionary<string, List<Dictionary<string, string>>>();
foreach (var item in listOp)
{
var deserialized = JsonConvert.DeserializeObject<Dictionary<string, string>>(item.JsoncActVal!);
if (deserialized != null)
{
if (dictDoorOP.ContainsKey(item.ObjectId))
{
var actList = dictDoorOP[item.ObjectId];
actList.Add(deserialized.Where(x => x.Key != "Folder").ToDictionary(x => x.Key, x => x.Value));
dictDoorOP[item.ObjectId] = actList;
}
else
{
var currList = new List<Dictionary<string, string>>();
currList.Add(deserialized.Where(x => x.Key != "Folder").ToDictionary(x => x.Key, x => x.Value));
dictDoorOP.Add(item.ObjectId, currList);
}
}
}
CurrentDoorOp.doorOpsDict = dictDoorOP;
string doorOpSer = CurrentDoorOp.GetSerialized(RemDoorOp);
// ora popolo l'oggetto DTO principale
CurrentConf.version = FormatVers;
outDdf = CurrentConf.GetSerialized(HeadRows, FootRows, doorOpSer);
}
catch
{ }
return outDdf;
}
#endregion Public Methods
#region Protected Properties
protected Dictionary<string, List<Dictionary<string, string>>> dictDoorOP { get; set; } = new Dictionary<string, List<Dictionary<string, string>>>();
protected List<string> FootRows { get; set; } = new List<string>();
protected string FormatVers { get; set; } = "0";
protected List<string> HeadRows { get; set; } = new List<string>();
protected List<Dictionary<string, string>> listDictDoorOP { get; set; } = new List<Dictionary<string, string>>();
protected bool RemDoorOp { get; set; } = false;
#endregion Protected Properties
}
}
+126 -52
View File
@@ -5,21 +5,12 @@ using NLog;
using StackExchange.Redis;
using System.Diagnostics;
using WebDoorCreator.Core;
using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data;
namespace WebDoorCreator.API.Data
namespace WebDoorCreator.Data.Services
{
public class QueueDataService : IDisposable
{
#region Public Fields
/// <summary>
/// Classe Accesso metodi DB
/// </summary>
public static WebDoorCreator.Data.Controllers.WebDoorCreatorController dbController = null!;
#endregion Public Fields
#region Public Constructors
/// <summary>
@@ -42,71 +33,116 @@ namespace WebDoorCreator.API.Data
else
{
this.redisConn = ConnectionMultiplexer.Connect(redConnString);
this.redisDb = this.redisConn.GetDatabase();
}
// Conf DB
var connStrDB = _configuration.GetConnectionString("WDC.DB");
if (string.IsNullOrEmpty(connStrDB))
{
Log.Error("ConnString empty!");
}
else
{
dbController = new WebDoorCreator.Data.Controllers.WebDoorCreatorController(configuration);
Log.Info("DbController OK");
redisDb = this.redisConn.GetDatabase();
}
// setup canali pub/sub
calcReqPipe = new MessagePipe(redisConn, Constants.CALC_REQ_QUEUE);
calcDonePipe = new MessagePipe(redisConn, Constants.CALC_DONE_QUEUE);
}
#endregion Public Constructors
#region Public Properties
/// <summary>
/// Message pipe esecuzione elaborazione CAM --&gt; UI
/// </summary>
public MessagePipe calcDonePipe { get; set; } = null!;
/// <summary>
/// Message pipe richieste elaborazione UI --&gt; CAM
/// </summary>
public MessagePipe calcReqPipe { get; set; } = null!;
#endregion Public Properties
#region Public Methods
public void Dispose()
{
// Clear database controller
dbController.Dispose();
redisConn.Dispose();
}
/// <summary>
/// Doors list by orderId
///
/// </summary>
public async Task<List<DoorModel>?> DoorGetByOrderId(int orderId)
/// <param name="DoorId"></param>
/// <param name="FullDDF">Contenuto completo del DDF</param>
/// <returns>indice/versione del calcolo DDF</returns>
public async Task<int> sendCalcReq(int DoorId, string FullDDF)
{
string source = "DB";
List<DoorModel>? dbResult = new List<DoorModel>();
// cerco da cache
string currKey = $"{Constants.rKeyOrderDetail}:{orderId}";
int currVers = 1;
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string? rawData = await redisDb.StringGetAsync(currKey);
if (!string.IsNullOrEmpty(rawData))
// accumulo richieste di calcolo in HashTable redis
// per prima cosa controllo se ho GIA' in coda qualcosa come richeiste
var numPending = await NumRequestPending();
// se coda vuota --> aggiungo e stop
if (numPending == 0)
{
source = "REDIS";
var tempResult = JsonConvert.DeserializeObject<List<DoorModel>>(rawData);
if (tempResult == null)
{
dbResult = new List<DoorModel>();
}
else
{
dbResult = tempResult;
}
}
// se coda non vuota: cerco la DoorId corrente, se c'è sovrascrivo versione altrimenti
// inserisco in coda
else
{
dbResult = dbController.DoorsGetByOrderId(orderId);
rawData = JsonConvert.SerializeObject(dbResult, JSSettings);
await redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
}
if (dbResult == null)
// salvo nell'archivio REDIS delle porte il DDF corrente (door+ vers numb), potrebbe
// venire buono anche x eventuale UNDO...
// invio sul canale dei messaggi il numero di items in coda attuali x chiedere esecuzione...
#if false
// cerco da cache
RedisKey currKey = new RedisKey(Constants.CALC_REQ_PEND);
currVers = redisDb.HashLength(currKey);
if (currVers > 0)
{
dbResult = new List<DoorModel>();
var rawData = await redisDb.HashGetAllAsync(currKey);
foreach (var item in rawData)
{
dictResult.Add($"{item.Name}", $"{item.Value}");
}
}
#endif
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"DoorGetByOrderId | {source} in: {ts.TotalMilliseconds} ms");
return dbResult;
Log.Debug($"EnqueueDoorDDF | DoorId: {DoorId} enqueued in: {ts.TotalMilliseconds} ms");
// to do
// calcolo quanti emssaggi ho in coda
string message = "999";
// invio sul channel redis la richiesta, salvando il valore anche in cache
bool answ = calcReqPipe.saveAndSendMessage(Constants.LAST_CALC_REQ_KEY, message);
// simulazione ritorno dati...
await Task.Delay(200);
// invio il FINTO messaggio di ritorno...
string retMess = "";
string fileName = Path.Combine("temp", $"Logo{idxSim:00}.svg");
if (File.Exists(fileName))
{
retMess = File.ReadAllText(fileName);
idxSim++;
idxSim = idxSim % 4;
}
calcDonePipe.saveAndSendMessage(Constants.LAST_CALC_DONE_KEY, retMess);
return currVers;
}
public async Task<bool> FlushRedisCache()
{
await Task.Delay(1);
RedisValue pattern = new RedisValue($"{Constants.BASE_HASH}:Cache*");
bool answ = await ExecFlushRedisPattern(pattern);
return answ;
}
/// <summary>
@@ -202,7 +238,6 @@ namespace WebDoorCreator.API.Data
Log.Debug($"RequestProcessing | {source} in: {ts.TotalMilliseconds} ms");
return dictResult;
}
/// <summary>
/// Get Queue request pending, removing from queue and putting on processing queue
/// </summary>
@@ -236,7 +271,9 @@ namespace WebDoorCreator.API.Data
#region Protected Fields
protected const string rKeyCalcOreFase = "Check:OreFasi";
protected const string rKeyFasiAct = "Check:FasiAct";
protected const string rKeyProjAct = "Check:ProjAct";
/// <summary>
@@ -244,6 +281,8 @@ namespace WebDoorCreator.API.Data
/// </summary>
protected const int shortTTL = 60 * 5;
protected int idxSim = 0;
protected Random rnd = new Random();
#endregion Protected Fields
@@ -313,7 +352,9 @@ namespace WebDoorCreator.API.Data
#region Private Fields
private static IConfiguration _configuration = null!;
private static JsonSerializerSettings? JSSettings;
private static Logger Log = LogManager.GetCurrentClassLogger();
private readonly IEmailSender _emailSender;
@@ -372,5 +413,38 @@ namespace WebDoorCreator.API.Data
}
#endregion Private Properties
#region Private Methods
/// <summary>
/// Esegue flush memoria redis dato pattern
/// </summary>
/// <param name="pattern"></param>
/// <returns></returns>
private async Task<bool> ExecFlushRedisPattern(RedisValue pattern)
{
bool answ = false;
var listEndpoints = redisConn.GetEndPoints();
foreach (var endPoint in listEndpoints)
{
//var server = redisConnAdmin.GetServer(listEndpoints[0]);
var server = redisConn.GetServer(endPoint);
if (server != null)
{
var keyList = server.Keys(redisDb.Database, pattern);
foreach (var item in keyList)
{
await redisDb.KeyDeleteAsync(item);
}
// brutalmente rimuovo intero contenuto DB... DANGER
//await server.FlushDatabaseAsync();
answ = true;
}
}
return answ;
}
#endregion Private Methods
}
}
@@ -1,8 +1,10 @@
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using Newtonsoft.Json;
using System.Configuration;
using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.DTO;
using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Data;
namespace WebDoorCreator.UI.Components.Buttons
@@ -28,7 +30,7 @@ namespace WebDoorCreator.UI.Components.Buttons
protected WebDoorCreatorService WDCService { get; set; } = null!;
[Inject]
protected WDCCurrDataService CamDataServ { get; set; } = null!;
protected QueueDataService QDataServ { get; set; } = null!;
[Inject]
@@ -57,12 +59,11 @@ namespace WebDoorCreator.UI.Components.Buttons
}
protected DDFDto CurrentConf { get; set; } = new DDFDto();
protected DoorOpsDTO CurrentDoorOp { get; set; } = new DoorOpsDTO();
public async Task SaveYaml()
public async Task SaveYaml(string ddfContent)
{
await Task.Delay(1);
//string fileName = Path.Combine(baseDir, $"Conf.yml");
string fileName = Path.Combine("temp", $"Conf.yaml");
#if false
string vers = config.GetValue<string>("ConfDDF:VersNumber");
bool remDoorOp = config.GetValue<bool>("ConfDDF:RemoveDoorOps");
var headRows = config.GetSection("ConfDDF:Header").Get<List<string>>();
@@ -71,29 +72,43 @@ namespace WebDoorCreator.UI.Components.Buttons
string doorOpSer = CurrentDoorOp.GetSerialized(remDoorOp);
CurrentConf.version = vers;
string fullData = CurrentConf.GetSerialized(headRows, footRows, doorOpSer);
string fullData = CurrentConf.GetSerialized(headRows, footRows, doorOpSer);
#endif
if (File.Exists(fileName))
{
File.Delete(fileName);
}
// scrivo!
File.WriteAllText(fileName, fullData);
//CurrentConf.SaveYaml(fileName);
File.WriteAllText(fileName, ddfContent);
}
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);
}
/// <summary>
/// Effettua salvataggio record e generazione DDF
/// </summary>
/// <returns></returns>
protected async Task doSave()
{
var listOpAll = await WDCService.DoorOpGetByDoorId(DoorId);
List<DoorOpModel>? listOpAll = await WDCService.DoorOpGetByDoorId(DoorId);
if (listOpAll != null)
{
var listOp = listOpAll.Where(x => x.userConfirm != "" && x.DtConfirm != null).ToList();
List<DoorOpModel> listOp = listOpAll.Where(x => x.userConfirm != "" && x.DtConfirm != null).ToList();
if (listOp != null)
{
// chiamo metodo x avewre DDF serializzato
string currDdf = currDdfConv.GetSerialized(listOp);
#if false
dictDoorOP = new Dictionary<string, List<Dictionary<string, string>>>();
listDoorOp = listOp;
foreach (var item in listDoorOp)
@@ -122,13 +137,16 @@ namespace WebDoorCreator.UI.Components.Buttons
//}
}
}
CurrentDoorOp.doorOpsDict = dictDoorOP;
#endif
// si potrebbe eliminare in futuro che va su REDIS
await SaveYaml(currDdf);
// versione corrente del DDF generato
int currVers = await QDataServ.sendCalcReq(DoorId, currDdf);
}
CurrentDoorOp.doorOpsDict = dictDoorOP;
await SaveYaml();
}
await CamDataServ.sendCalcReq($"ORD{idOrd:00000}");
}
protected WebDoorCreator.Data.DDF.Converter currDdfConv { get; set; } = null!;
}
}
@@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using Newtonsoft.Json;
using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Data;
namespace WebDoorCreator.UI.Components.DoorDef
@@ -80,7 +81,7 @@ namespace WebDoorCreator.UI.Components.DoorDef
protected WDCVocabularyService WDVService { get; set; } = null!;
[Inject]
protected WDCCurrDataService CamDataServ { get; set; } = null!;
protected QueueDataService QDataServ { get; set; } = null!;
#endregion Protected Properties
@@ -169,7 +170,10 @@ namespace WebDoorCreator.UI.Components.DoorDef
DoorOpInst.JsoncActVal = serVal;
// salvo!
await WDCService.DoorOpUpdate(DoorOpInst);
await CamDataServ.sendCalcReq($"ORD{DoorOpInst.DoorId:00000}");
// invio msg dato "salvabile"
#if false
await QDataServ.sendCalcReq($"ORD{DoorOpInst.DoorId:00000}");
#endif
// rileggo
await FullReloadData(true);
}
@@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using Newtonsoft.Json;
using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Data;
namespace WebDoorCreator.UI.Components.Hardware
@@ -110,7 +111,7 @@ namespace WebDoorCreator.UI.Components.Hardware
protected WDCVocabularyService WDVService { get; set; } = null!;
[Inject]
protected WDCCurrDataService CamDataServ { get; set; } = null!;
protected QueueDataService QDataServ { get; set; } = null!;
#endregion Protected Properties
@@ -199,7 +200,11 @@ namespace WebDoorCreator.UI.Components.Hardware
DoorOpInst.JsoncActVal = serVal;
// salvo!
await WDCService.DoorOpUpdate(DoorOpInst);
await CamDataServ.sendCalcReq($"ORD{DoorOpInst.DoorId:00000}");
// invio msg dato "salvabile"
#if false
// invio richiesta calcolo
await QDataServ.sendCalcReq($"ORD{DoorOpInst.DoorId:00000}");
#endif
// rileggo
await FullReloadData(true);
}
@@ -1,167 +0,0 @@
using NLog;
using StackExchange.Redis;
using WebDoorCreator.Core;
using WebDoorCreator.Data;
namespace WebDoorCreator.UI.Data
{
public class WDCCurrDataService : IDisposable
{
#region Public Constructors
public WDCCurrDataService(IConfiguration configuration, IConnectionMultiplexer redisConn)
{
_configuration = configuration;
// setup compoenti REDIS
this.redisConn = ConnectionMultiplexer.Connect(_configuration.GetConnectionString("Redis"));
this.redisDb = this.redisConn.GetDatabase();
// setup canali pub/sub
calcReqPipe = new MessagePipe(redisConn, Constants.CALC_REQ_QUEUE);
calcDonePipe = new MessagePipe(redisConn, Constants.CALC_DONE_QUEUE);
}
#endregion Public Constructors
#region Public Properties
/// <summary>
/// Message pipe esecuzione elaborazione CAM --&gt; UI
/// </summary>
public MessagePipe calcDonePipe { get; set; } = null!;
/// <summary>
/// Message pipe richieste elaborazione UI --&gt; CAM
/// </summary>
public MessagePipe calcReqPipe { get; set; } = null!;
#endregion Public Properties
#region Public Methods
public void Dispose()
{
redisConn.Dispose();
}
public async Task<bool> FlushRedisCache()
{
await Task.Delay(1);
RedisValue pattern = new RedisValue($"{Constants.BASE_HASH}:Cache*");
bool answ = await ExecFlushRedisPattern(pattern);
return answ;
}
public async Task<bool> sendCalcReq(string message)
{
// accumulo richieste di calcolo in HashTable redis
// to do
// invio sul channel redis la richiesta, salvando il valore anche in cache
bool answ = calcReqPipe.saveAndSendMessage(Constants.LAST_CALC_REQ_KEY, message);
// simulazione ritorno dati...
await Task.Delay(200);
// invio il FINTO messaggio di ritorno...
string retMess = "";
string fileName = Path.Combine("temp", $"Logo{idxSim:00}.svg");
if (File.Exists(fileName))
{
retMess = File.ReadAllText(fileName);
idxSim++;
idxSim = idxSim % 4;
}
calcDonePipe.saveAndSendMessage(Constants.LAST_CALC_DONE_KEY, retMess);
return answ;
}
#endregion Public Methods
#region Protected Fields
protected int idxSim = 0;
#endregion Protected Fields
#region Private Fields
private static IConfiguration _configuration = null!;
private static Logger Log = LogManager.GetCurrentClassLogger();
#if false
/// <summary>
/// Conf allarmi (BankBit) IMPOSTATA con valori silenziati
/// </summary>
/// <returns></returns>
public async Task<List<BaseAlarmBankConf>> getAlarmBankBitSetup()
{
List<BaseAlarmBankConf>? redResult = new List<BaseAlarmBankConf>();
string rawData = await redisDb.StringGetAsync(Constants.ALARMS_SETT_BBIT_KEY);
//se non avessi trovato valori cerco quelli di setup...
if (string.IsNullOrEmpty(rawData))
{
rawData = await redisDb.StringGetAsync(Constants.ALARMS_CONF_KEY);
}
// ora provo a deserializzare
if (!string.IsNullOrEmpty(rawData))
{
redResult = JsonConvert.DeserializeObject<List<BaseAlarmBankConf>>(rawData);
}
// altrimenti imposto vuoto
if (redResult == null)
{
redResult = new List<BaseAlarmBankConf>();
}
return await Task.FromResult(redResult);
}
#endif
/// <summary>
/// Oggetto per connessione a REDIS
/// </summary>
private ConnectionMultiplexer redisConn = null!;
//ISubscriber sub = redis.GetSubscriber();
/// <summary>
/// Oggetto DB redis da impiegare x chiamate R/W
/// </summary>
private IDatabase redisDb = null!;
#endregion Private Fields
#region Private Methods
/// <summary>
/// Esegue flush memoria redis dato pattern
/// </summary>
/// <param name="pattern"></param>
/// <returns></returns>
private async Task<bool> ExecFlushRedisPattern(RedisValue pattern)
{
bool answ = false;
var listEndpoints = redisConn.GetEndPoints();
foreach (var endPoint in listEndpoints)
{
//var server = redisConnAdmin.GetServer(listEndpoints[0]);
var server = redisConn.GetServer(endPoint);
if (server != null)
{
var keyList = server.Keys(redisDb.Database, pattern);
foreach (var item in keyList)
{
await redisDb.KeyDeleteAsync(item);
}
// brutalmente rimuovo intero contenuto DB... DANGER
//await server.FlushDatabaseAsync();
answ = true;
}
}
return answ;
}
#endregion Private Methods
}
}
@@ -4,6 +4,7 @@ using Microsoft.JSInterop;
using NLog;
using WebDoorCreator.Data;
using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Data;
namespace WebDoorCreator.UI.Pages
@@ -15,7 +16,7 @@ namespace WebDoorCreator.UI.Pages
public void Dispose()
{
WDCUService.EA_CurrLanguage -= WDUService_EA_CurrLanguage;
CamDataServ.calcDonePipe.EA_NewMessage -= CalcDonePipe_EA_NewMessage;
QDataServ.calcDonePipe.EA_NewMessage -= CalcDonePipe_EA_NewMessage;
}
#endregion Public Methods
@@ -23,7 +24,7 @@ namespace WebDoorCreator.UI.Pages
#region Protected Properties
[Inject]
protected WDCCurrDataService CamDataServ { get; set; } = null!;
protected QueueDataService QDataServ { get; set; } = null!;
protected string DoorSvgContent { get; set; } = "";
protected int idDoor { get; set; } = 0;
@@ -71,7 +72,7 @@ namespace WebDoorCreator.UI.Pages
}
userLang = WDCUService.currLanguage ?? "EN";
WDCUService.EA_CurrLanguage += WDUService_EA_CurrLanguage;
CamDataServ.calcDonePipe.EA_NewMessage += CalcDonePipe_EA_NewMessage;
QDataServ.calcDonePipe.EA_NewMessage += CalcDonePipe_EA_NewMessage;
}
protected async Task ReloadData()
+2 -1
View File
@@ -11,6 +11,7 @@ using Microsoft.EntityFrameworkCore;
using StackExchange.Redis;
using System.Globalization;
using WebDoorCreator.Data;
using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Areas.Identity;
using WebDoorCreator.UI.Data;
@@ -52,7 +53,7 @@ builder.Services.AddServerSideBlazor();
builder.Services.AddSingleton<WebDoorCreatorService>();
builder.Services.AddScoped<WDCUserService>();
builder.Services.AddSingleton<WDCVocabularyService>();
builder.Services.AddSingleton<WDCCurrDataService>();
builder.Services.AddSingleton<QueueDataService>();
builder.Services.AddScoped<AuthenticationStateProvider, RevalidatingIdentityAuthenticationStateProvider<IdentityUser>>();
builder.Services.AddHttpContextAccessor();
builder.Services.AddSingleton<IConnectionMultiplexer>(redisMultiplexer);
+1 -1
View File
@@ -8,7 +8,7 @@
"AllowedHosts": "*",
"ConnectionStrings": {
"Identity.DB": "Server=SQL2016DEV;Database=WebDoorCreator; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=WebDoorCreator.UI;",
"Redis": "localhost:6379,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.UI;"
},
"ExternalProviders": {
+17 -12
View File
@@ -12,8 +12,8 @@ order:
project:
pO:
line:
date: 2023-04-19T10:46:38.5109185+02:00
piece: DO_1<
date: 2023-04-19T12:03:17.7578859+02:00
piece: DO_1
size:
width: 33.8125
height: 81.25
@@ -38,15 +38,20 @@ profiles:
type: BV
machining: ON
overmaterial: 0.1
1:
- Swing: RH
Width: 33333
Height: 81.25
Thickness: 1.75
2:
- Hinge Edge: SQ
Top Edge: SQ
Bottom Edge: SQ
Lock Edge: SQ
edge_pulls:
- template: Generic\EdgePull230B
position: 45
flush_pulls:
- template: Generic\Circle
position: 35
back_set: 5
depth: 1
face: secure
locks:
- template: Generic\DocMyTest5Bore
position: 45.875
back_set: 2.0
offset_WS: 0.0
side: lock_top
---