Permessi_Parziale
This commit is contained in:
1
.idea/.idea.StandManager/.idea/.name
generated
Normal file
1
.idea/.idea.StandManager/.idea/.name
generated
Normal file
@ -0,0 +1 @@
|
||||
StandManager
|
||||
21
StandManager.Domain/Entita/Feature.cs
Normal file
21
StandManager.Domain/Entita/Feature.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using StandManager.Domain.Entita.Base;
|
||||
|
||||
namespace StandManager.Domain.Entita;
|
||||
|
||||
public class Feature : EntitaBase
|
||||
{
|
||||
public string Nome { get; set; }
|
||||
public string Descrizione { get; set; }
|
||||
public int Ordinamento { get; set; }
|
||||
public Sezione Sezione { get; set; }
|
||||
public FeatureType Type { get; set; }
|
||||
}
|
||||
|
||||
public enum FeatureType
|
||||
{
|
||||
Any = -99,
|
||||
Insert = 0,
|
||||
Edit,
|
||||
Delete,
|
||||
AdminGlobal = 100
|
||||
}
|
||||
14
StandManager.Domain/Entita/Permission.cs
Normal file
14
StandManager.Domain/Entita/Permission.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using StandManager.Domain.Entita.Base;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace StandManager.Domain.Entita;
|
||||
|
||||
public class Permission : EntitaBase
|
||||
{
|
||||
[ForeignKey(nameof(Ruolo))]
|
||||
public Guid? RuoloId { get; set; }
|
||||
public Ruolo Ruolo { get; set; }
|
||||
[ForeignKey(nameof(Feature))]
|
||||
public Guid IdFeature { get; set; }
|
||||
public Feature Feature { get; set; }
|
||||
}
|
||||
@ -12,11 +12,11 @@ public class Referente : EntitaBase
|
||||
public string Cognome { get; set; }
|
||||
public string Email { get; set; }
|
||||
public string NumeroTelefono { get; set; }
|
||||
public Ruolo Ruolo { get; set; }
|
||||
public RuoloReferente Ruolo { get; set; }
|
||||
public string RuoloNote { get; set; }
|
||||
}
|
||||
|
||||
public enum Ruolo
|
||||
public enum RuoloReferente
|
||||
{
|
||||
Ruolo1 = 0,
|
||||
Ruolo2,
|
||||
|
||||
19
StandManager.Domain/Entita/Ruolo.cs
Normal file
19
StandManager.Domain/Entita/Ruolo.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using StandManager.Domain.Entita.Base;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace StandManager.Domain.Entita;
|
||||
|
||||
public class Ruolo : EntitaBase
|
||||
{
|
||||
public Ruolo()
|
||||
{
|
||||
Nome = string.Empty;
|
||||
}
|
||||
public string Nome { get; set; }
|
||||
|
||||
[InverseProperty(nameof(Utente.Ruolo))]
|
||||
public List<Utente> Utenti { get; set; }
|
||||
|
||||
[InverseProperty(nameof(Permission.Ruolo))]
|
||||
public virtual List<Permission> Permessi { get; set; }
|
||||
}
|
||||
12
StandManager.Domain/Entita/Sezione.cs
Normal file
12
StandManager.Domain/Entita/Sezione.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using StandManager.Domain.Entita.Base;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace StandManager.Domain.Entita;
|
||||
|
||||
public class Sezione : EntitaBase
|
||||
{
|
||||
public string Nome { get; set; }
|
||||
public int Ordinamento { get; set; }
|
||||
[InverseProperty(nameof(Feature.Sezione))]
|
||||
public List<Feature> Features { get; set; }
|
||||
}
|
||||
@ -1,4 +1,5 @@
|
||||
using StandManager.Domain.Entita.Base;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace StandManager.Domain.Entita;
|
||||
|
||||
@ -16,6 +17,10 @@ public class Utente : EntitaBase
|
||||
public string Nome { get; set; }
|
||||
public string Cognome { get; set; }
|
||||
public string? CodiceAgente { get; set; }
|
||||
[ForeignKey(nameof(Ruolo))]
|
||||
public Guid? RuoloId { get; set; }
|
||||
public Ruolo Ruolo { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{Nome} {Cognome}";
|
||||
|
||||
@ -16,11 +16,13 @@ public class StandManagerDbContext : OAServiceContext
|
||||
public DbSet<Evento> Evento { get; set; }
|
||||
public DbSet<InvitoEvento> InvitoEvento { get; set; }
|
||||
public DbSet<IscrizioneEvento> IscrizioneEvento { get; set; }
|
||||
public DbSet<Permission> Permission { get; set; }
|
||||
public DbSet<Referente> Referente { get; set; }
|
||||
public DbSet<Ruolo> Ruolo { get; set; }
|
||||
public DbSet<Sezione> Sezione { get; set; }
|
||||
public DbSet<TipologiaCliente> TipologiaCliente { get; set; }
|
||||
public DbSet<Utente> Utente { get; set; }
|
||||
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
base.OnConfiguring(optionsBuilder);
|
||||
@ -29,6 +31,5 @@ public class StandManagerDbContext : OAServiceContext
|
||||
{
|
||||
optionsBuilder.UseSqlServer("Data Source=192.168.0.233\\SQL2019;Initial Catalog=DAC_StandManager;Persist Security Info=True;User ID=dac_user;Password=KZ4ZrUPzJV;TrustServerCertificate=True");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -94,7 +94,7 @@
|
||||
<div class="row">
|
||||
<div class="col-6 mb-3">
|
||||
<RadzenFormField Text="Destinazione" Variant="Variant.Flat" Style="width: 100%;">
|
||||
<RadzenDropDown @bind-Value="@iscrizione.DestinazioneId" TValue="Guid ?" Style="width: 100%" ValueProperty="Id" TextProperty="RagioneSociale" Placeholder="Seleziona la destinazione"
|
||||
<RadzenDropDown @bind-Value="@iscrizione.DestinazioneId" TValue="Guid ?" Style="width: 100%" ValueProperty="Id" TextProperty="Info" Placeholder="Seleziona la destinazione"
|
||||
Data="@destinazioniList" Size="ButtonSize.Small" />
|
||||
</RadzenFormField>
|
||||
</div>
|
||||
@ -107,21 +107,18 @@
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 mb-3">
|
||||
<RadzenFormField Text="Note" Variant="Variant.Flat" Style="width: 100%; border: none !important; box-shadow: none !important; background-color: transparent !important;">
|
||||
<RadzenTextArea @bind-Value="@iscrizione.Note" Style="width: 100%;" Rows="3" />
|
||||
</RadzenFormField>
|
||||
<ValidationMessage For="@(() => iscrizione.Note)" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-4 mb-3">
|
||||
<div class="col-6 mb-3">
|
||||
<RadzenFormField Text="Giorno presenza" Variant="Variant.Flat" Style="width: 100%;">
|
||||
<RadzenDatePicker @bind-Value=@iscrizione.GiornoPresenza Name="GiornoPresenza" ShowCalendarWeek ShowTime="false" DateFormat="dd/MM/yyyy" />
|
||||
</RadzenFormField>
|
||||
<ValidationMessage For="@(() => iscrizione.GiornoPresenza)" />
|
||||
</div>
|
||||
<div class="col-6 mb-3">
|
||||
<RadzenFormField Text="Note" Variant="Variant.Flat" Style="width: 100%; border: none !important; box-shadow: none !important; background-color: transparent !important;">
|
||||
<RadzenTextArea @bind-Value="@iscrizione.Note" Style="width: 100%;" Rows="1" />
|
||||
</RadzenFormField>
|
||||
<ValidationMessage For="@(() => iscrizione.Note)" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
@ -140,7 +137,10 @@
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3 mb-3">
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-6 mb-3">
|
||||
<button type="submit" class="btn btn-danger w-100" disabled="@(!presaVisionePrivacy || !presaVisioneDatiPersonali)">
|
||||
Invia
|
||||
</button>
|
||||
@ -208,6 +208,8 @@
|
||||
iscrizione.ClienteId = invito.ClienteId;
|
||||
iscrizione.RagioneSociale = invito.RagioneSociale;
|
||||
|
||||
StateHasChanged();
|
||||
|
||||
var destinazioniIds = invito.IscrizioniEvento?.Select(x => x.DestinazioneId).ToList() ?? new List<Guid?>();
|
||||
destinazioniList = (await _managerService.DestinazioneService.RicercaQueryable(filtro: x => x.ClienteId == invito.ClienteId && !destinazioniIds.Any(y => y == x.Id)))
|
||||
.Select(x => (DestinazioneViewModel)x).ToList();
|
||||
|
||||
@ -41,7 +41,7 @@
|
||||
{
|
||||
@if (destinazioniList.Count() > 0)
|
||||
{
|
||||
<Home_Registrazione invito="invito" />
|
||||
<Component_Registrazione invito="invito" @ref="registrazione" />
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -104,27 +104,33 @@
|
||||
public Guid? invitationId { get; set; }
|
||||
|
||||
public string invitationCode { get; set; } = string.Empty;
|
||||
private InvitoEvento invito { get; set; }
|
||||
private InvitoEventoViewModel invito { get; set; }
|
||||
private string invalidCode = string.Empty;
|
||||
|
||||
private IEnumerable<DestinazioneViewModel> destinazioniList { get; set; }
|
||||
private Component_Registrazione registrazione { get; set; }
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
base.OnInitializedAsync();
|
||||
invito = invitationId.GetValueOrDefault() != Guid.Empty
|
||||
var dbInvito = invitationId.GetValueOrDefault() != Guid.Empty
|
||||
? await _managerService.InvitoEventoService.RicercaPer(x => x.Id == invitationId && x.Eliminato == false,
|
||||
includi: x => x.Include(y => y.Evento).Include(y => y.Cliente).ThenInclude(y => y.Destinazioni).Include(y => y.IscrizioniEvento))
|
||||
: new();
|
||||
|
||||
invito = dbInvito;
|
||||
|
||||
var destinazioniIds = invito.IscrizioniEvento?.Select(x => x.DestinazioneId).ToList() ?? new List<Guid?>();
|
||||
destinazioniList = (await _managerService.DestinazioneService.RicercaQueryable(filtro: x => x.ClienteId == invito.ClienteId && !destinazioniIds.Any(y => y == x.Id))).Select(x => (DestinazioneViewModel)x).ToList();
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
await BodyClass.SetBodyClass("body-marketing body-gradient");
|
||||
if (invito.Id != Guid.Empty && registrazione != null)
|
||||
await registrazione.SetDatiCliente();
|
||||
}
|
||||
|
||||
private void reloadWithCode()
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
@using ClosedXML.Excel
|
||||
@using Microsoft.EntityFrameworkCore
|
||||
@using StandManager.Model
|
||||
@attribute [Authorize]
|
||||
|
||||
@rendermode InteractiveServer
|
||||
@ -32,14 +33,18 @@
|
||||
using var workbook = new XLWorkbook(ms);
|
||||
var ws = workbook.Worksheet(1);
|
||||
var usedRange = ws.RangeUsed();
|
||||
var rows = new List<ClienteExcelViewModel>(usedRange.RowCount() - 1);
|
||||
|
||||
var ragioniSociali = ws.RangeUsed().RowsUsed().Skip(1).Select(r => new { Rid = r.Cell(1).GetString(), RagioneSociale = r.Cell(4).GetString() }).Distinct().ToList();
|
||||
foreach (var row in usedRange.RowsUsed().Skip(1))
|
||||
rows.Add(new ClienteExcelViewModel(row));
|
||||
|
||||
var ragioniSociali = rows.Select(r => new { Rid = r.CodCli, RagioneSociale = r.RagSocCliente }).Distinct().ToList();
|
||||
clientiTotali = ragioniSociali.Count;
|
||||
counterLabel = " di " + clientiTotali;
|
||||
|
||||
foreach (var cliente in ragioniSociali)
|
||||
{
|
||||
var righeCliente = usedRange.RowsUsed().Where(r => r.Cell(1).GetString() == cliente.Rid).ToList();
|
||||
var righeCliente = rows.Where(r => r.CodCli == cliente.Rid).ToList();
|
||||
|
||||
var clienteDb = await _managerService.ClienteService.RicercaPer(
|
||||
x => x.Rid == cliente.Rid && x.Eliminato == false,
|
||||
@ -56,17 +61,17 @@
|
||||
_dialogService.Close();
|
||||
}
|
||||
|
||||
private async Task<Cliente> mapCliente(Cliente model, List<IXLRangeRow> rows)
|
||||
private async Task<Cliente> mapCliente(Cliente model, List<ClienteExcelViewModel> rows)
|
||||
{
|
||||
var idClaim = await MembershipUtils.GetUserId(auth);
|
||||
var firstRow = rows.First();
|
||||
model.Rid = firstRow.Cell(1).GetString();
|
||||
model.RagioneSociale = firstRow.Cell(4).GetString();
|
||||
model.PartitaIva = firstRow.Cell(5).GetString();
|
||||
model.Rid = firstRow.CodCli;
|
||||
model.RagioneSociale = firstRow.RagSocCliente;
|
||||
model.PartitaIva = firstRow.PartitaIva;
|
||||
model.Destinazioni ??= new();
|
||||
foreach (var destinazioneRiga in rows)
|
||||
{
|
||||
var destinazione = model.Destinazioni.FirstOrDefault(x => x.Rid == destinazioneRiga.Cell(2).GetString()) ?? new Destinazione();
|
||||
var destinazione = model.Destinazioni.FirstOrDefault(x => x.Rid == destinazioneRiga.CodCli) ?? new Destinazione();
|
||||
destinazione = mapDestinazione(destinazione, model.Id, destinazioneRiga);
|
||||
if (destinazione.Id == Guid.Empty)
|
||||
model.Destinazioni.Add(destinazione);
|
||||
@ -74,18 +79,18 @@
|
||||
return model;
|
||||
}
|
||||
|
||||
private Destinazione mapDestinazione(Destinazione model, Guid clienteId, IXLRangeRow? row)
|
||||
private Destinazione mapDestinazione(Destinazione model, Guid clienteId, ClienteExcelViewModel row)
|
||||
{
|
||||
model.Rid = row.Cell(2).GetString();
|
||||
model.RagioneSociale = row.Cell(7).GetString();
|
||||
model.PartitaIva = row.Cell(5).GetString();
|
||||
model.Rid = row.CodDes;
|
||||
model.RagioneSociale = row.RagSocDestinazione;
|
||||
model.PartitaIva = row.PartitaIva;
|
||||
model.ClienteId = clienteId;
|
||||
model.Indirizzo = $"{row.Cell(8).GetString()} {row.Cell(9).GetString()}";
|
||||
model.Cap = row.Cell(15).GetString();
|
||||
model.Citta = row.Cell(11).GetString();
|
||||
model.Email = row.Cell(21).GetString();
|
||||
model.EmailInvito = row.Cell(21).GetString();
|
||||
model.NumeroTelefono = row.Cell(16).GetString();
|
||||
model.Indirizzo = $"{row.Indirizzo} {row.NumeroCivico}";
|
||||
model.Cap = row.Cap;
|
||||
model.Citta = row.Comune;
|
||||
model.Email = row.MailFatturazione;
|
||||
model.EmailInvito = row.MailFatturazione;
|
||||
model.NumeroTelefono = row.Telefono;
|
||||
return model;
|
||||
}
|
||||
}
|
||||
|
||||
64
StandManager/Model/ClienteExcelViewModel.cs
Normal file
64
StandManager/Model/ClienteExcelViewModel.cs
Normal file
@ -0,0 +1,64 @@
|
||||
using ClosedXML.Excel;
|
||||
|
||||
namespace StandManager.Model;
|
||||
|
||||
public class ClienteExcelViewModel
|
||||
{
|
||||
public ClienteExcelViewModel(IXLRangeRow row)
|
||||
{
|
||||
CodCli = row.Cell(1).GetString();
|
||||
CodDes = row.Cell(2).GetString();
|
||||
Tipologia = row.Cell(3).GetString();
|
||||
RagSocCliente = row.Cell(4).GetString();
|
||||
PartitaIva = row.Cell(5).GetString();
|
||||
CodiceFiscale = row.Cell(6).GetString();
|
||||
RagSocDestinazione = row.Cell(7).GetString();
|
||||
Indirizzo = row.Cell(8).GetString();
|
||||
NumeroCivico = row.Cell(9).GetString();
|
||||
Istat = row.Cell(10).GetString();
|
||||
Comune = row.Cell(11).GetString();
|
||||
Provincia = row.Cell(12).GetString();
|
||||
CodRegione = row.Cell(13).GetString();
|
||||
Regione = row.Cell(14).GetString();
|
||||
Cap = row.Cell(15).GetString();
|
||||
Telefono = row.Cell(16).GetString();
|
||||
Agente = row.Cell(17).GetString();
|
||||
DescrizioneAgente = row.Cell(18).GetString();
|
||||
CapoArea = row.Cell(19).GetString();
|
||||
DescrizioneCapoArea = row.Cell(20).GetString();
|
||||
MailFatturazione = row.Cell(21).GetString();
|
||||
DataCreazione = row.Cell(22).GetString();
|
||||
DataUltimoOrdine = row.Cell(23).GetString();
|
||||
DataUltimaFattura = row.Cell(24).GetString();
|
||||
CoordX = row.Cell(25).GetString();
|
||||
CoordY = row.Cell(26).GetString();
|
||||
}
|
||||
|
||||
public string CodCli { get; set; }
|
||||
public string CodDes { get; set; }
|
||||
public string Tipologia { get; set; }
|
||||
public string RagSocCliente { get; set; }
|
||||
public string PartitaIva { get; set; }
|
||||
public string CodiceFiscale { get; set; }
|
||||
public string RagSocDestinazione { get; set; }
|
||||
public string Indirizzo { get; set; }
|
||||
public string NumeroCivico { get; set; }
|
||||
public string Istat { get; set; }
|
||||
public string Comune { get; set; }
|
||||
public string Provincia { get; set; }
|
||||
public string CodRegione { get; set; }
|
||||
public string Regione { get; set; }
|
||||
public string Cap { get; set; }
|
||||
public string Telefono { get; set; }
|
||||
public string Agente { get; set; }
|
||||
public string DescrizioneAgente { get; set; }
|
||||
public string CapoArea { get; set; }
|
||||
public string DescrizioneCapoArea { get; set; }
|
||||
public string MailFatturazione { get; set; }
|
||||
public string DataCreazione { get; set; }
|
||||
public string DataUltimoOrdine { get; set; }
|
||||
public string DataUltimaFattura { get; set; }
|
||||
public string CoordX { get; set; }
|
||||
public string CoordY { get; set; }
|
||||
|
||||
}
|
||||
@ -21,6 +21,8 @@ public class DestinazioneViewModel
|
||||
public UtenteViewModel Agente { get; set; }
|
||||
public List<ReferenteViewModel> Referenti { get; set; }
|
||||
|
||||
public string Info => $"{RagioneSociale} - {Citta}(), {Indirizzo}";
|
||||
|
||||
public static implicit operator DestinazioneViewModel(Destinazione model)
|
||||
{
|
||||
return model == null
|
||||
|
||||
@ -24,7 +24,8 @@ namespace StandManager.Model
|
||||
CodiceFornito = model.CodiceFornito,
|
||||
EventoId = model.EventoId,
|
||||
Id = model.Id,
|
||||
IscrizioniEvento = model.IscrizioniEvento?.Select(x => (IscrizioneEventoViewModel)x).ToList()
|
||||
IscrizioniEvento = model.IscrizioniEvento?.Select(x => (IscrizioneEventoViewModel)x).ToList(),
|
||||
RagioneSociale = model.Cliente?.RagioneSociale
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@ public class ReferenteViewModel
|
||||
public string Cognome { get; set; }
|
||||
public string Email { get; set; }
|
||||
public string NumeroTelefono { get; set; }
|
||||
public Ruolo Ruolo { get; set; }
|
||||
public RuoloReferente Ruolo { get; set; }
|
||||
public string RuoloNote { get; set; }
|
||||
|
||||
public static implicit operator ReferenteViewModel(Referente model)
|
||||
|
||||
Reference in New Issue
Block a user