diff --git a/MP.AppAuth/AppAuthContext.cs b/MP.AppAuth/AppAuthContext.cs index 29066c68..520acb42 100644 --- a/MP.AppAuth/AppAuthContext.cs +++ b/MP.AppAuth/AppAuthContext.cs @@ -58,7 +58,7 @@ namespace MP.AppAuth #region Public Properties - //public virtual DbSet DbSetMacchine { get; set; } + public virtual DbSet DbSetAnagOpr { get; set; } public virtual DbSet DbSetUpdMan { get; set; } public virtual DbSet DbSetVocabolario { get; set; } diff --git a/MP.AppAuth/Controllers/AppAuthController.cs b/MP.AppAuth/Controllers/AppAuthController.cs index 08b1a064..3c2897a9 100644 --- a/MP.AppAuth/Controllers/AppAuthController.cs +++ b/MP.AppAuth/Controllers/AppAuthController.cs @@ -31,6 +31,27 @@ namespace MP.AppAuth.Controllers #region Public Methods + public List AnagOpGetAll(string searchVal) + { + List dbResult = new List(); + + 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 diff --git a/MP.AppAuth/Models/AnagraficaOperatori.cs b/MP.AppAuth/Models/AnagraficaOperatori.cs index 675260c1..39cd386f 100644 --- a/MP.AppAuth/Models/AnagraficaOperatori.cs +++ b/MP.AppAuth/Models/AnagraficaOperatori.cs @@ -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(); - } - - #endregion Public Constructors - #region Public Properties public string AuthKey { get; set; } public string CodOprExt { get; set; } public string Cognome { get; set; } - public virtual ICollection Gruppi2Operatoris { get; set; } public bool? IsAdmin { get; set; } + + [Key] public int MatrOpr { get; set; } + public string Nome { get; set; } #endregion Public Properties diff --git a/MP.AppAuth/MoonProContext.cs b/MP.AppAuth/MoonProContext.cs index 33453f34..a1eca39d 100644 --- a/MP.AppAuth/MoonProContext.cs +++ b/MP.AppAuth/MoonProContext.cs @@ -29,7 +29,6 @@ namespace MP.AppAuth public virtual DbSet AnagKeyValues { get; set; } public virtual DbSet AnagraficaCausaliScartos { get; set; } public virtual DbSet AnagraficaFlussis { get; set; } - public virtual DbSet AnagraficaGruppis { get; set; } public virtual DbSet AnagraficaIngressis { get; set; } public virtual DbSet AnagraficaMicroStatis { get; set; } public virtual DbSet AnagraficaOperatoris { get; set; } @@ -37,8 +36,6 @@ namespace MP.AppAuth public virtual DbSet DatiMacchines { get; set; } public virtual DbSet FamigliaTipoIngressis { get; set; } public virtual DbSet FamiglieMacchines { get; set; } - public virtual DbSet Gruppi2Macchines { get; set; } - public virtual DbSet Gruppi2Operatoris { get; set; } public virtual DbSet KeepAlives { get; set; } public virtual DbSet LinkMenuJqms { get; set; } public virtual DbSet ListValues { get; set; } @@ -184,28 +181,6 @@ namespace MP.AppAuth entity.Property(e => e.DescrFlux).HasMaxLength(50); }); - modelBuilder.Entity(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(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(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(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(entity => { entity.HasKey(e => e.IdxMacchina); diff --git a/MP.Land/Components/UserCard.razor b/MP.Land/Components/UserCard.razor new file mode 100644 index 00000000..8f3ef9f5 --- /dev/null +++ b/MP.Land/Components/UserCard.razor @@ -0,0 +1,60 @@ +@using MP.AppAuth.Models + +@inject IJSRuntime JSRuntime + +
+
+
+
+ EgalWare +
+
+

@CardMessage

+
+
+
+
+
+
+ @*Image 12345*@ +
+
+
+

@CurrItem.Cognome @CurrItem.Nome

+ matr: @CurrItem.MatrOpr +
+
+
+ +
+ +@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; + } + } +} \ No newline at end of file diff --git a/MP.Land/Pages/UserQr.razor b/MP.Land/Pages/UserQr.razor new file mode 100644 index 00000000..117e491a --- /dev/null +++ b/MP.Land/Pages/UserQr.razor @@ -0,0 +1,28 @@ +@page "/UserQr" + +@using MP.Land.Data +@using MP.Land.Components + +
+
+ @if (ListRecords == null) + { + + } + else if (totalCount == 0) + { +
Nessun record trovato
+ } + else + { +
+ @foreach (var item in ListRecords) + { +
+ +
+ } +
+ } +
+
\ No newline at end of file diff --git a/MP.Land/Pages/UserQr.razor.cs b/MP.Land/Pages/UserQr.razor.cs new file mode 100644 index 00000000..1ed8ab66 --- /dev/null +++ b/MP.Land/Pages/UserQr.razor.cs @@ -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 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 = "
  • primo
  • secondo
  • "; + string rawHtml = DataService.Traduci(lemma, "IT"); + answ = new MarkupString(rawHtml); + // cerco nella cache Redis + return answ; + } + + #endregion Protected Methods + } +} \ No newline at end of file