diff --git a/MP.Data/Controllers/MpInveController.cs b/MP.Data/Controllers/MpInveController.cs
index 462222bf..2f67f10e 100644
--- a/MP.Data/Controllers/MpInveController.cs
+++ b/MP.Data/Controllers/MpInveController.cs
@@ -81,7 +81,7 @@ namespace MP.Data.Controllers
{
dbResult = dbCtx
.DbScanData
- .Where(x => x.InveSessID==InveSessId)
+ .Where(x => x.InveSessID == InveSessId)
.AsNoTracking()
.OrderByDescending(x => x.DtScan)
.ToList();
@@ -92,45 +92,34 @@ namespace MP.Data.Controllers
///
/// Elenco operatori
///
- ///
- public List ElencoOperatori()
- {
- List dbResult = new List();
- using (var dbCtx = new MoonProContext(_configuration))
- {
- dbResult = dbCtx
- .DbOperatori
- .Where(s=>s.MatrOpr>0)
- .AsNoTracking()
- .OrderBy(x => x.MatrOpr)
- .ToList();
- }
- return dbResult;
- }
- ///
- /// login operatore con controllo matricola + authkey
- ///
/// ///
/// ///
///
- public bool LoginOperatore(int MatrOpr, string authKey)
+ public List ElencoOperatori(int matrOpr, string authKey)
{
List dbResult = new List();
- bool result = false;
using (var dbCtx = new MoonProContext(_configuration))
{
- dbResult = dbCtx
- .DbOperatori
- .Where(s => (s.MatrOpr > 0) && (s.MatrOpr == MatrOpr) && (s.authKey == authKey))
- .AsNoTracking()
- .OrderBy(x => x.MatrOpr)
- .ToList();
+ if ((matrOpr == 0) && (authKey == ""))
+ {
+ dbResult = dbCtx
+ .DbOperatori
+ .Where(s => s.MatrOpr > 0)
+ .AsNoTracking()
+ .OrderBy(x => x.MatrOpr)
+ .ToList();
+ }
+ else
+ {
+ dbResult = dbCtx
+ .DbOperatori
+ .Where(s => (s.MatrOpr > 0) && (s.MatrOpr == matrOpr) && (s.authKey==authKey))
+ .AsNoTracking()
+ .OrderBy(x => x.MatrOpr)
+ .ToList();
+ }
}
- if (dbResult.Count == 1)
- {
- result = true;
- }
- return result;
+ return dbResult;
}
#endregion Public Methods
diff --git a/MP.Data/DTO/OperatoreDTO.cs b/MP.Data/DTO/OperatoreDTO.cs
new file mode 100644
index 00000000..93f27e5a
--- /dev/null
+++ b/MP.Data/DTO/OperatoreDTO.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MP.Data.DTO
+{
+ public class OperatoreDTO
+ {
+ public int MatrOpr { get; set; } = 0;
+ public string Cognome { get; set; } = "";
+ public string Nome { get; set; } = "";
+ public string hashAuthKey { get; set; }
+ }
+}
diff --git a/MP.INVE/Data/MiDataService.cs b/MP.INVE/Data/MiDataService.cs
index e4a9776c..532dfed6 100644
--- a/MP.INVE/Data/MiDataService.cs
+++ b/MP.INVE/Data/MiDataService.cs
@@ -62,17 +62,10 @@ namespace MP.INVE.Data
#region Public Methods
- public List ElencoOperatori()
+ public List ElencoOperatori(int matrOpr, string authkey)
{
List? result = new List();
- result = dbController.ElencoOperatori();
- return result;
- }
-
- public bool LoginOperatore(int MatrOpr, string authKey)
- {
- bool result = false;
- result = dbController.LoginOperatore(MatrOpr, authKey);
+ result = dbController.ElencoOperatori(matrOpr, authkey);
return result;
}
diff --git a/MP.INVE/Program.cs b/MP.INVE/Program.cs
index ae34829e..8b050128 100644
--- a/MP.INVE/Program.cs
+++ b/MP.INVE/Program.cs
@@ -1,3 +1,4 @@
+using Blazored.SessionStorage;
using Microsoft.AspNetCore.Authentication.Negotiate;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
@@ -38,7 +39,7 @@ builder.Services.AddServerSideBlazor();
builder.Services.AddSingleton(redisMultiplexer);
builder.Services.AddSingleton();
builder.Services.AddScoped();
-
+builder.Services.AddBlazoredSessionStorage();
builder.Services.AddHttpClient();
builder.Services.AddSingleton();