Aggiunta log in INVE
This commit is contained in:
@@ -92,22 +92,46 @@ namespace MP.Data.Controllers
|
||||
/// <summary>
|
||||
/// Elenco operatori
|
||||
/// </summary>
|
||||
/// <param name="InveSessId"></param>
|
||||
/// <returns></returns>
|
||||
public List<AnagOperatoriModel> ElencoOperatori()
|
||||
{
|
||||
List<AnagOperatoriModel> dbResult = new List<AnagOperatoriModel>();
|
||||
using (var dbCtx = new MoonPro_InveContext(_configuration))
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbOperatori
|
||||
.Where(s=>s.MatrOpr>0)
|
||||
.AsNoTracking()
|
||||
.OrderByDescending(x => x.MatrOpr)
|
||||
.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)
|
||||
{
|
||||
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 (dbResult.Count == 1)
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
@@ -8,6 +8,9 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace MP.Data.DatabaseModels
|
||||
{
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
[Table("AnagraficaOperatori")]
|
||||
public class AnagOperatoriModel
|
||||
{
|
||||
@@ -16,7 +19,7 @@ namespace MP.Data.DatabaseModels
|
||||
public string Cognome { get; set; } = "";
|
||||
public string Nome { get; set; } = "";
|
||||
public bool isAdmin { get; set; } = false;
|
||||
public int authKey { get; set; }
|
||||
public int CodOprExt { get; set; }
|
||||
public string authKey { get; set; }
|
||||
public string CodOprExt { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@ namespace MP.Data
|
||||
public virtual DbSet<StatoProdModel> DbSetStatoProd { get; set; }
|
||||
public virtual DbSet<EventListModel> DbSetEvList { get; set; }
|
||||
public virtual DbSet<VocabolarioModel> DbSetVocabolario { get; set; }
|
||||
public virtual DbSet<AnagOperatoriModel> DbOperatori { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
|
||||
@@ -47,7 +47,6 @@ namespace MP.Data
|
||||
|
||||
public virtual DbSet<InventorySessionModel> DbInveSess { get; set; }
|
||||
public virtual DbSet<ScanDataModel> DbScanData { get; set; }
|
||||
public virtual DbSet<AnagOperatoriModel> DbOperatori { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
@using Microsoft.AspNetCore.Components.Authorization
|
||||
|
||||
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||
@inject MessageService MService
|
||||
|
||||
<div class="d-flex w-100 justify-content-between">
|
||||
<div class="px-2">
|
||||
|
||||
@@ -12,7 +12,6 @@ namespace MP.INVE.Components
|
||||
public async Task flushCache()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
await MDService.FlushRedisCache();
|
||||
await Task.Delay(1);
|
||||
// rimando a pagina corrente
|
||||
NavManager.NavigateTo(NavManager.Uri, true);
|
||||
@@ -25,18 +24,12 @@ namespace MP.INVE.Components
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected MpDataService MDService { get; set; } = null!;
|
||||
|
||||
protected bool ShowSearch { get => MService.ShowSearch; set => MService.ShowSearch = value; }
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
MService.EA_ShowSearch += MService_EA_ShowSearch;
|
||||
await forceReload();
|
||||
}
|
||||
|
||||
@@ -53,7 +46,7 @@ namespace MP.INVE.Components
|
||||
[Inject]
|
||||
private NavigationManager NavManager { get; set; } = null!;
|
||||
|
||||
private string TipoSearch { get => MService.TipoSearch; set => MService.TipoSearch = value; }
|
||||
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
|
||||
@@ -13,10 +13,10 @@ namespace MP.INVE.Data
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public MiDataService(IConfiguration configuration, ILogger<MpDataService> logger)
|
||||
public MiDataService(IConfiguration configuration, ILogger<MiDataService> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
_logger.LogInformation("Starting MpDataService INIT");
|
||||
_logger.LogInformation("Starting MiDataService INIT");
|
||||
_configuration = configuration;
|
||||
|
||||
// setup compoenti REDIS
|
||||
@@ -30,10 +30,11 @@ namespace MP.INVE.Data
|
||||
_logger.LogInformation("Redis INIT");
|
||||
|
||||
// conf DB
|
||||
string connStr = _configuration.GetConnectionString("Mp.Data");
|
||||
if (string.IsNullOrEmpty(connStr))
|
||||
string connStrData = _configuration.GetConnectionString("Mp.Data");
|
||||
string connStrInve = _configuration.GetConnectionString("Mp.Inve");
|
||||
if (string.IsNullOrEmpty(connStrData) || string.IsNullOrEmpty(connStrInve))
|
||||
{
|
||||
_logger.LogError("DbController: ConnString empty!");
|
||||
_logger.LogError($"DbController: ConnString empty! connStrData: {connStrData} | connStrInve: {connStrInve}");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -44,6 +45,10 @@ namespace MP.INVE.Data
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public static MP.Data.Controllers.MpInveController dbController { get; set; } = null!;
|
||||
@@ -55,7 +60,24 @@ namespace MP.INVE.Data
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public List<AnagOperatoriModel> ElencoOperatori()
|
||||
{
|
||||
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);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
@@ -80,38 +102,6 @@ namespace MP.INVE.Data
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private const string redisArtByDossier = redisBaseAddr + "SPEC:Cache:ArtByDossier";
|
||||
|
||||
private const string redisArtList = redisBaseAddr + "SPEC:Cache:ArtList";
|
||||
|
||||
private const string redisBaseAddr = "MP:";
|
||||
|
||||
private const string redisConfKey = redisBaseAddr + "SPEC:Cache:Config";
|
||||
|
||||
private const string redisDossByMac = redisBaseAddr + "SPEC:Cache:DossByMac";
|
||||
|
||||
private const string redisFluxByMac = redisBaseAddr + "SPEC:Cache:FluxByMac";
|
||||
|
||||
private const string redisFluxLogFilt = redisBaseAddr + "SPEC:Cache:FluxLogFilt";
|
||||
|
||||
private const string redisMacByFlux = redisBaseAddr + "SPEC:Cache:MacByFlux";
|
||||
|
||||
private const string redisMacList = redisBaseAddr + "SPEC:Cache:MacList";
|
||||
|
||||
private const string redisOdlCurrByMac = redisBaseAddr + "SPEC:Cache:OdlByMac";
|
||||
|
||||
private const string redisPOdlList = redisBaseAddr + "SPEC:Cache:POdlList";
|
||||
|
||||
private const string redisPOdlByPOdl = redisBaseAddr + "SPEC:Cache:POdlByPOdl";
|
||||
|
||||
private const string redisPOdlByOdl = redisBaseAddr + "SPEC:Cache:POdlByOdl";
|
||||
|
||||
private const string redisStatoCom = redisBaseAddr + "SPEC:Cache:StatoCom";
|
||||
|
||||
private const string redisTipoArt = redisBaseAddr + "SPEC:Cache:TipoArt";
|
||||
|
||||
private const string redisVocabolario = redisBaseAddr + "SPEC:Cache:Vocabolario";
|
||||
|
||||
private static IConfiguration _configuration = null!;
|
||||
|
||||
private static ILogger<MiDataService> _logger = null!;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>MP.INVE</RootNamespace>
|
||||
<Version>6.16.2211.1412</Version>
|
||||
<Version>6.16.2211.1417</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -12,16 +12,6 @@ namespace MP.INVE.Pages
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
//[Inject]
|
||||
//protected MpDataService MDService { get; set; } = null!;
|
||||
|
||||
//[Inject]
|
||||
//protected MessageService MessageService { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
@page "/OperatoreLogin"
|
||||
|
||||
<h3>OperatoreLogin</h3>
|
||||
|
||||
<div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Inserire auth key</label>
|
||||
<input class="form-control" type="password" @bind="@authKey" />
|
||||
</div>
|
||||
<div>
|
||||
<select class="form-select" aria-label="Default select example" @bind="@idOperatore">
|
||||
@if (elencoOperatori != null)
|
||||
{
|
||||
@foreach (var item in elencoOperatori)
|
||||
{
|
||||
<option value="@item.MatrOpr">@item.Nome</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<button class="btn btn-primary" @onclick="login">SUBMIT</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
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.INVE;
|
||||
using MP.INVE.Data;
|
||||
using MP.INVE.Shared;
|
||||
using MP.INVE.Components;
|
||||
using MP.Data.DatabaseModels;
|
||||
|
||||
namespace MP.INVE.Pages
|
||||
{
|
||||
public partial class OperatoreLogin
|
||||
{
|
||||
[Inject]
|
||||
private MiDataService MIDataservice { get; set; } = null!;
|
||||
[Inject]
|
||||
private NavigationManager NavManager { get; set; } = null!;
|
||||
|
||||
private int idOperatore { get; set; }
|
||||
private string authKey { get; set; }
|
||||
|
||||
private List<AnagOperatoriModel>? elencoOperatori;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
//await FilterChanged.InvokeAsync(actFilter);
|
||||
await Task.Delay(1);
|
||||
elencoOperatori = MIDataservice.ElencoOperatori();
|
||||
}
|
||||
|
||||
private void login()
|
||||
{
|
||||
var ok = MIDataservice.LoginOperatore(idOperatore, authKey);
|
||||
|
||||
if (ok)
|
||||
{
|
||||
NavManager.NavigateTo("/Starter", true);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -36,7 +36,7 @@ builder.Services.AddAuthorization(options =>
|
||||
builder.Services.AddRazorPages();
|
||||
builder.Services.AddServerSideBlazor();
|
||||
builder.Services.AddSingleton<IConnectionMultiplexer>(redisMultiplexer);
|
||||
builder.Services.AddSingleton<MpDataService>();
|
||||
builder.Services.AddSingleton<MiDataService>();
|
||||
builder.Services.AddScoped<MessageService>();
|
||||
|
||||
builder.Services.AddHttpClient();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MAPOINVE </i>
|
||||
<h4>Versione: 6.16.2211.1412</h4>
|
||||
<h4>Versione: 6.16.2211.1417</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2211.1412
|
||||
6.16.2211.1417
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2211.1412</version>
|
||||
<version>6.16.2211.1417</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/MP.INVE.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace MP.INVE.Services
|
||||
public class IOApiService
|
||||
{
|
||||
private readonly IHttpClientFactory _clientFactory;
|
||||
private static ILogger<MpDataService> _logger = null!;
|
||||
private static ILogger<MiDataService> _logger = null!;
|
||||
private static IConfiguration _configuration = null!;
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace MP.INVE.Services
|
||||
|
||||
private static string MpIoBaseUrl = "";
|
||||
|
||||
public IOApiService(IHttpClientFactory clientFactory, IConfiguration configuration, ILogger<MpDataService> logger)
|
||||
public IOApiService(IHttpClientFactory clientFactory, IConfiguration configuration, ILogger<MiDataService> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
_logger.LogInformation("Starting IOApiService INIT");
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
@using MP.INVE.Components
|
||||
@using MP.INVE.Data
|
||||
@*@inject MpDataService MDService*@
|
||||
|
||||
<div class="top-row ps-2 navbar navbar-dark">
|
||||
<div class="container-fluid px-0">
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
"CodApp": "MP.INVE",
|
||||
"ConnectionStrings": {
|
||||
"Mp.Inve": "Server=SQL2016DEV;Database=MoonPro_MAG; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.INVE;",
|
||||
"Mp.Data": "Server=SQL2016DEV;Database=MoonPro; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.INVE;",
|
||||
"Redis": "localhost:6379,DefaultDatabase=1,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false",
|
||||
"RedisAdmin": "localhost:6379,DefaultDatabase=1,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false,allowAdmin=true"
|
||||
},
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>MP.SPEC</RootNamespace>
|
||||
<Version>6.16.2211.917</Version>
|
||||
<Version>6.16.2211.1416</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MAPOSPEC </i>
|
||||
<h4>Versione: 6.16.2211.917</h4>
|
||||
<h4>Versione: 6.16.2211.1416</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2211.917
|
||||
6.16.2211.1416
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2211.917</version>
|
||||
<version>6.16.2211.1416</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/MP.SPEC.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
Reference in New Issue
Block a user