Pagina cartellino QR Operatori
This commit is contained in:
@@ -58,7 +58,7 @@ namespace MP.AppAuth
|
||||
|
||||
#region Public Properties
|
||||
|
||||
//public virtual DbSet<MacchinaModel> DbSetMacchine { get; set; }
|
||||
public virtual DbSet<AnagraficaOperatori> DbSetAnagOpr { get; set; }
|
||||
public virtual DbSet<UpdMan> DbSetUpdMan { get; set; }
|
||||
|
||||
public virtual DbSet<Vocabolario> DbSetVocabolario { get; set; }
|
||||
|
||||
@@ -31,6 +31,27 @@ namespace MP.AppAuth.Controllers
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public List<Models.AnagraficaOperatori> AnagOpGetAll(string searchVal)
|
||||
{
|
||||
List<Models.AnagraficaOperatori> dbResult = new List<Models.AnagraficaOperatori>();
|
||||
|
||||
if (!string.IsNullOrEmpty(searchVal))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetAnagOpr
|
||||
.Where(x => x.Cognome.Contains(searchVal) || x.Nome.Contains(searchVal))
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetAnagOpr
|
||||
.ToList();
|
||||
}
|
||||
// ritorno
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Clear database context
|
||||
|
||||
@@ -1,29 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MP.AppAuth.Models
|
||||
{
|
||||
[Table("AnagraficaOperatori")]
|
||||
public partial class AnagraficaOperatori
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public AnagraficaOperatori()
|
||||
{
|
||||
Gruppi2Operatoris = new HashSet<Gruppi2Operatori>();
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public string AuthKey { get; set; }
|
||||
public string CodOprExt { get; set; }
|
||||
public string Cognome { get; set; }
|
||||
public virtual ICollection<Gruppi2Operatori> Gruppi2Operatoris { get; set; }
|
||||
public bool? IsAdmin { get; set; }
|
||||
|
||||
[Key]
|
||||
public int MatrOpr { get; set; }
|
||||
|
||||
public string Nome { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
@@ -29,7 +29,6 @@ namespace MP.AppAuth
|
||||
public virtual DbSet<AnagKeyValue> AnagKeyValues { get; set; }
|
||||
public virtual DbSet<AnagraficaCausaliScarto> AnagraficaCausaliScartos { get; set; }
|
||||
public virtual DbSet<AnagraficaFlussi> AnagraficaFlussis { get; set; }
|
||||
public virtual DbSet<AnagraficaGruppi> AnagraficaGruppis { get; set; }
|
||||
public virtual DbSet<AnagraficaIngressi> AnagraficaIngressis { get; set; }
|
||||
public virtual DbSet<AnagraficaMicroStati> AnagraficaMicroStatis { get; set; }
|
||||
public virtual DbSet<AnagraficaOperatori> AnagraficaOperatoris { get; set; }
|
||||
@@ -37,8 +36,6 @@ namespace MP.AppAuth
|
||||
public virtual DbSet<DatiMacchine> DatiMacchines { get; set; }
|
||||
public virtual DbSet<FamigliaTipoIngressi> FamigliaTipoIngressis { get; set; }
|
||||
public virtual DbSet<FamiglieMacchine> FamiglieMacchines { get; set; }
|
||||
public virtual DbSet<Gruppi2Macchine> Gruppi2Macchines { get; set; }
|
||||
public virtual DbSet<Gruppi2Operatori> Gruppi2Operatoris { get; set; }
|
||||
public virtual DbSet<KeepAlive> KeepAlives { get; set; }
|
||||
public virtual DbSet<LinkMenuJqm> LinkMenuJqms { get; set; }
|
||||
public virtual DbSet<ListValue> ListValues { get; set; }
|
||||
@@ -184,28 +181,6 @@ namespace MP.AppAuth
|
||||
entity.Property(e => e.DescrFlux).HasMaxLength(50);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<AnagraficaGruppi>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.CodGruppo);
|
||||
|
||||
entity.ToTable("AnagraficaGruppi");
|
||||
|
||||
entity.Property(e => e.CodGruppo).HasMaxLength(50);
|
||||
|
||||
entity.Property(e => e.DescrGruppo)
|
||||
.IsRequired()
|
||||
.HasMaxLength(250)
|
||||
.HasDefaultValueSql("('')");
|
||||
|
||||
entity.Property(e => e.SelEnabled).HasComment("Indica se sia selezionabile a livello di tendina x inserimento BCode");
|
||||
|
||||
entity.Property(e => e.TipoGruppo)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasDefaultValueSql("('REPARTO')")
|
||||
.HasComment("tipo gruppo: reparto (es x gestione operatori assegnati), GRUPPO FASE (es macchien che fanno lo stesso tipo di lavoro), ...");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<AnagraficaIngressi>(entity =>
|
||||
{
|
||||
entity.HasKey(e => new { e.IdxFamigliaIngresso, e.ValoreIngresso });
|
||||
@@ -353,50 +328,6 @@ namespace MP.AppAuth
|
||||
.HasComment("Indica se la famiglia macchina prevede UserDataInput ovvero inserimento MANUALE informazioni");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Gruppi2Macchine>(entity =>
|
||||
{
|
||||
entity.HasKey(e => new { e.IdxMacchina, e.CodGruppo });
|
||||
|
||||
entity.ToTable("Gruppi2Macchine");
|
||||
|
||||
entity.Property(e => e.IdxMacchina).HasMaxLength(50);
|
||||
|
||||
entity.Property(e => e.CodGruppo).HasMaxLength(50);
|
||||
|
||||
entity.HasOne(d => d.CodGruppoNavigation)
|
||||
.WithMany(p => p.Gruppi2Macchines)
|
||||
.HasForeignKey(d => d.CodGruppo)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("FK_Gruppi2Macchine_AnagraficaGruppi");
|
||||
|
||||
entity.HasOne(d => d.IdxMacchinaNavigation)
|
||||
.WithMany(p => p.Gruppi2Macchines)
|
||||
.HasForeignKey(d => d.IdxMacchina)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("FK_Gruppi2Macchine_Macchine");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Gruppi2Operatori>(entity =>
|
||||
{
|
||||
entity.HasKey(e => new { e.MatrOpr, e.CodGruppo });
|
||||
|
||||
entity.ToTable("Gruppi2Operatori");
|
||||
|
||||
entity.Property(e => e.CodGruppo).HasMaxLength(50);
|
||||
|
||||
entity.HasOne(d => d.CodGruppoNavigation)
|
||||
.WithMany(p => p.Gruppi2Operatoris)
|
||||
.HasForeignKey(d => d.CodGruppo)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("FK_Gruppi2Operatori_AnagraficaGruppi");
|
||||
|
||||
entity.HasOne(d => d.MatrOprNavigation)
|
||||
.WithMany(p => p.Gruppi2Operatoris)
|
||||
.HasForeignKey(d => d.MatrOpr)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("FK_Gruppi2Operatori_AnagraficaOperatori");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<KeepAlive>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.IdxMacchina);
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
@using MP.AppAuth.Models
|
||||
|
||||
@inject IJSRuntime JSRuntime
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header py-2 font-weight-bold">
|
||||
<div class="row">
|
||||
<div class="col-4 col-md-4">
|
||||
<img src="img/LogoBlu.svg" class="img-fluid" width="32" /> EgalWare
|
||||
</div>
|
||||
<div class="col-8 text-right">
|
||||
<h3 class="py-0 mb-0">@CardMessage</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body px-3">
|
||||
<div class="row">
|
||||
<div class="col-6 col-md-4">
|
||||
@*<img src="@Url.Action("QR", new { valore = @ViewBag.BaseUrl + "MatrOpr=" + @item.MatrOpr + "&UserAuthKey=" + item.authKey })" alt="Image 12345" class="img-fluid" />*@
|
||||
<div id="qrCodeImg_@(CurrItem.MatrOpr)"></div>
|
||||
</div>
|
||||
<div class="col-6 col-md-8">
|
||||
<h2><b>@CurrItem.Cognome</b> @CurrItem.Nome</h2>
|
||||
matr: @CurrItem.MatrOpr
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer text-muted">
|
||||
Card login MAPO-TAB
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
|
||||
[Parameter]
|
||||
public AnagraficaOperatori CurrItem { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public string CardMessage { get; set; }
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
await JSRuntime.InvokeVoidAsync("displayQr", $"qrCodeImg_{CurrItem.MatrOpr}", rawCode);
|
||||
}
|
||||
|
||||
protected string BaseUrl = "http://IIS01/";
|
||||
|
||||
protected string rawCode
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "";
|
||||
if (CurrItem != null)
|
||||
{
|
||||
answ = $"{BaseUrl}&MatrOpr={CurrItem.MatrOpr}&UserAuthKey={CurrItem.AuthKey}";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
@page "/UserQr"
|
||||
|
||||
@using MP.Land.Data
|
||||
@using MP.Land.Components
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
<div class="alert alert-warning text-center display-4">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row">
|
||||
@foreach (var item in ListRecords)
|
||||
{
|
||||
<div class="col-6 my-2 userCard">
|
||||
<UserCard CurrItem="@item"></UserCard>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,102 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using MP.AppAuth.Models;
|
||||
using MP.Land.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MP.Land.Pages
|
||||
{
|
||||
public partial class UserQr
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private List<AnagraficaOperatori> ListRecords;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected string CardMessage = "User Card";
|
||||
protected int totalCount = 0;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
[Inject]
|
||||
private IConfiguration Configuration { get; set; }
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected AppAuthService DataService { get; set; }
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected bool authOk(UpdMan currItem)
|
||||
{
|
||||
bool answ = !string.IsNullOrEmpty(currItem.LicenseKey) && Convert.ToBoolean(currItem.IsAuth);
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected string fullUrl(string relUrl)
|
||||
{
|
||||
return $"{Configuration["BaseUrl"]}{relUrl}";
|
||||
}
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
AppMService.ShowSearch = false;
|
||||
AppMService.PageName = "User Card";
|
||||
AppMService.PageIcon = "fas fa-qrcode pr-2";
|
||||
//AppMService.EA_SearchUpdated += OnSeachUpdated;
|
||||
//AppMService.EA_FilterUpdated += OnFilterUpdated;
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await ReloadAllData();
|
||||
}
|
||||
|
||||
protected async Task ReloadAllData()
|
||||
{
|
||||
isLoading = true;
|
||||
//MacList = await DataService.MacchineGetAll();
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected async Task ReloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
// importante altrimenti NON mostra update UI
|
||||
await Task.Delay(1);
|
||||
ListRecords = await DataService.AnagOperList();
|
||||
totalCount = ListRecords.Count();
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
protected MarkupString traduci(string lemma)
|
||||
{
|
||||
MarkupString answ;
|
||||
//string rawHtml = "<li>primo</li><li>secondo</li>";
|
||||
string rawHtml = DataService.Traduci(lemma, "IT");
|
||||
answ = new MarkupString(rawHtml);
|
||||
// cerco nella cache Redis
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user