GuidComune
This commit is contained in:
@ -32,7 +32,9 @@ public class IscrizioneEvento : EntitaBase
|
||||
[ForeignKey(nameof(Provincia))]
|
||||
public Guid? ProvinciaId { get; set; }
|
||||
public ProvinciaIstat Provincia { get; set; }
|
||||
public string? Comune { get; set; }
|
||||
[ForeignKey(nameof(Comune))]
|
||||
public Guid? ComuneId { get; set; }
|
||||
public ComuneIstat Comune { get; set; }
|
||||
public string? Cap { get; set; }
|
||||
public string? RagioneSociale { get; set; }
|
||||
[ForeignKey(nameof(TipologiaCliente))]
|
||||
|
||||
1166
StandManager.Infrastructure/Migrations/20251222160003_GuidComune.Designer.cs
generated
Normal file
1166
StandManager.Infrastructure/Migrations/20251222160003_GuidComune.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace StandManager.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class GuidComune : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Comune",
|
||||
table: "IscrizioneEvento");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "ComuneId",
|
||||
table: "IscrizioneEvento",
|
||||
type: "uniqueidentifier",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_IscrizioneEvento_ComuneId",
|
||||
table: "IscrizioneEvento",
|
||||
column: "ComuneId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_IscrizioneEvento_ComuneIstat_ComuneId",
|
||||
table: "IscrizioneEvento",
|
||||
column: "ComuneId",
|
||||
principalTable: "ComuneIstat",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_IscrizioneEvento_ComuneIstat_ComuneId",
|
||||
table: "IscrizioneEvento");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_IscrizioneEvento_ComuneId",
|
||||
table: "IscrizioneEvento");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ComuneId",
|
||||
table: "IscrizioneEvento");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Comune",
|
||||
table: "IscrizioneEvento",
|
||||
type: "nvarchar(max)",
|
||||
nullable: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -398,8 +398,8 @@ namespace StandManager.Infrastructure.Migrations
|
||||
b.Property<string>("Cognome")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Comune")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
b.Property<Guid?>("ComuneId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<DateTime>("DataCreazione")
|
||||
.HasColumnType("datetime2");
|
||||
@ -471,6 +471,8 @@ namespace StandManager.Infrastructure.Migrations
|
||||
|
||||
b.HasIndex("ClienteId");
|
||||
|
||||
b.HasIndex("ComuneId");
|
||||
|
||||
b.HasIndex("DestinazioneId");
|
||||
|
||||
b.HasIndex("EventoId");
|
||||
@ -941,6 +943,10 @@ namespace StandManager.Infrastructure.Migrations
|
||||
.WithMany()
|
||||
.HasForeignKey("ClienteId");
|
||||
|
||||
b.HasOne("StandManager.Domain.Entita.ComuneIstat", "Comune")
|
||||
.WithMany()
|
||||
.HasForeignKey("ComuneId");
|
||||
|
||||
b.HasOne("StandManager.Domain.Entita.Destinazione", "Destinazione")
|
||||
.WithMany()
|
||||
.HasForeignKey("DestinazioneId");
|
||||
@ -971,6 +977,8 @@ namespace StandManager.Infrastructure.Migrations
|
||||
|
||||
b.Navigation("Cliente");
|
||||
|
||||
b.Navigation("Comune");
|
||||
|
||||
b.Navigation("Destinazione");
|
||||
|
||||
b.Navigation("Evento");
|
||||
|
||||
@ -38,7 +38,7 @@
|
||||
<div class="row">
|
||||
<div class="col-4 mb-3">
|
||||
<RadzenFormField Text="Provincia" Variant="Variant.Flat" Style="width: 100%;">
|
||||
<RadzenDropDown TValue="Guid" @bind-Value="@iscrizione.Provincia" Style="width: 100%" TextProperty="Info" ValueProperty="Id" Placeholder="Seleziona la provincia"
|
||||
<RadzenDropDown TValue="Guid" @onchange="(args => onProvinciaChanged(args))" Style="width: 100%" TextProperty="Info" ValueProperty="Id" Placeholder="Seleziona la provincia"
|
||||
Data="@provList" Size="ButtonSize.Small" />
|
||||
</RadzenFormField>
|
||||
<ValidationMessage For="@(() => iscrizione.Provincia)" />
|
||||
@ -51,8 +51,8 @@
|
||||
</div>
|
||||
<div class="col-4 mb-3">
|
||||
<RadzenFormField Text="Comune" Variant="Variant.Flat" Style="width: 100%;">
|
||||
<RadzenDropDown @bind-Value="@iscrizione.Comune" Style="width: 100%" TextProperty="" Placeholder="Seleziona il comune"
|
||||
Data="@comuneList" Size="ButtonSize.Small" />
|
||||
<RadzenDropDown TValue="Guid" @bind-Value="@iscrizione.Comune" Style="width: 100%" TextProperty="Info" ValueProperty="Id" Placeholder="Seleziona il comune"
|
||||
Data="@comuniList" Size="ButtonSize.Small" />
|
||||
</RadzenFormField>
|
||||
<ValidationMessage For="@(() => iscrizione.Comune)" />
|
||||
</div>
|
||||
@ -154,13 +154,13 @@
|
||||
|
||||
[SupplyParameterFromForm]
|
||||
private IscrizioneEventoViewModel iscrizione { get; set; } = new();
|
||||
private IEnumerable<string> comuneList { 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 List<ComuneIstatExcelViewModel> comuniList { get; set; }
|
||||
|
||||
private bool presaVisionePrivacy { get; set; }
|
||||
private bool presaVisioneDatiPersonali { get; set; }
|
||||
@ -172,7 +172,6 @@
|
||||
|
||||
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" };
|
||||
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();
|
||||
@ -223,4 +222,22 @@
|
||||
{
|
||||
destinazioniList = new List<DestinazioneViewModel>() { new DestinazioneViewModel() { RagioneSociale = "--Nessuna" } };
|
||||
}
|
||||
|
||||
private async Task onProvinciaChanged(ChangeEventArgs args)
|
||||
{
|
||||
Guid parsed;
|
||||
var guidId = Guid.TryParse(args.Value?.ToString(), out parsed);
|
||||
var prov = await _managerService.ProvinciaIstatService.RicercaPer(x => x.Id == parsed);
|
||||
|
||||
if (prov == null)
|
||||
{
|
||||
await _dialogService.Alert("La provincia indicata non è presente", "Errore", new ConfirmOptions() { OkButtonText = "Ok" });
|
||||
return;
|
||||
}
|
||||
|
||||
iscrizione.Provincia = prov.Id;
|
||||
|
||||
comuniList = (await _managerService.ComuneIstatService.RicercaQueryable(x => x.Provincia == prov.Sigla))
|
||||
.Select(x => (ComuneIstatExcelViewModel)x).ToList();
|
||||
}
|
||||
}
|
||||
@ -1,9 +1,14 @@
|
||||
using ClosedXML.Excel;
|
||||
using StandManager.Domain.Entita;
|
||||
|
||||
namespace StandManager.Model;
|
||||
|
||||
public class ComuneIstatExcelViewModel
|
||||
{
|
||||
public ComuneIstatExcelViewModel()
|
||||
{
|
||||
|
||||
}
|
||||
public ComuneIstatExcelViewModel(IXLRangeRow row)
|
||||
{
|
||||
Istat = row.Cell(1).GetString();
|
||||
@ -14,6 +19,7 @@ public class ComuneIstatExcelViewModel
|
||||
CodFisco = row.Cell(6).GetString();
|
||||
}
|
||||
|
||||
public Guid Id { get; set; }
|
||||
public string Istat { get; set; }
|
||||
public string Comune { get; set; }
|
||||
public string Regione { get; set; }
|
||||
@ -21,4 +27,14 @@ public class ComuneIstatExcelViewModel
|
||||
public string Prefisso { get; set; }
|
||||
public string CodFisco { get; set; }
|
||||
|
||||
public static implicit operator ComuneIstatExcelViewModel(ComuneIstat model)
|
||||
{
|
||||
return model == null
|
||||
? null
|
||||
: new ComuneIstatExcelViewModel
|
||||
{
|
||||
Id = model.Id,
|
||||
Comune = model.Comune
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -28,7 +28,7 @@ public class IscrizioneEventoViewModel
|
||||
[Required(ErrorMessage = "La provincia è obbigatoria")]
|
||||
public Guid Provincia { get; set; }
|
||||
[Required(ErrorMessage = "Il comune è obbigatorio")]
|
||||
public string Comune { get; set; }
|
||||
public Guid Comune { get; set; }
|
||||
[Required(ErrorMessage = "Il CAP è obbigatorio")]
|
||||
public string Cap { get; set; }
|
||||
[Required(ErrorMessage = "La Ragione Sociale è obbigatoria")]
|
||||
@ -54,8 +54,6 @@ public class IscrizioneEventoViewModel
|
||||
model.Cognome = Cognome;
|
||||
model.Email = Email;
|
||||
model.NumeroTelefono = NumeroTelefono;
|
||||
/*model.Provincia = Provincia;*/
|
||||
model.Comune = Comune;
|
||||
model.Cap = Cap;
|
||||
model.RagioneSociale = RagioneSociale;
|
||||
model.EsperienzaConDAC = EsperienzaConDAC;
|
||||
@ -84,7 +82,7 @@ public class IscrizioneEventoViewModel
|
||||
Email = model.Email,
|
||||
NumeroTelefono = model.NumeroTelefono,
|
||||
Provincia = model.Provincia?.Id ?? Guid.Empty,
|
||||
Comune = model.Comune,
|
||||
Comune = model.Comune?.Id ?? Guid.Empty,
|
||||
Cap = model.Cap,
|
||||
RagioneSociale = model.RagioneSociale,
|
||||
EsperienzaConDAC = model.EsperienzaConDAC,
|
||||
|
||||
Reference in New Issue
Block a user