Update preliminare DB + migration relativa

This commit is contained in:
Samuele Locatelli
2023-03-22 17:37:37 +01:00
parent 4d348afa47
commit cc83fc775e
14 changed files with 1112 additions and 9 deletions
+46
View File
@@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WebDoorCreator.Core
{
public class ConfigItem
{
/// <summary>
/// Nome dell'item
/// </summary>
public string Name { get; set; } = "";
/// <summary>
/// Tipo dell'item (es: string, int, double, list...)
/// </summary>
public string Type { get; set; } = "";
/// <summary>
/// Valore dell'item
/// </summary>
public string ValString { get; set; } = "";
public int ValInt
{
get
{
int answ = 0;
int.TryParse(ValString, out answ);
return answ;
}
}
public double ValDouble
{
get
{
double answ = 0;
double.TryParse(ValString, out answ);
return answ;
}
}
}
}
+1
View File
@@ -21,5 +21,6 @@
ApprovedByCustomer,
InProduction
}
}
}
+1 -1
View File
@@ -12,7 +12,7 @@ using System.Threading.Tasks;
namespace WebDoorCreator.Data.DbModels
{
/// <summary>
/// Tabella dati Orders
/// Tabella dati Door
/// </summary>
[Table("Door")]
public class DoorModel
@@ -0,0 +1,69 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace WebDoorCreator.Data.DbModels
{
/// <summary>
/// Tabella dati operation CONCRETE collegate alla porta
/// </summary>
[Table("DoorOp")]
public class DoorOpModel
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int DoorOpId { get; set; }
/// <summary>
/// porta di riferimento
/// </summary>
public int DoorId { get; set; } = 0;
/// <summary>
/// Tipo astratto di riferimento
/// </summary>
public int DoorOpTypId { get; set; } = 0;
/// <summary>
/// Descrizione
/// </summary>
public string Description { get; set; } = "";
/// <summary>
/// Data inserimento ordine
/// </summary>
public DateTime DateIns { get; set; } = DateTime.Now;
/// <summary>
/// Codice utente che ha creato
/// </summary>
public string UserIdIns { get; set; } = "";
/// <summary>
/// Data (ultima) modifica ordine
/// </summary>
public DateTime DateMod { get; set; } = DateTime.Now;
/// <summary>
/// Codice utente che ha creato
/// </summary>
public string UserIdMod { get; set; } = "";
/// <summary>
/// Oggetto Json per specifica configurazione VALORIZZATO
/// </summary>
public string JsoncConfigVal { get; set; } = "";
[ForeignKey("DoorId")]
public virtual DoorModel? DoorNav { get; set; }
[ForeignKey("DoorOpTypId")]
public virtual DoorOpTypeModel? DoorOpTypeNav { get; set; }
}
}
@@ -0,0 +1,112 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace WebDoorCreator.Data.DbModels
{
/// <summary>
/// Tabella dati Door Operation Type (astratte)
/// </summary>
[Table("DoorOpType")]
public class DoorOpTypeModel
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int DoorOpTypId { get; set; }
/// <summary>
/// Codice univoco dell'operazione da svolgere (calcolato, idealmente 4 char da 36 val 0..Z)
/// </summary>
public string OpCode { get; set; } = "";
/// <summary>
/// Descrizione
/// </summary>
public string Description { get; set; } = "";
/// <summary>
/// Indica se ci sia un hardware correlato all'operazione
/// </summary>
public bool HasHw { get; set; } = true;
/// <summary>
/// Indica se sia un oggetto concreto (= con un file, che si può produrre) o abstract (ha figli, è un gruppo logico)
/// </summary>
public bool IsConcrete { get; set; } = true;
/// <summary>
/// Codice dell'HW collegato
/// </summary>
public string HwCode { get; set; } = "";
/// <summary>
/// Descrizione dell'HW collegato
/// </summary>
public string HwDescription { get; set; } = "";
/// <summary>
/// Path folder/file di riferimento
/// </summary>
public string FPath { get; set; } = "";
/// <summary>
/// Idx univoco dell'elemento parent (se 0 = root)
/// </summary>
public int ParentDoorOpId { get; set; } = 0;
/// <summary>
/// Codice tipo treeView
/// </summary>
public string TreeCode { get; set; } = "";
/// <summary>
/// Oggetto Json per specifica configurazione (template)
/// </summary>
public string JsoncConfig { get; set; } = "";
/// <summary>
/// Codice esterno (opzionale)
/// </summary>
public string ExtOpCode { get; set; } = "";
/// <summary>
/// Descrizione esterna (opzionale)
/// </summary>
public string ExtDescript { get; set; } = "";
/// <summary>
/// Revisione dell'item
/// </summary>
public string Rev { get; set; } = "";
/// <summary>
/// Inizio validità item
/// </summary>
public DateTime ValidFrom { get; set; } = new DateTime(2000, 1, 1);
/// <summary>
/// Fine validità item
/// </summary>
public DateTime ValidUntil { get; set; } = new DateTime(3000, 1, 1);
/// <summary>
/// Check validità item
/// </summary>
[NotMapped]
public bool IsActive
{
get => DateTime.Today >= ValidFrom && DateTime.Today <= ValidUntil;
}
#if false
[ForeignKey("ParentDoorOpId")]
public virtual DoorOpTypeModel? ParentNav { get; set; }
#endif
}
}
@@ -12,7 +12,7 @@ using System.Threading.Tasks;
namespace WebDoorCreator.Data.DbModels
{
/// <summary>
/// Tabella dati Orders
/// Tabella dati Door Type
/// </summary>
[Table("DoorType")]
public class DoorTypeModel
@@ -0,0 +1,635 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using WebDoorCreator.Data;
#nullable disable
namespace WebDoorCreator.Data.Migrations.WDCData
{
[DbContext(typeof(WDCDataContext))]
[Migration("20230322163704_DoorOpModelCreation")]
partial class DoorOpModelCreation
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.UseCollation("Latin1_General_CI_AS")
.HasAnnotation("ProductVersion", "6.0.14")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
modelBuilder.Entity("WebDoorCreator.Data.DbModels.AspNetRoles", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("nvarchar(450)");
b.Property<string>("ConcurrencyStamp")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("NormalizedName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("AspNetRoles", null, t => t.ExcludeFromMigrations());
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.AspNetUserRoles", b =>
{
b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<string>("RoleId")
.HasColumnType("nvarchar(450)");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", null, t => t.ExcludeFromMigrations());
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.AspNetUsers", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("nvarchar(450)");
b.Property<int>("AccessFailedCount")
.HasColumnType("int");
b.Property<string>("ConcurrencyStamp")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Email")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("bit");
b.Property<bool>("LockoutEnabled")
.HasColumnType("bit");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetimeoffset");
b.Property<string>("NormalizedEmail")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("NormalizedUserName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("PasswordHash")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("PhoneNumber")
.HasColumnType("nvarchar(max)");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("bit");
b.Property<string>("SecurityStamp")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("bit");
b.Property<string>("UserName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("AspNetUsers", null, t => t.ExcludeFromMigrations());
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.CompanyModel", b =>
{
b.Property<int>("CompanyId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("CompanyId"), 1L, 1);
b.Property<string>("Address")
.IsRequired()
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("City")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("CompanyExtCode")
.IsRequired()
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("CompanyName")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<string>("CompanyToken")
.IsRequired()
.HasMaxLength(150)
.HasColumnType("nvarchar(150)");
b.Property<string>("PrivateNote")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<string>("State")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("VAT")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<int>("ZipCode")
.HasColumnType("int");
b.HasKey("CompanyId");
b.ToTable("Company");
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.DoorModel", b =>
{
b.Property<int>("DoorId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("DoorId"), 1L, 1);
b.Property<DateTime>("DateIns")
.HasColumnType("datetime2");
b.Property<DateTime>("DateMod")
.HasColumnType("datetime2");
b.Property<string>("DoorDescript")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("DoorExtCode")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("OrderId")
.HasColumnType("int");
b.Property<int>("Quantity")
.HasColumnType("int");
b.Property<int>("TypeId")
.HasColumnType("int");
b.Property<decimal>("UnitCost")
.HasColumnType("decimal(18,2)");
b.Property<string>("UserIdIns")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("UserIdMod")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("DoorId");
b.HasIndex("OrderId");
b.HasIndex("TypeId");
b.ToTable("Door");
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.DoorOpModel", b =>
{
b.Property<int>("DoorOpId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("DoorOpId"), 1L, 1);
b.Property<DateTime>("DateIns")
.HasColumnType("datetime2");
b.Property<DateTime>("DateMod")
.HasColumnType("datetime2");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("DoorId")
.HasColumnType("int");
b.Property<int>("DoorOpTypId")
.HasColumnType("int");
b.Property<string>("JsoncConfigVal")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("UserIdIns")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("UserIdMod")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("DoorOpId");
b.HasIndex("DoorId");
b.HasIndex("DoorOpTypId");
b.ToTable("DoorOp");
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.DoorOpTypeModel", b =>
{
b.Property<int>("DoorOpTypId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("DoorOpTypId"), 1L, 1);
b.Property<string>("Description")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("ExtDescript")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("ExtOpCode")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("FPath")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<bool>("HasHw")
.HasColumnType("bit");
b.Property<string>("HwCode")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("HwDescription")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsConcrete")
.HasColumnType("bit");
b.Property<string>("JsoncConfig")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("OpCode")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("ParentDoorOpId")
.HasColumnType("int");
b.Property<string>("Rev")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("TreeCode")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("ValidFrom")
.HasColumnType("datetime2");
b.Property<DateTime>("ValidUntil")
.HasColumnType("datetime2");
b.HasKey("DoorOpTypId");
b.ToTable("DoorOpType");
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.DoorTypeModel", b =>
{
b.Property<int>("TypeId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("TypeId"), 1L, 1);
b.Property<string>("Description")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("TypeCode")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("TypeId");
b.ToTable("DoorType");
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.ListValuesModel", b =>
{
b.Property<string>("TableName")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("FieldName")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("value")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("label")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<int>("ordinal")
.HasColumnType("int");
b.HasKey("TableName", "FieldName", "value");
b.ToTable("ListValues");
b.HasData(
new
{
TableName = "Opening",
FieldName = "Swing",
value = "LH",
label = "Left Handed",
ordinal = 1
},
new
{
TableName = "Opening",
FieldName = "Swing",
value = "RH",
label = "Right Handed",
ordinal = 2
},
new
{
TableName = "Opening",
FieldName = "Swing",
value = "LHR",
label = "Left Handed Reverse",
ordinal = 3
},
new
{
TableName = "Opening",
FieldName = "Swing",
value = "RHR",
label = "Right Handed Reverse",
ordinal = 4
},
new
{
TableName = "Edges",
FieldName = "EdgeType",
value = "BV",
label = "Bevel",
ordinal = 1
},
new
{
TableName = "Edges",
FieldName = "EdgeType",
value = "SQ",
label = "Squared",
ordinal = 2
},
new
{
TableName = "Edges",
FieldName = "EdgeType",
value = "1B",
label = "Bull Nose 1",
ordinal = 3
});
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.OrderModel", b =>
{
b.Property<int>("OrderId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("OrderId"), 1L, 1);
b.Property<int>("CompanyId")
.HasColumnType("int");
b.Property<DateTime>("DateIns")
.HasColumnType("datetime2");
b.Property<DateTime>("DateMod")
.HasColumnType("datetime2");
b.Property<string>("OrderDescript")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("OrderExtCode")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("Status")
.HasColumnType("int");
b.Property<string>("UserIdIns")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("UserIdMod")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("OrderId");
b.HasIndex("CompanyId");
b.ToTable("Order");
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.OrderStatusViewModel", b =>
{
b.Property<int>("OrderId")
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("OrderId"), 1L, 1);
b.Property<int>("CompanyId")
.HasColumnType("int");
b.Property<DateTime>("DateIns")
.HasColumnType("datetime2");
b.Property<int>("NumDoors")
.HasColumnType("int");
b.Property<int>("NumType")
.HasColumnType("int");
b.Property<string>("OrderDescript")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("OrderExtCode")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("OrderStatus")
.HasColumnType("int");
b.Property<decimal>("TotCost")
.HasColumnType("decimal(18,2)");
b.Property<string>("UserIdIns")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("UserIdMod")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("OrderId");
b.ToView("OrderStatusViewModel");
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.UsersViewModel", b =>
{
b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<string>("RoleId")
.HasColumnType("nvarchar(450)");
b.Property<string>("Email")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("RoleName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("UserName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("UserId", "RoleId");
b.ToView("UsersViewModel");
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.AspNetUserRoles", b =>
{
b.HasOne("WebDoorCreator.Data.DbModels.AspNetRoles", "RolesNav")
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("WebDoorCreator.Data.DbModels.AspNetUsers", "UsersNav")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("RolesNav");
b.Navigation("UsersNav");
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.DoorModel", b =>
{
b.HasOne("WebDoorCreator.Data.DbModels.OrderModel", "OrderNav")
.WithMany()
.HasForeignKey("OrderId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("WebDoorCreator.Data.DbModels.DoorTypeModel", "TypeNav")
.WithMany()
.HasForeignKey("TypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("OrderNav");
b.Navigation("TypeNav");
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.DoorOpModel", b =>
{
b.HasOne("WebDoorCreator.Data.DbModels.DoorModel", "DoorNav")
.WithMany()
.HasForeignKey("DoorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("WebDoorCreator.Data.DbModels.DoorOpTypeModel", "DoorOpTypeNav")
.WithMany()
.HasForeignKey("DoorOpTypId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("DoorNav");
b.Navigation("DoorOpTypeNav");
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.OrderModel", b =>
{
b.HasOne("WebDoorCreator.Data.DbModels.CompanyModel", "CompanyNav")
.WithMany()
.HasForeignKey("CompanyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("CompanyNav");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,91 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace WebDoorCreator.Data.Migrations.WDCData
{
public partial class DoorOpModelCreation : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "DoorOpType",
columns: table => new
{
DoorOpTypId = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
OpCode = table.Column<string>(type: "nvarchar(max)", nullable: false),
Description = table.Column<string>(type: "nvarchar(max)", nullable: false),
HasHw = table.Column<bool>(type: "bit", nullable: false),
IsConcrete = table.Column<bool>(type: "bit", nullable: false),
HwCode = table.Column<string>(type: "nvarchar(max)", nullable: false),
HwDescription = table.Column<string>(type: "nvarchar(max)", nullable: false),
FPath = table.Column<string>(type: "nvarchar(max)", nullable: false),
ParentDoorOpId = table.Column<int>(type: "int", nullable: false),
TreeCode = table.Column<string>(type: "nvarchar(max)", nullable: false),
JsoncConfig = table.Column<string>(type: "nvarchar(max)", nullable: false),
ExtOpCode = table.Column<string>(type: "nvarchar(max)", nullable: false),
ExtDescript = table.Column<string>(type: "nvarchar(max)", nullable: false),
Rev = table.Column<string>(type: "nvarchar(max)", nullable: false),
ValidFrom = table.Column<DateTime>(type: "datetime2", nullable: false),
ValidUntil = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DoorOpType", x => x.DoorOpTypId);
});
migrationBuilder.CreateTable(
name: "DoorOp",
columns: table => new
{
DoorOpId = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
DoorId = table.Column<int>(type: "int", nullable: false),
DoorOpTypId = table.Column<int>(type: "int", nullable: false),
Description = table.Column<string>(type: "nvarchar(max)", nullable: false),
DateIns = table.Column<DateTime>(type: "datetime2", nullable: false),
UserIdIns = table.Column<string>(type: "nvarchar(max)", nullable: false),
DateMod = table.Column<DateTime>(type: "datetime2", nullable: false),
UserIdMod = table.Column<string>(type: "nvarchar(max)", nullable: false),
JsoncConfigVal = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DoorOp", x => x.DoorOpId);
table.ForeignKey(
name: "FK_DoorOp_Door_DoorId",
column: x => x.DoorId,
principalTable: "Door",
principalColumn: "DoorId",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_DoorOp_DoorOpType_DoorOpTypId",
column: x => x.DoorOpTypId,
principalTable: "DoorOpType",
principalColumn: "DoorOpTypId",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_DoorOp_DoorId",
table: "DoorOp",
column: "DoorId");
migrationBuilder.CreateIndex(
name: "IX_DoorOp_DoorOpTypId",
table: "DoorOp",
column: "DoorOpTypId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "DoorOp");
migrationBuilder.DropTable(
name: "DoorOpType");
}
}
}
@@ -228,6 +228,119 @@ namespace WebDoorCreator.Data.Migrations.WDCData
b.ToTable("Door");
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.DoorOpModel", b =>
{
b.Property<int>("DoorOpId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("DoorOpId"), 1L, 1);
b.Property<DateTime>("DateIns")
.HasColumnType("datetime2");
b.Property<DateTime>("DateMod")
.HasColumnType("datetime2");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("DoorId")
.HasColumnType("int");
b.Property<int>("DoorOpTypId")
.HasColumnType("int");
b.Property<string>("JsoncConfigVal")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("UserIdIns")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("UserIdMod")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("DoorOpId");
b.HasIndex("DoorId");
b.HasIndex("DoorOpTypId");
b.ToTable("DoorOp");
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.DoorOpTypeModel", b =>
{
b.Property<int>("DoorOpTypId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("DoorOpTypId"), 1L, 1);
b.Property<string>("Description")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("ExtDescript")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("ExtOpCode")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("FPath")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<bool>("HasHw")
.HasColumnType("bit");
b.Property<string>("HwCode")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("HwDescription")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsConcrete")
.HasColumnType("bit");
b.Property<string>("JsoncConfig")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("OpCode")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("ParentDoorOpId")
.HasColumnType("int");
b.Property<string>("Rev")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("TreeCode")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("ValidFrom")
.HasColumnType("datetime2");
b.Property<DateTime>("ValidUntil")
.HasColumnType("datetime2");
b.HasKey("DoorOpTypId");
b.ToTable("DoorOpType");
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.DoorTypeModel", b =>
{
b.Property<int>("TypeId")
@@ -485,6 +598,25 @@ namespace WebDoorCreator.Data.Migrations.WDCData
b.Navigation("TypeNav");
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.DoorOpModel", b =>
{
b.HasOne("WebDoorCreator.Data.DbModels.DoorModel", "DoorNav")
.WithMany()
.HasForeignKey("DoorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("WebDoorCreator.Data.DbModels.DoorOpTypeModel", "DoorOpTypeNav")
.WithMany()
.HasForeignKey("DoorOpTypId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("DoorNav");
b.Navigation("DoorOpTypeNav");
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.OrderModel", b =>
{
b.HasOne("WebDoorCreator.Data.DbModels.CompanyModel", "CompanyNav")
+19 -1
View File
@@ -67,6 +67,9 @@ namespace WebDoorCreator.Data
public virtual DbSet<UsersViewModel> DbSetUsersView { get; set; } = null!;
public virtual DbSet<ListValuesModel> DbSetValues { get; set; } = null!;
public virtual DbSet<DoorOpTypeModel> DbSetDoorOpType { get; set; } = null!;
public virtual DbSet<DoorOpModel> DbSetDoorOp { get; set; } = null!;
#endregion Public Properties
#region Public Methods
@@ -128,8 +131,23 @@ namespace WebDoorCreator.Data
modelBuilder.Entity<AspNetUserRoles>().HasKey(c => new { c.UserId, c.RoleId });
modelBuilder.Entity<UsersViewModel>().HasKey(c => new { c.UserId, c.RoleId });
modelBuilder.Entity<ListValuesModel>().HasKey(c => new { c.TableName, c.FieldName, c.value });
#if false
// gestione onCascade DoorOp <--> parent
modelBuilder.Entity<DoorOpTypeModel>().HasOne(e => e.ParentNav).WithOne(e => e.ParentNav).OnDelete(DeleteBehavior.NoAction);
#endif
// verifico SE devo eseguire la migration del DB IDENT...
bool disableMigrate = _configuration.GetValue<bool>("SetupOpt:DisableWDCMigrate");
bool disableMigrate = false;
if (_configuration != null && _configuration.GetValue<string>("SetupOpt:DisableWDCMigrate") != null)
{
try
{
_configuration.GetValue<bool>("SetupOpt:DisableWDCMigrate");
}
catch
{ }
}
if (!disableMigrate)
{
modelBuilder.ApplyConfiguration(new ListValuesConfiguration());
+2 -3
View File
@@ -2,9 +2,8 @@
<PageTitle>Index</PageTitle>
<div class="d-flex flex-wrap align-items-center bgbg">
<div class="bgbg">
<div class="transpLayer">
<h1>Web Door Creator</h1>
<div class="fs-1 p-2 px-3">Web Door Creator</div>
</div>
</div>
+1 -1
View File
@@ -15,7 +15,7 @@
color: #DEDEDE;
background-image: linear-gradient(to right, rgba(30, 30, 30, 0.9), rgba(255, 255, 255, 0.1));
width: 100%;
height: 7rem;
height: 5rem;
display: flex;
flex-wrap: wrap;
align-items: end;
+1 -1
View File
@@ -13,7 +13,7 @@
color: #DEDEDE;
background-image: linear-gradient(to right, rgba(30,30,30,0.9), rgba(255,255,255,0.1));
width: 100%;
height: 7rem;
height: 5rem;
display: flex;
flex-wrap: wrap;
align-items: end;
+1 -1
View File
@@ -1 +1 @@
.bgbg{background-image:url("images/DOORBG.png");background-position:center;background-repeat:no-repeat;background-size:cover;height:45rem;display:flex;flex-wrap:wrap;align-items:end;}.transpLayer{color:#dedede;background-image:linear-gradient(to right,rgba(30,30,30,.9),rgba(255,255,255,.1));width:100%;height:7rem;display:flex;flex-wrap:wrap;align-items:end;}
.bgbg{background-image:url("images/DOORBG.png");background-position:center;background-repeat:no-repeat;background-size:cover;height:45rem;display:flex;flex-wrap:wrap;align-items:end;}.transpLayer{color:#dedede;background-image:linear-gradient(to right,rgba(30,30,30,.9),rgba(255,255,255,.1));width:100%;height:5rem;display:flex;flex-wrap:wrap;align-items:end;}