Fix
This commit is contained in:
6
.idea/.idea.StandManager/.idea/sqldialects.xml
generated
6
.idea/.idea.StandManager/.idea/sqldialects.xml
generated
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="SqlDialectMappings">
|
||||
<file url="file://$PROJECT_DIR$/.idea/.idea.StandManager/.idea/queries/Query.sql" dialect="TSQL" />
|
||||
</component>
|
||||
</project>
|
||||
@ -10,6 +10,7 @@ public class ProvinciaIstat : EntitaBase
|
||||
|
||||
public bool CapoareaDaVerificare { get; set; }
|
||||
|
||||
[InverseProperty(nameof(Utente.ProvinciaIstat))]
|
||||
public List<Utente> UtentiList { get; set; }
|
||||
[ForeignKey(nameof(Capoarea))]
|
||||
public Guid? CapoareaId { get; set; }
|
||||
public Utente Capoarea { get; set; }
|
||||
}
|
||||
@ -25,10 +25,6 @@ public class Utente : EntitaBase
|
||||
public Guid? CapoareaId { get; set; }
|
||||
public Utente Capoarea { get; set; }
|
||||
public bool IsCapoarea { get; set; }
|
||||
|
||||
[ForeignKey(nameof(ProvinciaIstat))]
|
||||
public Guid? ProvinciaIstatId { get; set; }
|
||||
public ProvinciaIstat ProvinciaIstat { get; set; }
|
||||
public string Info => $"{Nome} {Cognome}";
|
||||
|
||||
public override string ToString()
|
||||
|
||||
1314
StandManager.Infrastructure/Migrations/20260206070903_CapoareaSuProvIstat.Designer.cs
generated
Normal file
1314
StandManager.Infrastructure/Migrations/20260206070903_CapoareaSuProvIstat.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,79 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace StandManager.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class CapoareaSuProvIstat : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Utente_Province_ProvinciaIstatId",
|
||||
table: "Utente");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Utente_ProvinciaIstatId",
|
||||
table: "Utente");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ProvinciaIstatId",
|
||||
table: "Utente");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "CapoareaId",
|
||||
table: "Province",
|
||||
type: "uniqueidentifier",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Province_CapoareaId",
|
||||
table: "Province",
|
||||
column: "CapoareaId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Province_Utente_CapoareaId",
|
||||
table: "Province",
|
||||
column: "CapoareaId",
|
||||
principalTable: "Utente",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Province_Utente_CapoareaId",
|
||||
table: "Province");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Province_CapoareaId",
|
||||
table: "Province");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "CapoareaId",
|
||||
table: "Province");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "ProvinciaIstatId",
|
||||
table: "Utente",
|
||||
type: "uniqueidentifier",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Utente_ProvinciaIstatId",
|
||||
table: "Utente",
|
||||
column: "ProvinciaIstatId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Utente_Province_ProvinciaIstatId",
|
||||
table: "Utente",
|
||||
column: "ProvinciaIstatId",
|
||||
principalTable: "Province",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -621,6 +621,9 @@ namespace StandManager.Infrastructure.Migrations
|
||||
b.Property<bool>("CapoareaDaVerificare")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<Guid?>("CapoareaId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<DateTime>("DataCreazione")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
@ -646,6 +649,8 @@ namespace StandManager.Infrastructure.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CapoareaId");
|
||||
|
||||
b.HasIndex("IdUtenteCreazione");
|
||||
|
||||
b.HasIndex("IdUtenteModifica");
|
||||
@ -862,9 +867,6 @@ namespace StandManager.Infrastructure.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<Guid?>("ProvinciaIstatId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<Guid?>("RuoloId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
@ -880,8 +882,6 @@ namespace StandManager.Infrastructure.Migrations
|
||||
|
||||
b.HasIndex("IdUtenteModifica");
|
||||
|
||||
b.HasIndex("ProvinciaIstatId");
|
||||
|
||||
b.HasIndex("RuoloId");
|
||||
|
||||
b.ToTable("Utente");
|
||||
@ -1160,6 +1160,10 @@ namespace StandManager.Infrastructure.Migrations
|
||||
|
||||
modelBuilder.Entity("StandManager.Domain.Entita.ProvinciaIstat", b =>
|
||||
{
|
||||
b.HasOne("StandManager.Domain.Entita.Utente", "Capoarea")
|
||||
.WithMany()
|
||||
.HasForeignKey("CapoareaId");
|
||||
|
||||
b.HasOne("StandManager.Domain.Entita.Utente", "UtenteCreazione")
|
||||
.WithMany()
|
||||
.HasForeignKey("IdUtenteCreazione");
|
||||
@ -1168,6 +1172,8 @@ namespace StandManager.Infrastructure.Migrations
|
||||
.WithMany()
|
||||
.HasForeignKey("IdUtenteModifica");
|
||||
|
||||
b.Navigation("Capoarea");
|
||||
|
||||
b.Navigation("UtenteCreazione");
|
||||
|
||||
b.Navigation("UtenteModifica");
|
||||
@ -1253,18 +1259,12 @@ namespace StandManager.Infrastructure.Migrations
|
||||
.WithMany()
|
||||
.HasForeignKey("IdUtenteModifica");
|
||||
|
||||
b.HasOne("StandManager.Domain.Entita.ProvinciaIstat", "ProvinciaIstat")
|
||||
.WithMany("UtentiList")
|
||||
.HasForeignKey("ProvinciaIstatId");
|
||||
|
||||
b.HasOne("StandManager.Domain.Entita.Ruolo", "Ruolo")
|
||||
.WithMany("Utenti")
|
||||
.HasForeignKey("RuoloId");
|
||||
|
||||
b.Navigation("Capoarea");
|
||||
|
||||
b.Navigation("ProvinciaIstat");
|
||||
|
||||
b.Navigation("Ruolo");
|
||||
|
||||
b.Navigation("UtenteCreazione");
|
||||
@ -1294,11 +1294,6 @@ namespace StandManager.Infrastructure.Migrations
|
||||
b.Navigation("IscrizioniEvento");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("StandManager.Domain.Entita.ProvinciaIstat", b =>
|
||||
{
|
||||
b.Navigation("UtentiList");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("StandManager.Domain.Entita.Ruolo", b =>
|
||||
{
|
||||
b.Navigation("Permessi");
|
||||
|
||||
@ -304,7 +304,8 @@
|
||||
|
||||
if (destinazione == null || string.IsNullOrEmpty(text))
|
||||
{
|
||||
await _dialogService.Alert("Non è stato trovato il clente (Codice cliente/Partita IVA non presente)", "Errore", new ConfirmOptions() { OkButtonText = "Ok" });
|
||||
var msg = new NotificationMessage { Severity = NotificationSeverity.Warning, Summary = "Non trovato", Detail = "Non è stato possibile trovare il Codice Cliente o la Partita IVA indicati.", Duration = 4000 };
|
||||
_notificationService.Notify(msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -26,13 +26,14 @@
|
||||
Data="@iscrizioni" LogicalFilterOperator="LogicalFilterOperator.Or" SelectionMode="DataGridSelectionMode.Single">
|
||||
<Columns>
|
||||
<RadzenDataGridColumn Property="@nameof(IscrizioneEventoViewModel.RagioneSociale)" Title="Ragione sociale" Width="250px" />
|
||||
<RadzenDataGridColumn Property="@nameof(IscrizioneEventoViewModel.PartitaIva)" Title="Partita IVA" Width="250px" />
|
||||
<RadzenDataGridColumn Property="@nameof(IscrizioneEventoViewModel.GiornoPresenza)" Title="Giorno presenza" Width="250px" FormatString="{0:dd/MM/yyyy}" />
|
||||
<RadzenDataGridColumn Property="@nameof(IscrizioneEventoViewModel.PartitaIva)" Title="Partita IVA" Width="200px" />
|
||||
<RadzenDataGridColumn Property="@nameof(IscrizioneEventoViewModel.GiornoPresenza)" Title="Giorno presenza" Width="150px" FormatString="{0:dd/MM/yyyy}" />
|
||||
<RadzenDataGridColumn Property="@nameof(IscrizioneEventoViewModel.CapoareaInfo)" Title="Capoarea" Width="200px" />
|
||||
<RadzenDataGridColumn Property="@nameof(IscrizioneEventoViewModel.AgenteInfo)" Title="Agente" Width="200px" />
|
||||
|
||||
<RadzenDataGridColumn Context="iscrizioni" Filterable="false" Sortable="false" TextAlign="TextAlign.Right" Width="250px">
|
||||
<Template Context="iscrizioni">
|
||||
<RadzenButton Icon="edit" ButtonStyle="ButtonStyle.Light" Variant="Variant.Flat" Size="ButtonSize.Medium" class="rz-my-1 rz-ms-1" Click="@(args => EditRow(iscrizioni))" @onclick:stopPropagation="true" />
|
||||
<RadzenButton Icon="delete" ButtonStyle="ButtonStyle.Danger" Variant="Variant.Flat" Size="ButtonSize.Medium" Shade="Shade.Lighter" class="rz-my-1 rz-ms-1" Click="@(args => DeleteRow(iscrizioni))" @onclick:stopPropagation="true" />
|
||||
</Template>
|
||||
</RadzenDataGridColumn>
|
||||
</Columns>
|
||||
@ -56,8 +57,9 @@
|
||||
|
||||
iscrizioni = (await _managerService.IscrizioneEventoService.RicercaQueryable(
|
||||
x => x.Eliminato == false,
|
||||
includi:x => x.Include(x => x.Provincia).Include(x => x.Comune).Include(y => y.Cliente).Include(y => y.Evento).Include(y => y.InvitoEvento),
|
||||
ordinamento: x => x.OrderBy(y => y.RagioneSociale)))
|
||||
includi:x => x.Include(x => x.Provincia).Include(x => x.Comune).Include(y => y.Cliente)
|
||||
.Include(y => y.Evento).Include(y => y.InvitoEvento).Include(y => y.Agente).Include(y => y.Capoarea),
|
||||
ordinamento: x => x.OrderByDescending(y => y.DataCreazione)))
|
||||
.Select(x => (IscrizioneEventoViewModel)x).ToList();
|
||||
}
|
||||
|
||||
@ -71,17 +73,4 @@
|
||||
{
|
||||
_navManager.NavigateTo($"/management/Iscrizioni/Modifica/{iscrizioneEvento.Id}");
|
||||
}
|
||||
|
||||
private async Task DeleteRow(IscrizioneEventoViewModel iscrizioneEvento)
|
||||
{
|
||||
var ok = await _dialogService.Confirm($"Vuoi davvero eliminare la registrazione {iscrizioneEvento.RagioneSociale}?", "Conferma eliminazione", new ConfirmOptions { OkButtonText = "Sì", CancelButtonText = "No", Width = "400px" });
|
||||
|
||||
if (ok == true)
|
||||
{
|
||||
await _managerService.IscrizioneEventoService.Elimina(iscrizioneEvento.Id, await MembershipUtils.GetUserId(auth));
|
||||
iscrizioni = (await _managerService.IscrizioneEventoService.RicercaQueryable(
|
||||
x => x.Eliminato == false, includi: x => x.Include(x => x.Provincia).Include(x => x.Comune).Include(y => y.Cliente).Include(y => y.Evento).Include(y => y.InvitoEvento), ordinamento: x => x.OrderBy(y => y.RagioneSociale)))
|
||||
.Select(x => (IscrizioneEventoViewModel)x).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,6 @@
|
||||
@attribute [Authorize]
|
||||
@rendermode InteractiveServer
|
||||
|
||||
@page "/management/Iscrizioni/Modifica"
|
||||
@page "/management/Iscrizioni/Modifica/{IscrizioneId:guid}"
|
||||
|
||||
@using Microsoft.AspNetCore.Identity
|
||||
@ -35,115 +34,100 @@
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row g-5">
|
||||
<EditForm Model="iscrizione" OnValidSubmit="onIscrizioneSave" FormName="editIscrizioneForm">
|
||||
<DataAnnotationsValidator />
|
||||
|
||||
<div class="col-12">
|
||||
<div class="row">
|
||||
<div class="col-3 mb-3">
|
||||
<RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">Nome</RadzenText>
|
||||
<RadzenTextBox Style="width: 100%" aria-label="Nome" @bind-Value="@iscrizione.Nome" />
|
||||
<ValidationMessage For="@(() => iscrizione.RagioneSociale)" />
|
||||
<RadzenLabel Style="width: 100%" aria-label="NumeroTelefono" Text="@iscrizione.Nome" />
|
||||
</div>
|
||||
|
||||
<div class="col-3 mb-3">
|
||||
<RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">Cognome</RadzenText>
|
||||
<RadzenTextBox Style="width: 100%" aria-label="Cognome" @bind-Value="@iscrizione.Cognome" />
|
||||
<ValidationMessage For="@(() => iscrizione.PartitaIva)" />
|
||||
<RadzenLabel Style="width: 100%" aria-label="NumeroTelefono" Text="@iscrizione.Cognome" />
|
||||
</div>
|
||||
|
||||
<div class="col-3 mb-3">
|
||||
<RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">Email</RadzenText>
|
||||
<RadzenTextBox Style="width: 100%" aria-label="Email" @bind-Value="@iscrizione.Email" />
|
||||
<RadzenLabel Style="width: 100%" aria-label="NumeroTelefono" Text="@iscrizione.Email" />
|
||||
</div>
|
||||
|
||||
<div class="col-3 mb-3">
|
||||
<RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">Numero di Telefono</RadzenText>
|
||||
<RadzenTextBox Style="width: 100%" aria-label="NumeroTelefono" @bind-Value="@iscrizione.NumeroTelefono" />
|
||||
<RadzenLabel Style="width: 100%" aria-label="NumeroTelefono" Text="@iscrizione.NumeroTelefono" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-4 mb-3">
|
||||
<div class="col-3 mb-3">
|
||||
<RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">Provincia</RadzenText>
|
||||
<RadzenDropDown TValue="Guid ?" @bind-Value="@iscrizione.ProvinciaId" Change="@(args => onProvinciaChanged(args))" Style="width: 100%" TextProperty="Info" ValueProperty="Id" Placeholder="Seleziona la provincia"
|
||||
Data="@provList" Size="ButtonSize.Small" />
|
||||
<ValidationMessage For="@(() => iscrizione.ProvinciaId)" />
|
||||
<RadzenLabel Style="width: 100%" aria-label="NumeroTelefono" Text="@iscrizione.ProvinciaInfo" />
|
||||
</div>
|
||||
<div class="col-4 mb-3">
|
||||
<div class="col-3 mb-3">
|
||||
<RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">CAP</RadzenText>
|
||||
<RadzenTextBox Style="width: 100%" aria-label="Cap" @bind-Value="@iscrizione.Cap" />
|
||||
<ValidationMessage For="@(() => iscrizione.Cap)" />
|
||||
<RadzenLabel Style="width: 100%" aria-label="NumeroTelefono" Text="@iscrizione.Cap" />
|
||||
</div>
|
||||
<div class="col-4 mb-3">
|
||||
<div class="col-3 mb-3">
|
||||
<RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">Comune</RadzenText>
|
||||
<RadzenDropDown TValue="Guid ?" @bind-Value="@iscrizione.ComuneId" Style="width: 100%" TextProperty="Info" ValueProperty="Id" Placeholder="Seleziona il comune"
|
||||
Data="@comuniList" Size="ButtonSize.Small" />
|
||||
<ValidationMessage For="@(() => iscrizione.ComuneId)" />
|
||||
<RadzenLabel Style="width: 100%" aria-label="NumeroTelefono" Text="@iscrizione.ComuneInfo" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-3 mb-3">
|
||||
<RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">Ragione Sociale</RadzenText>
|
||||
<RadzenTextBox Style="width: 100%" aria-label="RagioneSociale" @bind-Value="@iscrizione.RagioneSociale" />
|
||||
<ValidationMessage For="@(() => iscrizione.RagioneSociale)" />
|
||||
<RadzenLabel Style="width: 100%" aria-label="NumeroTelefono" Text="@iscrizione.RagioneSociale" />
|
||||
</div>
|
||||
|
||||
<div class="col-3 mb-3">
|
||||
<RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">Partita Iva</RadzenText>
|
||||
<RadzenTextBox Style="width: 100%" aria-label="PartitaIVA" @bind-Value="@iscrizione.PartitaIva" />
|
||||
<ValidationMessage For="@(() => iscrizione.PartitaIva)" />
|
||||
<RadzenLabel Style="width: 100%" aria-label="NumeroTelefono" Text="@iscrizione.PartitaIva" />
|
||||
</div>
|
||||
|
||||
<div class="col-3 mb-3">
|
||||
<RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">Tipologia Cliente</RadzenText>
|
||||
<RadzenDropDown @bind-Value="@iscrizione.TipologiaClienteId" TValue="Guid ?" Style="width: 100%" TextProperty="Description" ValueProperty="Key" Placeholder="Seleziona la tipologia"
|
||||
Data="@tipologiaList" Size="ButtonSize.Small" />
|
||||
<RadzenLabel Style="width: 100%" aria-label="NumeroTelefono" Text="@iscrizione.TipologiaClienteInfo" />
|
||||
</div>
|
||||
|
||||
<div class="col-3 mb-3">
|
||||
<RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">Ha già avuto esperienza con DAC?</RadzenText>
|
||||
<RadzenDropDown @bind-Value="@iscrizione.EsperienzaConDAC" Style="width: 100%" TextProperty="" Placeholder="Scegli dal menù"
|
||||
Data="@esperienzaList" Size="ButtonSize.Small" />
|
||||
<RadzenLabel Style="width: 100%" aria-label="NumeroTelefono" Text="@iscrizione.EsperienzaConDAC" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-3 mb-3">
|
||||
<RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">Destinazione</RadzenText>
|
||||
<RadzenDropDown @bind-Value="@iscrizione.DestinazioneId" TValue="Guid ?" Style="width: 100%" ValueProperty="Id" TextProperty="Info" Placeholder="Seleziona la destinazione"
|
||||
Data="@destinazioniList" Size="ButtonSize.Small" Disabled="@(!destinazioniList.Any(x => x.Id == iscrizione.DestinazioneId))" />
|
||||
<ValidationMessage For="@(() => iscrizione.RagioneSociale)" />
|
||||
<RadzenLabel Style="width: 100%" aria-label="NumeroTelefono" Text="@iscrizione.DestinazioneInfo" />
|
||||
</div>
|
||||
|
||||
<div class="col-3 mb-3">
|
||||
<RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">Note</RadzenText>
|
||||
<RadzenTextArea @bind-Value="@iscrizione.Note" Style="width: 100%;" Rows="1" />
|
||||
<ValidationMessage For="@(() => iscrizione.PartitaIva)" />
|
||||
<RadzenLabel Style="width: 100%" aria-label="NumeroTelefono" Text="@iscrizione.Note" />
|
||||
</div>
|
||||
|
||||
<div class="col-3 mb-3">
|
||||
<RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">Ruolo</RadzenText>
|
||||
<RadzenDropDown @bind-Value="@iscrizione.RuoloInt" TValue="int?" Style="width: 100%" TextProperty="Description" ValueProperty="Key" Placeholder="Seleziona il ruolo"
|
||||
Data="@ruoloList" Size="ButtonSize.Small" />
|
||||
<RadzenLabel Style="width: 100%" aria-label="NumeroTelefono" Text="@iscrizione.RuoloInfo" />
|
||||
</div>
|
||||
<div class="col-3 mb-3">
|
||||
<RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">Giorno presenza</RadzenText>
|
||||
<RadzenDatePicker @bind-Value=@iscrizione.GiornoPresenza Name="GiornoPresenza" ShowCalendarWeek ShowTime="false"
|
||||
DateFormat="dd/MM/yyyy" Min="inizioEvento" Max="fineEvento" />
|
||||
<RadzenLabel Style="width: 100%" aria-label="NumeroTelefono" Text="@iscrizione.GiornoPresenzaInfo" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-3 mb-3">
|
||||
<RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">Capoarea</RadzenText>
|
||||
<RadzenDropDown Style="width: 100%" TValue="Guid ?" @bind-Value=@iscrizione.CapoareaId Data=@capiarea TextProperty="Info" ValueProperty="Id" Name="capoareaDrop" Change="(x => OnCapoareaChange(x))" />
|
||||
<RadzenAlert AlertStyle="AlertStyle.Danger" ShowIcon="false" Variant="Variant.Flat" Shade="Shade.Lighter" Visible="capoareaDaConfermare" AllowClose="false">
|
||||
Capoarea da confermare
|
||||
</RadzenAlert>
|
||||
</div>
|
||||
|
||||
<div class="col-3 mb-3">
|
||||
<RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">Agente</RadzenText>
|
||||
<RadzenDropDown Style="width: 100%" TValue="Guid ?" @bind-Value=@iscrizione.AgenteId Data=@agenti TextProperty="Info" ValueProperty="Id" Name="agenteDrop" Disabled="@(agenti.Count() == 0)" />
|
||||
</div>
|
||||
<div class="col-3 mb-3">
|
||||
<RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">Capoarea</RadzenText>
|
||||
<RadzenDropDown Style="width: 100%" TValue="Guid ?" @bind-Value=@iscrizione.CapoareaId Data=@capiarea TextProperty="Info" ValueProperty="Id" Name="capoareaDrop" Disabled="!isAdmin" Change="(x => OnCapoareaChange(x))" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
@ -153,13 +137,12 @@
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-3 mb-3">
|
||||
<button type="submit" class="btn btn-primary w-100">
|
||||
<button type="submit" class="btn btn-primary w-100" @onclick="onIscrizioneSave">
|
||||
Salva
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</EditForm>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -177,29 +160,11 @@
|
||||
[SupplyParameterFromForm]
|
||||
private IscrizioneEventoViewModel iscrizione { get; set; } = new();
|
||||
|
||||
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<ComuneIstatViewModel> comuniList { get; set; }
|
||||
private IEnumerable<UtenteViewModel> agenti { get; set; } = new List<UtenteViewModel>();
|
||||
private IEnumerable<UtenteViewModel> capiarea { get; set; } = new List<UtenteViewModel>();
|
||||
|
||||
private DateTime inizioEvento { get; set; }
|
||||
private DateTime fineEvento { get; set; }
|
||||
|
||||
private bool isAdmin { get; set; } = false;
|
||||
private Guid capoareaId { get; set; } = Guid.Empty;
|
||||
|
||||
private string pageTitle => iscrizione?.Id == Guid.Empty ? "Nuova iscrizione" : "Modifica iscrizione";
|
||||
|
||||
private DialogOptions editNewDialogOption { get; set; } = new()
|
||||
{
|
||||
Resizable = false,
|
||||
Draggable = false,
|
||||
Width = "900px"
|
||||
};
|
||||
private string pageTitle => $"Iscrizione {iscrizione?.RagioneSociale}";
|
||||
private bool capoareaDaConfermare { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Creo tutte le drop necessarie per il form
|
||||
@ -208,55 +173,59 @@
|
||||
/// </summary>
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
var eUtils = new EnumUtils();
|
||||
idClaim = await MembershipUtils.GetUserId(auth);
|
||||
var idRuolo = await MembershipUtils.GetRoleId(auth);
|
||||
var ruolo = await _managerService.RuoloService.RicercaPer(
|
||||
x => x.Id == idRuolo && x.Permessi.Any(y => y.Feature.Type == FeatureType.Capoarea || y.Feature.Type == FeatureType.AdminGlobal),
|
||||
includi: x => x.Include(y => y.Permessi).ThenInclude(z => z.Feature));
|
||||
|
||||
isAdmin = ruolo?.Permessi.Where(x => x.Eliminato == false)?.Any(x => x.Feature.Type == FeatureType.AdminGlobal) ?? false;
|
||||
var a = ruolo?.Permessi.Where(x => x.Eliminato == false);
|
||||
iscrizione = await _managerService.IscrizioneEventoService.RicercaPer(
|
||||
x => x.Id == IscrizioneId,
|
||||
includi: x => x
|
||||
.Include(x => x.Comune)
|
||||
.Include(x => x.Provincia)
|
||||
.Include(y => y.Cliente)
|
||||
.Include(y => y.Evento)
|
||||
.Include(y => y.InvitoEvento));
|
||||
|
||||
if (IscrizioneId.GetValueOrDefault() != Guid.Empty)
|
||||
iscrizione = await _managerService.IscrizioneEventoService.RicercaPer(x => x.Id == IscrizioneId, includi: x => x.Include(x => x.Comune).Include(x => x.Provincia).Include(y => y.Cliente).Include(y => y.Evento).Include(y => y.InvitoEvento));
|
||||
else
|
||||
iscrizione = new IscrizioneEventoViewModel();
|
||||
|
||||
destinazioniList = (await _managerService.DestinazioneService.RicercaQueryable(filtro: x => x.ClienteId == iscrizione.ClienteId.GetValueOrDefault())).Select(x => (DestinazioneViewModel)x).ToList();
|
||||
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();
|
||||
comuniList = (await _managerService.ComuneIstatService.RicercaQueryable(x => x.ProvinciaIstatId == iscrizione.ProvinciaId.GetValueOrDefault())).Select(x => (ComuneIstatViewModel)x).ToList();
|
||||
|
||||
capoareaId = iscrizione.CapoareaId.GetValueOrDefault();
|
||||
capiarea = (await _managerService.UtenteService.RicercaQueryable(
|
||||
x => x.Eliminato == false && x.IsCapoarea, ordinamento: x => x.OrderBy(y => y.Cognome).ThenBy(z => z.Nome))).Select(x => (UtenteViewModel)x).ToList();
|
||||
x => x.Eliminato == false && x.IsCapoarea,
|
||||
ordinamento: x => x.OrderBy(y => y.Cognome).ThenBy(z => z.Nome)))
|
||||
.Select(x => (UtenteViewModel)x).ToList();
|
||||
|
||||
if (capoareaId != Guid.Empty)
|
||||
agenti = (await _managerService.UtenteService.RicercaQueryable(
|
||||
x => x.Eliminato == false && (isAdmin || x.CapoareaId == idClaim) && !x.IsCapoarea && x.CapoareaId == iscrizione.CapoareaId,
|
||||
includi: x => x.Include(y => y.Capoarea), ordinamento: x => x.OrderBy(y => y.Cognome).ThenBy(z => z.Nome))).Select(x => (UtenteViewModel)x).ToList();
|
||||
|
||||
inizioEvento = iscrizione.Evento?.DataDa ?? DateTime.Now.AddDays(-7);
|
||||
fineEvento = iscrizione.Evento?.DataA ?? DateTime.Now.AddDays(7);
|
||||
if (iscrizione.ProvinciaId.HasValue && iscrizione.CapoareaId.GetValueOrDefault() == Guid.Empty)
|
||||
{
|
||||
capoareaDaConfermare = true;
|
||||
var dbProv = await _managerService.ProvinciaIstatService.RicercaPer(x => x.Id == iscrizione.ProvinciaId);
|
||||
iscrizione.CapoareaId = dbProv.CapoareaId;
|
||||
}
|
||||
|
||||
if (iscrizione.CapoareaId.GetValueOrDefault() != Guid.Empty)
|
||||
{
|
||||
agenti = (await _managerService.UtenteService.RicercaQueryable(x => x.CapoareaId == iscrizione.CapoareaId,
|
||||
ordinamento:x => x.OrderBy(y => y.Cognome).ThenBy(z => z.Nome)))
|
||||
.Select(x => (UtenteViewModel)x).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Salva il cliente: recupera o crea il modello, applica i dati dalla UI,
|
||||
/// collega l’agente, crea una destinazione di default se è un nuovo cliente
|
||||
/// e poi salva usando l’ID dell’utente loggato, tornando alla lista clienti.
|
||||
/// </summary>
|
||||
private async Task onIscrizioneSave()
|
||||
{
|
||||
var model = await _managerService.IscrizioneEventoService.RicercaPer(x => x.Id == iscrizione.Id, solaLettura: false) ?? new IscrizioneEvento();
|
||||
try
|
||||
{
|
||||
if (iscrizione.CapoareaId.GetValueOrDefault() == Guid.Empty || iscrizione.AgenteId.GetValueOrDefault() == Guid.Empty)
|
||||
throw new Exception("Selezionare un capoarea e un agente");
|
||||
|
||||
model = iscrizione.Map(model);
|
||||
var model = await _managerService.IscrizioneEventoService.RicercaPer(x => x.Id == iscrizione.Id, solaLettura: false);
|
||||
if (model == null)
|
||||
throw new Exception("Si è verificato un errore");
|
||||
|
||||
model.AgenteId = iscrizione.AgenteId;
|
||||
model.CapoareaId = iscrizione.CapoareaId;
|
||||
|
||||
await _managerService.IscrizioneEventoService.Salva(model, idClaim);
|
||||
_navManager.NavigateTo("/management/Iscrizioni");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await _dialogService.Alert(ex.Message, "Errore");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Torna alla pagina di elenco clienti senza salvare altre modifiche.
|
||||
@ -272,41 +241,15 @@
|
||||
private async Task OnCapoareaChange(object value)
|
||||
{
|
||||
var capoId = Guid.Empty;
|
||||
capoareaDaConfermare = false;
|
||||
|
||||
if (Guid.TryParse(value.ToString(), out capoId))
|
||||
{
|
||||
capoareaId = capoId;
|
||||
iscrizione.AgenteId = null;
|
||||
|
||||
agenti = iscrizione.CapoareaId == idClaim || isAdmin
|
||||
? (await _managerService.UtenteService.RicercaQueryable(
|
||||
x => x.Eliminato == false && (isAdmin || x.CapoareaId == idClaim) && !x.IsCapoarea && x.CapoareaId == capoareaId,
|
||||
includi: x => x.Include(y => y.Capoarea),
|
||||
ordinamento: x => x.OrderBy(y => y.Cognome).ThenBy(z => z.Nome)))
|
||||
.Select(x => (UtenteViewModel)x).ToList()
|
||||
: [await _managerService.UtenteService.RicercaPer(x => x.Id == iscrizione.AgenteId)];
|
||||
agenti = (await _managerService.UtenteService.RicercaQueryable(x => x.CapoareaId == capoId,
|
||||
ordinamento:x => x.OrderBy(y => y.Cognome).ThenBy(z => z.Nome)))
|
||||
.Select(x => (UtenteViewModel)x).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggiorna la drop dei comuni in base alla provincia
|
||||
/// </summary>
|
||||
private async Task onProvinciaChanged(object args)
|
||||
{
|
||||
Guid parsed;
|
||||
Guid.TryParse(args.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.ProvinciaId = prov.Id;
|
||||
iscrizione.ComuneId = null;
|
||||
|
||||
comuniList = (await _managerService.ComuneIstatService.RicercaQueryable(x => x.Provincia == prov.Sigla))
|
||||
.Select(x => (ComuneIstatViewModel)x).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
@ -74,14 +74,6 @@
|
||||
<RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">Password</RadzenText>
|
||||
<RadzenPassword Style="width: 100%" aria-label="Password" @bind-Value="@utente.Password" />
|
||||
</div>
|
||||
|
||||
@if (utente.IsCapoarea)
|
||||
{
|
||||
<div class="col-3 mb-3">
|
||||
<RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">Provincia Associata</RadzenText>
|
||||
<RadzenDropDown Style="width: 100%" TValue="Guid?" @bind-Value=@utente.ProvinciaId Data=@province TextProperty="Description" ValueProperty="Key" Name="provinceDrop" />
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
@ -115,7 +107,6 @@
|
||||
private UtenteViewModel? utente { get; set; } = new();
|
||||
private List<UtenteViewModel> capoareaList { get; set; } = new();
|
||||
private List<RuoloViewModel> ruoli { get; set; } = new();
|
||||
private List<LookupViewModel<Guid?>> province { get; set; } = new();
|
||||
|
||||
private string pageTitle => utente?.Id == Guid.Empty ? "Nuovo utente" : "Modifica utente";
|
||||
|
||||
@ -135,8 +126,6 @@
|
||||
ruoli = (await _managerService.RuoloService.RicercaQueryable(x => x.Eliminato == false))
|
||||
.Select(x => (RuoloViewModel)x).ToList();
|
||||
|
||||
province = (await _managerService.ProvinciaIstatService.RicercaQueryable(x => x.Eliminato == false && (!x.UtentiList.Any() || x.UtentiList.Any(x => x.Id == utente.Id)))).Select(x => new LookupViewModel<Guid?>(x.Id, x.Provincia)).ToList();
|
||||
|
||||
var ruoliCapoarea = await _managerService.RuoloService.RicercaQueryable(
|
||||
x => x.Permessi.Any(y => y.Feature.Type == FeatureType.AdminGlobal || y.Feature.Type == FeatureType.Capoarea),
|
||||
includi: x => x.Include(y => y.Permessi).ThenInclude(z => z.Feature));
|
||||
|
||||
@ -20,5 +20,6 @@
|
||||
@inject IManagerService _managerService
|
||||
|
||||
@inject DialogService _dialogService
|
||||
@inject NotificationService _notificationService
|
||||
@inject NavigationManager _navManager
|
||||
@inject AuthenticationStateProvider _auth
|
||||
@ -93,20 +93,3 @@ public class ClienteViewModel
|
||||
return model;
|
||||
}
|
||||
}
|
||||
|
||||
public class TipologiaClienteViewModel
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string Nome { get; set; }
|
||||
|
||||
public static implicit operator TipologiaClienteViewModel(TipologiaCliente model)
|
||||
{
|
||||
return model == null
|
||||
? null
|
||||
: new TipologiaClienteViewModel()
|
||||
{
|
||||
Id = model.Id,
|
||||
Nome = model.Nome
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,6 +12,7 @@ public class IscrizioneEventoViewModel
|
||||
public InvitoEvento InvitoEvento { get; set; }
|
||||
public ClienteViewModel Cliente { get; set; }
|
||||
public Guid? ClienteId { get; set; }
|
||||
public DestinazioneViewModel Destinazione { get; set; }
|
||||
public Guid? DestinazioneId { get; set; }
|
||||
/*[Range(1, int.MaxValue, ErrorMessage = "Inserire un numero di partecipanti valido")]*/
|
||||
public int Partecipanti { get; set; }
|
||||
@ -40,6 +41,8 @@ public class IscrizioneEventoViewModel
|
||||
public string RagioneSociale { get; set; }
|
||||
[Required(ErrorMessage = "Il campo è obbigatorio")]
|
||||
public string EsperienzaConDAC { get; set; }
|
||||
|
||||
public TipologiaClienteViewModel TipologiaCliente { get; set; }
|
||||
[Required(ErrorMessage = "La tipologia è obbigatoria")]
|
||||
public Guid? TipologiaClienteId { get; set; }
|
||||
public RuoloTipo Ruolo { get; set; }
|
||||
@ -48,9 +51,20 @@ public class IscrizioneEventoViewModel
|
||||
public string? PartitaIva { get; set; }
|
||||
[Required(ErrorMessage = "E' necessario indicare la data di partecipazione")]
|
||||
public DateTime? GiornoPresenza { get; set; }
|
||||
public UtenteViewModel Agente { get; set; }
|
||||
public Guid? AgenteId { get; set; }
|
||||
public UtenteViewModel Capoarea { get; set; }
|
||||
public Guid? CapoareaId { get; set; }
|
||||
|
||||
public string ProvinciaInfo => $"{Provincia?.Provincia ?? "--Non indicato"}";
|
||||
public string ComuneInfo => $"{Comune?.Comune ?? "--Non indicato"}";
|
||||
public string TipologiaClienteInfo => $"{TipologiaCliente?.Nome ?? "--Non indicato"}";
|
||||
public string DestinazioneInfo => $"{Destinazione?.RagioneSociale ?? "--Non indicato"}";
|
||||
public string RuoloInfo => $"{new EnumUtils().GetDescription(Ruolo)}";
|
||||
public string GiornoPresenzaInfo => $"{GiornoPresenza.GetValueOrDefault():dd/MM/yyyy}";
|
||||
public string AgenteInfo => $"{Agente?.Info ?? "--Non indicato"}";
|
||||
public string CapoareaInfo => $"{Capoarea?.Info ?? "--Non indicato"}";
|
||||
|
||||
public IscrizioneEvento Map(IscrizioneEvento model)
|
||||
{
|
||||
model.Note = Note;
|
||||
@ -105,6 +119,9 @@ public class IscrizioneEventoViewModel
|
||||
GiornoPresenza = model.GiornoPresenza,
|
||||
CapoareaId = model.CapoareaId,
|
||||
AgenteId = model.AgenteId,
|
||||
TipologiaCliente = model.TipologiaCliente,
|
||||
Agente = model.Agente,
|
||||
Capoarea = model.Capoarea
|
||||
};
|
||||
}
|
||||
}
|
||||
20
StandManager/Model/TipologiaClienteViewModel.cs
Normal file
20
StandManager/Model/TipologiaClienteViewModel.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using StandManager.Domain.Entita;
|
||||
|
||||
namespace StandManager.Model;
|
||||
|
||||
public class TipologiaClienteViewModel
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string Nome { get; set; }
|
||||
|
||||
public static implicit operator TipologiaClienteViewModel(TipologiaCliente model)
|
||||
{
|
||||
return model == null
|
||||
? null
|
||||
: new TipologiaClienteViewModel()
|
||||
{
|
||||
Id = model.Id,
|
||||
Nome = model.Nome
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -19,7 +19,6 @@ public class UtenteViewModel
|
||||
public Guid? RuoloId { get; set; }
|
||||
public Guid? CapoareaId { get; set; }
|
||||
public bool IsCapoarea { get; set; }
|
||||
public Guid? ProvinciaId { get; set; }
|
||||
public string Info => $"{Nome} {Cognome}";
|
||||
|
||||
public static implicit operator UtenteViewModel(Utente? model)
|
||||
@ -33,8 +32,7 @@ public class UtenteViewModel
|
||||
Cognome = model.Cognome,
|
||||
RuoloId = model.Ruolo?.Id,
|
||||
CapoareaId = model.Capoarea?.Id,
|
||||
IsCapoarea = model.IsCapoarea,
|
||||
ProvinciaId = model.ProvinciaIstatId
|
||||
IsCapoarea = model.IsCapoarea
|
||||
};
|
||||
}
|
||||
|
||||
@ -44,7 +42,6 @@ public class UtenteViewModel
|
||||
model.Cognome = Cognome;
|
||||
model.Email = Email;
|
||||
model.IsCapoarea = IsCapoarea;
|
||||
model.ProvinciaIstatId = ProvinciaId;
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
7
Writerside.iml
Normal file
7
Writerside.iml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="EMPTY_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$/Writerside" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
84
script.sql
84
script.sql
@ -1,51 +1,55 @@
|
||||
BEGIN TRANSACTION;
|
||||
CREATE TABLE [MailQueue] (
|
||||
[Id] uniqueidentifier NOT NULL,
|
||||
[Subject] nvarchar(max) NOT NULL,
|
||||
[Body] nvarchar(max) NOT NULL,
|
||||
[ToList] nvarchar(max) NOT NULL,
|
||||
[Args] nvarchar(max) NULL,
|
||||
[From] int NOT NULL,
|
||||
[Sent] bit NOT NULL,
|
||||
[Error] nvarchar(max) NULL,
|
||||
[DataCreazione] datetime2 NOT NULL,
|
||||
[DataModifica] datetime2 NULL,
|
||||
[Eliminato] bit NOT NULL,
|
||||
[IdUtenteCreazione] uniqueidentifier NULL,
|
||||
[IdUtenteModifica] uniqueidentifier NULL,
|
||||
CONSTRAINT [PK_MailQueue] PRIMARY KEY ([Id]),
|
||||
CONSTRAINT [FK_MailQueue_Utente_IdUtenteCreazione] FOREIGN KEY ([IdUtenteCreazione]) REFERENCES [Utente] ([Id]),
|
||||
CONSTRAINT [FK_MailQueue_Utente_IdUtenteModifica] FOREIGN KEY ([IdUtenteModifica]) REFERENCES [Utente] ([Id])
|
||||
);
|
||||
|
||||
CREATE INDEX [IX_MailQueue_IdUtenteCreazione] ON [MailQueue] ([IdUtenteCreazione]);
|
||||
|
||||
CREATE INDEX [IX_MailQueue_IdUtenteModifica] ON [MailQueue] ([IdUtenteModifica]);
|
||||
DROP TABLE [IscrizioneEventoPerMail];
|
||||
|
||||
INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion])
|
||||
VALUES (N'20260109133732_MailQueue', N'9.0.11');
|
||||
VALUES (N'20260122105724_Rimozione_IscrizioneEventoPerMail', N'9.0.11');
|
||||
|
||||
CREATE TABLE [IscrizioneEventoPerMail] (
|
||||
[Id] uniqueidentifier NOT NULL,
|
||||
[Mail] nvarchar(max) NOT NULL,
|
||||
[Processata] bit NOT NULL,
|
||||
[Inviata] bit NOT NULL,
|
||||
[DataCreazione] datetime2 NOT NULL,
|
||||
[DataModifica] datetime2 NULL,
|
||||
[Eliminato] bit NOT NULL,
|
||||
[IdUtenteCreazione] uniqueidentifier NULL,
|
||||
[IdUtenteModifica] uniqueidentifier NULL,
|
||||
CONSTRAINT [PK_IscrizioneEventoPerMail] PRIMARY KEY ([Id]),
|
||||
CONSTRAINT [FK_IscrizioneEventoPerMail_Utente_IdUtenteCreazione] FOREIGN KEY ([IdUtenteCreazione]) REFERENCES [Utente] ([Id]),
|
||||
CONSTRAINT [FK_IscrizioneEventoPerMail_Utente_IdUtenteModifica] FOREIGN KEY ([IdUtenteModifica]) REFERENCES [Utente] ([Id])
|
||||
);
|
||||
ALTER TABLE [Utente] ADD [ProvinciaIstatId] uniqueidentifier NULL;
|
||||
|
||||
CREATE INDEX [IX_IscrizioneEventoPerMail_IdUtenteCreazione] ON [IscrizioneEventoPerMail] ([IdUtenteCreazione]);
|
||||
ALTER TABLE [IscrizioneEvento] ADD [AgenteId] uniqueidentifier NULL;
|
||||
|
||||
CREATE INDEX [IX_IscrizioneEventoPerMail_IdUtenteModifica] ON [IscrizioneEventoPerMail] ([IdUtenteModifica]);
|
||||
ALTER TABLE [IscrizioneEvento] ADD [CapoareaId] uniqueidentifier NULL;
|
||||
|
||||
CREATE INDEX [IX_Utente_ProvinciaIstatId] ON [Utente] ([ProvinciaIstatId]);
|
||||
|
||||
CREATE INDEX [IX_IscrizioneEvento_AgenteId] ON [IscrizioneEvento] ([AgenteId]);
|
||||
|
||||
CREATE INDEX [IX_IscrizioneEvento_CapoareaId] ON [IscrizioneEvento] ([CapoareaId]);
|
||||
|
||||
ALTER TABLE [IscrizioneEvento] ADD CONSTRAINT [FK_IscrizioneEvento_Utente_AgenteId] FOREIGN KEY ([AgenteId]) REFERENCES [Utente] ([Id]);
|
||||
|
||||
ALTER TABLE [IscrizioneEvento] ADD CONSTRAINT [FK_IscrizioneEvento_Utente_CapoareaId] FOREIGN KEY ([CapoareaId]) REFERENCES [Utente] ([Id]);
|
||||
|
||||
ALTER TABLE [Utente] ADD CONSTRAINT [FK_Utente_Province_ProvinciaIstatId] FOREIGN KEY ([ProvinciaIstatId]) REFERENCES [Province] ([Id]);
|
||||
|
||||
INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion])
|
||||
VALUES (N'20260120130758_IscrizioneEventoPerMail', N'9.0.11');
|
||||
VALUES (N'20260204162205_CapiareaAgentiInIscrizioneEvento', N'9.0.11');
|
||||
|
||||
ALTER TABLE [Province] ADD [CapoareaDaVerificare] bit NOT NULL DEFAULT CAST(0 AS bit);
|
||||
|
||||
INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion])
|
||||
VALUES (N'20260205095709_CapoareaDaVerificareInProvincia', N'9.0.11');
|
||||
|
||||
ALTER TABLE [Utente] DROP CONSTRAINT [FK_Utente_Province_ProvinciaIstatId];
|
||||
|
||||
DROP INDEX [IX_Utente_ProvinciaIstatId] ON [Utente];
|
||||
|
||||
DECLARE @var sysname;
|
||||
SELECT @var = [d].[name]
|
||||
FROM [sys].[default_constraints] [d]
|
||||
INNER JOIN [sys].[columns] [c] ON [d].[parent_column_id] = [c].[column_id] AND [d].[parent_object_id] = [c].[object_id]
|
||||
WHERE ([d].[parent_object_id] = OBJECT_ID(N'[Utente]') AND [c].[name] = N'ProvinciaIstatId');
|
||||
IF @var IS NOT NULL EXEC(N'ALTER TABLE [Utente] DROP CONSTRAINT [' + @var + '];');
|
||||
ALTER TABLE [Utente] DROP COLUMN [ProvinciaIstatId];
|
||||
|
||||
ALTER TABLE [Province] ADD [CapoareaId] uniqueidentifier NULL;
|
||||
|
||||
CREATE INDEX [IX_Province_CapoareaId] ON [Province] ([CapoareaId]);
|
||||
|
||||
ALTER TABLE [Province] ADD CONSTRAINT [FK_Province_Utente_CapoareaId] FOREIGN KEY ([CapoareaId]) REFERENCES [Utente] ([Id]);
|
||||
|
||||
INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion])
|
||||
VALUES (N'20260206070903_CapoareaSuProvIstat', N'9.0.11');
|
||||
|
||||
COMMIT;
|
||||
GO
|
||||
|
||||
Reference in New Issue
Block a user