cambio gestione login
This commit is contained in:
@@ -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
|
||||
/// <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 operatore con controllo matricola + authkey
|
||||
/// </summary>
|
||||
/// /// <param name="MatrOpr"></param>
|
||||
/// /// <param name="authKey"></param>
|
||||
/// <returns></returns>
|
||||
public bool LoginOperatore(int MatrOpr, string authKey)
|
||||
public List<AnagOperatoriModel> ElencoOperatori(int matrOpr, string authKey)
|
||||
{
|
||||
List<AnagOperatoriModel> dbResult = new List<AnagOperatoriModel>();
|
||||
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
|
||||
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -62,17 +62,10 @@ namespace MP.INVE.Data
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public List<AnagOperatoriModel> ElencoOperatori()
|
||||
public List<AnagOperatoriModel> ElencoOperatori(int matrOpr, string authkey)
|
||||
{
|
||||
List<AnagOperatoriModel>? result = new List<AnagOperatoriModel>();
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -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<IConnectionMultiplexer>(redisMultiplexer);
|
||||
builder.Services.AddSingleton<MiDataService>();
|
||||
builder.Services.AddScoped<MessageService>();
|
||||
|
||||
builder.Services.AddBlazoredSessionStorage();
|
||||
builder.Services.AddHttpClient();
|
||||
builder.Services.AddSingleton<IOApiService>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user