Merge branch 'develop' of https://gitlab.steamware.net/steamware/mapo-core into develop
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
<div class="top-row d-flex justify-content-between text-light">
|
||||
<div class="col-4">
|
||||
<span>
|
||||
<button class="btn btn-sm @ResetClass" @onclick="() => ForceReload()" title="Update"><i class="fa-solid fa-rotate"></i></button>
|
||||
Username
|
||||
</span>
|
||||
<sub>[999]</sub>
|
||||
</div>
|
||||
<div class="col-4 text-center d-flex justify-content-center">
|
||||
<a href="status-map" class="text-decoration-none text-light">
|
||||
<i class="fa-solid fa-house"></i>
|
||||
MapoTAB2
|
||||
|
||||
<img src="images/LogoSteamware.png" style="height: 1rem" />
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-4 text-end">
|
||||
<div class="row w-100 slideMen">
|
||||
<div class="p-0">
|
||||
<SlideMenu MenuItems="@CurrMenuItems"></SlideMenu>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,139 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System.Net.Http;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using Microsoft.AspNetCore.Components.Forms;
|
||||
using Microsoft.AspNetCore.Components.Routing;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Microsoft.AspNetCore.Components.Web.Virtualization;
|
||||
using Microsoft.JSInterop;
|
||||
using MP_TAB_SERV;
|
||||
using MP_TAB_SERV.Shared;
|
||||
using MP_TAB_SERV.Components;
|
||||
using MP.Data;
|
||||
using MP.Data.DatabaseModels;
|
||||
using MP.Data.DTO;
|
||||
using MP.Data.Services;
|
||||
using Newtonsoft.Json;
|
||||
using NLog;
|
||||
using EgwCoreLib.Razor;
|
||||
using MP_TAB_SERV.Pages;
|
||||
using NLog.Fluent;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace MP_TAB_SERV.Components
|
||||
{
|
||||
public partial class CmpTop
|
||||
{
|
||||
[Inject]
|
||||
protected ListSelectDataSrv MDataService { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected MessageService MsgServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected SharedMemService MStor { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavMan { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected TabDataService TDService { get; set; } = null!;
|
||||
|
||||
[Parameter]
|
||||
public List<LinkMenu> CurrMenuItems { get; set; } = new List<LinkMenu>();
|
||||
|
||||
|
||||
protected string ResetClass = "btn-primary";
|
||||
|
||||
protected async Task ReloadMemStor()
|
||||
{
|
||||
// in primis svuoto...
|
||||
MStor.ClearCache();
|
||||
// rileggo link
|
||||
var allData = await MDataService.ListLinkAll();
|
||||
MStor.SetupMenu(allData);
|
||||
// fix config...
|
||||
var allConf = await MDataService.ConfigGetAll();
|
||||
MStor.SetConfig(allConf);
|
||||
// fix MSFD...
|
||||
var allMSFD = await TDService.VMSFDGetAll();
|
||||
MStor.SetMsfd(allMSFD);
|
||||
// fix slave
|
||||
var macSlave = await TDService.Macchine2Slave();
|
||||
MStor.SetM2S(macSlave);
|
||||
|
||||
// fix elenco eventi
|
||||
var allEvents = await TDService.AnagEventiGetAll();
|
||||
MStor.SetEventi(allEvents);
|
||||
// fix elenco stati
|
||||
var allStati = await TDService.AnaStatiGetAll();
|
||||
MStor.SetStati(allStati);
|
||||
// non da farsi globalmente // fix macchine var allMach = await
|
||||
// MDataService.MacchineByMatrOper(0); MStor.DictMacchine = allMach.ToDictionary(x =>
|
||||
// x.IdxMacchina, x => $"{x.IdxMacchina} | {x.Nome}");
|
||||
|
||||
// fix vocabolario
|
||||
var allVoc = TDService.VocabolarioGetAll();
|
||||
MStor.SetVocab(allVoc);
|
||||
|
||||
// resetto il tabDServ
|
||||
await TDService.FlushCache();
|
||||
// ricarica la config...
|
||||
TDService.SetupConfig();
|
||||
}
|
||||
|
||||
protected async Task ForceReload()
|
||||
{
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
Log.Info("Start ForceReload");
|
||||
ResetClass = "btn-warning";
|
||||
await InvokeAsync(StateHasChanged);
|
||||
// reset cache varie
|
||||
await MsgServ.ClearLocalStor();
|
||||
await MsgServ.ClearSessionStor();
|
||||
await MDataService.FlushCache();
|
||||
// reload MStor
|
||||
await ReloadMemStor();
|
||||
// calcolo tempo esecuzione
|
||||
sw.Stop();
|
||||
int delta = 500 - (int)sw.ElapsedMilliseconds;
|
||||
delta = delta > 0 ? delta : 50;
|
||||
await Task.Delay(delta);
|
||||
ResetClass = "btn-primary";
|
||||
// await InvokeAsync(StateHasChanged);
|
||||
Log.Info($"ForceReload completed in {sw.ElapsedMilliseconds}ms");
|
||||
// ricarica pagina!
|
||||
NavMan.NavigateTo("/", true);
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
CurrOprTknLS = await MsgServ.getCurrOperDtoAsync();
|
||||
var decodedUrl = Uri.UnescapeDataString(CurrOprTknLS);
|
||||
CurrOprTknRedis = await TDService.OperatoreGetRedis(MsgServ.MatrOpr);
|
||||
if (CurrOprTknRedis == "")
|
||||
{
|
||||
if (!NavMan.Uri.Contains("regnewdevice"))
|
||||
{
|
||||
NavMan.NavigateTo("regnewdevice", true);
|
||||
}
|
||||
}
|
||||
else if (CurrOprTknRedis != "")
|
||||
{
|
||||
if (!NavMan.Uri.Contains("status-map"))
|
||||
{
|
||||
NavMan.NavigateTo("status-map", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
protected string CurrOprTknLS { get; set; } = null!;
|
||||
protected string CurrOprTknRedis { get; set; } = null!;
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,7 @@
|
||||
<PackageReference Include="EgwCoreLib.Razor" Version="1.4.2310.2417" />
|
||||
<PackageReference Include="EgwCoreLib.Utils" Version="1.4.2310.2417" />
|
||||
<PackageReference Include="StackExchange.Redis" Version="2.2.4" />
|
||||
<PackageReference Include="ZXingBlazor" Version="0.1.6" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
@page "/regnewdevice"
|
||||
@using ZXingBlazor.Components
|
||||
|
||||
<div class="text-center">
|
||||
<span class="fs-2 fw-bold">QR-Scan USER LOGIN</span>
|
||||
</div>
|
||||
<div class="d-flex justify-content-center w-100">
|
||||
<div class="d-flex justify-content-center input-group w-50">
|
||||
<button class="btn btn-sm btn-info fw-bold" @onclick="()=>btnMode()"><i class="fa-solid fa-qrcode"></i> Scan</button>
|
||||
<input type="text" class="form-control" />
|
||||
<button class="btn btn-success fw-bold"> GO <i class="fa-solid fa-circle-arrow-right"></i> </button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (ShowScanBarcode)
|
||||
{
|
||||
|
||||
<BarcodeReader ScanResult="(e) => ScanDoneHandler(e)"
|
||||
ShowScanBarcode="@ShowScanBarcode"
|
||||
ScanBtnTitle="Scan"
|
||||
ResetBtnTitle="Reset"
|
||||
CloseBtnTitle="Close"
|
||||
SelectDeviceBtnTitle="Select Device"></BarcodeReader>
|
||||
}
|
||||
|
||||
|
||||
|
||||
@if (oprsList.Count > 0)
|
||||
{
|
||||
<div class="mb-1">
|
||||
<span class="fs-5 fw-bold">Selezionare un operatore</span>
|
||||
<select class="form-select" @bind="matrOpr">
|
||||
@foreach (var opr in oprsList)
|
||||
{
|
||||
<option value="@opr.MatrOpr">@($"{opr.Cognome} {opr.Nome}")</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<span class="fs-5 fw-bold">User Auth Key</span>
|
||||
<input type="password" class="form-control" @bind="authKey" />
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="d-flex justify-content-between my-2">
|
||||
<div class="pe-2 col-6">
|
||||
<button class="btn btn-sm btn-primary w-100" @onclick="()=>logIn()">Log In</button>
|
||||
</div>
|
||||
<div class="ps-2 col-6">
|
||||
<button class="btn btn-sm btn-warning w-100">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (rigaOpr != null)
|
||||
{
|
||||
<div>@($"{MsgServ.UserAuthKey} {MsgServ.MatrOpr}")</div>
|
||||
}
|
||||
|
||||
@*@if (done)
|
||||
{
|
||||
<div>Logged In</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div>Not logged in</div>
|
||||
}*@
|
||||
|
||||
@@ -0,0 +1,200 @@
|
||||
using EgwCoreLib.Utils;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.WebUtilities;
|
||||
//using MongoDB.Bson.IO;
|
||||
using MP.Data.DatabaseModels;
|
||||
using MP.Data.DTO;
|
||||
using MP.Data.Services;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace MP_TAB_SERV.Pages
|
||||
{
|
||||
public partial class RegNewDevice
|
||||
{
|
||||
[Inject]
|
||||
protected TabDataService TDService { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected MessageService MsgServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavMan { get; set; } = null!;
|
||||
|
||||
protected List<AnagOperatoriModel> oprsList { get; set; } = new List<AnagOperatoriModel>();
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
|
||||
//var currOpr = await TDService.LoginOperatore(matrOpr, authKey);
|
||||
//if (currOpr.MatrOpr != 0)
|
||||
//{
|
||||
// MsgServ.RigaOper = currOpr;
|
||||
//}
|
||||
TDService.ConfigGetVal("cookieDayExpire", ref expDays);
|
||||
|
||||
expDT = DateTime.Now.AddDays(expDays);
|
||||
|
||||
//CurrOprTknLS = await MsgServ.getCurrOperDtoAsync();
|
||||
//var decodedUrl = Uri.UnescapeDataString(CurrOprTknLS);
|
||||
//CurrOprTknRedis = await TDService.OperatoreGetRedis(decodedUrl);
|
||||
|
||||
//if (CurrOprTknRedis != "")
|
||||
//{
|
||||
// NavMan.NavigateTo("status-map");
|
||||
//}
|
||||
|
||||
//if (MsgServ.RigaOper != null)
|
||||
//{
|
||||
// NavMan.NavigateTo("status-map", true);
|
||||
//}
|
||||
oprsList = await TDService.ElencoOperatori();
|
||||
}
|
||||
|
||||
protected int expDays = 1;
|
||||
protected int matrOpr { get; set; } = 0;
|
||||
protected string authKey { get; set; } = "";
|
||||
protected AnagOperatoriModel rigaOpr { get; set; } = null!;
|
||||
protected string CurrOprTknLS { get; set; } = null!;
|
||||
protected string CurrOprTknRedis { get; set; } = null!;
|
||||
|
||||
protected DateTime expDT { get; set; } = DateTime.Now;
|
||||
protected async Task logIn()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
rigaOpr = await TDService.LoginOperatore(matrOpr, authKey);
|
||||
if (rigaOpr != null)
|
||||
{
|
||||
userTknDTO newUserTkn = new userTknDTO()
|
||||
{
|
||||
currOpr = rigaOpr,
|
||||
expTime = expDT
|
||||
};
|
||||
|
||||
var jsonTkn = JsonConvert.SerializeObject(newUserTkn);
|
||||
string hash = TDService.EncriptData(jsonTkn);
|
||||
MsgServ.RigaOper = rigaOpr;
|
||||
await MsgServ.setCurrOperDtoAsync(hash);
|
||||
await TDService.OperatoreSetRedis(matrOpr, hash);
|
||||
NavMan.NavigateTo("status-map");
|
||||
}
|
||||
//StateHasChanged();
|
||||
}
|
||||
|
||||
protected async Task btnMode()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
ShowScanBarcode = !ShowScanBarcode;
|
||||
}
|
||||
|
||||
protected DateTime vetoScan = DateTime.Now;
|
||||
|
||||
protected async Task ScanDoneHandler(string value)
|
||||
{
|
||||
DateTime adesso = DateTime.Now;
|
||||
// non nullo
|
||||
if (!string.IsNullOrEmpty(value))
|
||||
{
|
||||
// non veto...
|
||||
if (adesso.Subtract(vetoScan).TotalMinutes > 0)
|
||||
{
|
||||
vetoScan = adesso.AddSeconds(4);
|
||||
//NavManager.NavigateTo($"CodeProcess/{value}");
|
||||
var uri = NavMan.ToAbsoluteUri(value);
|
||||
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("MatrOpr", out var _matrOpr))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(_matrOpr))
|
||||
{
|
||||
matrOpr = int.Parse(_matrOpr);
|
||||
}
|
||||
}
|
||||
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("UserAuthKey", out var _authKey))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(_authKey))
|
||||
{
|
||||
authKey = _authKey;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
rigaOpr = await TDService.LoginOperatore(matrOpr, authKey);
|
||||
if (rigaOpr == null)
|
||||
{
|
||||
var deHash = TDService.DeriptData(authKey);
|
||||
rigaOpr = await TDService.LoginOperatore(matrOpr, deHash);
|
||||
}
|
||||
if (rigaOpr != null)
|
||||
{
|
||||
userTknDTO newUserTkn = new userTknDTO()
|
||||
{
|
||||
currOpr = rigaOpr,
|
||||
expTime = expDT
|
||||
};
|
||||
|
||||
var jsonTkn = JsonConvert.SerializeObject(newUserTkn);
|
||||
string hash = TDService.EncriptData(jsonTkn);
|
||||
MsgServ.RigaOper = rigaOpr;
|
||||
await MsgServ.setCurrOperDtoAsync(hash);
|
||||
await TDService.OperatoreSetRedis(matrOpr, hash);
|
||||
NavMan.NavigateTo("status-map");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool ShowScanBarcode { get; set; } = false;
|
||||
|
||||
|
||||
//private async Task ProcessBarcode(string Barcode)
|
||||
//{
|
||||
// if (OrderCode != Barcode)
|
||||
// {
|
||||
// await InvokeAsync(() =>
|
||||
// {
|
||||
// OrderCode = Barcode;
|
||||
// });
|
||||
// var ordine = await DataService.OrderGetByCode(Barcode);
|
||||
// if (ordine != null)
|
||||
// {
|
||||
// if (ordine.DtExecEnd > ordine.DtOrder)
|
||||
// {
|
||||
// await InvokeAsync(() =>
|
||||
// {
|
||||
// errorDescription = "Errore: ordine già completato";
|
||||
// });
|
||||
// await Task.Run(() =>
|
||||
// {
|
||||
// Thread.Sleep(3000);
|
||||
// forceReset();
|
||||
// });
|
||||
// }
|
||||
// else if (ordine.PlantId != SelPlantId)
|
||||
// {
|
||||
// await InvokeAsync(() =>
|
||||
// {
|
||||
// errorDescription = "Errore: ordine destinato ad altro impianto";
|
||||
// });
|
||||
|
||||
// await Task.Run(() =>
|
||||
// {
|
||||
// Thread.Sleep(3000);
|
||||
// forceReset();
|
||||
// });
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // salvo...
|
||||
// MessageService.SelPlantId = $"{SelPlantId}";
|
||||
// MessageService.SelOrderCode = Barcode;
|
||||
// // rimando a pagina load....
|
||||
// NavManager.NavigateTo($"GasStationLoad");
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// errorDescription = "Errore: ordine non trovato";
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
@@ -38,6 +38,9 @@
|
||||
<a class="dismiss">🗙</a>
|
||||
</div>
|
||||
|
||||
<script src="_content/ZXingBlazor/lib/barcodereader/zxing.js"></script>
|
||||
<script src="_content/ZXingBlazor/lib/barcodereader/barcode.js"></script>
|
||||
|
||||
<script src="lib/WindowSize.js"></script>
|
||||
<script src="lib/bootstrap/js/bootstrap.bundle.js"></script>
|
||||
<script src="_framework/blazor.server.js"></script>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<div class="page">
|
||||
|
||||
<main>
|
||||
<div class="top-row d-flex justify-content-between text-light">
|
||||
@*<div class="top-row d-flex justify-content-between text-light">
|
||||
<div class="col-4">
|
||||
<span>
|
||||
<button class="btn btn-sm @ResetClass" @onclick="() => ForceReload()" title="Update"><i class="fa-solid fa-rotate"></i></button>
|
||||
@@ -30,7 +30,10 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>*@
|
||||
|
||||
<CmpTop CurrMenuItems="@CurrMenuItems"></CmpTop>
|
||||
|
||||
|
||||
<article class="content pt-1 d-flex mb-5">
|
||||
<div class="" id="mainBody">
|
||||
|
||||
@@ -55,31 +55,6 @@ namespace MP_TAB_SERV.Shared
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected async Task ForceReload()
|
||||
{
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
Log.Info("Start ForceReload");
|
||||
ResetClass = "btn-warning";
|
||||
await InvokeAsync(StateHasChanged);
|
||||
// reset cache varie
|
||||
await MServ.ClearLocalStor();
|
||||
await MServ.ClearSessionStor();
|
||||
await MDataService.FlushCache();
|
||||
// reload MStor
|
||||
await ReloadMemStor();
|
||||
// calcolo tempo esecuzione
|
||||
sw.Stop();
|
||||
int delta = 500 - (int)sw.ElapsedMilliseconds;
|
||||
delta = delta > 0 ? delta : 50;
|
||||
await Task.Delay(delta);
|
||||
ResetClass = "btn-primary";
|
||||
// await InvokeAsync(StateHasChanged);
|
||||
Log.Info($"ForceReload completed in {sw.ElapsedMilliseconds}ms");
|
||||
// ricarica pagina!
|
||||
NavMan.NavigateTo("/", true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Init struttura dati
|
||||
/// </summary>
|
||||
|
||||
@@ -13,29 +13,7 @@ main {
|
||||
padding: 0 10px 0 0;
|
||||
}
|
||||
|
||||
.top-row {
|
||||
background-color: #05173d;
|
||||
/*border-bottom: 1px solid #d6d5d5;*/
|
||||
justify-content: flex-end;
|
||||
height: 3.5rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.top-row ::deep a, .top-row ::deep .btn-link {
|
||||
white-space: nowrap;
|
||||
/*margin-left: 1.5rem;*/
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.top-row ::deep a:hover, .top-row ::deep .btn-link:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.top-row ::deep a:first-child {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
@media (min-width: 640.98px) {
|
||||
.slideMen:not(.auth) {
|
||||
@@ -48,26 +26,6 @@ main {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@media (max-width: 640.98px) {
|
||||
.top-row:not(.auth) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#mainBody {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.top-row.auth {
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.top-row ::deep a, .top-row ::deep .btn-link {
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 641px) {
|
||||
.page {
|
||||
flex-direction: row;
|
||||
@@ -82,22 +40,6 @@ main {
|
||||
}
|
||||
}
|
||||
|
||||
.top-row {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.top-row.auth ::deep a:first-child {
|
||||
flex: 1;
|
||||
text-align: right;
|
||||
width: 0;
|
||||
}
|
||||
|
||||
.top-row, article {
|
||||
padding-left: 1rem !important;
|
||||
padding-right: .5rem !important;
|
||||
}
|
||||
|
||||
#blazor-error-ui {
|
||||
background: lightyellow;
|
||||
|
||||
@@ -101,4 +101,56 @@ a,
|
||||
}
|
||||
.blazor-error-boundary::after {
|
||||
content: "An error has occurred.";
|
||||
}
|
||||
.top-row {
|
||||
background-color: #05173d;
|
||||
/*border-bottom: 1px solid #d6d5d5;*/
|
||||
justify-content: flex-end;
|
||||
height: 3.5rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.top-row ::deep a,
|
||||
.top-row ::deep .btn-link {
|
||||
white-space: nowrap;
|
||||
/*margin-left: 1.5rem;*/
|
||||
text-decoration: none;
|
||||
}
|
||||
.top-row ::deep a:hover,
|
||||
.top-row ::deep .btn-link:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
.top-row ::deep a:first-child {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
@media (max-width: 640.98px) {
|
||||
.top-row:not(.auth) {
|
||||
display: none;
|
||||
}
|
||||
#mainBody {
|
||||
width: 100%;
|
||||
}
|
||||
.top-row.auth {
|
||||
justify-content: space-between;
|
||||
}
|
||||
.top-row ::deep a,
|
||||
.top-row ::deep .btn-link {
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
.top-row {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 1;
|
||||
}
|
||||
.top-row.auth ::deep a:first-child {
|
||||
flex: 1;
|
||||
text-align: right;
|
||||
width: 0;
|
||||
}
|
||||
.top-row,
|
||||
article {
|
||||
padding-left: 1rem !important;
|
||||
padding-right: 0.5rem !important;
|
||||
}
|
||||
@@ -114,3 +114,63 @@ html, body {
|
||||
.blazor-error-boundary::after {
|
||||
content: "An error has occurred."
|
||||
}
|
||||
|
||||
.top-row {
|
||||
background-color: #05173d;
|
||||
/*border-bottom: 1px solid #d6d5d5;*/
|
||||
justify-content: flex-end;
|
||||
height: 3.5rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.top-row ::deep a, .top-row ::deep .btn-link {
|
||||
white-space: nowrap;
|
||||
/*margin-left: 1.5rem;*/
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.top-row ::deep a:hover, .top-row ::deep .btn-link:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.top-row ::deep a:first-child {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
|
||||
@media (max-width: 640.98px) {
|
||||
.top-row:not(.auth) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#mainBody {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.top-row.auth {
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.top-row ::deep a, .top-row ::deep .btn-link {
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.top-row {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.top-row.auth ::deep a:first-child {
|
||||
flex: 1;
|
||||
text-align: right;
|
||||
width: 0;
|
||||
}
|
||||
|
||||
.top-row, article {
|
||||
padding-left: 1rem !important;
|
||||
padding-right: .5rem !important;
|
||||
}
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
@import url('open-iconic/font/css/open-iconic-bootstrap.min.css');html,body{font-family:'Open Sans Condensed',sans-serif;background-color:#151321;color:#ededed;}.cardObj{border-radius:.375rem;background:linear-gradient(121deg,rgba(255,255,255,.2) -.71%,rgba(255,255,255,.05) 97.66%);box-shadow:0 4px 24px -1px rgba(0,0,0,.25);flex-shrink:0;}.cardObjNoBL{border-radius:.375rem 0 0 .375rem;background:linear-gradient(121deg,rgba(255,255,255,.2) -.71%,rgba(255,255,255,.05) 97.66%);box-shadow:0 4px 24px -1px rgba(0,0,0,.25);flex-shrink:0;}.cardFullHeight{border-radius:.375rem;background:linear-gradient(121deg,rgba(255,255,255,.2) -.71%,rgba(255,255,255,.05) 97.66%);box-shadow:0 4px 24px -1px rgba(0,0,0,.25);flex-shrink:0;height:100%;}.longStopListNotes{height:100%;}@media(max-width:640.98px){.longStopListNotes{max-height:120px;}}.borderStd{border-radius:.375rem;}.table-dark{--bs-table-color:#fff;--bs-table-bg:transparent;--bs-table-border-color:#4d5154;--bs-table-striped-bg:#2c3034;--bs-table-striped-color:#fff;--bs-table-active-bg:#373b3e;--bs-table-active-color:#fff;--bs-table-hover-bg:#323539;--bs-table-hover-color:#fff;color:var(--bs-table-color);border-color:var(--bs-table-border-color);}h1:focus{outline:0;}a,.btn-link{color:#0071c1;}.btn-primary{color:#fff;background-color:#1b6ec2;border-color:#1861ac;}.content{padding-top:1.1rem;}.valid.modified:not([type=checkbox]){outline:1px solid #26b050;}.invalid{outline:1px solid #f00;}.validation-message{color:#f00;}#blazor-error-ui{background:#ffffe0;bottom:0;box-shadow:0 -1px 2px rgba(0,0,0,.2);display:none;left:0;padding:.6rem 1.25rem .7rem 1.25rem;position:fixed;width:100%;z-index:1000;}#blazor-error-ui .dismiss{cursor:pointer;position:absolute;right:.75rem;top:.5rem;}.blazor-error-boundary{background:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem,#b32121;padding:1rem 1rem 1rem 3.7rem;color:#fff;}.blazor-error-boundary::after{content:"An error has occurred.";}
|
||||
@import url('open-iconic/font/css/open-iconic-bootstrap.min.css');html,body{font-family:'Open Sans Condensed',sans-serif;background-color:#151321;color:#ededed;}.cardObj{border-radius:.375rem;background:linear-gradient(121deg,rgba(255,255,255,.2) -.71%,rgba(255,255,255,.05) 97.66%);box-shadow:0 4px 24px -1px rgba(0,0,0,.25);flex-shrink:0;}.cardObjNoBL{border-radius:.375rem 0 0 .375rem;background:linear-gradient(121deg,rgba(255,255,255,.2) -.71%,rgba(255,255,255,.05) 97.66%);box-shadow:0 4px 24px -1px rgba(0,0,0,.25);flex-shrink:0;}.cardFullHeight{border-radius:.375rem;background:linear-gradient(121deg,rgba(255,255,255,.2) -.71%,rgba(255,255,255,.05) 97.66%);box-shadow:0 4px 24px -1px rgba(0,0,0,.25);flex-shrink:0;height:100%;}.longStopListNotes{height:100%;}@media(max-width:640.98px){.longStopListNotes{max-height:120px;}}.borderStd{border-radius:.375rem;}.table-dark{--bs-table-color:#fff;--bs-table-bg:transparent;--bs-table-border-color:#4d5154;--bs-table-striped-bg:#2c3034;--bs-table-striped-color:#fff;--bs-table-active-bg:#373b3e;--bs-table-active-color:#fff;--bs-table-hover-bg:#323539;--bs-table-hover-color:#fff;color:var(--bs-table-color);border-color:var(--bs-table-border-color);}h1:focus{outline:0;}a,.btn-link{color:#0071c1;}.btn-primary{color:#fff;background-color:#1b6ec2;border-color:#1861ac;}.content{padding-top:1.1rem;}.valid.modified:not([type=checkbox]){outline:1px solid #26b050;}.invalid{outline:1px solid #f00;}.validation-message{color:#f00;}#blazor-error-ui{background:#ffffe0;bottom:0;box-shadow:0 -1px 2px rgba(0,0,0,.2);display:none;left:0;padding:.6rem 1.25rem .7rem 1.25rem;position:fixed;width:100%;z-index:1000;}#blazor-error-ui .dismiss{cursor:pointer;position:absolute;right:.75rem;top:.5rem;}.blazor-error-boundary{background:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem,#b32121;padding:1rem 1rem 1rem 3.7rem;color:#fff;}.blazor-error-boundary::after{content:"An error has occurred.";}.top-row{background-color:#05173d;justify-content:flex-end;height:3.5rem;display:flex;align-items:center;}.top-row ::deep a,.top-row ::deep .btn-link{white-space:nowrap;text-decoration:none;}.top-row ::deep a:hover,.top-row ::deep .btn-link:hover{text-decoration:underline;}.top-row ::deep a:first-child{overflow:hidden;text-overflow:ellipsis;}@media(max-width:640.98px){.top-row:not(.auth){display:none;}#mainBody{width:100%;}.top-row.auth{justify-content:space-between;}.top-row ::deep a,.top-row ::deep .btn-link{margin-left:0;}}.top-row{position:sticky;top:0;z-index:1;}.top-row.auth ::deep a:first-child{flex:1;text-align:right;width:0;}.top-row,article{padding-left:1rem!important;padding-right:.5rem!important;}
|
||||
@@ -54,6 +54,51 @@ namespace MP.Data.Controllers
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Elenco operatori
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<AnagOperatoriModel> ElencoOperatori()
|
||||
{
|
||||
List<AnagOperatoriModel> dbResult = new List<AnagOperatoriModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbOperatori
|
||||
.Where(s => s.MatrOpr > 0)
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.MatrOpr)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// login operatori
|
||||
/// </summary>
|
||||
/// /// <param name="matrOpr"></param>
|
||||
/// /// <param name="authKey"></param>
|
||||
/// <returns></returns>
|
||||
public AnagOperatoriModel LoginOperatore(int matrOpr, string authKey)
|
||||
{
|
||||
AnagOperatoriModel dbResult = null;
|
||||
AnagOperatoriModel answ = new AnagOperatoriModel();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbOperatori
|
||||
.Where(s => (s.MatrOpr > 0) && (s.MatrOpr == matrOpr) && (s.authKey == authKey))
|
||||
.AsNoTracking()
|
||||
.FirstOrDefault();
|
||||
if (dbResult != null)
|
||||
{
|
||||
answ = dbResult;
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registrato ACK allarme
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
using MP.Data.DatabaseModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MP.Data.DTO
|
||||
{
|
||||
public class userTknDTO
|
||||
{
|
||||
public AnagOperatoriModel currOpr { get; set; } = null;
|
||||
public DateTime expTime { get; set; } = DateTime.Now;
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
using Blazored.SessionStorage;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using MP.Data.DatabaseModels;
|
||||
using MP.Data.DTO;
|
||||
using Newtonsoft.Json;
|
||||
using NLog;
|
||||
using StackExchange.Redis;
|
||||
@@ -339,6 +340,7 @@ namespace MP.Data.Services
|
||||
return answ;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Recupero singola preferenza utente
|
||||
/// </summary>
|
||||
@@ -482,6 +484,35 @@ namespace MP.Data.Services
|
||||
return fatto;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce il record OperatoreDTO da localstorage
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<string> getCurrOperDtoAsync()
|
||||
{
|
||||
string answ = "";
|
||||
var result = await localStorage.GetItemAsync<string>("currTkn");
|
||||
if (result != null)
|
||||
{
|
||||
//var data = JsonConvert.DeserializeObject<userTknDTO>(result);
|
||||
answ = result;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// scrive il record OperatoreDTO nel localstorage
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> setCurrOperDtoAsync(string currTkn)
|
||||
{
|
||||
bool answ = false;
|
||||
await localStorage.SetItemAsync("currTkn", currTkn);
|
||||
answ = true;
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#if false
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using EgwCoreLib.Utils;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using MP.Data.DatabaseModels;
|
||||
using MP.Data.DTO;
|
||||
@@ -175,6 +176,41 @@ namespace MP.Data.Services
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Elenco operatori
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<AnagOperatoriModel>> ElencoOperatori()
|
||||
{
|
||||
string source = "DB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
List<AnagOperatoriModel>? result = new List<AnagOperatoriModel>();
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:ElencoOpr";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<AnagOperatoriModel>>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = dbTabController.ElencoOperatori();
|
||||
// serializzo e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<AnagOperatoriModel>();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"ElencoOperatori | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registrato ACK allarme
|
||||
/// </summary>
|
||||
@@ -188,6 +224,129 @@ namespace MP.Data.Services
|
||||
return answ;
|
||||
}
|
||||
|
||||
public string EncriptData(string rawData)
|
||||
{
|
||||
return SteamCrypto.EncryptString(rawData, passPhrase);
|
||||
}
|
||||
public string DeriptData(string encData)
|
||||
{
|
||||
return SteamCrypto.DecryptString(encData, passPhrase);
|
||||
}
|
||||
|
||||
protected const string passPhrase = "7871D817-C71F-4DFC-BF12-00A95BE507B5";
|
||||
|
||||
protected int expDays = 1;
|
||||
|
||||
protected void setExpDays()
|
||||
{
|
||||
ConfigGetVal("cookieDayExpire", ref expDays);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Log in operatore
|
||||
/// </summary>
|
||||
/// <param name="matrOpr">matricola operatore</param>
|
||||
/// <param name="authKey">Auth Key</param>
|
||||
/// <returns></returns>
|
||||
public async Task<AnagOperatoriModel> LoginOperatore(int matrOpr, string authKey)
|
||||
{
|
||||
string source = "DB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
AnagOperatoriModel answ = null;
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:CurrOpr:{matrOpr}";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
//var encrData = SteamCrypto.DecryptString(rawData, passPhrase);
|
||||
answ = JsonConvert.DeserializeObject<AnagOperatoriModel>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = dbTabController.LoginOperatore(matrOpr, authKey);
|
||||
// serializzo e salvo...
|
||||
rawData = JsonConvert.SerializeObject(answ);
|
||||
//var encrData = SteamCrypto.EncryptString(rawData, passPhrase);
|
||||
await redisDb.StringSetAsync(currKey, rawData, ConfigCache);
|
||||
}
|
||||
if (answ == null)
|
||||
{
|
||||
answ = new AnagOperatoriModel();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"LoginOperatore | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
await Task.Delay(1);
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Scrive l'hash dell'oggetto curr opr
|
||||
/// </summary>
|
||||
/// <param name="currOpr"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<string> OperatoreGetRedis(int matrOpr)
|
||||
{
|
||||
string source = "REDIS";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
string answ = "";
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:CurrOpr:{matrOpr}";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
//var encrData = SteamCrypto.DecryptString(rawData, passPhrase);
|
||||
//answ = JsonConvert.DeserializeObject<string>(rawData);
|
||||
answ = rawData;
|
||||
}
|
||||
if (answ == null)
|
||||
{
|
||||
answ = "";
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"OperatoreGetRedis | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
await Task.Delay(1);
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// legge l'hash dell'oggetto curr opr
|
||||
/// </summary>
|
||||
/// <param name="currOpr"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<string> OperatoreSetRedis(int matrOpr, string currOpr)
|
||||
{
|
||||
string source = "REDIS";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
string answ = "";
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:CurrOpr:{matrOpr}";
|
||||
//RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
// serializzo e salvo...
|
||||
//rawData = JsonConvert.SerializeObject(currOpr);
|
||||
answ = currOpr;
|
||||
//var encrData = SteamCrypto.EncryptString(rawData, passPhrase);
|
||||
await redisDb.StringSetAsync(currKey, currOpr, ConfigCache);
|
||||
if (answ == null)
|
||||
{
|
||||
answ = "";
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"OperatoreSetRedis | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
await Task.Delay(1);
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Durata cache data dal valore in config
|
||||
/// </summary>
|
||||
protected TimeSpan ConfigCache
|
||||
{
|
||||
get => TimeSpan.FromDays(expDays);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registrato ACK allarme
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user