cambio gestione login

This commit is contained in:
zaccaria.majid
2022-11-16 10:18:53 +01:00
parent 5eaeebc283
commit c17001ec28
4 changed files with 41 additions and 42 deletions
+21 -32
View File
@@ -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