diff --git a/TecniStamp/TecniStamp.Domain/Cliente.cs b/TecniStamp/TecniStamp.Domain/Cliente.cs index 9fcad04..4eae546 100644 --- a/TecniStamp/TecniStamp.Domain/Cliente.cs +++ b/TecniStamp/TecniStamp.Domain/Cliente.cs @@ -7,16 +7,14 @@ public class Cliente : EntitaBase { public string RagioneSociale { get; set; } public string PartitaIva { get; set; } - public string Paese { get; set; } public string Telefono { get; set; } public string Email { get; set; } - public string Indirizzo { get; set; } public string CAP { get; set; } public string Citta { get; set; } public string NumeroCivico { get; set; } public string Via { get; set; } public string Provincia { get; set; } - public string Note { get; set; } + public string? Note { get; set; } [ForeignKey(nameof(Comune))] public Guid? ComuneId { get; set; } diff --git a/TecniStamp/TecniStamp.Domain/Commessa.cs b/TecniStamp/TecniStamp.Domain/Commessa.cs index 069a694..79370b4 100644 --- a/TecniStamp/TecniStamp.Domain/Commessa.cs +++ b/TecniStamp/TecniStamp.Domain/Commessa.cs @@ -17,6 +17,9 @@ public class Commessa : EntitaBase public DateTime DataConsegnaPrevista { get; set; } public DateTime DataConsegna { get; set; } public CommessaStato Stato { get; set; } + + [InverseProperty(nameof(CommessaPosizione.Commessa))] + public List Posizioni { get; set; } } public enum CommessaStato diff --git a/TecniStamp/TecniStamp.Domain/CommessaPosizione.cs b/TecniStamp/TecniStamp.Domain/CommessaPosizione.cs new file mode 100644 index 0000000..5d1eb4f --- /dev/null +++ b/TecniStamp/TecniStamp.Domain/CommessaPosizione.cs @@ -0,0 +1,20 @@ +using System.ComponentModel.DataAnnotations.Schema; +using TecniStamp.Domain.Base; + +namespace TecniStamp.Domain; + +public class CommessaPosizione : EntitaBase +{ + public int Posizione { get; set; } + public string NumeroDisegno { get; set; } + public string NumeroArticolo { get; set; } + public string NumeroFabb { get; set; } + public string Descrizione { get; set; } + public string Categoria { get; set; } + public DateTime DataConsegna { get; set; } + public DateTime DataTerminePrevisto { get; set; } + + [ForeignKey(nameof(Commessa))] + public Guid? CommessaId { get; set; } + public Commessa Commessa { get; set; } +} \ No newline at end of file diff --git a/TecniStamp/TecniStamp.Infrastructure/DAL/Context/TecniStampDbContext.cs b/TecniStamp/TecniStamp.Infrastructure/DAL/Context/TecniStampDbContext.cs index 9a782b7..ae87f6a 100644 --- a/TecniStamp/TecniStamp.Infrastructure/DAL/Context/TecniStampDbContext.cs +++ b/TecniStamp/TecniStamp.Infrastructure/DAL/Context/TecniStampDbContext.cs @@ -11,6 +11,7 @@ public class TecniStampDbContext : OAServiceContext public DbSet Cliente { get; set; } public DbSet Commessa { get; set; } + public DbSet ComessaPosizione { get; set; } public DbSet ComuneIstat { get; set; } public DbSet Feature { get; set; } public DbSet Lavorazione { get; set; } diff --git a/TecniStamp/TecniStamp.Infrastructure/Migrations/20260203103529_Rimossi campi cliente.Designer.cs b/TecniStamp/TecniStamp.Infrastructure/Migrations/20260203103529_Rimossi campi cliente.Designer.cs new file mode 100644 index 0000000..633ca7e --- /dev/null +++ b/TecniStamp/TecniStamp.Infrastructure/Migrations/20260203103529_Rimossi campi cliente.Designer.cs @@ -0,0 +1,825 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using TecniStamp.Infrastructure.DAL.Context; + +#nullable disable + +namespace TecniStamp.Infrastructure.Migrations +{ + [DbContext(typeof(TecniStampDbContext))] + [Migration("20260203103529_Rimossi campi cliente")] + partial class Rimossicampicliente + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.11") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("TecniStamp.Domain.Cliente", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CAP") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Citta") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ComuneId") + .HasColumnType("uniqueidentifier"); + + b.Property("DataCreazione") + .HasColumnType("datetime2"); + + b.Property("DataModifica") + .HasColumnType("datetime2"); + + b.Property("Eliminato") + .HasColumnType("bit"); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IdUtenteCreazione") + .HasColumnType("uniqueidentifier"); + + b.Property("IdUtenteModifica") + .HasColumnType("uniqueidentifier"); + + b.Property("Note") + .HasColumnType("nvarchar(max)"); + + b.Property("NumeroCivico") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("PartitaIva") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Provincia") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("RagioneSociale") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Telefono") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Via") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ComuneId"); + + b.HasIndex("IdUtenteCreazione"); + + b.HasIndex("IdUtenteModifica"); + + b.ToTable("Cliente"); + }); + + modelBuilder.Entity("TecniStamp.Domain.Commessa", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AnnoCommessa") + .HasColumnType("int"); + + b.Property("ClienteId") + .HasColumnType("uniqueidentifier"); + + b.Property("CodiceCommessa") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("DataConsegna") + .HasColumnType("datetime2"); + + b.Property("DataConsegnaPrevista") + .HasColumnType("datetime2"); + + b.Property("DataCreazione") + .HasColumnType("datetime2"); + + b.Property("DataModifica") + .HasColumnType("datetime2"); + + b.Property("DataOrdine") + .HasColumnType("datetime2"); + + b.Property("Eliminato") + .HasColumnType("bit"); + + b.Property("IdUtenteCreazione") + .HasColumnType("uniqueidentifier"); + + b.Property("IdUtenteModifica") + .HasColumnType("uniqueidentifier"); + + b.Property("OrdineNr") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("OreTotali") + .HasColumnType("decimal(18,2)"); + + b.Property("RiferimentoCliente") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Stato") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ClienteId"); + + b.HasIndex("IdUtenteCreazione"); + + b.HasIndex("IdUtenteModifica"); + + b.ToTable("Commessa"); + }); + + modelBuilder.Entity("TecniStamp.Domain.ComuneIstat", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CodFisco") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Comune") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("DataCreazione") + .HasColumnType("datetime2"); + + b.Property("DataModifica") + .HasColumnType("datetime2"); + + b.Property("Eliminato") + .HasColumnType("bit"); + + b.Property("IdUtenteCreazione") + .HasColumnType("uniqueidentifier"); + + b.Property("IdUtenteModifica") + .HasColumnType("uniqueidentifier"); + + b.Property("Istat") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Prefisso") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Provincia") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ProvinciaIstatId") + .HasColumnType("uniqueidentifier"); + + b.Property("Regione") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("IdUtenteCreazione"); + + b.HasIndex("IdUtenteModifica"); + + b.HasIndex("ProvinciaIstatId"); + + b.ToTable("ComuneIstat"); + }); + + modelBuilder.Entity("TecniStamp.Domain.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DataCreazione") + .HasColumnType("datetime2"); + + b.Property("DataModifica") + .HasColumnType("datetime2"); + + b.Property("Descrizione") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Eliminato") + .HasColumnType("bit"); + + b.Property("IdUtenteCreazione") + .HasColumnType("uniqueidentifier"); + + b.Property("IdUtenteModifica") + .HasColumnType("uniqueidentifier"); + + b.Property("Nome") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Ordinamento") + .HasColumnType("int"); + + b.Property("SezioneId") + .HasColumnType("uniqueidentifier"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("IdUtenteCreazione"); + + b.HasIndex("IdUtenteModifica"); + + b.HasIndex("SezioneId"); + + b.ToTable("Feature"); + }); + + modelBuilder.Entity("TecniStamp.Domain.Lavorazione", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ChiaveEsterna") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Codice") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CodiceColore") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CostoOrario") + .HasColumnType("real"); + + b.Property("DataCreazione") + .HasColumnType("datetime2"); + + b.Property("DataModifica") + .HasColumnType("datetime2"); + + b.Property("Descrizione") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Eliminato") + .HasColumnType("bit"); + + b.Property("IdUtenteCreazione") + .HasColumnType("uniqueidentifier"); + + b.Property("IdUtenteModifica") + .HasColumnType("uniqueidentifier"); + + b.Property("Sovrapponibile") + .HasColumnType("bit"); + + b.HasKey("Id"); + + b.HasIndex("IdUtenteCreazione"); + + b.HasIndex("IdUtenteModifica"); + + b.ToTable("Lavorazione"); + }); + + modelBuilder.Entity("TecniStamp.Domain.Macchinario", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CodiceEsterno") + .HasColumnType("nvarchar(max)"); + + b.Property("ConfigurazioneJSON") + .HasColumnType("nvarchar(max)"); + + b.Property("ConfigurazionePercorso") + .HasColumnType("nvarchar(max)"); + + b.Property("DataCreazione") + .HasColumnType("datetime2"); + + b.Property("DataModifica") + .HasColumnType("datetime2"); + + b.Property("Descrizione") + .HasColumnType("nvarchar(max)"); + + b.Property("Eliminato") + .HasColumnType("bit"); + + b.Property("IdUtenteCreazione") + .HasColumnType("uniqueidentifier"); + + b.Property("IdUtenteModifica") + .HasColumnType("uniqueidentifier"); + + b.Property("Interscambio") + .HasColumnType("bit"); + + b.Property("Nome") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("IdUtenteCreazione"); + + b.HasIndex("IdUtenteModifica"); + + b.ToTable("Macchinario"); + }); + + modelBuilder.Entity("TecniStamp.Domain.Permission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DataCreazione") + .HasColumnType("datetime2"); + + b.Property("DataModifica") + .HasColumnType("datetime2"); + + b.Property("Eliminato") + .HasColumnType("bit"); + + b.Property("IdFeature") + .HasColumnType("uniqueidentifier"); + + b.Property("IdUtenteCreazione") + .HasColumnType("uniqueidentifier"); + + b.Property("IdUtenteModifica") + .HasColumnType("uniqueidentifier"); + + b.Property("RuoloId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("IdFeature"); + + b.HasIndex("IdUtenteCreazione"); + + b.HasIndex("IdUtenteModifica"); + + b.HasIndex("RuoloId"); + + b.ToTable("Permission"); + }); + + modelBuilder.Entity("TecniStamp.Domain.ProvinciaIstat", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DataCreazione") + .HasColumnType("datetime2"); + + b.Property("DataModifica") + .HasColumnType("datetime2"); + + b.Property("Eliminato") + .HasColumnType("bit"); + + b.Property("IdUtenteCreazione") + .HasColumnType("uniqueidentifier"); + + b.Property("IdUtenteModifica") + .HasColumnType("uniqueidentifier"); + + b.Property("Provincia") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Sigla") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("IdUtenteCreazione"); + + b.HasIndex("IdUtenteModifica"); + + b.ToTable("ProvinciaIstat"); + }); + + modelBuilder.Entity("TecniStamp.Domain.Ruolo", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DataCreazione") + .HasColumnType("datetime2"); + + b.Property("DataModifica") + .HasColumnType("datetime2"); + + b.Property("Eliminato") + .HasColumnType("bit"); + + b.Property("IdUtenteCreazione") + .HasColumnType("uniqueidentifier"); + + b.Property("IdUtenteModifica") + .HasColumnType("uniqueidentifier"); + + b.Property("Nome") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("IdUtenteCreazione"); + + b.HasIndex("IdUtenteModifica"); + + b.ToTable("Ruolo"); + }); + + modelBuilder.Entity("TecniStamp.Domain.Sezione", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Blank") + .HasColumnType("bit"); + + b.Property("DataCreazione") + .HasColumnType("datetime2"); + + b.Property("DataModifica") + .HasColumnType("datetime2"); + + b.Property("Eliminato") + .HasColumnType("bit"); + + b.Property("Icona") + .HasColumnType("nvarchar(max)"); + + b.Property("IdUtenteCreazione") + .HasColumnType("uniqueidentifier"); + + b.Property("IdUtenteModifica") + .HasColumnType("uniqueidentifier"); + + b.Property("Nome") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Ordinamento") + .HasColumnType("int"); + + b.Property("ParentId") + .HasColumnType("uniqueidentifier"); + + b.Property("Url") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("IdUtenteCreazione"); + + b.HasIndex("IdUtenteModifica"); + + b.HasIndex("ParentId"); + + b.ToTable("Sezione"); + }); + + modelBuilder.Entity("TecniStamp.Domain.Utente", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Cognome") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Costo") + .HasColumnType("decimal(18,2)"); + + b.Property("DataCreazione") + .HasColumnType("datetime2"); + + b.Property("DataModifica") + .HasColumnType("datetime2"); + + b.Property("Eliminato") + .HasColumnType("bit"); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IdUtenteCreazione") + .HasColumnType("uniqueidentifier"); + + b.Property("IdUtenteModifica") + .HasColumnType("uniqueidentifier"); + + b.Property("Nome") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Password") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("RuoloId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("IdUtenteCreazione"); + + b.HasIndex("IdUtenteModifica"); + + b.HasIndex("RuoloId"); + + b.ToTable("Utente"); + }); + + modelBuilder.Entity("TecniStamp.Domain.Cliente", b => + { + b.HasOne("TecniStamp.Domain.ComuneIstat", "Comune") + .WithMany() + .HasForeignKey("ComuneId"); + + b.HasOne("TecniStamp.Domain.Utente", "UtenteCreazione") + .WithMany() + .HasForeignKey("IdUtenteCreazione"); + + b.HasOne("TecniStamp.Domain.Utente", "UtenteModifica") + .WithMany() + .HasForeignKey("IdUtenteModifica"); + + b.Navigation("Comune"); + + b.Navigation("UtenteCreazione"); + + b.Navigation("UtenteModifica"); + }); + + modelBuilder.Entity("TecniStamp.Domain.Commessa", b => + { + b.HasOne("TecniStamp.Domain.Cliente", "Cliente") + .WithMany() + .HasForeignKey("ClienteId"); + + b.HasOne("TecniStamp.Domain.Utente", "UtenteCreazione") + .WithMany() + .HasForeignKey("IdUtenteCreazione"); + + b.HasOne("TecniStamp.Domain.Utente", "UtenteModifica") + .WithMany() + .HasForeignKey("IdUtenteModifica"); + + b.Navigation("Cliente"); + + b.Navigation("UtenteCreazione"); + + b.Navigation("UtenteModifica"); + }); + + modelBuilder.Entity("TecniStamp.Domain.ComuneIstat", b => + { + b.HasOne("TecniStamp.Domain.Utente", "UtenteCreazione") + .WithMany() + .HasForeignKey("IdUtenteCreazione"); + + b.HasOne("TecniStamp.Domain.Utente", "UtenteModifica") + .WithMany() + .HasForeignKey("IdUtenteModifica"); + + b.HasOne("TecniStamp.Domain.ProvinciaIstat", "ProvinciaIstat") + .WithMany() + .HasForeignKey("ProvinciaIstatId"); + + b.Navigation("ProvinciaIstat"); + + b.Navigation("UtenteCreazione"); + + b.Navigation("UtenteModifica"); + }); + + modelBuilder.Entity("TecniStamp.Domain.Feature", b => + { + b.HasOne("TecniStamp.Domain.Utente", "UtenteCreazione") + .WithMany() + .HasForeignKey("IdUtenteCreazione"); + + b.HasOne("TecniStamp.Domain.Utente", "UtenteModifica") + .WithMany() + .HasForeignKey("IdUtenteModifica"); + + b.HasOne("TecniStamp.Domain.Sezione", "Sezione") + .WithMany("Features") + .HasForeignKey("SezioneId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Sezione"); + + b.Navigation("UtenteCreazione"); + + b.Navigation("UtenteModifica"); + }); + + modelBuilder.Entity("TecniStamp.Domain.Lavorazione", b => + { + b.HasOne("TecniStamp.Domain.Utente", "UtenteCreazione") + .WithMany() + .HasForeignKey("IdUtenteCreazione"); + + b.HasOne("TecniStamp.Domain.Utente", "UtenteModifica") + .WithMany() + .HasForeignKey("IdUtenteModifica"); + + b.Navigation("UtenteCreazione"); + + b.Navigation("UtenteModifica"); + }); + + modelBuilder.Entity("TecniStamp.Domain.Macchinario", b => + { + b.HasOne("TecniStamp.Domain.Utente", "UtenteCreazione") + .WithMany() + .HasForeignKey("IdUtenteCreazione"); + + b.HasOne("TecniStamp.Domain.Utente", "UtenteModifica") + .WithMany() + .HasForeignKey("IdUtenteModifica"); + + b.Navigation("UtenteCreazione"); + + b.Navigation("UtenteModifica"); + }); + + modelBuilder.Entity("TecniStamp.Domain.Permission", b => + { + b.HasOne("TecniStamp.Domain.Feature", "Feature") + .WithMany() + .HasForeignKey("IdFeature") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("TecniStamp.Domain.Utente", "UtenteCreazione") + .WithMany() + .HasForeignKey("IdUtenteCreazione"); + + b.HasOne("TecniStamp.Domain.Utente", "UtenteModifica") + .WithMany() + .HasForeignKey("IdUtenteModifica"); + + b.HasOne("TecniStamp.Domain.Ruolo", "Ruolo") + .WithMany("Permessi") + .HasForeignKey("RuoloId"); + + b.Navigation("Feature"); + + b.Navigation("Ruolo"); + + b.Navigation("UtenteCreazione"); + + b.Navigation("UtenteModifica"); + }); + + modelBuilder.Entity("TecniStamp.Domain.ProvinciaIstat", b => + { + b.HasOne("TecniStamp.Domain.Utente", "UtenteCreazione") + .WithMany() + .HasForeignKey("IdUtenteCreazione"); + + b.HasOne("TecniStamp.Domain.Utente", "UtenteModifica") + .WithMany() + .HasForeignKey("IdUtenteModifica"); + + b.Navigation("UtenteCreazione"); + + b.Navigation("UtenteModifica"); + }); + + modelBuilder.Entity("TecniStamp.Domain.Ruolo", b => + { + b.HasOne("TecniStamp.Domain.Utente", "UtenteCreazione") + .WithMany() + .HasForeignKey("IdUtenteCreazione"); + + b.HasOne("TecniStamp.Domain.Utente", "UtenteModifica") + .WithMany() + .HasForeignKey("IdUtenteModifica"); + + b.Navigation("UtenteCreazione"); + + b.Navigation("UtenteModifica"); + }); + + modelBuilder.Entity("TecniStamp.Domain.Sezione", b => + { + b.HasOne("TecniStamp.Domain.Utente", "UtenteCreazione") + .WithMany() + .HasForeignKey("IdUtenteCreazione"); + + b.HasOne("TecniStamp.Domain.Utente", "UtenteModifica") + .WithMany() + .HasForeignKey("IdUtenteModifica"); + + b.HasOne("TecniStamp.Domain.Sezione", "Parent") + .WithMany() + .HasForeignKey("ParentId"); + + b.Navigation("Parent"); + + b.Navigation("UtenteCreazione"); + + b.Navigation("UtenteModifica"); + }); + + modelBuilder.Entity("TecniStamp.Domain.Utente", b => + { + b.HasOne("TecniStamp.Domain.Utente", "UtenteCreazione") + .WithMany() + .HasForeignKey("IdUtenteCreazione"); + + b.HasOne("TecniStamp.Domain.Utente", "UtenteModifica") + .WithMany() + .HasForeignKey("IdUtenteModifica"); + + b.HasOne("TecniStamp.Domain.Ruolo", "Ruolo") + .WithMany("Utenti") + .HasForeignKey("RuoloId"); + + b.Navigation("Ruolo"); + + b.Navigation("UtenteCreazione"); + + b.Navigation("UtenteModifica"); + }); + + modelBuilder.Entity("TecniStamp.Domain.Ruolo", b => + { + b.Navigation("Permessi"); + + b.Navigation("Utenti"); + }); + + modelBuilder.Entity("TecniStamp.Domain.Sezione", b => + { + b.Navigation("Features"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/TecniStamp/TecniStamp.Infrastructure/Migrations/20260203103529_Rimossi campi cliente.cs b/TecniStamp/TecniStamp.Infrastructure/Migrations/20260203103529_Rimossi campi cliente.cs new file mode 100644 index 0000000..428c10f --- /dev/null +++ b/TecniStamp/TecniStamp.Infrastructure/Migrations/20260203103529_Rimossi campi cliente.cs @@ -0,0 +1,58 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace TecniStamp.Infrastructure.Migrations +{ + /// + public partial class Rimossicampicliente : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Indirizzo", + table: "Cliente"); + + migrationBuilder.DropColumn( + name: "Paese", + table: "Cliente"); + + migrationBuilder.AlterColumn( + name: "Note", + table: "Cliente", + type: "nvarchar(max)", + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(max)"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "Note", + table: "Cliente", + type: "nvarchar(max)", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "nvarchar(max)", + oldNullable: true); + + migrationBuilder.AddColumn( + name: "Indirizzo", + table: "Cliente", + type: "nvarchar(max)", + nullable: false, + defaultValue: ""); + + migrationBuilder.AddColumn( + name: "Paese", + table: "Cliente", + type: "nvarchar(max)", + nullable: false, + defaultValue: ""); + } + } +} diff --git a/TecniStamp/TecniStamp.Infrastructure/Migrations/20260203110047_CommessaPosizione.Designer.cs b/TecniStamp/TecniStamp.Infrastructure/Migrations/20260203110047_CommessaPosizione.Designer.cs new file mode 100644 index 0000000..2f3d7d6 --- /dev/null +++ b/TecniStamp/TecniStamp.Infrastructure/Migrations/20260203110047_CommessaPosizione.Designer.cs @@ -0,0 +1,915 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using TecniStamp.Infrastructure.DAL.Context; + +#nullable disable + +namespace TecniStamp.Infrastructure.Migrations +{ + [DbContext(typeof(TecniStampDbContext))] + [Migration("20260203110047_CommessaPosizione")] + partial class CommessaPosizione + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.11") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("TecniStamp.Domain.Cliente", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CAP") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Citta") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ComuneId") + .HasColumnType("uniqueidentifier"); + + b.Property("DataCreazione") + .HasColumnType("datetime2"); + + b.Property("DataModifica") + .HasColumnType("datetime2"); + + b.Property("Eliminato") + .HasColumnType("bit"); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IdUtenteCreazione") + .HasColumnType("uniqueidentifier"); + + b.Property("IdUtenteModifica") + .HasColumnType("uniqueidentifier"); + + b.Property("Note") + .HasColumnType("nvarchar(max)"); + + b.Property("NumeroCivico") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("PartitaIva") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Provincia") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("RagioneSociale") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Telefono") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Via") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ComuneId"); + + b.HasIndex("IdUtenteCreazione"); + + b.HasIndex("IdUtenteModifica"); + + b.ToTable("Cliente"); + }); + + modelBuilder.Entity("TecniStamp.Domain.Commessa", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AnnoCommessa") + .HasColumnType("int"); + + b.Property("ClienteId") + .HasColumnType("uniqueidentifier"); + + b.Property("CodiceCommessa") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("DataConsegna") + .HasColumnType("datetime2"); + + b.Property("DataConsegnaPrevista") + .HasColumnType("datetime2"); + + b.Property("DataCreazione") + .HasColumnType("datetime2"); + + b.Property("DataModifica") + .HasColumnType("datetime2"); + + b.Property("DataOrdine") + .HasColumnType("datetime2"); + + b.Property("Eliminato") + .HasColumnType("bit"); + + b.Property("IdUtenteCreazione") + .HasColumnType("uniqueidentifier"); + + b.Property("IdUtenteModifica") + .HasColumnType("uniqueidentifier"); + + b.Property("OrdineNr") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("OreTotali") + .HasColumnType("decimal(18,2)"); + + b.Property("RiferimentoCliente") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Stato") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ClienteId"); + + b.HasIndex("IdUtenteCreazione"); + + b.HasIndex("IdUtenteModifica"); + + b.ToTable("Commessa"); + }); + + modelBuilder.Entity("TecniStamp.Domain.CommessaPosizione", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Categoria") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CommessaId") + .HasColumnType("uniqueidentifier"); + + b.Property("DataConsegna") + .HasColumnType("datetime2"); + + b.Property("DataCreazione") + .HasColumnType("datetime2"); + + b.Property("DataModifica") + .HasColumnType("datetime2"); + + b.Property("DataTerminePrevisto") + .HasColumnType("datetime2"); + + b.Property("Descrizione") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Eliminato") + .HasColumnType("bit"); + + b.Property("IdUtenteCreazione") + .HasColumnType("uniqueidentifier"); + + b.Property("IdUtenteModifica") + .HasColumnType("uniqueidentifier"); + + b.Property("NumeroArticolo") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("NumeroDisegno") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("NumeroFabb") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Posizione") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CommessaId"); + + b.HasIndex("IdUtenteCreazione"); + + b.HasIndex("IdUtenteModifica"); + + b.ToTable("ComessaPosizione"); + }); + + modelBuilder.Entity("TecniStamp.Domain.ComuneIstat", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CodFisco") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Comune") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("DataCreazione") + .HasColumnType("datetime2"); + + b.Property("DataModifica") + .HasColumnType("datetime2"); + + b.Property("Eliminato") + .HasColumnType("bit"); + + b.Property("IdUtenteCreazione") + .HasColumnType("uniqueidentifier"); + + b.Property("IdUtenteModifica") + .HasColumnType("uniqueidentifier"); + + b.Property("Istat") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Prefisso") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Provincia") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ProvinciaIstatId") + .HasColumnType("uniqueidentifier"); + + b.Property("Regione") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("IdUtenteCreazione"); + + b.HasIndex("IdUtenteModifica"); + + b.HasIndex("ProvinciaIstatId"); + + b.ToTable("ComuneIstat"); + }); + + modelBuilder.Entity("TecniStamp.Domain.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DataCreazione") + .HasColumnType("datetime2"); + + b.Property("DataModifica") + .HasColumnType("datetime2"); + + b.Property("Descrizione") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Eliminato") + .HasColumnType("bit"); + + b.Property("IdUtenteCreazione") + .HasColumnType("uniqueidentifier"); + + b.Property("IdUtenteModifica") + .HasColumnType("uniqueidentifier"); + + b.Property("Nome") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Ordinamento") + .HasColumnType("int"); + + b.Property("SezioneId") + .HasColumnType("uniqueidentifier"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("IdUtenteCreazione"); + + b.HasIndex("IdUtenteModifica"); + + b.HasIndex("SezioneId"); + + b.ToTable("Feature"); + }); + + modelBuilder.Entity("TecniStamp.Domain.Lavorazione", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ChiaveEsterna") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Codice") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CodiceColore") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CostoOrario") + .HasColumnType("real"); + + b.Property("DataCreazione") + .HasColumnType("datetime2"); + + b.Property("DataModifica") + .HasColumnType("datetime2"); + + b.Property("Descrizione") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Eliminato") + .HasColumnType("bit"); + + b.Property("IdUtenteCreazione") + .HasColumnType("uniqueidentifier"); + + b.Property("IdUtenteModifica") + .HasColumnType("uniqueidentifier"); + + b.Property("Sovrapponibile") + .HasColumnType("bit"); + + b.HasKey("Id"); + + b.HasIndex("IdUtenteCreazione"); + + b.HasIndex("IdUtenteModifica"); + + b.ToTable("Lavorazione"); + }); + + modelBuilder.Entity("TecniStamp.Domain.Macchinario", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CodiceEsterno") + .HasColumnType("nvarchar(max)"); + + b.Property("ConfigurazioneJSON") + .HasColumnType("nvarchar(max)"); + + b.Property("ConfigurazionePercorso") + .HasColumnType("nvarchar(max)"); + + b.Property("DataCreazione") + .HasColumnType("datetime2"); + + b.Property("DataModifica") + .HasColumnType("datetime2"); + + b.Property("Descrizione") + .HasColumnType("nvarchar(max)"); + + b.Property("Eliminato") + .HasColumnType("bit"); + + b.Property("IdUtenteCreazione") + .HasColumnType("uniqueidentifier"); + + b.Property("IdUtenteModifica") + .HasColumnType("uniqueidentifier"); + + b.Property("Interscambio") + .HasColumnType("bit"); + + b.Property("Nome") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("IdUtenteCreazione"); + + b.HasIndex("IdUtenteModifica"); + + b.ToTable("Macchinario"); + }); + + modelBuilder.Entity("TecniStamp.Domain.Permission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DataCreazione") + .HasColumnType("datetime2"); + + b.Property("DataModifica") + .HasColumnType("datetime2"); + + b.Property("Eliminato") + .HasColumnType("bit"); + + b.Property("IdFeature") + .HasColumnType("uniqueidentifier"); + + b.Property("IdUtenteCreazione") + .HasColumnType("uniqueidentifier"); + + b.Property("IdUtenteModifica") + .HasColumnType("uniqueidentifier"); + + b.Property("RuoloId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("IdFeature"); + + b.HasIndex("IdUtenteCreazione"); + + b.HasIndex("IdUtenteModifica"); + + b.HasIndex("RuoloId"); + + b.ToTable("Permission"); + }); + + modelBuilder.Entity("TecniStamp.Domain.ProvinciaIstat", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DataCreazione") + .HasColumnType("datetime2"); + + b.Property("DataModifica") + .HasColumnType("datetime2"); + + b.Property("Eliminato") + .HasColumnType("bit"); + + b.Property("IdUtenteCreazione") + .HasColumnType("uniqueidentifier"); + + b.Property("IdUtenteModifica") + .HasColumnType("uniqueidentifier"); + + b.Property("Provincia") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Sigla") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("IdUtenteCreazione"); + + b.HasIndex("IdUtenteModifica"); + + b.ToTable("ProvinciaIstat"); + }); + + modelBuilder.Entity("TecniStamp.Domain.Ruolo", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DataCreazione") + .HasColumnType("datetime2"); + + b.Property("DataModifica") + .HasColumnType("datetime2"); + + b.Property("Eliminato") + .HasColumnType("bit"); + + b.Property("IdUtenteCreazione") + .HasColumnType("uniqueidentifier"); + + b.Property("IdUtenteModifica") + .HasColumnType("uniqueidentifier"); + + b.Property("Nome") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("IdUtenteCreazione"); + + b.HasIndex("IdUtenteModifica"); + + b.ToTable("Ruolo"); + }); + + modelBuilder.Entity("TecniStamp.Domain.Sezione", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Blank") + .HasColumnType("bit"); + + b.Property("DataCreazione") + .HasColumnType("datetime2"); + + b.Property("DataModifica") + .HasColumnType("datetime2"); + + b.Property("Eliminato") + .HasColumnType("bit"); + + b.Property("Icona") + .HasColumnType("nvarchar(max)"); + + b.Property("IdUtenteCreazione") + .HasColumnType("uniqueidentifier"); + + b.Property("IdUtenteModifica") + .HasColumnType("uniqueidentifier"); + + b.Property("Nome") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Ordinamento") + .HasColumnType("int"); + + b.Property("ParentId") + .HasColumnType("uniqueidentifier"); + + b.Property("Url") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("IdUtenteCreazione"); + + b.HasIndex("IdUtenteModifica"); + + b.HasIndex("ParentId"); + + b.ToTable("Sezione"); + }); + + modelBuilder.Entity("TecniStamp.Domain.Utente", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Cognome") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Costo") + .HasColumnType("decimal(18,2)"); + + b.Property("DataCreazione") + .HasColumnType("datetime2"); + + b.Property("DataModifica") + .HasColumnType("datetime2"); + + b.Property("Eliminato") + .HasColumnType("bit"); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IdUtenteCreazione") + .HasColumnType("uniqueidentifier"); + + b.Property("IdUtenteModifica") + .HasColumnType("uniqueidentifier"); + + b.Property("Nome") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Password") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("RuoloId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("IdUtenteCreazione"); + + b.HasIndex("IdUtenteModifica"); + + b.HasIndex("RuoloId"); + + b.ToTable("Utente"); + }); + + modelBuilder.Entity("TecniStamp.Domain.Cliente", b => + { + b.HasOne("TecniStamp.Domain.ComuneIstat", "Comune") + .WithMany() + .HasForeignKey("ComuneId"); + + b.HasOne("TecniStamp.Domain.Utente", "UtenteCreazione") + .WithMany() + .HasForeignKey("IdUtenteCreazione"); + + b.HasOne("TecniStamp.Domain.Utente", "UtenteModifica") + .WithMany() + .HasForeignKey("IdUtenteModifica"); + + b.Navigation("Comune"); + + b.Navigation("UtenteCreazione"); + + b.Navigation("UtenteModifica"); + }); + + modelBuilder.Entity("TecniStamp.Domain.Commessa", b => + { + b.HasOne("TecniStamp.Domain.Cliente", "Cliente") + .WithMany() + .HasForeignKey("ClienteId"); + + b.HasOne("TecniStamp.Domain.Utente", "UtenteCreazione") + .WithMany() + .HasForeignKey("IdUtenteCreazione"); + + b.HasOne("TecniStamp.Domain.Utente", "UtenteModifica") + .WithMany() + .HasForeignKey("IdUtenteModifica"); + + b.Navigation("Cliente"); + + b.Navigation("UtenteCreazione"); + + b.Navigation("UtenteModifica"); + }); + + modelBuilder.Entity("TecniStamp.Domain.CommessaPosizione", b => + { + b.HasOne("TecniStamp.Domain.Commessa", "Commessa") + .WithMany("Posizioni") + .HasForeignKey("CommessaId"); + + b.HasOne("TecniStamp.Domain.Utente", "UtenteCreazione") + .WithMany() + .HasForeignKey("IdUtenteCreazione"); + + b.HasOne("TecniStamp.Domain.Utente", "UtenteModifica") + .WithMany() + .HasForeignKey("IdUtenteModifica"); + + b.Navigation("Commessa"); + + b.Navigation("UtenteCreazione"); + + b.Navigation("UtenteModifica"); + }); + + modelBuilder.Entity("TecniStamp.Domain.ComuneIstat", b => + { + b.HasOne("TecniStamp.Domain.Utente", "UtenteCreazione") + .WithMany() + .HasForeignKey("IdUtenteCreazione"); + + b.HasOne("TecniStamp.Domain.Utente", "UtenteModifica") + .WithMany() + .HasForeignKey("IdUtenteModifica"); + + b.HasOne("TecniStamp.Domain.ProvinciaIstat", "ProvinciaIstat") + .WithMany() + .HasForeignKey("ProvinciaIstatId"); + + b.Navigation("ProvinciaIstat"); + + b.Navigation("UtenteCreazione"); + + b.Navigation("UtenteModifica"); + }); + + modelBuilder.Entity("TecniStamp.Domain.Feature", b => + { + b.HasOne("TecniStamp.Domain.Utente", "UtenteCreazione") + .WithMany() + .HasForeignKey("IdUtenteCreazione"); + + b.HasOne("TecniStamp.Domain.Utente", "UtenteModifica") + .WithMany() + .HasForeignKey("IdUtenteModifica"); + + b.HasOne("TecniStamp.Domain.Sezione", "Sezione") + .WithMany("Features") + .HasForeignKey("SezioneId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Sezione"); + + b.Navigation("UtenteCreazione"); + + b.Navigation("UtenteModifica"); + }); + + modelBuilder.Entity("TecniStamp.Domain.Lavorazione", b => + { + b.HasOne("TecniStamp.Domain.Utente", "UtenteCreazione") + .WithMany() + .HasForeignKey("IdUtenteCreazione"); + + b.HasOne("TecniStamp.Domain.Utente", "UtenteModifica") + .WithMany() + .HasForeignKey("IdUtenteModifica"); + + b.Navigation("UtenteCreazione"); + + b.Navigation("UtenteModifica"); + }); + + modelBuilder.Entity("TecniStamp.Domain.Macchinario", b => + { + b.HasOne("TecniStamp.Domain.Utente", "UtenteCreazione") + .WithMany() + .HasForeignKey("IdUtenteCreazione"); + + b.HasOne("TecniStamp.Domain.Utente", "UtenteModifica") + .WithMany() + .HasForeignKey("IdUtenteModifica"); + + b.Navigation("UtenteCreazione"); + + b.Navigation("UtenteModifica"); + }); + + modelBuilder.Entity("TecniStamp.Domain.Permission", b => + { + b.HasOne("TecniStamp.Domain.Feature", "Feature") + .WithMany() + .HasForeignKey("IdFeature") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("TecniStamp.Domain.Utente", "UtenteCreazione") + .WithMany() + .HasForeignKey("IdUtenteCreazione"); + + b.HasOne("TecniStamp.Domain.Utente", "UtenteModifica") + .WithMany() + .HasForeignKey("IdUtenteModifica"); + + b.HasOne("TecniStamp.Domain.Ruolo", "Ruolo") + .WithMany("Permessi") + .HasForeignKey("RuoloId"); + + b.Navigation("Feature"); + + b.Navigation("Ruolo"); + + b.Navigation("UtenteCreazione"); + + b.Navigation("UtenteModifica"); + }); + + modelBuilder.Entity("TecniStamp.Domain.ProvinciaIstat", b => + { + b.HasOne("TecniStamp.Domain.Utente", "UtenteCreazione") + .WithMany() + .HasForeignKey("IdUtenteCreazione"); + + b.HasOne("TecniStamp.Domain.Utente", "UtenteModifica") + .WithMany() + .HasForeignKey("IdUtenteModifica"); + + b.Navigation("UtenteCreazione"); + + b.Navigation("UtenteModifica"); + }); + + modelBuilder.Entity("TecniStamp.Domain.Ruolo", b => + { + b.HasOne("TecniStamp.Domain.Utente", "UtenteCreazione") + .WithMany() + .HasForeignKey("IdUtenteCreazione"); + + b.HasOne("TecniStamp.Domain.Utente", "UtenteModifica") + .WithMany() + .HasForeignKey("IdUtenteModifica"); + + b.Navigation("UtenteCreazione"); + + b.Navigation("UtenteModifica"); + }); + + modelBuilder.Entity("TecniStamp.Domain.Sezione", b => + { + b.HasOne("TecniStamp.Domain.Utente", "UtenteCreazione") + .WithMany() + .HasForeignKey("IdUtenteCreazione"); + + b.HasOne("TecniStamp.Domain.Utente", "UtenteModifica") + .WithMany() + .HasForeignKey("IdUtenteModifica"); + + b.HasOne("TecniStamp.Domain.Sezione", "Parent") + .WithMany() + .HasForeignKey("ParentId"); + + b.Navigation("Parent"); + + b.Navigation("UtenteCreazione"); + + b.Navigation("UtenteModifica"); + }); + + modelBuilder.Entity("TecniStamp.Domain.Utente", b => + { + b.HasOne("TecniStamp.Domain.Utente", "UtenteCreazione") + .WithMany() + .HasForeignKey("IdUtenteCreazione"); + + b.HasOne("TecniStamp.Domain.Utente", "UtenteModifica") + .WithMany() + .HasForeignKey("IdUtenteModifica"); + + b.HasOne("TecniStamp.Domain.Ruolo", "Ruolo") + .WithMany("Utenti") + .HasForeignKey("RuoloId"); + + b.Navigation("Ruolo"); + + b.Navigation("UtenteCreazione"); + + b.Navigation("UtenteModifica"); + }); + + modelBuilder.Entity("TecniStamp.Domain.Commessa", b => + { + b.Navigation("Posizioni"); + }); + + modelBuilder.Entity("TecniStamp.Domain.Ruolo", b => + { + b.Navigation("Permessi"); + + b.Navigation("Utenti"); + }); + + modelBuilder.Entity("TecniStamp.Domain.Sezione", b => + { + b.Navigation("Features"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/TecniStamp/TecniStamp.Infrastructure/Migrations/20260203110047_CommessaPosizione.cs b/TecniStamp/TecniStamp.Infrastructure/Migrations/20260203110047_CommessaPosizione.cs new file mode 100644 index 0000000..ba05783 --- /dev/null +++ b/TecniStamp/TecniStamp.Infrastructure/Migrations/20260203110047_CommessaPosizione.cs @@ -0,0 +1,77 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace TecniStamp.Infrastructure.Migrations +{ + /// + public partial class CommessaPosizione : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "ComessaPosizione", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + Posizione = table.Column(type: "int", nullable: false), + NumeroDisegno = table.Column(type: "nvarchar(max)", nullable: false), + NumeroArticolo = table.Column(type: "nvarchar(max)", nullable: false), + NumeroFabb = table.Column(type: "nvarchar(max)", nullable: false), + Descrizione = table.Column(type: "nvarchar(max)", nullable: false), + Categoria = table.Column(type: "nvarchar(max)", nullable: false), + DataConsegna = table.Column(type: "datetime2", nullable: false), + DataTerminePrevisto = table.Column(type: "datetime2", nullable: false), + CommessaId = table.Column(type: "uniqueidentifier", nullable: true), + DataCreazione = table.Column(type: "datetime2", nullable: false), + DataModifica = table.Column(type: "datetime2", nullable: true), + Eliminato = table.Column(type: "bit", nullable: false), + IdUtenteCreazione = table.Column(type: "uniqueidentifier", nullable: true), + IdUtenteModifica = table.Column(type: "uniqueidentifier", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_ComessaPosizione", x => x.Id); + table.ForeignKey( + name: "FK_ComessaPosizione_Commessa_CommessaId", + column: x => x.CommessaId, + principalTable: "Commessa", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_ComessaPosizione_Utente_IdUtenteCreazione", + column: x => x.IdUtenteCreazione, + principalTable: "Utente", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_ComessaPosizione_Utente_IdUtenteModifica", + column: x => x.IdUtenteModifica, + principalTable: "Utente", + principalColumn: "Id"); + }); + + migrationBuilder.CreateIndex( + name: "IX_ComessaPosizione_CommessaId", + table: "ComessaPosizione", + column: "CommessaId"); + + migrationBuilder.CreateIndex( + name: "IX_ComessaPosizione_IdUtenteCreazione", + table: "ComessaPosizione", + column: "IdUtenteCreazione"); + + migrationBuilder.CreateIndex( + name: "IX_ComessaPosizione_IdUtenteModifica", + table: "ComessaPosizione", + column: "IdUtenteModifica"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "ComessaPosizione"); + } + } +} diff --git a/TecniStamp/TecniStamp.Infrastructure/Migrations/TecniStampDbContextModelSnapshot.cs b/TecniStamp/TecniStamp.Infrastructure/Migrations/TecniStampDbContextModelSnapshot.cs index 2a4bb0d..2fc846d 100644 --- a/TecniStamp/TecniStamp.Infrastructure/Migrations/TecniStampDbContextModelSnapshot.cs +++ b/TecniStamp/TecniStamp.Infrastructure/Migrations/TecniStampDbContextModelSnapshot.cs @@ -58,22 +58,13 @@ namespace TecniStamp.Infrastructure.Migrations b.Property("IdUtenteModifica") .HasColumnType("uniqueidentifier"); - b.Property("Indirizzo") - .IsRequired() - .HasColumnType("nvarchar(max)"); - b.Property("Note") - .IsRequired() .HasColumnType("nvarchar(max)"); b.Property("NumeroCivico") .IsRequired() .HasColumnType("nvarchar(max)"); - b.Property("Paese") - .IsRequired() - .HasColumnType("nvarchar(max)"); - b.Property("PartitaIva") .IsRequired() .HasColumnType("nvarchar(max)"); @@ -170,6 +161,70 @@ namespace TecniStamp.Infrastructure.Migrations b.ToTable("Commessa"); }); + modelBuilder.Entity("TecniStamp.Domain.CommessaPosizione", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Categoria") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CommessaId") + .HasColumnType("uniqueidentifier"); + + b.Property("DataConsegna") + .HasColumnType("datetime2"); + + b.Property("DataCreazione") + .HasColumnType("datetime2"); + + b.Property("DataModifica") + .HasColumnType("datetime2"); + + b.Property("DataTerminePrevisto") + .HasColumnType("datetime2"); + + b.Property("Descrizione") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Eliminato") + .HasColumnType("bit"); + + b.Property("IdUtenteCreazione") + .HasColumnType("uniqueidentifier"); + + b.Property("IdUtenteModifica") + .HasColumnType("uniqueidentifier"); + + b.Property("NumeroArticolo") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("NumeroDisegno") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("NumeroFabb") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Posizione") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CommessaId"); + + b.HasIndex("IdUtenteCreazione"); + + b.HasIndex("IdUtenteModifica"); + + b.ToTable("ComessaPosizione"); + }); + modelBuilder.Entity("TecniStamp.Domain.ComuneIstat", b => { b.Property("Id") @@ -639,6 +694,27 @@ namespace TecniStamp.Infrastructure.Migrations b.Navigation("UtenteModifica"); }); + modelBuilder.Entity("TecniStamp.Domain.CommessaPosizione", b => + { + b.HasOne("TecniStamp.Domain.Commessa", "Commessa") + .WithMany("Posizioni") + .HasForeignKey("CommessaId"); + + b.HasOne("TecniStamp.Domain.Utente", "UtenteCreazione") + .WithMany() + .HasForeignKey("IdUtenteCreazione"); + + b.HasOne("TecniStamp.Domain.Utente", "UtenteModifica") + .WithMany() + .HasForeignKey("IdUtenteModifica"); + + b.Navigation("Commessa"); + + b.Navigation("UtenteCreazione"); + + b.Navigation("UtenteModifica"); + }); + modelBuilder.Entity("TecniStamp.Domain.ComuneIstat", b => { b.HasOne("TecniStamp.Domain.Utente", "UtenteCreazione") @@ -814,6 +890,11 @@ namespace TecniStamp.Infrastructure.Migrations b.Navigation("UtenteModifica"); }); + modelBuilder.Entity("TecniStamp.Domain.Commessa", b => + { + b.Navigation("Posizioni"); + }); + modelBuilder.Entity("TecniStamp.Domain.Ruolo", b => { b.Navigation("Permessi"); diff --git a/TecniStamp/TecniStamp/Components/Layout/MainLayout.razor b/TecniStamp/TecniStamp/Components/Layout/MainLayout.razor index f1ef179..119d4e8 100644 --- a/TecniStamp/TecniStamp/Components/Layout/MainLayout.razor +++ b/TecniStamp/TecniStamp/Components/Layout/MainLayout.razor @@ -4,15 +4,15 @@ -
- -
+ +
diff --git a/TecniStamp/TecniStamp/Components/Pages/Anagrafiche/Ruoli.razor b/TecniStamp/TecniStamp/Components/Pages/Anagrafiche/Ruoli.razor index ad3318c..ea6374c 100644 --- a/TecniStamp/TecniStamp/Components/Pages/Anagrafiche/Ruoli.razor +++ b/TecniStamp/TecniStamp/Components/Pages/Anagrafiche/Ruoli.razor @@ -16,7 +16,7 @@ diff --git a/TecniStamp/TecniStamp/Components/Pages/Anagrafiche/Ruoli_Edit.razor b/TecniStamp/TecniStamp/Components/Pages/Anagrafiche/Ruoli_Edit.razor index cb486e1..3c575a4 100644 --- a/TecniStamp/TecniStamp/Components/Pages/Anagrafiche/Ruoli_Edit.razor +++ b/TecniStamp/TecniStamp/Components/Pages/Anagrafiche/Ruoli_Edit.razor @@ -11,88 +11,75 @@ @pageTitle + -
- - - - -
-
- +
+
+
-
-
-
-
- - +
+
+
+ + -
-
-
- Descrizione - - -
-
- -
-
- -
-
- -
+
+
+
+ Descrizione + +
- + +
+
+ +
+
+ +
+
+
+ +
+ +
+
+
+ + + + + + + + + + + + +
- -
-
- - - - - - - - - - - - -
-
-
-
- +
@code { [Parameter] public Guid? RuoloId { get; set; } + public List BreadcrumbList { get; set; } = new(); public RuoloViewModel Model { get; set; } = new(); private List permessi { get; set; } = new(); diff --git a/TecniStamp/TecniStamp/Components/Pages/Commesse/Commesse.razor b/TecniStamp/TecniStamp/Components/Pages/Commesse/Commesse.razor index 6c6b06e..d41cfc0 100644 --- a/TecniStamp/TecniStamp/Components/Pages/Commesse/Commesse.razor +++ b/TecniStamp/TecniStamp/Components/Pages/Commesse/Commesse.razor @@ -4,6 +4,8 @@ @using TecniStamp.Model.Common @using TecniStamp.Utils +@rendermode InteractiveServer + Commesse @@ -24,15 +26,37 @@ + - - - - - - - - + + + + + + + + + + + +
@@ -48,6 +72,9 @@ public List CommesseList { get; set; } = new(); RadzenDataGrid commesseGrid; + private bool canEdit = false; + private bool canDelete = false; + protected override async Task OnInitializedAsync() { await base.OnInitializedAsync(); @@ -56,7 +83,32 @@ CommesseList = (await _managerService.CommessaService.RicercaQueryable( x => x.Eliminato == false, - includi:x => x.Include(y => y.Cliente).ThenInclude(z => z.Comune).ThenInclude(w => w.ProvinciaIstat))) + includi:x => x.Include(y => y.Cliente).ThenInclude(z => z.Comune).ThenInclude(w => w.ProvinciaIstat) + .Include(x => x.Posizioni))) .Select(x => (CommessaViewModel)x).ToList(); + canEdit = await MembershipUtils.CheckPermission(_auth, _managerService, "Commesse_Edit"); + canDelete = await MembershipUtils.CheckPermission(_auth, _managerService, "Commesse_Delete"); } + + private async Task EditRow(CommessaViewModel commessa) + { + _navManager.NavigateTo($"/commesse/modifica/{commessa.Id}"); + } + + private async Task DeleteRow(CommessaViewModel commessa) + { + var ok = await _dialogService.Confirm($"Vuoi davvero eliminare la commessa {commessa.CodiceCommessa}?", "Conferma eliminazione", new ConfirmOptions { OkButtonText = "Sì", CancelButtonText = "No", Width = "400px" }); + + if (ok == true) + { + await _managerService.CommessaService.Elimina(commessa.Id, await MembershipUtils.GetUserId(_auth)); + CommesseList = (await _managerService.CommessaService.RicercaQueryable( + x => x.Eliminato == false, + includi:x => x.Include(y => y.Cliente).ThenInclude(z => z.Comune).ThenInclude(w => w.ProvinciaIstat) + .Include(x => x.Posizioni))) + .Select(x => (CommessaViewModel)x).ToList(); + } + } + +void ShowTooltip(ElementReference elementReference, TooltipOptions options = null) => _tooltipService.Open(elementReference, options.Text, options); } \ No newline at end of file diff --git a/TecniStamp/TecniStamp/Components/Pages/Commesse/Commesse_Edit.razor b/TecniStamp/TecniStamp/Components/Pages/Commesse/Commesse_Edit.razor new file mode 100644 index 0000000..0edd4c6 --- /dev/null +++ b/TecniStamp/TecniStamp/Components/Pages/Commesse/Commesse_Edit.razor @@ -0,0 +1,55 @@ +@page "/commesse/modifica" +@page "/commesse/modifica/{CommessaId:guid}" + +@rendermode InteractiveServer + +@using Microsoft.EntityFrameworkCore +@using TecniStamp.Model.Commesse +@using TecniStamp.Model.Common +@using TecniStamp.Utils + +Commesse + + +
+
+
+
+
+ + + + + + + + + + + +
+
+
+
+
+ +@code { + [Parameter] public Guid? CommessaId { get; set; } + + public List BreadcrumbList { get; set; } = new(); + + public CommessaViewModel Model { get; set; } = new(); + + protected override async Task OnInitializedAsync() + { + await base.OnInitializedAsync(); + + Model = CommessaId.GetValueOrDefault() == Guid.Empty + ? new CommessaViewModel() + : await _managerService.CommessaService.RicercaPer(x => x.Id == CommessaId, + includi:x => x.Include(y => y.Cliente).Include(y => y.Posizioni)); + + BreadcrumbList = await BreadcrumbUtils.BuildBreadcrumbByFeature(_managerService, "Commesse_Info", "Modifica", "/commesse"); + } + +} \ No newline at end of file diff --git a/TecniStamp/TecniStamp/Components/Pages/Commesse/Commesse_Edit_InfoGenerali.razor b/TecniStamp/TecniStamp/Components/Pages/Commesse/Commesse_Edit_InfoGenerali.razor new file mode 100644 index 0000000..56ca312 --- /dev/null +++ b/TecniStamp/TecniStamp/Components/Pages/Commesse/Commesse_Edit_InfoGenerali.razor @@ -0,0 +1,6 @@ +@using TecniStamp.Model.Commesse +

@Model.CodiceCommessa

+ +@code { + [Parameter] public CommessaViewModel Model { get; set; } = new(); +} \ No newline at end of file diff --git a/TecniStamp/TecniStamp/Components/Pages/Commesse/Commesse_Edit_OE.razor b/TecniStamp/TecniStamp/Components/Pages/Commesse/Commesse_Edit_OE.razor new file mode 100644 index 0000000..512b43a --- /dev/null +++ b/TecniStamp/TecniStamp/Components/Pages/Commesse/Commesse_Edit_OE.razor @@ -0,0 +1,6 @@ +@using TecniStamp.Model.Commesse +

Commesse_Edit_OE

+ +@code { + [Parameter] public CommessaViewModel Model { get; set; } = new(); +} \ No newline at end of file diff --git a/TecniStamp/TecniStamp/Components/Widget/Breadcrumb.razor b/TecniStamp/TecniStamp/Components/Widget/Breadcrumb.razor index fed5bee..afc68c0 100644 --- a/TecniStamp/TecniStamp/Components/Widget/Breadcrumb.razor +++ b/TecniStamp/TecniStamp/Components/Widget/Breadcrumb.razor @@ -1,5 +1,5 @@ @using TecniStamp.Model.Common -
+