ProvSuIscrizione

This commit is contained in:
2025-12-22 15:38:12 +01:00
parent 8f98a1d70e
commit 50c0562c3e
15 changed files with 2577 additions and 17 deletions

View File

@ -29,7 +29,9 @@ public class IscrizioneEvento : EntitaBase
public string? Cognome{ get; set; }
public string? Email { get; set; }
public string? NumeroTelefono { get; set; }
public string? Provincia { get; set; }
[ForeignKey(nameof(Provincia))]
public Guid? ProvinciaId { get; set; }
public ProvinciaIstat Provincia { get; set; }
public string? Comune { get; set; }
public string? Cap { get; set; }
public string? RagioneSociale { get; set; }

View File

@ -18,7 +18,7 @@ public class StandManagerDbContext : OAServiceContext
public DbSet<InvitoEvento> InvitoEvento { get; set; }
public DbSet<IscrizioneEvento> IscrizioneEvento { get; set; }
public DbSet<Permission> Permission { get; set; }
public DbSet<ProvinciaIstat> Provincie { get; set; }
public DbSet<ProvinciaIstat> Province { get; set; }
public DbSet<Referente> Referente { get; set; }
public DbSet<Ruolo> Ruolo { get; set; }
public DbSet<Sezione> Sezione { get; set; }

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,59 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace StandManager.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class ModificaProvSuIscrizione : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Provincia",
table: "IscrizioneEvento");
migrationBuilder.AddColumn<Guid>(
name: "ProvinciaId",
table: "IscrizioneEvento",
type: "uniqueidentifier",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_IscrizioneEvento_ProvinciaId",
table: "IscrizioneEvento",
column: "ProvinciaId");
migrationBuilder.AddForeignKey(
name: "FK_IscrizioneEvento_Provincie_ProvinciaId",
table: "IscrizioneEvento",
column: "ProvinciaId",
principalTable: "Provincie",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_IscrizioneEvento_Provincie_ProvinciaId",
table: "IscrizioneEvento");
migrationBuilder.DropIndex(
name: "IX_IscrizioneEvento_ProvinciaId",
table: "IscrizioneEvento");
migrationBuilder.DropColumn(
name: "ProvinciaId",
table: "IscrizioneEvento");
migrationBuilder.AddColumn<string>(
name: "Provincia",
table: "IscrizioneEvento",
type: "nvarchar(max)",
nullable: true);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,130 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace StandManager.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class RinominataEntita : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_IscrizioneEvento_Provincie_ProvinciaId",
table: "IscrizioneEvento");
migrationBuilder.DropForeignKey(
name: "FK_Provincie_Utente_IdUtenteCreazione",
table: "Provincie");
migrationBuilder.DropForeignKey(
name: "FK_Provincie_Utente_IdUtenteModifica",
table: "Provincie");
migrationBuilder.DropPrimaryKey(
name: "PK_Provincie",
table: "Provincie");
migrationBuilder.RenameTable(
name: "Provincie",
newName: "Province");
migrationBuilder.RenameIndex(
name: "IX_Provincie_IdUtenteModifica",
table: "Province",
newName: "IX_Province_IdUtenteModifica");
migrationBuilder.RenameIndex(
name: "IX_Provincie_IdUtenteCreazione",
table: "Province",
newName: "IX_Province_IdUtenteCreazione");
migrationBuilder.AddPrimaryKey(
name: "PK_Province",
table: "Province",
column: "Id");
migrationBuilder.AddForeignKey(
name: "FK_IscrizioneEvento_Province_ProvinciaId",
table: "IscrizioneEvento",
column: "ProvinciaId",
principalTable: "Province",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_Province_Utente_IdUtenteCreazione",
table: "Province",
column: "IdUtenteCreazione",
principalTable: "Utente",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_Province_Utente_IdUtenteModifica",
table: "Province",
column: "IdUtenteModifica",
principalTable: "Utente",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_IscrizioneEvento_Province_ProvinciaId",
table: "IscrizioneEvento");
migrationBuilder.DropForeignKey(
name: "FK_Province_Utente_IdUtenteCreazione",
table: "Province");
migrationBuilder.DropForeignKey(
name: "FK_Province_Utente_IdUtenteModifica",
table: "Province");
migrationBuilder.DropPrimaryKey(
name: "PK_Province",
table: "Province");
migrationBuilder.RenameTable(
name: "Province",
newName: "Provincie");
migrationBuilder.RenameIndex(
name: "IX_Province_IdUtenteModifica",
table: "Provincie",
newName: "IX_Provincie_IdUtenteModifica");
migrationBuilder.RenameIndex(
name: "IX_Province_IdUtenteCreazione",
table: "Provincie",
newName: "IX_Provincie_IdUtenteCreazione");
migrationBuilder.AddPrimaryKey(
name: "PK_Provincie",
table: "Provincie",
column: "Id");
migrationBuilder.AddForeignKey(
name: "FK_IscrizioneEvento_Provincie_ProvinciaId",
table: "IscrizioneEvento",
column: "ProvinciaId",
principalTable: "Provincie",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_Provincie_Utente_IdUtenteCreazione",
table: "Provincie",
column: "IdUtenteCreazione",
principalTable: "Utente",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_Provincie_Utente_IdUtenteModifica",
table: "Provincie",
column: "IdUtenteModifica",
principalTable: "Utente",
principalColumn: "Id");
}
}
}

View File

@ -452,8 +452,8 @@ namespace StandManager.Infrastructure.Migrations
b.Property<string>("PartitaIva")
.HasColumnType("nvarchar(max)");
b.Property<string>("Provincia")
.HasColumnType("nvarchar(max)");
b.Property<Guid?>("ProvinciaId")
.HasColumnType("uniqueidentifier");
b.Property<string>("RagioneSociale")
.HasColumnType("nvarchar(max)");
@ -481,6 +481,8 @@ namespace StandManager.Infrastructure.Migrations
b.HasIndex("InvitoEventoId");
b.HasIndex("ProvinciaId");
b.HasIndex("TipologiaClienteId");
b.ToTable("IscrizioneEvento");
@ -561,7 +563,7 @@ namespace StandManager.Infrastructure.Migrations
b.HasIndex("IdUtenteModifica");
b.ToTable("Provincie");
b.ToTable("Province");
});
modelBuilder.Entity("StandManager.Domain.Entita.Referente", b =>
@ -959,6 +961,10 @@ namespace StandManager.Infrastructure.Migrations
.WithMany("IscrizioniEvento")
.HasForeignKey("InvitoEventoId");
b.HasOne("StandManager.Domain.Entita.ProvinciaIstat", "Provincia")
.WithMany()
.HasForeignKey("ProvinciaId");
b.HasOne("StandManager.Domain.Entita.TipologiaCliente", "TipologiaCliente")
.WithMany()
.HasForeignKey("TipologiaClienteId");
@ -971,6 +977,8 @@ namespace StandManager.Infrastructure.Migrations
b.Navigation("InvitoEvento");
b.Navigation("Provincia");
b.Navigation("TipologiaCliente");
b.Navigation("UtenteCreazione");

View File

@ -10,6 +10,7 @@
public IInvitoEventoService InvitoEventoService{ get; set; }
public IIscrizioneEventoService IscrizioneEventoService{ get; set; }
public IPermissionService PermissionService{ get; set; }
public IProvinciaIstatService ProvinciaIstatService{ get; set; }
public IReferenteService ReferenteService{ get; set; }
public IRuoloService RuoloService{ get; set; }
public ISezioneService SezioneService{ get; set; }

View File

@ -0,0 +1,6 @@
using OAService.Service.Servizi.Interfacce;
using StandManager.Domain.Entita;
namespace StandManager.Service.Interfaces;
public interface IProvinciaIstatService : ITService<ProvinciaIstat> {}

View File

@ -3,4 +3,4 @@ using StandManager.Domain.Entita;
namespace StandManager.Service.Interfaces;
public interface ITipologiaClienteService : ITService<TipologiaCliente> {}
public interface ITipologiaClienteService : ITService<TipologiaCliente> {}

View File

@ -4,9 +4,10 @@ namespace StandManager.Service;
public class ManagerService : IManagerService
{
public ManagerService(IUtenteService utenteService, IClienteService clienteService, IComuneIstatService comuneIstatService, IDestinazioneService destinazioneService, IEventoService eventoService,
IInvitoEventoService invitoEventoService, IIscrizioneEventoService iscrizioneEventoService, IReferenteService referenteService,
ITipologiaClienteService tipologiaClienteService, IFeatureService featureService, IPermissionService permissionService, IRuoloService ruoloService, ISezioneService sezioneService)
public ManagerService(IUtenteService utenteService, IClienteService clienteService, IComuneIstatService comuneIstatService, IDestinazioneService destinazioneService,
IEventoService eventoService, IInvitoEventoService invitoEventoService, IIscrizioneEventoService iscrizioneEventoService, IReferenteService referenteService,
ITipologiaClienteService tipologiaClienteService, IFeatureService featureService, IPermissionService permissionService, IRuoloService ruoloService,
ISezioneService sezioneService, IProvinciaIstatService provinciaIstatService)
{
UtenteService = utenteService;
ClienteService = clienteService;
@ -21,6 +22,7 @@ public class ManagerService : IManagerService
PermissionService = permissionService;
RuoloService = ruoloService;
SezioneService = sezioneService;
ProvinciaIstatService = provinciaIstatService;
}
public IUtenteService UtenteService { get; set; }
@ -31,6 +33,7 @@ public class ManagerService : IManagerService
public IInvitoEventoService InvitoEventoService{ get; set; }
public IIscrizioneEventoService IscrizioneEventoService { get; set; }
public IPermissionService PermissionService { get; set; }
public IProvinciaIstatService ProvinciaIstatService { get; set; }
public IReferenteService ReferenteService { get; set; }
public IRuoloService RuoloService { get; set; }
public ISezioneService SezioneService { get; set; }

View File

@ -0,0 +1,16 @@
using OAService.Service.Servizi.Implementazioni;
using StandManager.Domain.Entita;
using StandManager.Service.Interfaces;
using StandManager.Service.Repository;
namespace StandManager.Service;
public class ProvinciaIstatService : TService<ProvinciaIstat>, IProvinciaIstatService
{
private readonly IStandManagerUnitOfWork _unitOfWork;
public ProvinciaIstatService(IStandManagerUnitOfWork unitOfWork) : base(unitOfWork)
{
_unitOfWork = unitOfWork;
}
}

View File

@ -38,8 +38,8 @@
<div class="row">
<div class="col-4 mb-3">
<RadzenFormField Text="Provincia" Variant="Variant.Flat" Style="width: 100%;">
<RadzenDropDown @bind-Value="@iscrizione.Provincia" Style="width: 100%" TextProperty="" Placeholder="Seleziona la provincia"
Data="@provinciaList" Size="ButtonSize.Small" />
<RadzenDropDown TValue="Guid" @bind-Value="@iscrizione.Provincia" Style="width: 100%" TextProperty="Info" ValueProperty="Id" Placeholder="Seleziona la provincia"
Data="@provList" Size="ButtonSize.Small" />
</RadzenFormField>
<ValidationMessage For="@(() => iscrizione.Provincia)" />
</div>
@ -155,11 +155,12 @@
[SupplyParameterFromForm]
private IscrizioneEventoViewModel iscrizione { get; set; } = new();
private IEnumerable<string> comuneList { get; set; }
private IEnumerable<string> provinciaList { get; set; }
private IEnumerable<DestinazioneViewModel> destinazioniList { get; set; }
private IEnumerable<LookupViewModel<Guid>> tipologiaList { get; set; }
private IEnumerable<string> esperienzaList { get; set; }
private IEnumerable<LookupViewModel<int>> ruoloList { get; set; }
private List<ProvinciaViewModel> provList { get; set; }
private bool presaVisionePrivacy { get; set; }
private bool presaVisioneDatiPersonali { get; set; }
@ -172,11 +173,14 @@
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();
comuneList = new List<string>() { "Brescia" };
provinciaList = new List<string>() { "BS" };
esperienzaList = new List<string>() { "Si", "No" };
tipologiaList = (await _managerService.TipologiaClienteService.RicercaQueryable(x => x.Eliminato == false, ordinamento: x => x.OrderBy(y => y.Nome)))
.Select(x => new LookupViewModel<Guid>(x.Id, x.Nome)).ToList();
ruoloList = eUtils.GetEnumList<RuoloTipo>();
provList = (await _managerService.ProvinciaIstatService.RicercaQueryable(
x => x.Eliminato == false,
ordinamento: x => x.OrderBy(y => y.Provincia)))
.Select(x => (ProvinciaViewModel)x).ToList();
}
private async Task onIscrizioneSave()

View File

@ -26,7 +26,7 @@ public class IscrizioneEventoViewModel
[Required(ErrorMessage = "Il numero di telefono è obbigatorio")]
public string NumeroTelefono { get; set; }
[Required(ErrorMessage = "La provincia è obbigatoria")]
public string Provincia { get; set; }
public Guid Provincia { get; set; }
[Required(ErrorMessage = "Il comune è obbigatorio")]
public string Comune { get; set; }
[Required(ErrorMessage = "Il CAP è obbigatorio")]
@ -54,7 +54,7 @@ public class IscrizioneEventoViewModel
model.Cognome = Cognome;
model.Email = Email;
model.NumeroTelefono = NumeroTelefono;
model.Provincia = Provincia;
/*model.Provincia = Provincia;*/
model.Comune = Comune;
model.Cap = Cap;
model.RagioneSociale = RagioneSociale;
@ -83,7 +83,7 @@ public class IscrizioneEventoViewModel
Cognome = model.Cognome,
Email = model.Email,
NumeroTelefono = model.NumeroTelefono,
Provincia = model.Provincia,
Provincia = model.Provincia?.Id ?? Guid.Empty,
Comune = model.Comune,
Cap = model.Cap,
RagioneSociale = model.RagioneSociale,

View File

@ -1,8 +1,23 @@
namespace StandManager.Model;
using StandManager.Domain.Entita;
namespace StandManager.Model;
public class ProvinciaViewModel
{
public Guid Id { get; set; }
public string Sigla { get; set; }
public string Provincia { get; set; }
public string Info => $"{Sigla} - {Provincia}";
public static implicit operator ProvinciaViewModel(ProvinciaIstat model)
{
return model == null
? null
: new ProvinciaViewModel()
{
Provincia = model.Provincia,
Sigla = model.Sigla,
Id = model.Id
};
}
}