diff --git a/GWMS.Data/Controllers/GWMSController.cs b/GWMS.Data/Controllers/GWMSController.cs index d388699..0f8de5f 100644 --- a/GWMS.Data/Controllers/GWMSController.cs +++ b/GWMS.Data/Controllers/GWMSController.cs @@ -214,11 +214,10 @@ namespace GWMS.Data.Controllers return dbResult; } - public List GetTransporters(int SupplierId) + public List GetTransporters() { var dbResult = dbCtx .DbSetTransporter - .Where(x => SupplierId == 0 || x.SupplierId == SupplierId) .ToList(); return dbResult; diff --git a/GWMS.Data/DatabaseModels/TransporterModel.cs b/GWMS.Data/DatabaseModels/TransporterModel.cs index 1d94549..67b8a41 100644 --- a/GWMS.Data/DatabaseModels/TransporterModel.cs +++ b/GWMS.Data/DatabaseModels/TransporterModel.cs @@ -32,11 +32,6 @@ namespace GWMS.Data.DatabaseModels public DateTime PositionUpdated { get; set; } = DateTime.Now; - public int SupplierId { get; set; } - - [ForeignKey("SupplierId")] - public virtual SupplierModel Supplier { get; set; } - #endregion Public Properties } } \ No newline at end of file diff --git a/GWMS.Data/DatabaseModels/UserModel.cs b/GWMS.Data/DatabaseModels/UserModel.cs index 061452a..6c357f3 100644 --- a/GWMS.Data/DatabaseModels/UserModel.cs +++ b/GWMS.Data/DatabaseModels/UserModel.cs @@ -24,11 +24,11 @@ namespace GWMS.Data.DatabaseModels public int UserId { get; set; } [Column(Order = 1), MaxLength(50)] - public string Domain { get; set; } = ""; - - [Column(Order = 2), MaxLength(50)] public string UserName { get; set; } = ""; + [Column(Order = 1), MaxLength(250)] + public string SaltPasswd { get; set; } = ""; + [Column(Order = 3), MaxLength(50)] public string Lastname { get; set; } = ""; @@ -47,9 +47,6 @@ namespace GWMS.Data.DatabaseModels [Column(Order = 8)] public bool IsActive { get; set; } = true; - [Column(Order = 9), MaxLength(50)] - public string ExtCode { get; set; } = ""; - #endregion Public Properties } } \ No newline at end of file diff --git a/GWMS.Data/GWMS.Data.csproj b/GWMS.Data/GWMS.Data.csproj index 825d969..50e7757 100644 --- a/GWMS.Data/GWMS.Data.csproj +++ b/GWMS.Data/GWMS.Data.csproj @@ -22,6 +22,7 @@ + diff --git a/GWMS.Data/GWMSContext.cs b/GWMS.Data/GWMSContext.cs index 39f124d..7f65278 100644 --- a/GWMS.Data/GWMSContext.cs +++ b/GWMS.Data/GWMSContext.cs @@ -16,6 +16,8 @@ namespace GWMS.Data private IConfiguration _configuration; + private bool useMysql = true; + #endregion Private Fields #region Public Constructors @@ -66,12 +68,24 @@ namespace GWMS.Data protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { - //string connString = ""; + string connString = ""; if (!optionsBuilder.IsConfigured) { - //connString = _configuration.GetConnectionString("GWMS.Data"); - //optionsBuilder.UseSqlServer(connString); - optionsBuilder.UseSqlServer("Server=SQL2016DEV;Database=GWMS;Trusted_Connection=True;"); + // caso MySql + if (useMysql) + { + //connString = _configuration.GetConnectionString("GWMS.Data"); + connString = "Server=localhost;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;"; + var serverVersion = ServerVersion.AutoDetect(connString); + optionsBuilder.UseMySql(connString, serverVersion); + } + // caso MsSql + else + { + //connString = _configuration.GetConnectionString("GWMS.Data"); + //optionsBuilder.UseSqlServer(connString); + optionsBuilder.UseSqlServer("Server=SQL2016DEV;Database=GWMS;Trusted_Connection=True;"); + } } } @@ -82,7 +96,10 @@ namespace GWMS.Data relationship.DeleteBehavior = DeleteBehavior.Restrict; } - modelBuilder.HasAnnotation("Relational:Collation", "SQL_Latin1_General_CP1_CI_AS"); + if (!useMysql) + { + modelBuilder.HasAnnotation("Relational:Collation", "SQL_Latin1_General_CP1_CI_AS"); + } modelBuilder.Entity(entity => { diff --git a/GWMS.Data/Migrations/20210531154814_InitDb.Designer.cs b/GWMS.Data/Migrations/20210531154814_InitDb.Designer.cs deleted file mode 100644 index 8d5e58c..0000000 --- a/GWMS.Data/Migrations/20210531154814_InitDb.Designer.cs +++ /dev/null @@ -1,236 +0,0 @@ -// -using GWMS.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace GWMS.Data.Migrations -{ - [DbContext(typeof(GWMSContext))] - [Migration("20210531154814_InitDb")] - partial class InitDb - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Relational:Collation", "SQL_Latin1_General_CP1_CI_AS") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("ProductVersion", "5.0.6") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.AnKeyValModel", b => - { - b.Property("KeyName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Descript") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)") - .HasComment("Descrizione dell'item"); - - b.Property("ValFloat") - .HasColumnType("int"); - - b.Property("ValInt") - .HasColumnType("int"); - - b.Property("ValString") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.HasKey("KeyName"); - - b.ToTable("AnKeyVal"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.AuthModel", b => - { - b.Property("AuthRole") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)") - .HasColumnName("AuthRole"); - - b.Property("Description") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)") - .HasColumnName("Description"); - - b.HasKey("AuthRole"); - - b.ToTable("Auths"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.ConfigModel", b => - { - b.Property("KeyName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Note") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("Val") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("ValStd") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)") - .HasComment("Valore di default/riferimento per la variabile"); - - b.HasKey("KeyName"); - - b.ToTable("Config"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.ItemModel", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("ItemCode") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("ItemDesc") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("ItemType") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("UM") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("ItemId"); - - b.ToTable("Items"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.ListValModel", b => - { - b.Property("TabName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)") - .HasColumnName("TabName"); - - b.Property("FieldName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)") - .HasColumnName("FieldName"); - - b.Property("Val") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)") - .HasColumnName("Val"); - - b.Property("Descript") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)") - .HasColumnName("Descript"); - - b.Property("Ordinal") - .HasColumnType("int") - .HasColumnName("Ordinal"); - - b.HasKey("TabName", "FieldName", "Val"); - - b.ToTable("ListVal"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.UserAuthModel", b => - { - b.Property("UserId") - .HasColumnType("int"); - - b.Property("AuthRole") - .HasColumnType("nvarchar(50)"); - - b.Property("AuthLevel") - .HasColumnType("int"); - - b.HasKey("UserId", "AuthRole"); - - b.HasIndex("AuthRole"); - - b.ToTable("UserAuth"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.UserModel", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("AuthKey") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Domain") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Email") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("ExtCode") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Firstname") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("IsActive") - .HasColumnType("bit"); - - b.Property("Lang") - .HasMaxLength(10) - .HasColumnType("nvarchar(10)"); - - b.Property("Lastname") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("UserName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("UserId"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.UserAuthModel", b => - { - b.HasOne("GWMS.Data.DatabaseModels.AuthModel", "Role") - .WithMany() - .HasForeignKey("AuthRole") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("GWMS.Data.DatabaseModels.UserModel", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Role"); - - b.Navigation("User"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/GWMS.Data/Migrations/20210531154814_InitDb.cs b/GWMS.Data/Migrations/20210531154814_InitDb.cs deleted file mode 100644 index 0e5b99d..0000000 --- a/GWMS.Data/Migrations/20210531154814_InitDb.cs +++ /dev/null @@ -1,157 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace GWMS.Data.Migrations -{ - public partial class InitDb : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "AnKeyVal", - columns: table => new - { - KeyName = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), - ValInt = table.Column(type: "int", nullable: false), - ValFloat = table.Column(type: "int", nullable: false), - ValString = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: true), - Descript = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: true, comment: "Descrizione dell'item") - }, - constraints: table => - { - table.PrimaryKey("PK_AnKeyVal", x => x.KeyName); - }); - - migrationBuilder.CreateTable( - name: "Auths", - columns: table => new - { - AuthRole = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), - Description = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Auths", x => x.AuthRole); - }); - - migrationBuilder.CreateTable( - name: "Config", - columns: table => new - { - KeyName = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), - Val = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), - ValStd = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true, comment: "Valore di default/riferimento per la variabile"), - Note = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Config", x => x.KeyName); - }); - - migrationBuilder.CreateTable( - name: "Items", - columns: table => new - { - ItemId = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - ItemCode = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), - ItemDesc = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: true), - ItemType = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), - UM = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Items", x => x.ItemId); - }); - - migrationBuilder.CreateTable( - name: "ListVal", - columns: table => new - { - TabName = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), - FieldName = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), - Val = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), - Descript = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: true), - Ordinal = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ListVal", x => new { x.TabName, x.FieldName, x.Val }); - }); - - migrationBuilder.CreateTable( - name: "Users", - columns: table => new - { - UserId = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - Domain = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), - UserName = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), - Lastname = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), - Firstname = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), - Email = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: true), - Lang = table.Column(type: "nvarchar(10)", maxLength: 10, nullable: true), - AuthKey = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), - IsActive = table.Column(type: "bit", nullable: false), - ExtCode = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Users", x => x.UserId); - }); - - migrationBuilder.CreateTable( - name: "UserAuth", - columns: table => new - { - UserId = table.Column(type: "int", nullable: false), - AuthRole = table.Column(type: "nvarchar(50)", nullable: false), - AuthLevel = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_UserAuth", x => new { x.UserId, x.AuthRole }); - table.ForeignKey( - name: "FK_UserAuth_Auths_AuthRole", - column: x => x.AuthRole, - principalTable: "Auths", - principalColumn: "AuthRole", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_UserAuth_Users_UserId", - column: x => x.UserId, - principalTable: "Users", - principalColumn: "UserId", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_UserAuth_AuthRole", - table: "UserAuth", - column: "AuthRole"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "AnKeyVal"); - - migrationBuilder.DropTable( - name: "Config"); - - migrationBuilder.DropTable( - name: "Items"); - - migrationBuilder.DropTable( - name: "ListVal"); - - migrationBuilder.DropTable( - name: "UserAuth"); - - migrationBuilder.DropTable( - name: "Auths"); - - migrationBuilder.DropTable( - name: "Users"); - } - } -} diff --git a/GWMS.Data/Migrations/20210531154829_SeedAuthDemo.Designer.cs b/GWMS.Data/Migrations/20210531154829_SeedAuthDemo.Designer.cs deleted file mode 100644 index dcf6aa6..0000000 --- a/GWMS.Data/Migrations/20210531154829_SeedAuthDemo.Designer.cs +++ /dev/null @@ -1,386 +0,0 @@ -// -using GWMS.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace GWMS.Data.Migrations -{ - [DbContext(typeof(GWMSContext))] - [Migration("20210531154829_SeedAuthDemo")] - partial class SeedAuthDemo - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Relational:Collation", "SQL_Latin1_General_CP1_CI_AS") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("ProductVersion", "5.0.6") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.AnKeyValModel", b => - { - b.Property("KeyName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Descript") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)") - .HasComment("Descrizione dell'item"); - - b.Property("ValFloat") - .HasColumnType("int"); - - b.Property("ValInt") - .HasColumnType("int"); - - b.Property("ValString") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.HasKey("KeyName"); - - b.ToTable("AnKeyVal"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.AuthModel", b => - { - b.Property("AuthRole") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)") - .HasColumnName("AuthRole"); - - b.Property("Description") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)") - .HasColumnName("Description"); - - b.HasKey("AuthRole"); - - b.ToTable("Auths"); - - b.HasData( - new - { - AuthRole = "User", - Description = "Base User" - }, - new - { - AuthRole = "AppAdmin", - Description = "App Admin User" - }, - new - { - AuthRole = "Supervisor", - Description = "Supervisor User" - }, - new - { - AuthRole = "PlantUser", - Description = "Plant User" - }, - new - { - AuthRole = "SupplSuperUser", - Description = "Supplier Super User" - }, - new - { - AuthRole = "SupplUser", - Description = "Supplier Standard User" - }); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.ConfigModel", b => - { - b.Property("KeyName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Note") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("Val") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("ValStd") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)") - .HasComment("Valore di default/riferimento per la variabile"); - - b.HasKey("KeyName"); - - b.ToTable("Config"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.ItemModel", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("ItemCode") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("ItemDesc") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("ItemType") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("UM") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("ItemId"); - - b.ToTable("Items"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.ListValModel", b => - { - b.Property("TabName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)") - .HasColumnName("TabName"); - - b.Property("FieldName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)") - .HasColumnName("FieldName"); - - b.Property("Val") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)") - .HasColumnName("Val"); - - b.Property("Descript") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)") - .HasColumnName("Descript"); - - b.Property("Ordinal") - .HasColumnType("int") - .HasColumnName("Ordinal"); - - b.HasKey("TabName", "FieldName", "Val"); - - b.ToTable("ListVal"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.UserAuthModel", b => - { - b.Property("UserId") - .HasColumnType("int"); - - b.Property("AuthRole") - .HasColumnType("nvarchar(50)"); - - b.Property("AuthLevel") - .HasColumnType("int"); - - b.HasKey("UserId", "AuthRole"); - - b.HasIndex("AuthRole"); - - b.ToTable("UserAuth"); - - b.HasData( - new - { - UserId = 1, - AuthRole = "AppAdmin", - AuthLevel = 0 - }, - new - { - UserId = 2, - AuthRole = "AppAdmin", - AuthLevel = 0 - }, - new - { - UserId = 3, - AuthRole = "Supervisor", - AuthLevel = 0 - }, - new - { - UserId = 4, - AuthRole = "PlantUser", - AuthLevel = 0 - }, - new - { - UserId = 5, - AuthRole = "SupplSuperUser", - AuthLevel = 0 - }, - new - { - UserId = 6, - AuthRole = "SupplUser", - AuthLevel = 0 - }); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.UserModel", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("AuthKey") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Domain") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Email") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("ExtCode") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Firstname") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("IsActive") - .HasColumnType("bit"); - - b.Property("Lang") - .HasMaxLength(10) - .HasColumnType("nvarchar(10)"); - - b.Property("Lastname") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("UserName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("UserId"); - - b.ToTable("Users"); - - b.HasData( - new - { - UserId = 1, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", - Email = "samuele@steamware.net", - ExtCode = "", - Firstname = "Samuele", - IsActive = true, - Lang = "IT", - Lastname = "Locatelli", - UserName = "samuele" - }, - new - { - UserId = 2, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", - Email = "giancarlo@steamware.net", - ExtCode = "", - Firstname = "Giancarlo", - IsActive = true, - Lang = "IT", - Lastname = "Rottoli", - UserName = "giancarlo" - }, - new - { - UserId = 3, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", - Email = "info@steamware.net", - ExtCode = "", - Firstname = "Steamware", - IsActive = true, - Lang = "IT", - Lastname = "User03", - UserName = "user03" - }, - new - { - UserId = 4, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", - Email = "info@steamware.net", - ExtCode = "", - Firstname = "Steamware", - IsActive = true, - Lang = "IT", - Lastname = "User04", - UserName = "user04" - }, - new - { - UserId = 5, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", - Email = "info@steamware.net", - ExtCode = "", - Firstname = "Steamware", - IsActive = true, - Lang = "IT", - Lastname = "User05", - UserName = "user05" - }, - new - { - UserId = 6, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", - Email = "info@steamware.net", - ExtCode = "", - Firstname = "Steamware", - IsActive = true, - Lang = "IT", - Lastname = "User06", - UserName = "user06" - }); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.UserAuthModel", b => - { - b.HasOne("GWMS.Data.DatabaseModels.AuthModel", "Role") - .WithMany() - .HasForeignKey("AuthRole") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("GWMS.Data.DatabaseModels.UserModel", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Role"); - - b.Navigation("User"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/GWMS.Data/Migrations/20210531154829_SeedAuthDemo.cs b/GWMS.Data/Migrations/20210531154829_SeedAuthDemo.cs deleted file mode 100644 index 4e5f0b5..0000000 --- a/GWMS.Data/Migrations/20210531154829_SeedAuthDemo.cs +++ /dev/null @@ -1,142 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace GWMS.Data.Migrations -{ - public partial class SeedAuthDemo : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.InsertData( - table: "Auths", - columns: new[] { "AuthRole", "Description" }, - values: new object[,] - { - { "User", "Base User" }, - { "AppAdmin", "App Admin User" }, - { "Supervisor", "Supervisor User" }, - { "PlantUser", "Plant User" }, - { "SupplSuperUser", "Supplier Super User" }, - { "SupplUser", "Supplier Standard User" } - }); - - migrationBuilder.InsertData( - table: "Users", - columns: new[] { "UserId", "AuthKey", "Domain", "Email", "ExtCode", "Firstname", "IsActive", "Lang", "Lastname", "UserName" }, - values: new object[,] - { - { 1, "thisIsTh3R1verOfTheNight90", "", "samuele@steamware.net", "", "Samuele", true, "IT", "Locatelli", "samuele" }, - { 2, "thisIsTh3R1verOfTheNight90", "", "giancarlo@steamware.net", "", "Giancarlo", true, "IT", "Rottoli", "giancarlo" }, - { 3, "thisIsTh3R1verOfTheNight90", "", "info@steamware.net", "", "Steamware", true, "IT", "User03", "user03" }, - { 4, "thisIsTh3R1verOfTheNight90", "", "info@steamware.net", "", "Steamware", true, "IT", "User04", "user04" }, - { 5, "thisIsTh3R1verOfTheNight90", "", "info@steamware.net", "", "Steamware", true, "IT", "User05", "user05" }, - { 6, "thisIsTh3R1verOfTheNight90", "", "info@steamware.net", "", "Steamware", true, "IT", "User06", "user06" } - }); - - migrationBuilder.InsertData( - table: "UserAuth", - columns: new[] { "AuthRole", "UserId", "AuthLevel" }, - values: new object[,] - { - { "AppAdmin", 1, 0 }, - { "AppAdmin", 2, 0 }, - { "Supervisor", 3, 0 }, - { "PlantUser", 4, 0 }, - { "SupplSuperUser", 5, 0 }, - { "SupplUser", 6, 0 } - }); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DeleteData( - table: "Auths", - keyColumn: "AuthRole", - keyValue: "User"); - - migrationBuilder.DeleteData( - table: "UserAuth", - keyColumns: new[] { "AuthRole", "UserId" }, - keyValues: new object[] { "AppAdmin", 1 }); - - migrationBuilder.DeleteData( - table: "UserAuth", - keyColumns: new[] { "AuthRole", "UserId" }, - keyValues: new object[] { "AppAdmin", 2 }); - - migrationBuilder.DeleteData( - table: "UserAuth", - keyColumns: new[] { "AuthRole", "UserId" }, - keyValues: new object[] { "Supervisor", 3 }); - - migrationBuilder.DeleteData( - table: "UserAuth", - keyColumns: new[] { "AuthRole", "UserId" }, - keyValues: new object[] { "PlantUser", 4 }); - - migrationBuilder.DeleteData( - table: "UserAuth", - keyColumns: new[] { "AuthRole", "UserId" }, - keyValues: new object[] { "SupplSuperUser", 5 }); - - migrationBuilder.DeleteData( - table: "UserAuth", - keyColumns: new[] { "AuthRole", "UserId" }, - keyValues: new object[] { "SupplUser", 6 }); - - migrationBuilder.DeleteData( - table: "Auths", - keyColumn: "AuthRole", - keyValue: "AppAdmin"); - - migrationBuilder.DeleteData( - table: "Auths", - keyColumn: "AuthRole", - keyValue: "PlantUser"); - - migrationBuilder.DeleteData( - table: "Auths", - keyColumn: "AuthRole", - keyValue: "Supervisor"); - - migrationBuilder.DeleteData( - table: "Auths", - keyColumn: "AuthRole", - keyValue: "SupplSuperUser"); - - migrationBuilder.DeleteData( - table: "Auths", - keyColumn: "AuthRole", - keyValue: "SupplUser"); - - migrationBuilder.DeleteData( - table: "Users", - keyColumn: "UserId", - keyValue: 1); - - migrationBuilder.DeleteData( - table: "Users", - keyColumn: "UserId", - keyValue: 2); - - migrationBuilder.DeleteData( - table: "Users", - keyColumn: "UserId", - keyValue: 3); - - migrationBuilder.DeleteData( - table: "Users", - keyColumn: "UserId", - keyValue: 4); - - migrationBuilder.DeleteData( - table: "Users", - keyColumn: "UserId", - keyValue: 5); - - migrationBuilder.DeleteData( - table: "Users", - keyColumn: "UserId", - keyValue: 6); - } - } -} diff --git a/GWMS.Data/Migrations/20210601103725_PlantData.Designer.cs b/GWMS.Data/Migrations/20210601103725_PlantData.Designer.cs deleted file mode 100644 index c1d47d2..0000000 --- a/GWMS.Data/Migrations/20210601103725_PlantData.Designer.cs +++ /dev/null @@ -1,510 +0,0 @@ -// -using System; -using GWMS.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace GWMS.Data.Migrations -{ - [DbContext(typeof(GWMSContext))] - [Migration("20210601103725_PlantData")] - partial class PlantData - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Relational:Collation", "SQL_Latin1_General_CP1_CI_AS") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("ProductVersion", "5.0.6") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.AnKeyValModel", b => - { - b.Property("KeyName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Descript") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)") - .HasComment("Descrizione dell'item"); - - b.Property("ValFloat") - .HasColumnType("int"); - - b.Property("ValInt") - .HasColumnType("int"); - - b.Property("ValString") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.HasKey("KeyName"); - - b.ToTable("AnKeyVal"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.AuthModel", b => - { - b.Property("AuthRole") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)") - .HasColumnName("AuthRole"); - - b.Property("Description") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)") - .HasColumnName("Description"); - - b.HasKey("AuthRole"); - - b.ToTable("Auths"); - - b.HasData( - new - { - AuthRole = "User", - Description = "Base User" - }, - new - { - AuthRole = "AppAdmin", - Description = "App Admin User" - }, - new - { - AuthRole = "Supervisor", - Description = "Supervisor User" - }, - new - { - AuthRole = "PlantUser", - Description = "Plant User" - }, - new - { - AuthRole = "SupplSuperUser", - Description = "Supplier Super User" - }, - new - { - AuthRole = "SupplUser", - Description = "Supplier Standard User" - }); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.ConfigModel", b => - { - b.Property("KeyName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Note") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("Val") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("ValStd") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)") - .HasComment("Valore di default/riferimento per la variabile"); - - b.HasKey("KeyName"); - - b.ToTable("Config"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.ItemModel", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("ItemCode") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("ItemDesc") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("ItemType") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("UM") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("ItemId"); - - b.ToTable("Items"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.ListValModel", b => - { - b.Property("TabName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)") - .HasColumnName("TabName"); - - b.Property("FieldName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)") - .HasColumnName("FieldName"); - - b.Property("Val") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)") - .HasColumnName("Val"); - - b.Property("Descript") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)") - .HasColumnName("Descript"); - - b.Property("Ordinal") - .HasColumnType("int") - .HasColumnName("Ordinal"); - - b.HasKey("TabName", "FieldName", "Val"); - - b.ToTable("ListVal"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantDetailModel", b => - { - b.Property("PlantId") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("PlantCode") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("PlantDesc") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.HasKey("PlantId"); - - b.ToTable("PlantDetail"); - - b.HasData( - new - { - PlantId = 1, - PlantCode = "PSIM01", - PlantDesc = "Impianto SIM 01" - }, - new - { - PlantId = 2, - PlantCode = "PSIM02", - PlantDesc = "Impianto SIM 02" - }, - new - { - PlantId = 3, - PlantCode = "PSIM03", - PlantDesc = "Impianto SIM 03" - }, - new - { - PlantId = 4, - PlantCode = "PSIM04", - PlantDesc = "Impianto SIM 04" - }); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantLogModel", b => - { - b.Property("PlantDataId") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("DtEvent") - .HasColumnType("datetime2"); - - b.Property("FluxType") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("PlantId") - .HasColumnType("int"); - - b.Property("ValNumber") - .HasColumnType("float"); - - b.Property("ValString") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.HasKey("PlantDataId"); - - b.HasIndex("PlantId"); - - b.ToTable("PlantLog"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantStatusModel", b => - { - b.Property("PlantId") - .HasColumnType("int"); - - b.Property("FluxType") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("DtEvent") - .HasColumnType("datetime2"); - - b.Property("ValNumber") - .HasColumnType("float"); - - b.Property("ValString") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.HasKey("PlantId", "FluxType"); - - b.ToTable("PlantStatus"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.UserAuthModel", b => - { - b.Property("UserId") - .HasColumnType("int"); - - b.Property("AuthRole") - .HasColumnType("nvarchar(50)"); - - b.Property("AuthLevel") - .HasColumnType("int"); - - b.HasKey("UserId", "AuthRole"); - - b.HasIndex("AuthRole"); - - b.ToTable("UserAuth"); - - b.HasData( - new - { - UserId = 1, - AuthRole = "AppAdmin", - AuthLevel = 0 - }, - new - { - UserId = 2, - AuthRole = "AppAdmin", - AuthLevel = 0 - }, - new - { - UserId = 3, - AuthRole = "Supervisor", - AuthLevel = 0 - }, - new - { - UserId = 4, - AuthRole = "PlantUser", - AuthLevel = 0 - }, - new - { - UserId = 5, - AuthRole = "SupplSuperUser", - AuthLevel = 0 - }, - new - { - UserId = 6, - AuthRole = "SupplUser", - AuthLevel = 0 - }); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.UserModel", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("AuthKey") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Domain") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Email") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("ExtCode") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Firstname") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("IsActive") - .HasColumnType("bit"); - - b.Property("Lang") - .HasMaxLength(10) - .HasColumnType("nvarchar(10)"); - - b.Property("Lastname") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("UserName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("UserId"); - - b.ToTable("Users"); - - b.HasData( - new - { - UserId = 1, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", - Email = "samuele@steamware.net", - ExtCode = "", - Firstname = "Samuele", - IsActive = true, - Lang = "IT", - Lastname = "Locatelli", - UserName = "samuele" - }, - new - { - UserId = 2, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", - Email = "giancarlo@steamware.net", - ExtCode = "", - Firstname = "Giancarlo", - IsActive = true, - Lang = "IT", - Lastname = "Rottoli", - UserName = "giancarlo" - }, - new - { - UserId = 3, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", - Email = "info@steamware.net", - ExtCode = "", - Firstname = "Steamware", - IsActive = true, - Lang = "IT", - Lastname = "User03", - UserName = "user03" - }, - new - { - UserId = 4, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", - Email = "info@steamware.net", - ExtCode = "", - Firstname = "Steamware", - IsActive = true, - Lang = "IT", - Lastname = "User04", - UserName = "user04" - }, - new - { - UserId = 5, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", - Email = "info@steamware.net", - ExtCode = "", - Firstname = "Steamware", - IsActive = true, - Lang = "IT", - Lastname = "User05", - UserName = "user05" - }, - new - { - UserId = 6, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", - Email = "info@steamware.net", - ExtCode = "", - Firstname = "Steamware", - IsActive = true, - Lang = "IT", - Lastname = "User06", - UserName = "user06" - }); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantLogModel", b => - { - b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantStatusModel", b => - { - b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.UserAuthModel", b => - { - b.HasOne("GWMS.Data.DatabaseModels.AuthModel", "Role") - .WithMany() - .HasForeignKey("AuthRole") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("GWMS.Data.DatabaseModels.UserModel", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Role"); - - b.Navigation("User"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/GWMS.Data/Migrations/20210601103725_PlantData.cs b/GWMS.Data/Migrations/20210601103725_PlantData.cs deleted file mode 100644 index 5c9f849..0000000 --- a/GWMS.Data/Migrations/20210601103725_PlantData.cs +++ /dev/null @@ -1,101 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -namespace GWMS.Data.Migrations -{ - public partial class PlantData : Migration - { - #region Protected Methods - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "PlantLog"); - - migrationBuilder.DropTable( - name: "PlantStatus"); - - migrationBuilder.DropTable( - name: "PlantDetail"); - } - - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "PlantDetail", - columns: table => new - { - PlantId = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - PlantCode = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), - PlantDesc = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_PlantDetail", x => x.PlantId); - }); - - migrationBuilder.CreateTable( - name: "PlantLog", - columns: table => new - { - PlantDataId = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - DtEvent = table.Column(type: "datetime2", nullable: false), - FluxType = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: true), - PlantId = table.Column(type: "int", nullable: false), - ValNumber = table.Column(type: "float", nullable: false), - ValString = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_PlantLog", x => x.PlantDataId); - table.ForeignKey( - name: "FK_PlantLog_PlantDetail_PlantId", - column: x => x.PlantId, - principalTable: "PlantDetail", - principalColumn: "PlantId", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "PlantStatus", - columns: table => new - { - PlantId = table.Column(type: "int", nullable: false), - FluxType = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: false), - DtEvent = table.Column(type: "datetime2", nullable: false), - ValNumber = table.Column(type: "float", nullable: false), - ValString = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_PlantStatus", x => new { x.PlantId, x.FluxType }); - table.ForeignKey( - name: "FK_PlantStatus_PlantDetail_PlantId", - column: x => x.PlantId, - principalTable: "PlantDetail", - principalColumn: "PlantId", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.InsertData( - table: "PlantDetail", - columns: new[] { "PlantId", "PlantCode", "PlantDesc" }, - values: new object[,] - { - { 1, "PSIM01", "Impianto SIM 01" }, - { 2, "PSIM02", "Impianto SIM 02" }, - { 3, "PSIM03", "Impianto SIM 03" }, - { 4, "PSIM04", "Impianto SIM 04" } - }); - - migrationBuilder.CreateIndex( - name: "IX_PlantLog_PlantId", - table: "PlantLog", - column: "PlantId"); - } - - #endregion Protected Methods - } -} \ No newline at end of file diff --git a/GWMS.Data/Migrations/20210601104131_SupplierData.Designer.cs b/GWMS.Data/Migrations/20210601104131_SupplierData.Designer.cs deleted file mode 100644 index 0f9434a..0000000 --- a/GWMS.Data/Migrations/20210601104131_SupplierData.Designer.cs +++ /dev/null @@ -1,616 +0,0 @@ -// -using System; -using GWMS.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace GWMS.Data.Migrations -{ - [DbContext(typeof(GWMSContext))] - [Migration("20210601104131_SupplierData")] - partial class SupplierData - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Relational:Collation", "SQL_Latin1_General_CP1_CI_AS") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("ProductVersion", "5.0.6") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.AnKeyValModel", b => - { - b.Property("KeyName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Descript") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)") - .HasComment("Descrizione dell'item"); - - b.Property("ValFloat") - .HasColumnType("int"); - - b.Property("ValInt") - .HasColumnType("int"); - - b.Property("ValString") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.HasKey("KeyName"); - - b.ToTable("AnKeyVal"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.AuthModel", b => - { - b.Property("AuthRole") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)") - .HasColumnName("AuthRole"); - - b.Property("Description") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)") - .HasColumnName("Description"); - - b.HasKey("AuthRole"); - - b.ToTable("Auths"); - - b.HasData( - new - { - AuthRole = "User", - Description = "Base User" - }, - new - { - AuthRole = "AppAdmin", - Description = "App Admin User" - }, - new - { - AuthRole = "Supervisor", - Description = "Supervisor User" - }, - new - { - AuthRole = "PlantUser", - Description = "Plant User" - }, - new - { - AuthRole = "SupplSuperUser", - Description = "Supplier Super User" - }, - new - { - AuthRole = "SupplUser", - Description = "Supplier Standard User" - }); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.ConfigModel", b => - { - b.Property("KeyName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Note") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("Val") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("ValStd") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)") - .HasComment("Valore di default/riferimento per la variabile"); - - b.HasKey("KeyName"); - - b.ToTable("Config"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.ItemModel", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("ItemCode") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("ItemDesc") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("ItemType") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("UM") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("ItemId"); - - b.ToTable("Items"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.ListValModel", b => - { - b.Property("TabName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)") - .HasColumnName("TabName"); - - b.Property("FieldName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)") - .HasColumnName("FieldName"); - - b.Property("Val") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)") - .HasColumnName("Val"); - - b.Property("Descript") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)") - .HasColumnName("Descript"); - - b.Property("Ordinal") - .HasColumnType("int") - .HasColumnName("Ordinal"); - - b.HasKey("TabName", "FieldName", "Val"); - - b.ToTable("ListVal"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantDetailModel", b => - { - b.Property("PlantId") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("PlantCode") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("PlantDesc") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.HasKey("PlantId"); - - b.ToTable("PlantDetail"); - - b.HasData( - new - { - PlantId = 1, - PlantCode = "PSIM01", - PlantDesc = "Impianto SIM 01" - }, - new - { - PlantId = 2, - PlantCode = "PSIM02", - PlantDesc = "Impianto SIM 02" - }, - new - { - PlantId = 3, - PlantCode = "PSIM03", - PlantDesc = "Impianto SIM 03" - }, - new - { - PlantId = 4, - PlantCode = "PSIM04", - PlantDesc = "Impianto SIM 04" - }); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantLogModel", b => - { - b.Property("PlantDataId") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("DtEvent") - .HasColumnType("datetime2"); - - b.Property("FluxType") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("PlantId") - .HasColumnType("int"); - - b.Property("ValNumber") - .HasColumnType("float"); - - b.Property("ValString") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.HasKey("PlantDataId"); - - b.HasIndex("PlantId"); - - b.ToTable("PlantLog"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantStatusModel", b => - { - b.Property("PlantId") - .HasColumnType("int"); - - b.Property("FluxType") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("DtEvent") - .HasColumnType("datetime2"); - - b.Property("ValNumber") - .HasColumnType("float"); - - b.Property("ValString") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.HasKey("PlantId", "FluxType"); - - b.ToTable("PlantStatus"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantSupplWeekPlanModel", b => - { - b.Property("PlantId") - .HasColumnType("int"); - - b.Property("SupplierId") - .HasColumnType("int"); - - b.Property("DayNum") - .HasColumnType("int"); - - b.Property("Note") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.HasKey("PlantId", "SupplierId", "DayNum"); - - b.HasIndex("SupplierId"); - - b.ToTable("PlantSupplWeekPlan"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.SupplierModel", b => - { - b.Property("SupplierId") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("SupplierCode") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("SupplierDesc") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.HasKey("SupplierId"); - - b.ToTable("Supplier"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.TransporterModel", b => - { - b.Property("TransporterId") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("PositionLatitude") - .HasColumnType("float"); - - b.Property("PositionLongitude") - .HasColumnType("float"); - - b.Property("PositionUpdated") - .HasColumnType("datetime2"); - - b.Property("SupplierId") - .HasColumnType("int"); - - b.Property("TransporterCode") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("TransporterDesc") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.HasKey("TransporterId"); - - b.HasIndex("SupplierId"); - - b.ToTable("Transporter"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.UserAuthModel", b => - { - b.Property("UserId") - .HasColumnType("int"); - - b.Property("AuthRole") - .HasColumnType("nvarchar(50)"); - - b.Property("AuthLevel") - .HasColumnType("int"); - - b.HasKey("UserId", "AuthRole"); - - b.HasIndex("AuthRole"); - - b.ToTable("UserAuth"); - - b.HasData( - new - { - UserId = 1, - AuthRole = "AppAdmin", - AuthLevel = 0 - }, - new - { - UserId = 2, - AuthRole = "AppAdmin", - AuthLevel = 0 - }, - new - { - UserId = 3, - AuthRole = "Supervisor", - AuthLevel = 0 - }, - new - { - UserId = 4, - AuthRole = "PlantUser", - AuthLevel = 0 - }, - new - { - UserId = 5, - AuthRole = "SupplSuperUser", - AuthLevel = 0 - }, - new - { - UserId = 6, - AuthRole = "SupplUser", - AuthLevel = 0 - }); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.UserModel", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("AuthKey") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Domain") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Email") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("ExtCode") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Firstname") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("IsActive") - .HasColumnType("bit"); - - b.Property("Lang") - .HasMaxLength(10) - .HasColumnType("nvarchar(10)"); - - b.Property("Lastname") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("UserName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("UserId"); - - b.ToTable("Users"); - - b.HasData( - new - { - UserId = 1, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", - Email = "samuele@steamware.net", - ExtCode = "", - Firstname = "Samuele", - IsActive = true, - Lang = "IT", - Lastname = "Locatelli", - UserName = "samuele" - }, - new - { - UserId = 2, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", - Email = "giancarlo@steamware.net", - ExtCode = "", - Firstname = "Giancarlo", - IsActive = true, - Lang = "IT", - Lastname = "Rottoli", - UserName = "giancarlo" - }, - new - { - UserId = 3, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", - Email = "info@steamware.net", - ExtCode = "", - Firstname = "Steamware", - IsActive = true, - Lang = "IT", - Lastname = "User03", - UserName = "user03" - }, - new - { - UserId = 4, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", - Email = "info@steamware.net", - ExtCode = "", - Firstname = "Steamware", - IsActive = true, - Lang = "IT", - Lastname = "User04", - UserName = "user04" - }, - new - { - UserId = 5, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", - Email = "info@steamware.net", - ExtCode = "", - Firstname = "Steamware", - IsActive = true, - Lang = "IT", - Lastname = "User05", - UserName = "user05" - }, - new - { - UserId = 6, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", - Email = "info@steamware.net", - ExtCode = "", - Firstname = "Steamware", - IsActive = true, - Lang = "IT", - Lastname = "User06", - UserName = "user06" - }); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantLogModel", b => - { - b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantStatusModel", b => - { - b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantSupplWeekPlanModel", b => - { - b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("GWMS.Data.DatabaseModels.SupplierModel", "Supplier") - .WithMany() - .HasForeignKey("SupplierId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Plant"); - - b.Navigation("Supplier"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.TransporterModel", b => - { - b.HasOne("GWMS.Data.DatabaseModels.SupplierModel", "Supplier") - .WithMany() - .HasForeignKey("SupplierId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Supplier"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.UserAuthModel", b => - { - b.HasOne("GWMS.Data.DatabaseModels.AuthModel", "Role") - .WithMany() - .HasForeignKey("AuthRole") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("GWMS.Data.DatabaseModels.UserModel", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Role"); - - b.Navigation("User"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/GWMS.Data/Migrations/20210601104131_SupplierData.cs b/GWMS.Data/Migrations/20210601104131_SupplierData.cs deleted file mode 100644 index 70d56cc..0000000 --- a/GWMS.Data/Migrations/20210601104131_SupplierData.cs +++ /dev/null @@ -1,97 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -namespace GWMS.Data.Migrations -{ - public partial class SupplierData : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Supplier", - columns: table => new - { - SupplierId = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - SupplierCode = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), - SupplierDesc = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Supplier", x => x.SupplierId); - }); - - migrationBuilder.CreateTable( - name: "PlantSupplWeekPlan", - columns: table => new - { - PlantId = table.Column(type: "int", nullable: false), - SupplierId = table.Column(type: "int", nullable: false), - DayNum = table.Column(type: "int", nullable: false), - Note = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_PlantSupplWeekPlan", x => new { x.PlantId, x.SupplierId, x.DayNum }); - table.ForeignKey( - name: "FK_PlantSupplWeekPlan_PlantDetail_PlantId", - column: x => x.PlantId, - principalTable: "PlantDetail", - principalColumn: "PlantId", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_PlantSupplWeekPlan_Supplier_SupplierId", - column: x => x.SupplierId, - principalTable: "Supplier", - principalColumn: "SupplierId", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "Transporter", - columns: table => new - { - TransporterId = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - TransporterCode = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), - TransporterDesc = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: true), - PositionLatitude = table.Column(type: "float", nullable: false), - PositionLongitude = table.Column(type: "float", nullable: false), - PositionUpdated = table.Column(type: "datetime2", nullable: false), - SupplierId = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Transporter", x => x.TransporterId); - table.ForeignKey( - name: "FK_Transporter_Supplier_SupplierId", - column: x => x.SupplierId, - principalTable: "Supplier", - principalColumn: "SupplierId", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_PlantSupplWeekPlan_SupplierId", - table: "PlantSupplWeekPlan", - column: "SupplierId"); - - migrationBuilder.CreateIndex( - name: "IX_Transporter_SupplierId", - table: "Transporter", - column: "SupplierId"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "PlantSupplWeekPlan"); - - migrationBuilder.DropTable( - name: "Transporter"); - - migrationBuilder.DropTable( - name: "Supplier"); - } - } -} diff --git a/GWMS.Data/Migrations/20210601105323_OrderModel.Designer.cs b/GWMS.Data/Migrations/20210601105323_OrderModel.Designer.cs deleted file mode 100644 index 775919b..0000000 --- a/GWMS.Data/Migrations/20210601105323_OrderModel.Designer.cs +++ /dev/null @@ -1,693 +0,0 @@ -// -using System; -using GWMS.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace GWMS.Data.Migrations -{ - [DbContext(typeof(GWMSContext))] - [Migration("20210601105323_OrderModel")] - partial class OrderModel - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Relational:Collation", "SQL_Latin1_General_CP1_CI_AS") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("ProductVersion", "5.0.6") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.AnKeyValModel", b => - { - b.Property("KeyName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Descript") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)") - .HasComment("Descrizione dell'item"); - - b.Property("ValFloat") - .HasColumnType("int"); - - b.Property("ValInt") - .HasColumnType("int"); - - b.Property("ValString") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.HasKey("KeyName"); - - b.ToTable("AnKeyVal"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.AuthModel", b => - { - b.Property("AuthRole") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)") - .HasColumnName("AuthRole"); - - b.Property("Description") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)") - .HasColumnName("Description"); - - b.HasKey("AuthRole"); - - b.ToTable("Auths"); - - b.HasData( - new - { - AuthRole = "User", - Description = "Base User" - }, - new - { - AuthRole = "AppAdmin", - Description = "App Admin User" - }, - new - { - AuthRole = "Supervisor", - Description = "Supervisor User" - }, - new - { - AuthRole = "PlantUser", - Description = "Plant User" - }, - new - { - AuthRole = "SupplSuperUser", - Description = "Supplier Super User" - }, - new - { - AuthRole = "SupplUser", - Description = "Supplier Standard User" - }); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.ConfigModel", b => - { - b.Property("KeyName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Note") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("Val") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("ValStd") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)") - .HasComment("Valore di default/riferimento per la variabile"); - - b.HasKey("KeyName"); - - b.ToTable("Config"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.ItemModel", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("ItemCode") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("ItemDesc") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("ItemType") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("UM") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("ItemId"); - - b.ToTable("Items"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.ListValModel", b => - { - b.Property("TabName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)") - .HasColumnName("TabName"); - - b.Property("FieldName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)") - .HasColumnName("FieldName"); - - b.Property("Val") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)") - .HasColumnName("Val"); - - b.Property("Descript") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)") - .HasColumnName("Descript"); - - b.Property("Ordinal") - .HasColumnType("int") - .HasColumnName("Ordinal"); - - b.HasKey("TabName", "FieldName", "Val"); - - b.ToTable("ListVal"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.OrderModel", b => - { - b.Property("OrderId") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("DtExecEnd") - .HasColumnType("datetime2"); - - b.Property("DtExecStart") - .HasColumnType("datetime2"); - - b.Property("DtOrder") - .HasColumnType("datetime2"); - - b.Property("ExecutionQty") - .HasColumnType("float"); - - b.Property("OrderCode") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("OrderDesc") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("OrderQty") - .HasColumnType("float"); - - b.Property("PlantId") - .HasColumnType("int"); - - b.Property("SupplierId") - .HasColumnType("int"); - - b.Property("TransporterId") - .HasColumnType("int"); - - b.HasKey("OrderId"); - - b.HasIndex("PlantId"); - - b.HasIndex("SupplierId"); - - b.HasIndex("TransporterId"); - - b.ToTable("Order"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantDetailModel", b => - { - b.Property("PlantId") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("PlantCode") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("PlantDesc") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.HasKey("PlantId"); - - b.ToTable("PlantDetail"); - - b.HasData( - new - { - PlantId = 1, - PlantCode = "PSIM01", - PlantDesc = "Impianto SIM 01" - }, - new - { - PlantId = 2, - PlantCode = "PSIM02", - PlantDesc = "Impianto SIM 02" - }, - new - { - PlantId = 3, - PlantCode = "PSIM03", - PlantDesc = "Impianto SIM 03" - }, - new - { - PlantId = 4, - PlantCode = "PSIM04", - PlantDesc = "Impianto SIM 04" - }); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantLogModel", b => - { - b.Property("PlantDataId") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("DtEvent") - .HasColumnType("datetime2"); - - b.Property("FluxType") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("PlantId") - .HasColumnType("int"); - - b.Property("ValNumber") - .HasColumnType("float"); - - b.Property("ValString") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.HasKey("PlantDataId"); - - b.HasIndex("PlantId"); - - b.ToTable("PlantLog"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantStatusModel", b => - { - b.Property("PlantId") - .HasColumnType("int"); - - b.Property("FluxType") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("DtEvent") - .HasColumnType("datetime2"); - - b.Property("ValNumber") - .HasColumnType("float"); - - b.Property("ValString") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.HasKey("PlantId", "FluxType"); - - b.ToTable("PlantStatus"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantSupplWeekPlanModel", b => - { - b.Property("PlantId") - .HasColumnType("int"); - - b.Property("SupplierId") - .HasColumnType("int"); - - b.Property("DayNum") - .HasColumnType("int"); - - b.Property("Note") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.HasKey("PlantId", "SupplierId", "DayNum"); - - b.HasIndex("SupplierId"); - - b.ToTable("PlantSupplWeekPlan"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.SupplierModel", b => - { - b.Property("SupplierId") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("SupplierCode") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("SupplierDesc") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.HasKey("SupplierId"); - - b.ToTable("Supplier"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.TransporterModel", b => - { - b.Property("TransporterId") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("PositionLatitude") - .HasColumnType("float"); - - b.Property("PositionLongitude") - .HasColumnType("float"); - - b.Property("PositionUpdated") - .HasColumnType("datetime2"); - - b.Property("SupplierId") - .HasColumnType("int"); - - b.Property("TransporterCode") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("TransporterDesc") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.HasKey("TransporterId"); - - b.HasIndex("SupplierId"); - - b.ToTable("Transporter"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.UserAuthModel", b => - { - b.Property("UserId") - .HasColumnType("int"); - - b.Property("AuthRole") - .HasColumnType("nvarchar(50)"); - - b.Property("AuthLevel") - .HasColumnType("int"); - - b.HasKey("UserId", "AuthRole"); - - b.HasIndex("AuthRole"); - - b.ToTable("UserAuth"); - - b.HasData( - new - { - UserId = 1, - AuthRole = "AppAdmin", - AuthLevel = 0 - }, - new - { - UserId = 2, - AuthRole = "AppAdmin", - AuthLevel = 0 - }, - new - { - UserId = 3, - AuthRole = "Supervisor", - AuthLevel = 0 - }, - new - { - UserId = 4, - AuthRole = "PlantUser", - AuthLevel = 0 - }, - new - { - UserId = 5, - AuthRole = "SupplSuperUser", - AuthLevel = 0 - }, - new - { - UserId = 6, - AuthRole = "SupplUser", - AuthLevel = 0 - }); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.UserModel", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("AuthKey") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Domain") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Email") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("ExtCode") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Firstname") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("IsActive") - .HasColumnType("bit"); - - b.Property("Lang") - .HasMaxLength(10) - .HasColumnType("nvarchar(10)"); - - b.Property("Lastname") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("UserName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("UserId"); - - b.ToTable("Users"); - - b.HasData( - new - { - UserId = 1, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", - Email = "samuele@steamware.net", - ExtCode = "", - Firstname = "Samuele", - IsActive = true, - Lang = "IT", - Lastname = "Locatelli", - UserName = "samuele" - }, - new - { - UserId = 2, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", - Email = "giancarlo@steamware.net", - ExtCode = "", - Firstname = "Giancarlo", - IsActive = true, - Lang = "IT", - Lastname = "Rottoli", - UserName = "giancarlo" - }, - new - { - UserId = 3, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", - Email = "info@steamware.net", - ExtCode = "", - Firstname = "Steamware", - IsActive = true, - Lang = "IT", - Lastname = "User03", - UserName = "user03" - }, - new - { - UserId = 4, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", - Email = "info@steamware.net", - ExtCode = "", - Firstname = "Steamware", - IsActive = true, - Lang = "IT", - Lastname = "User04", - UserName = "user04" - }, - new - { - UserId = 5, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", - Email = "info@steamware.net", - ExtCode = "", - Firstname = "Steamware", - IsActive = true, - Lang = "IT", - Lastname = "User05", - UserName = "user05" - }, - new - { - UserId = 6, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", - Email = "info@steamware.net", - ExtCode = "", - Firstname = "Steamware", - IsActive = true, - Lang = "IT", - Lastname = "User06", - UserName = "user06" - }); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.OrderModel", b => - { - b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("GWMS.Data.DatabaseModels.SupplierModel", "Supplier") - .WithMany() - .HasForeignKey("SupplierId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("GWMS.Data.DatabaseModels.TransporterModel", "Transporter") - .WithMany() - .HasForeignKey("TransporterId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Plant"); - - b.Navigation("Supplier"); - - b.Navigation("Transporter"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantLogModel", b => - { - b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantStatusModel", b => - { - b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantSupplWeekPlanModel", b => - { - b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("GWMS.Data.DatabaseModels.SupplierModel", "Supplier") - .WithMany() - .HasForeignKey("SupplierId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Plant"); - - b.Navigation("Supplier"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.TransporterModel", b => - { - b.HasOne("GWMS.Data.DatabaseModels.SupplierModel", "Supplier") - .WithMany() - .HasForeignKey("SupplierId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Supplier"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.UserAuthModel", b => - { - b.HasOne("GWMS.Data.DatabaseModels.AuthModel", "Role") - .WithMany() - .HasForeignKey("AuthRole") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("GWMS.Data.DatabaseModels.UserModel", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Role"); - - b.Navigation("User"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/GWMS.Data/Migrations/20210601105323_OrderModel.cs b/GWMS.Data/Migrations/20210601105323_OrderModel.cs deleted file mode 100644 index d08b800..0000000 --- a/GWMS.Data/Migrations/20210601105323_OrderModel.cs +++ /dev/null @@ -1,240 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -namespace GWMS.Data.Migrations -{ - public partial class OrderModel : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_PlantLog_PlantDetail_PlantId", - table: "PlantLog"); - - migrationBuilder.DropForeignKey( - name: "FK_PlantStatus_PlantDetail_PlantId", - table: "PlantStatus"); - - migrationBuilder.DropForeignKey( - name: "FK_PlantSupplWeekPlan_PlantDetail_PlantId", - table: "PlantSupplWeekPlan"); - - migrationBuilder.DropForeignKey( - name: "FK_PlantSupplWeekPlan_Supplier_SupplierId", - table: "PlantSupplWeekPlan"); - - migrationBuilder.DropForeignKey( - name: "FK_Transporter_Supplier_SupplierId", - table: "Transporter"); - - migrationBuilder.DropForeignKey( - name: "FK_UserAuth_Auths_AuthRole", - table: "UserAuth"); - - migrationBuilder.DropForeignKey( - name: "FK_UserAuth_Users_UserId", - table: "UserAuth"); - - migrationBuilder.CreateTable( - name: "Order", - columns: table => new - { - OrderId = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - DtOrder = table.Column(type: "datetime2", nullable: false), - PlantId = table.Column(type: "int", nullable: false), - SupplierId = table.Column(type: "int", nullable: false), - TransporterId = table.Column(type: "int", nullable: false), - OrderCode = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), - OrderDesc = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: true), - OrderQty = table.Column(type: "float", nullable: false), - DtExecStart = table.Column(type: "datetime2", nullable: false), - DtExecEnd = table.Column(type: "datetime2", nullable: false), - ExecutionQty = table.Column(type: "float", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Order", x => x.OrderId); - table.ForeignKey( - name: "FK_Order_PlantDetail_PlantId", - column: x => x.PlantId, - principalTable: "PlantDetail", - principalColumn: "PlantId", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_Order_Supplier_SupplierId", - column: x => x.SupplierId, - principalTable: "Supplier", - principalColumn: "SupplierId", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_Order_Transporter_TransporterId", - column: x => x.TransporterId, - principalTable: "Transporter", - principalColumn: "TransporterId", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateIndex( - name: "IX_Order_PlantId", - table: "Order", - column: "PlantId"); - - migrationBuilder.CreateIndex( - name: "IX_Order_SupplierId", - table: "Order", - column: "SupplierId"); - - migrationBuilder.CreateIndex( - name: "IX_Order_TransporterId", - table: "Order", - column: "TransporterId"); - - migrationBuilder.AddForeignKey( - name: "FK_PlantLog_PlantDetail_PlantId", - table: "PlantLog", - column: "PlantId", - principalTable: "PlantDetail", - principalColumn: "PlantId", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_PlantStatus_PlantDetail_PlantId", - table: "PlantStatus", - column: "PlantId", - principalTable: "PlantDetail", - principalColumn: "PlantId", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_PlantSupplWeekPlan_PlantDetail_PlantId", - table: "PlantSupplWeekPlan", - column: "PlantId", - principalTable: "PlantDetail", - principalColumn: "PlantId", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_PlantSupplWeekPlan_Supplier_SupplierId", - table: "PlantSupplWeekPlan", - column: "SupplierId", - principalTable: "Supplier", - principalColumn: "SupplierId", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_Transporter_Supplier_SupplierId", - table: "Transporter", - column: "SupplierId", - principalTable: "Supplier", - principalColumn: "SupplierId", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_UserAuth_Auths_AuthRole", - table: "UserAuth", - column: "AuthRole", - principalTable: "Auths", - principalColumn: "AuthRole", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_UserAuth_Users_UserId", - table: "UserAuth", - column: "UserId", - principalTable: "Users", - principalColumn: "UserId", - onDelete: ReferentialAction.Restrict); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_PlantLog_PlantDetail_PlantId", - table: "PlantLog"); - - migrationBuilder.DropForeignKey( - name: "FK_PlantStatus_PlantDetail_PlantId", - table: "PlantStatus"); - - migrationBuilder.DropForeignKey( - name: "FK_PlantSupplWeekPlan_PlantDetail_PlantId", - table: "PlantSupplWeekPlan"); - - migrationBuilder.DropForeignKey( - name: "FK_PlantSupplWeekPlan_Supplier_SupplierId", - table: "PlantSupplWeekPlan"); - - migrationBuilder.DropForeignKey( - name: "FK_Transporter_Supplier_SupplierId", - table: "Transporter"); - - migrationBuilder.DropForeignKey( - name: "FK_UserAuth_Auths_AuthRole", - table: "UserAuth"); - - migrationBuilder.DropForeignKey( - name: "FK_UserAuth_Users_UserId", - table: "UserAuth"); - - migrationBuilder.DropTable( - name: "Order"); - - migrationBuilder.AddForeignKey( - name: "FK_PlantLog_PlantDetail_PlantId", - table: "PlantLog", - column: "PlantId", - principalTable: "PlantDetail", - principalColumn: "PlantId", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "FK_PlantStatus_PlantDetail_PlantId", - table: "PlantStatus", - column: "PlantId", - principalTable: "PlantDetail", - principalColumn: "PlantId", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "FK_PlantSupplWeekPlan_PlantDetail_PlantId", - table: "PlantSupplWeekPlan", - column: "PlantId", - principalTable: "PlantDetail", - principalColumn: "PlantId", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "FK_PlantSupplWeekPlan_Supplier_SupplierId", - table: "PlantSupplWeekPlan", - column: "SupplierId", - principalTable: "Supplier", - principalColumn: "SupplierId", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "FK_Transporter_Supplier_SupplierId", - table: "Transporter", - column: "SupplierId", - principalTable: "Supplier", - principalColumn: "SupplierId", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "FK_UserAuth_Auths_AuthRole", - table: "UserAuth", - column: "AuthRole", - principalTable: "Auths", - principalColumn: "AuthRole", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "FK_UserAuth_Users_UserId", - table: "UserAuth", - column: "UserId", - principalTable: "Users", - principalColumn: "UserId", - onDelete: ReferentialAction.Cascade); - } - } -} diff --git a/GWMS.Data/Migrations/20210601163441_UpdatePlantModel.Designer.cs b/GWMS.Data/Migrations/20210601163441_UpdatePlantModel.Designer.cs deleted file mode 100644 index b1be548..0000000 --- a/GWMS.Data/Migrations/20210601163441_UpdatePlantModel.Designer.cs +++ /dev/null @@ -1,707 +0,0 @@ -// -using System; -using GWMS.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace GWMS.Data.Migrations -{ - [DbContext(typeof(GWMSContext))] - [Migration("20210601163441_UpdatePlantModel")] - partial class UpdatePlantModel - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Relational:Collation", "SQL_Latin1_General_CP1_CI_AS") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("ProductVersion", "5.0.6") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.AnKeyValModel", b => - { - b.Property("KeyName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Descript") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)") - .HasComment("Descrizione dell'item"); - - b.Property("ValFloat") - .HasColumnType("int"); - - b.Property("ValInt") - .HasColumnType("int"); - - b.Property("ValString") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.HasKey("KeyName"); - - b.ToTable("AnKeyVal"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.AuthModel", b => - { - b.Property("AuthRole") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)") - .HasColumnName("AuthRole"); - - b.Property("Description") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)") - .HasColumnName("Description"); - - b.HasKey("AuthRole"); - - b.ToTable("Auths"); - - b.HasData( - new - { - AuthRole = "User", - Description = "Base User" - }, - new - { - AuthRole = "AppAdmin", - Description = "App Admin User" - }, - new - { - AuthRole = "Supervisor", - Description = "Supervisor User" - }, - new - { - AuthRole = "PlantUser", - Description = "Plant User" - }, - new - { - AuthRole = "SupplSuperUser", - Description = "Supplier Super User" - }, - new - { - AuthRole = "SupplUser", - Description = "Supplier Standard User" - }); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.ConfigModel", b => - { - b.Property("KeyName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Note") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("Val") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("ValStd") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)") - .HasComment("Valore di default/riferimento per la variabile"); - - b.HasKey("KeyName"); - - b.ToTable("Config"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.ItemModel", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("ItemCode") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("ItemDesc") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("ItemType") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("UM") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("ItemId"); - - b.ToTable("Items"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.ListValModel", b => - { - b.Property("TabName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)") - .HasColumnName("TabName"); - - b.Property("FieldName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)") - .HasColumnName("FieldName"); - - b.Property("Val") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)") - .HasColumnName("Val"); - - b.Property("Descript") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)") - .HasColumnName("Descript"); - - b.Property("Ordinal") - .HasColumnType("int") - .HasColumnName("Ordinal"); - - b.HasKey("TabName", "FieldName", "Val"); - - b.ToTable("ListVal"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.OrderModel", b => - { - b.Property("OrderId") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("DtExecEnd") - .HasColumnType("datetime2"); - - b.Property("DtExecStart") - .HasColumnType("datetime2"); - - b.Property("DtOrder") - .HasColumnType("datetime2"); - - b.Property("ExecutionQty") - .HasColumnType("float"); - - b.Property("OrderCode") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("OrderDesc") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("OrderQty") - .HasColumnType("float"); - - b.Property("PlantId") - .HasColumnType("int"); - - b.Property("SupplierId") - .HasColumnType("int"); - - b.Property("TransporterId") - .HasColumnType("int"); - - b.HasKey("OrderId"); - - b.HasIndex("PlantId"); - - b.HasIndex("SupplierId"); - - b.HasIndex("TransporterId"); - - b.ToTable("Order"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantDetailModel", b => - { - b.Property("PlantId") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("LevelAct") - .HasColumnType("float"); - - b.Property("LevelMax") - .HasColumnType("float"); - - b.Property("PlantCode") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("PlantDesc") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.HasKey("PlantId"); - - b.ToTable("PlantDetail"); - - b.HasData( - new - { - PlantId = 1, - LevelAct = 0.0, - LevelMax = 9999.0, - PlantCode = "PSIM01", - PlantDesc = "Impianto SIM 01" - }, - new - { - PlantId = 2, - LevelAct = 0.0, - LevelMax = 9999.0, - PlantCode = "PSIM02", - PlantDesc = "Impianto SIM 02" - }, - new - { - PlantId = 3, - LevelAct = 0.0, - LevelMax = 9999.0, - PlantCode = "PSIM03", - PlantDesc = "Impianto SIM 03" - }, - new - { - PlantId = 4, - LevelAct = 0.0, - LevelMax = 9999.0, - PlantCode = "PSIM04", - PlantDesc = "Impianto SIM 04" - }); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantLogModel", b => - { - b.Property("PlantDataId") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("DtEvent") - .HasColumnType("datetime2"); - - b.Property("FluxType") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("PlantId") - .HasColumnType("int"); - - b.Property("ValNumber") - .HasColumnType("float"); - - b.Property("ValString") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.HasKey("PlantDataId"); - - b.HasIndex("PlantId"); - - b.ToTable("PlantLog"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantStatusModel", b => - { - b.Property("PlantId") - .HasColumnType("int"); - - b.Property("FluxType") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("DtEvent") - .HasColumnType("datetime2"); - - b.Property("ValNumber") - .HasColumnType("float"); - - b.Property("ValString") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.HasKey("PlantId", "FluxType"); - - b.ToTable("PlantStatus"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantSupplWeekPlanModel", b => - { - b.Property("PlantId") - .HasColumnType("int"); - - b.Property("SupplierId") - .HasColumnType("int"); - - b.Property("DayNum") - .HasColumnType("int"); - - b.Property("Note") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.HasKey("PlantId", "SupplierId", "DayNum"); - - b.HasIndex("SupplierId"); - - b.ToTable("PlantSupplWeekPlan"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.SupplierModel", b => - { - b.Property("SupplierId") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("SupplierCode") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("SupplierDesc") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.HasKey("SupplierId"); - - b.ToTable("Supplier"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.TransporterModel", b => - { - b.Property("TransporterId") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("PositionLatitude") - .HasColumnType("float"); - - b.Property("PositionLongitude") - .HasColumnType("float"); - - b.Property("PositionUpdated") - .HasColumnType("datetime2"); - - b.Property("SupplierId") - .HasColumnType("int"); - - b.Property("TransporterCode") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("TransporterDesc") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.HasKey("TransporterId"); - - b.HasIndex("SupplierId"); - - b.ToTable("Transporter"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.UserAuthModel", b => - { - b.Property("UserId") - .HasColumnType("int"); - - b.Property("AuthRole") - .HasColumnType("nvarchar(50)"); - - b.Property("AuthLevel") - .HasColumnType("int"); - - b.HasKey("UserId", "AuthRole"); - - b.HasIndex("AuthRole"); - - b.ToTable("UserAuth"); - - b.HasData( - new - { - UserId = 1, - AuthRole = "AppAdmin", - AuthLevel = 0 - }, - new - { - UserId = 2, - AuthRole = "AppAdmin", - AuthLevel = 0 - }, - new - { - UserId = 3, - AuthRole = "Supervisor", - AuthLevel = 0 - }, - new - { - UserId = 4, - AuthRole = "PlantUser", - AuthLevel = 0 - }, - new - { - UserId = 5, - AuthRole = "SupplSuperUser", - AuthLevel = 0 - }, - new - { - UserId = 6, - AuthRole = "SupplUser", - AuthLevel = 0 - }); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.UserModel", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("AuthKey") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Domain") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Email") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("ExtCode") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Firstname") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("IsActive") - .HasColumnType("bit"); - - b.Property("Lang") - .HasMaxLength(10) - .HasColumnType("nvarchar(10)"); - - b.Property("Lastname") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("UserName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("UserId"); - - b.ToTable("Users"); - - b.HasData( - new - { - UserId = 1, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", - Email = "samuele@steamware.net", - ExtCode = "", - Firstname = "Samuele", - IsActive = true, - Lang = "IT", - Lastname = "Locatelli", - UserName = "samuele" - }, - new - { - UserId = 2, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", - Email = "giancarlo@steamware.net", - ExtCode = "", - Firstname = "Giancarlo", - IsActive = true, - Lang = "IT", - Lastname = "Rottoli", - UserName = "giancarlo" - }, - new - { - UserId = 3, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", - Email = "info@steamware.net", - ExtCode = "", - Firstname = "Steamware", - IsActive = true, - Lang = "IT", - Lastname = "User03", - UserName = "user03" - }, - new - { - UserId = 4, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", - Email = "info@steamware.net", - ExtCode = "", - Firstname = "Steamware", - IsActive = true, - Lang = "IT", - Lastname = "User04", - UserName = "user04" - }, - new - { - UserId = 5, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", - Email = "info@steamware.net", - ExtCode = "", - Firstname = "Steamware", - IsActive = true, - Lang = "IT", - Lastname = "User05", - UserName = "user05" - }, - new - { - UserId = 6, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", - Email = "info@steamware.net", - ExtCode = "", - Firstname = "Steamware", - IsActive = true, - Lang = "IT", - Lastname = "User06", - UserName = "user06" - }); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.OrderModel", b => - { - b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("GWMS.Data.DatabaseModels.SupplierModel", "Supplier") - .WithMany() - .HasForeignKey("SupplierId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("GWMS.Data.DatabaseModels.TransporterModel", "Transporter") - .WithMany() - .HasForeignKey("TransporterId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Plant"); - - b.Navigation("Supplier"); - - b.Navigation("Transporter"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantLogModel", b => - { - b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantStatusModel", b => - { - b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantSupplWeekPlanModel", b => - { - b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("GWMS.Data.DatabaseModels.SupplierModel", "Supplier") - .WithMany() - .HasForeignKey("SupplierId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Plant"); - - b.Navigation("Supplier"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.TransporterModel", b => - { - b.HasOne("GWMS.Data.DatabaseModels.SupplierModel", "Supplier") - .WithMany() - .HasForeignKey("SupplierId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Supplier"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.UserAuthModel", b => - { - b.HasOne("GWMS.Data.DatabaseModels.AuthModel", "Role") - .WithMany() - .HasForeignKey("AuthRole") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("GWMS.Data.DatabaseModels.UserModel", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Role"); - - b.Navigation("User"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/GWMS.Data/Migrations/20210601163441_UpdatePlantModel.cs b/GWMS.Data/Migrations/20210601163441_UpdatePlantModel.cs deleted file mode 100644 index 0305dac..0000000 --- a/GWMS.Data/Migrations/20210601163441_UpdatePlantModel.cs +++ /dev/null @@ -1,39 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace GWMS.Data.Migrations -{ - public partial class UpdatePlantModel : Migration - { - #region Protected Methods - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "LevelAct", - table: "PlantDetail"); - - migrationBuilder.DropColumn( - name: "LevelMax", - table: "PlantDetail"); - } - - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "LevelAct", - table: "PlantDetail", - type: "float", - nullable: false, - defaultValue: 0.0); - - migrationBuilder.AddColumn( - name: "LevelMax", - table: "PlantDetail", - type: "float", - nullable: false, - defaultValue: 9999.0); - } - - #endregion Protected Methods - } -} \ No newline at end of file diff --git a/GWMS.Data/Migrations/20210607112525_UpdatePlantData.Designer.cs b/GWMS.Data/Migrations/20210607112525_UpdatePlantData.Designer.cs deleted file mode 100644 index 7975894..0000000 --- a/GWMS.Data/Migrations/20210607112525_UpdatePlantData.Designer.cs +++ /dev/null @@ -1,763 +0,0 @@ -// -using System; -using GWMS.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace GWMS.Data.Migrations -{ - [DbContext(typeof(GWMSContext))] - [Migration("20210607112525_UpdatePlantData")] - partial class UpdatePlantData - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Relational:Collation", "SQL_Latin1_General_CP1_CI_AS") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("ProductVersion", "5.0.6") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.AnKeyValModel", b => - { - b.Property("KeyName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Descript") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)") - .HasComment("Descrizione dell'item"); - - b.Property("ValFloat") - .HasColumnType("int"); - - b.Property("ValInt") - .HasColumnType("int"); - - b.Property("ValString") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.HasKey("KeyName"); - - b.ToTable("AnKeyVal"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.AuthModel", b => - { - b.Property("AuthRole") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)") - .HasColumnName("AuthRole"); - - b.Property("Description") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)") - .HasColumnName("Description"); - - b.HasKey("AuthRole"); - - b.ToTable("Auths"); - - b.HasData( - new - { - AuthRole = "User", - Description = "Base User" - }, - new - { - AuthRole = "AppAdmin", - Description = "App Admin User" - }, - new - { - AuthRole = "Supervisor", - Description = "Supervisor User" - }, - new - { - AuthRole = "PlantUser", - Description = "Plant User" - }, - new - { - AuthRole = "SupplSuperUser", - Description = "Supplier Super User" - }, - new - { - AuthRole = "SupplUser", - Description = "Supplier Standard User" - }); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.ConfigModel", b => - { - b.Property("KeyName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Note") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("Val") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("ValStd") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)") - .HasComment("Valore di default/riferimento per la variabile"); - - b.HasKey("KeyName"); - - b.ToTable("Config"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.ItemModel", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("ItemCode") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("ItemDesc") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("ItemType") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("UM") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("ItemId"); - - b.ToTable("Items"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.ListValModel", b => - { - b.Property("TabName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)") - .HasColumnName("TabName"); - - b.Property("FieldName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)") - .HasColumnName("FieldName"); - - b.Property("Val") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)") - .HasColumnName("Val"); - - b.Property("Descript") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)") - .HasColumnName("Descript"); - - b.Property("Ordinal") - .HasColumnType("int") - .HasColumnName("Ordinal"); - - b.HasKey("TabName", "FieldName", "Val"); - - b.ToTable("ListVal"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.OrderModel", b => - { - b.Property("OrderId") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("DtExecEnd") - .HasColumnType("datetime2"); - - b.Property("DtExecStart") - .HasColumnType("datetime2"); - - b.Property("DtOrder") - .HasColumnType("datetime2"); - - b.Property("ExecutionQty") - .HasColumnType("float"); - - b.Property("OrderCode") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("OrderDesc") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("OrderQty") - .HasColumnType("float"); - - b.Property("PlantId") - .HasColumnType("int"); - - b.Property("SupplierId") - .HasColumnType("int"); - - b.Property("TransporterId") - .HasColumnType("int"); - - b.HasKey("OrderId"); - - b.HasIndex("PlantId"); - - b.HasIndex("SupplierId"); - - b.HasIndex("TransporterId"); - - b.ToTable("Order"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantDetailModel", b => - { - b.Property("PlantId") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("LevelAct") - .HasColumnType("float"); - - b.Property("LevelMax") - .HasColumnType("float"); - - b.Property("PlantCode") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("PlantDesc") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.HasKey("PlantId"); - - b.ToTable("PlantDetail"); - - b.HasData( - new - { - PlantId = 1, - LevelAct = 0.0, - LevelMax = 28000.0, - PlantCode = "PIZ03", - PlantDesc = "Collecchio" - }, - new - { - PlantId = 2, - LevelAct = 0.0, - LevelMax = 28000.0, - PlantCode = "PIZ04", - PlantDesc = "Noceto" - }, - new - { - PlantId = 3, - LevelAct = 0.0, - LevelMax = 24000.0, - PlantCode = "PIZ05", - PlantDesc = "Baganzola" - }, - new - { - PlantId = 4, - LevelAct = 0.0, - LevelMax = 24000.0, - PlantCode = "PIZ08", - PlantDesc = "Pilastrello" - }); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantLogModel", b => - { - b.Property("PlantDataId") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("DtEvent") - .HasColumnType("datetime2"); - - b.Property("FluxType") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("PlantId") - .HasColumnType("int"); - - b.Property("ValNumber") - .HasColumnType("float"); - - b.Property("ValString") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.HasKey("PlantDataId"); - - b.HasIndex("PlantId"); - - b.ToTable("PlantLog"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantStatusModel", b => - { - b.Property("PlantId") - .HasColumnType("int"); - - b.Property("FluxType") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("DtEvent") - .HasColumnType("datetime2"); - - b.Property("ValNumber") - .HasColumnType("float"); - - b.Property("ValString") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.HasKey("PlantId", "FluxType"); - - b.ToTable("PlantStatus"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantSupplWeekPlanModel", b => - { - b.Property("PlantId") - .HasColumnType("int"); - - b.Property("SupplierId") - .HasColumnType("int"); - - b.Property("DayNum") - .HasColumnType("int"); - - b.Property("Note") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.HasKey("PlantId", "SupplierId", "DayNum"); - - b.HasIndex("SupplierId"); - - b.ToTable("PlantSupplWeekPlan"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.SupplierModel", b => - { - b.Property("SupplierId") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("SupplierCode") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("SupplierDesc") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.HasKey("SupplierId"); - - b.ToTable("Supplier"); - - b.HasData( - new - { - SupplierId = 1, - SupplierCode = "SUPSIM01", - SupplierDesc = "Fornitore 01" - }, - new - { - SupplierId = 2, - SupplierCode = "SUPSIM02", - SupplierDesc = "Fornitore 02" - }); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.TransporterModel", b => - { - b.Property("TransporterId") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("PositionLatitude") - .HasColumnType("float"); - - b.Property("PositionLongitude") - .HasColumnType("float"); - - b.Property("PositionUpdated") - .HasColumnType("datetime2"); - - b.Property("SupplierId") - .HasColumnType("int"); - - b.Property("TransporterCode") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("TransporterDesc") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.HasKey("TransporterId"); - - b.HasIndex("SupplierId"); - - b.ToTable("Transporter"); - - b.HasData( - new - { - TransporterId = 1, - PositionLatitude = 0.0, - PositionLongitude = 0.0, - PositionUpdated = new DateTime(2021, 6, 7, 13, 25, 25, 232, DateTimeKind.Local).AddTicks(985), - SupplierId = 1, - TransporterCode = "TSIM01", - TransporterDesc = "Trasportatore SIM 01" - }, - new - { - TransporterId = 2, - PositionLatitude = 0.0, - PositionLongitude = 0.0, - PositionUpdated = new DateTime(2021, 6, 7, 13, 25, 25, 232, DateTimeKind.Local).AddTicks(1704), - SupplierId = 1, - TransporterCode = "TSIM02", - TransporterDesc = "Trasportatore SIM 02" - }, - new - { - TransporterId = 3, - PositionLatitude = 0.0, - PositionLongitude = 0.0, - PositionUpdated = new DateTime(2021, 6, 7, 13, 25, 25, 232, DateTimeKind.Local).AddTicks(1715), - SupplierId = 2, - TransporterCode = "TSIM03", - TransporterDesc = "Trasportatore SIM 03" - }, - new - { - TransporterId = 4, - PositionLatitude = 0.0, - PositionLongitude = 0.0, - PositionUpdated = new DateTime(2021, 6, 7, 13, 25, 25, 232, DateTimeKind.Local).AddTicks(1717), - SupplierId = 2, - TransporterCode = "TSIM04", - TransporterDesc = "Trasportatore SIM 04" - }); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.UserAuthModel", b => - { - b.Property("UserId") - .HasColumnType("int"); - - b.Property("AuthRole") - .HasColumnType("nvarchar(50)"); - - b.Property("AuthLevel") - .HasColumnType("int"); - - b.HasKey("UserId", "AuthRole"); - - b.HasIndex("AuthRole"); - - b.ToTable("UserAuth"); - - b.HasData( - new - { - UserId = 1, - AuthRole = "AppAdmin", - AuthLevel = 0 - }, - new - { - UserId = 2, - AuthRole = "AppAdmin", - AuthLevel = 0 - }, - new - { - UserId = 3, - AuthRole = "Supervisor", - AuthLevel = 0 - }, - new - { - UserId = 4, - AuthRole = "PlantUser", - AuthLevel = 0 - }, - new - { - UserId = 5, - AuthRole = "SupplSuperUser", - AuthLevel = 0 - }, - new - { - UserId = 6, - AuthRole = "SupplUser", - AuthLevel = 0 - }); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.UserModel", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("AuthKey") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Domain") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Email") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("ExtCode") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Firstname") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("IsActive") - .HasColumnType("bit"); - - b.Property("Lang") - .HasMaxLength(10) - .HasColumnType("nvarchar(10)"); - - b.Property("Lastname") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("UserName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("UserId"); - - b.ToTable("Users"); - - b.HasData( - new - { - UserId = 1, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", - Email = "samuele@steamware.net", - ExtCode = "", - Firstname = "Samuele", - IsActive = true, - Lang = "IT", - Lastname = "Locatelli", - UserName = "samuele" - }, - new - { - UserId = 2, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", - Email = "giancarlo@steamware.net", - ExtCode = "", - Firstname = "Giancarlo", - IsActive = true, - Lang = "IT", - Lastname = "Rottoli", - UserName = "giancarlo" - }, - new - { - UserId = 3, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", - Email = "info@steamware.net", - ExtCode = "", - Firstname = "Steamware", - IsActive = true, - Lang = "IT", - Lastname = "User03", - UserName = "user03" - }, - new - { - UserId = 4, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", - Email = "info@steamware.net", - ExtCode = "", - Firstname = "Steamware", - IsActive = true, - Lang = "IT", - Lastname = "User04", - UserName = "user04" - }, - new - { - UserId = 5, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", - Email = "info@steamware.net", - ExtCode = "", - Firstname = "Steamware", - IsActive = true, - Lang = "IT", - Lastname = "User05", - UserName = "user05" - }, - new - { - UserId = 6, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", - Email = "info@steamware.net", - ExtCode = "", - Firstname = "Steamware", - IsActive = true, - Lang = "IT", - Lastname = "User06", - UserName = "user06" - }); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.OrderModel", b => - { - b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("GWMS.Data.DatabaseModels.SupplierModel", "Supplier") - .WithMany() - .HasForeignKey("SupplierId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("GWMS.Data.DatabaseModels.TransporterModel", "Transporter") - .WithMany() - .HasForeignKey("TransporterId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Plant"); - - b.Navigation("Supplier"); - - b.Navigation("Transporter"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantLogModel", b => - { - b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantStatusModel", b => - { - b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantSupplWeekPlanModel", b => - { - b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("GWMS.Data.DatabaseModels.SupplierModel", "Supplier") - .WithMany() - .HasForeignKey("SupplierId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Plant"); - - b.Navigation("Supplier"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.TransporterModel", b => - { - b.HasOne("GWMS.Data.DatabaseModels.SupplierModel", "Supplier") - .WithMany() - .HasForeignKey("SupplierId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Supplier"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.UserAuthModel", b => - { - b.HasOne("GWMS.Data.DatabaseModels.AuthModel", "Role") - .WithMany() - .HasForeignKey("AuthRole") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("GWMS.Data.DatabaseModels.UserModel", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Role"); - - b.Navigation("User"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/GWMS.Data/Migrations/20210607112525_UpdatePlantData.cs b/GWMS.Data/Migrations/20210607112525_UpdatePlantData.cs deleted file mode 100644 index bebd995..0000000 --- a/GWMS.Data/Migrations/20210607112525_UpdatePlantData.cs +++ /dev/null @@ -1,120 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -namespace GWMS.Data.Migrations -{ - public partial class UpdatePlantData : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.UpdateData( - table: "PlantDetail", - keyColumn: "PlantId", - keyValue: 1, - columns: new[] { "LevelMax", "PlantCode", "PlantDesc" }, - values: new object[] { 28000.0, "PIZ03", "Collecchio" }); - - migrationBuilder.UpdateData( - table: "PlantDetail", - keyColumn: "PlantId", - keyValue: 2, - columns: new[] { "LevelMax", "PlantCode", "PlantDesc" }, - values: new object[] { 28000.0, "PIZ04", "Noceto" }); - - migrationBuilder.UpdateData( - table: "PlantDetail", - keyColumn: "PlantId", - keyValue: 3, - columns: new[] { "LevelMax", "PlantCode", "PlantDesc" }, - values: new object[] { 24000.0, "PIZ05", "Baganzola" }); - - migrationBuilder.UpdateData( - table: "PlantDetail", - keyColumn: "PlantId", - keyValue: 4, - columns: new[] { "LevelMax", "PlantCode", "PlantDesc" }, - values: new object[] { 24000.0, "PIZ08", "Pilastrello" }); - - migrationBuilder.InsertData( - table: "Supplier", - columns: new[] { "SupplierId", "SupplierCode", "SupplierDesc" }, - values: new object[,] - { - { 1, "SUPSIM01", "Fornitore 01" }, - { 2, "SUPSIM02", "Fornitore 02" } - }); - - migrationBuilder.InsertData( - table: "Transporter", - columns: new[] { "TransporterId", "PositionLatitude", "PositionLongitude", "PositionUpdated", "SupplierId", "TransporterCode", "TransporterDesc" }, - values: new object[,] - { - { 1, 0.0, 0.0, new DateTime(2021, 6, 7, 13, 25, 25, 232, DateTimeKind.Local).AddTicks(985), 1, "TSIM01", "Trasportatore SIM 01" }, - { 2, 0.0, 0.0, new DateTime(2021, 6, 7, 13, 25, 25, 232, DateTimeKind.Local).AddTicks(1704), 1, "TSIM02", "Trasportatore SIM 02" }, - { 3, 0.0, 0.0, new DateTime(2021, 6, 7, 13, 25, 25, 232, DateTimeKind.Local).AddTicks(1715), 2, "TSIM03", "Trasportatore SIM 03" }, - { 4, 0.0, 0.0, new DateTime(2021, 6, 7, 13, 25, 25, 232, DateTimeKind.Local).AddTicks(1717), 2, "TSIM04", "Trasportatore SIM 04" } - }); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DeleteData( - table: "Transporter", - keyColumn: "TransporterId", - keyValue: 1); - - migrationBuilder.DeleteData( - table: "Transporter", - keyColumn: "TransporterId", - keyValue: 2); - - migrationBuilder.DeleteData( - table: "Transporter", - keyColumn: "TransporterId", - keyValue: 3); - - migrationBuilder.DeleteData( - table: "Transporter", - keyColumn: "TransporterId", - keyValue: 4); - - migrationBuilder.DeleteData( - table: "Supplier", - keyColumn: "SupplierId", - keyValue: 1); - - migrationBuilder.DeleteData( - table: "Supplier", - keyColumn: "SupplierId", - keyValue: 2); - - migrationBuilder.UpdateData( - table: "PlantDetail", - keyColumn: "PlantId", - keyValue: 1, - columns: new[] { "LevelMax", "PlantCode", "PlantDesc" }, - values: new object[] { 9999.0, "PSIM01", "Impianto SIM 01" }); - - migrationBuilder.UpdateData( - table: "PlantDetail", - keyColumn: "PlantId", - keyValue: 2, - columns: new[] { "LevelMax", "PlantCode", "PlantDesc" }, - values: new object[] { 9999.0, "PSIM02", "Impianto SIM 02" }); - - migrationBuilder.UpdateData( - table: "PlantDetail", - keyColumn: "PlantId", - keyValue: 3, - columns: new[] { "LevelMax", "PlantCode", "PlantDesc" }, - values: new object[] { 9999.0, "PSIM03", "Impianto SIM 03" }); - - migrationBuilder.UpdateData( - table: "PlantDetail", - keyColumn: "PlantId", - keyValue: 4, - columns: new[] { "LevelMax", "PlantCode", "PlantDesc" }, - values: new object[] { 9999.0, "PSIM04", "Impianto SIM 04" }); - } - } -} diff --git a/GWMS.Data/Migrations/20210607140427_UpdatePlantData2.Designer.cs b/GWMS.Data/Migrations/20210607140427_UpdatePlantData2.Designer.cs deleted file mode 100644 index dfec2bf..0000000 --- a/GWMS.Data/Migrations/20210607140427_UpdatePlantData2.Designer.cs +++ /dev/null @@ -1,805 +0,0 @@ -// -using System; -using GWMS.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace GWMS.Data.Migrations -{ - [DbContext(typeof(GWMSContext))] - [Migration("20210607140427_UpdatePlantData2")] - partial class UpdatePlantData2 - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Relational:Collation", "SQL_Latin1_General_CP1_CI_AS") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("ProductVersion", "5.0.6") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.AnKeyValModel", b => - { - b.Property("KeyName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Descript") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)") - .HasComment("Descrizione dell'item"); - - b.Property("ValFloat") - .HasColumnType("int"); - - b.Property("ValInt") - .HasColumnType("int"); - - b.Property("ValString") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.HasKey("KeyName"); - - b.ToTable("AnKeyVal"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.AuthModel", b => - { - b.Property("AuthRole") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)") - .HasColumnName("AuthRole"); - - b.Property("Description") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)") - .HasColumnName("Description"); - - b.HasKey("AuthRole"); - - b.ToTable("Auths"); - - b.HasData( - new - { - AuthRole = "User", - Description = "Base User" - }, - new - { - AuthRole = "AppAdmin", - Description = "App Admin User" - }, - new - { - AuthRole = "Supervisor", - Description = "Supervisor User" - }, - new - { - AuthRole = "PlantUser", - Description = "Plant User" - }, - new - { - AuthRole = "SupplSuperUser", - Description = "Supplier Super User" - }, - new - { - AuthRole = "SupplUser", - Description = "Supplier Standard User" - }); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.ConfigModel", b => - { - b.Property("KeyName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Note") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("Val") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("ValStd") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)") - .HasComment("Valore di default/riferimento per la variabile"); - - b.HasKey("KeyName"); - - b.ToTable("Config"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.ItemModel", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("ItemCode") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("ItemDesc") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("ItemType") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("UM") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("ItemId"); - - b.ToTable("Items"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.ListValModel", b => - { - b.Property("TabName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)") - .HasColumnName("TabName"); - - b.Property("FieldName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)") - .HasColumnName("FieldName"); - - b.Property("Val") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)") - .HasColumnName("Val"); - - b.Property("Descript") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)") - .HasColumnName("Descript"); - - b.Property("Ordinal") - .HasColumnType("int") - .HasColumnName("Ordinal"); - - b.HasKey("TabName", "FieldName", "Val"); - - b.ToTable("ListVal"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.OrderModel", b => - { - b.Property("OrderId") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("DtExecEnd") - .HasColumnType("datetime2"); - - b.Property("DtExecStart") - .HasColumnType("datetime2"); - - b.Property("DtOrder") - .HasColumnType("datetime2"); - - b.Property("ExecutionQty") - .HasColumnType("float"); - - b.Property("OrderCode") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("OrderDesc") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("OrderQty") - .HasColumnType("float"); - - b.Property("PlantId") - .HasColumnType("int"); - - b.Property("SupplierId") - .HasColumnType("int"); - - b.Property("TransporterId") - .HasColumnType("int"); - - b.HasKey("OrderId"); - - b.HasIndex("PlantId"); - - b.HasIndex("SupplierId"); - - b.HasIndex("TransporterId"); - - b.ToTable("Order"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantDetailModel", b => - { - b.Property("PlantId") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("LevelAct") - .HasColumnType("float"); - - b.Property("LevelMax") - .HasColumnType("float"); - - b.Property("PlantCode") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("PlantDesc") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("PressAct") - .HasColumnType("float"); - - b.Property("PressBHAct") - .HasColumnType("float"); - - b.Property("PressBHMax") - .HasColumnType("float"); - - b.Property("PressBLAct") - .HasColumnType("float"); - - b.Property("PressBLMax") - .HasColumnType("float"); - - b.Property("PressMax") - .HasColumnType("float"); - - b.HasKey("PlantId"); - - b.ToTable("PlantDetail"); - - b.HasData( - new - { - PlantId = 1, - LevelAct = 0.0, - LevelMax = 28000.0, - PlantCode = "PIZ03", - PlantDesc = "Collecchio", - PressAct = 0.0, - PressBHAct = 0.0, - PressBHMax = 270.0, - PressBLAct = 0.0, - PressBLMax = 270.0, - PressMax = 19.0 - }, - new - { - PlantId = 2, - LevelAct = 0.0, - LevelMax = 28000.0, - PlantCode = "PIZ04", - PlantDesc = "Noceto", - PressAct = 0.0, - PressBHAct = 0.0, - PressBHMax = 270.0, - PressBLAct = 0.0, - PressBLMax = 270.0, - PressMax = 19.0 - }, - new - { - PlantId = 3, - LevelAct = 0.0, - LevelMax = 24000.0, - PlantCode = "PIZ05", - PlantDesc = "Baganzola", - PressAct = 0.0, - PressBHAct = 0.0, - PressBHMax = 270.0, - PressBLAct = 0.0, - PressBLMax = 270.0, - PressMax = 19.0 - }, - new - { - PlantId = 4, - LevelAct = 0.0, - LevelMax = 24000.0, - PlantCode = "PIZ08", - PlantDesc = "Pilastrello", - PressAct = 0.0, - PressBHAct = 0.0, - PressBHMax = 270.0, - PressBLAct = 0.0, - PressBLMax = 270.0, - PressMax = 19.0 - }); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantLogModel", b => - { - b.Property("PlantDataId") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("DtEvent") - .HasColumnType("datetime2"); - - b.Property("FluxType") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("PlantId") - .HasColumnType("int"); - - b.Property("ValNumber") - .HasColumnType("float"); - - b.Property("ValString") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.HasKey("PlantDataId"); - - b.HasIndex("PlantId"); - - b.ToTable("PlantLog"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantStatusModel", b => - { - b.Property("PlantId") - .HasColumnType("int"); - - b.Property("FluxType") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("DtEvent") - .HasColumnType("datetime2"); - - b.Property("ValNumber") - .HasColumnType("float"); - - b.Property("ValString") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.HasKey("PlantId", "FluxType"); - - b.ToTable("PlantStatus"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantSupplWeekPlanModel", b => - { - b.Property("PlantId") - .HasColumnType("int"); - - b.Property("SupplierId") - .HasColumnType("int"); - - b.Property("DayNum") - .HasColumnType("int"); - - b.Property("Note") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.HasKey("PlantId", "SupplierId", "DayNum"); - - b.HasIndex("SupplierId"); - - b.ToTable("PlantSupplWeekPlan"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.SupplierModel", b => - { - b.Property("SupplierId") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("SupplierCode") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("SupplierDesc") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.HasKey("SupplierId"); - - b.ToTable("Supplier"); - - b.HasData( - new - { - SupplierId = 1, - SupplierCode = "SUPSIM01", - SupplierDesc = "Fornitore 01" - }, - new - { - SupplierId = 2, - SupplierCode = "SUPSIM02", - SupplierDesc = "Fornitore 02" - }); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.TransporterModel", b => - { - b.Property("TransporterId") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("PositionLatitude") - .HasColumnType("float"); - - b.Property("PositionLongitude") - .HasColumnType("float"); - - b.Property("PositionUpdated") - .HasColumnType("datetime2"); - - b.Property("SupplierId") - .HasColumnType("int"); - - b.Property("TransporterCode") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("TransporterDesc") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.HasKey("TransporterId"); - - b.HasIndex("SupplierId"); - - b.ToTable("Transporter"); - - b.HasData( - new - { - TransporterId = 1, - PositionLatitude = 0.0, - PositionLongitude = 0.0, - PositionUpdated = new DateTime(2021, 6, 7, 16, 4, 27, 345, DateTimeKind.Local).AddTicks(2116), - SupplierId = 1, - TransporterCode = "TSIM01", - TransporterDesc = "Trasportatore SIM 01" - }, - new - { - TransporterId = 2, - PositionLatitude = 0.0, - PositionLongitude = 0.0, - PositionUpdated = new DateTime(2021, 6, 7, 16, 4, 27, 345, DateTimeKind.Local).AddTicks(2799), - SupplierId = 1, - TransporterCode = "TSIM02", - TransporterDesc = "Trasportatore SIM 02" - }, - new - { - TransporterId = 3, - PositionLatitude = 0.0, - PositionLongitude = 0.0, - PositionUpdated = new DateTime(2021, 6, 7, 16, 4, 27, 345, DateTimeKind.Local).AddTicks(2809), - SupplierId = 2, - TransporterCode = "TSIM03", - TransporterDesc = "Trasportatore SIM 03" - }, - new - { - TransporterId = 4, - PositionLatitude = 0.0, - PositionLongitude = 0.0, - PositionUpdated = new DateTime(2021, 6, 7, 16, 4, 27, 345, DateTimeKind.Local).AddTicks(2811), - SupplierId = 2, - TransporterCode = "TSIM04", - TransporterDesc = "Trasportatore SIM 04" - }); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.UserAuthModel", b => - { - b.Property("UserId") - .HasColumnType("int"); - - b.Property("AuthRole") - .HasColumnType("nvarchar(50)"); - - b.Property("AuthLevel") - .HasColumnType("int"); - - b.HasKey("UserId", "AuthRole"); - - b.HasIndex("AuthRole"); - - b.ToTable("UserAuth"); - - b.HasData( - new - { - UserId = 1, - AuthRole = "AppAdmin", - AuthLevel = 0 - }, - new - { - UserId = 2, - AuthRole = "AppAdmin", - AuthLevel = 0 - }, - new - { - UserId = 3, - AuthRole = "Supervisor", - AuthLevel = 0 - }, - new - { - UserId = 4, - AuthRole = "PlantUser", - AuthLevel = 0 - }, - new - { - UserId = 5, - AuthRole = "SupplSuperUser", - AuthLevel = 0 - }, - new - { - UserId = 6, - AuthRole = "SupplUser", - AuthLevel = 0 - }); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.UserModel", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("AuthKey") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Domain") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Email") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("ExtCode") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Firstname") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("IsActive") - .HasColumnType("bit"); - - b.Property("Lang") - .HasMaxLength(10) - .HasColumnType("nvarchar(10)"); - - b.Property("Lastname") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("UserName") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("UserId"); - - b.ToTable("Users"); - - b.HasData( - new - { - UserId = 1, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", - Email = "samuele@steamware.net", - ExtCode = "", - Firstname = "Samuele", - IsActive = true, - Lang = "IT", - Lastname = "Locatelli", - UserName = "samuele" - }, - new - { - UserId = 2, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", - Email = "giancarlo@steamware.net", - ExtCode = "", - Firstname = "Giancarlo", - IsActive = true, - Lang = "IT", - Lastname = "Rottoli", - UserName = "giancarlo" - }, - new - { - UserId = 3, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", - Email = "info@steamware.net", - ExtCode = "", - Firstname = "Steamware", - IsActive = true, - Lang = "IT", - Lastname = "User03", - UserName = "user03" - }, - new - { - UserId = 4, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", - Email = "info@steamware.net", - ExtCode = "", - Firstname = "Steamware", - IsActive = true, - Lang = "IT", - Lastname = "User04", - UserName = "user04" - }, - new - { - UserId = 5, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", - Email = "info@steamware.net", - ExtCode = "", - Firstname = "Steamware", - IsActive = true, - Lang = "IT", - Lastname = "User05", - UserName = "user05" - }, - new - { - UserId = 6, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", - Email = "info@steamware.net", - ExtCode = "", - Firstname = "Steamware", - IsActive = true, - Lang = "IT", - Lastname = "User06", - UserName = "user06" - }); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.OrderModel", b => - { - b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("GWMS.Data.DatabaseModels.SupplierModel", "Supplier") - .WithMany() - .HasForeignKey("SupplierId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("GWMS.Data.DatabaseModels.TransporterModel", "Transporter") - .WithMany() - .HasForeignKey("TransporterId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Plant"); - - b.Navigation("Supplier"); - - b.Navigation("Transporter"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantLogModel", b => - { - b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantStatusModel", b => - { - b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantSupplWeekPlanModel", b => - { - b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("GWMS.Data.DatabaseModels.SupplierModel", "Supplier") - .WithMany() - .HasForeignKey("SupplierId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Plant"); - - b.Navigation("Supplier"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.TransporterModel", b => - { - b.HasOne("GWMS.Data.DatabaseModels.SupplierModel", "Supplier") - .WithMany() - .HasForeignKey("SupplierId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Supplier"); - }); - - modelBuilder.Entity("GWMS.Data.DatabaseModels.UserAuthModel", b => - { - b.HasOne("GWMS.Data.DatabaseModels.AuthModel", "Role") - .WithMany() - .HasForeignKey("AuthRole") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("GWMS.Data.DatabaseModels.UserModel", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Role"); - - b.Navigation("User"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/GWMS.Data/Migrations/20210607140427_UpdatePlantData2.cs b/GWMS.Data/Migrations/20210607140427_UpdatePlantData2.cs deleted file mode 100644 index 77dd04c..0000000 --- a/GWMS.Data/Migrations/20210607140427_UpdatePlantData2.cs +++ /dev/null @@ -1,164 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -namespace GWMS.Data.Migrations -{ - public partial class UpdatePlantData2 : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "PressAct", - table: "PlantDetail", - type: "float", - nullable: false, - defaultValue: 0.0); - - migrationBuilder.AddColumn( - name: "PressBHAct", - table: "PlantDetail", - type: "float", - nullable: false, - defaultValue: 0.0); - - migrationBuilder.AddColumn( - name: "PressBHMax", - table: "PlantDetail", - type: "float", - nullable: false, - defaultValue: 0.0); - - migrationBuilder.AddColumn( - name: "PressBLAct", - table: "PlantDetail", - type: "float", - nullable: false, - defaultValue: 0.0); - - migrationBuilder.AddColumn( - name: "PressBLMax", - table: "PlantDetail", - type: "float", - nullable: false, - defaultValue: 0.0); - - migrationBuilder.AddColumn( - name: "PressMax", - table: "PlantDetail", - type: "float", - nullable: false, - defaultValue: 0.0); - - migrationBuilder.UpdateData( - table: "PlantDetail", - keyColumn: "PlantId", - keyValue: 1, - columns: new[] { "PressBHMax", "PressBLMax", "PressMax" }, - values: new object[] { 270.0, 270.0, 19.0 }); - - migrationBuilder.UpdateData( - table: "PlantDetail", - keyColumn: "PlantId", - keyValue: 2, - columns: new[] { "PressBHMax", "PressBLMax", "PressMax" }, - values: new object[] { 270.0, 270.0, 19.0 }); - - migrationBuilder.UpdateData( - table: "PlantDetail", - keyColumn: "PlantId", - keyValue: 3, - columns: new[] { "PressBHMax", "PressBLMax", "PressMax" }, - values: new object[] { 270.0, 270.0, 19.0 }); - - migrationBuilder.UpdateData( - table: "PlantDetail", - keyColumn: "PlantId", - keyValue: 4, - columns: new[] { "PressBHMax", "PressBLMax", "PressMax" }, - values: new object[] { 270.0, 270.0, 19.0 }); - - migrationBuilder.UpdateData( - table: "Transporter", - keyColumn: "TransporterId", - keyValue: 1, - column: "PositionUpdated", - value: new DateTime(2021, 6, 7, 16, 4, 27, 345, DateTimeKind.Local).AddTicks(2116)); - - migrationBuilder.UpdateData( - table: "Transporter", - keyColumn: "TransporterId", - keyValue: 2, - column: "PositionUpdated", - value: new DateTime(2021, 6, 7, 16, 4, 27, 345, DateTimeKind.Local).AddTicks(2799)); - - migrationBuilder.UpdateData( - table: "Transporter", - keyColumn: "TransporterId", - keyValue: 3, - column: "PositionUpdated", - value: new DateTime(2021, 6, 7, 16, 4, 27, 345, DateTimeKind.Local).AddTicks(2809)); - - migrationBuilder.UpdateData( - table: "Transporter", - keyColumn: "TransporterId", - keyValue: 4, - column: "PositionUpdated", - value: new DateTime(2021, 6, 7, 16, 4, 27, 345, DateTimeKind.Local).AddTicks(2811)); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "PressAct", - table: "PlantDetail"); - - migrationBuilder.DropColumn( - name: "PressBHAct", - table: "PlantDetail"); - - migrationBuilder.DropColumn( - name: "PressBHMax", - table: "PlantDetail"); - - migrationBuilder.DropColumn( - name: "PressBLAct", - table: "PlantDetail"); - - migrationBuilder.DropColumn( - name: "PressBLMax", - table: "PlantDetail"); - - migrationBuilder.DropColumn( - name: "PressMax", - table: "PlantDetail"); - - migrationBuilder.UpdateData( - table: "Transporter", - keyColumn: "TransporterId", - keyValue: 1, - column: "PositionUpdated", - value: new DateTime(2021, 6, 7, 13, 25, 25, 232, DateTimeKind.Local).AddTicks(985)); - - migrationBuilder.UpdateData( - table: "Transporter", - keyColumn: "TransporterId", - keyValue: 2, - column: "PositionUpdated", - value: new DateTime(2021, 6, 7, 13, 25, 25, 232, DateTimeKind.Local).AddTicks(1704)); - - migrationBuilder.UpdateData( - table: "Transporter", - keyColumn: "TransporterId", - keyValue: 3, - column: "PositionUpdated", - value: new DateTime(2021, 6, 7, 13, 25, 25, 232, DateTimeKind.Local).AddTicks(1715)); - - migrationBuilder.UpdateData( - table: "Transporter", - keyColumn: "TransporterId", - keyValue: 4, - column: "PositionUpdated", - value: new DateTime(2021, 6, 7, 13, 25, 25, 232, DateTimeKind.Local).AddTicks(1717)); - } - } -} diff --git a/GWMS.Data/Migrations/20210619150155_OrderETA.cs b/GWMS.Data/Migrations/20210619150155_OrderETA.cs deleted file mode 100644 index aa263ba..0000000 --- a/GWMS.Data/Migrations/20210619150155_OrderETA.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -namespace GWMS.Data.Migrations -{ - public partial class OrderETA : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "DtETA", - table: "Order", - type: "datetime2", - nullable: false, - defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); - - migrationBuilder.UpdateData( - table: "Transporter", - keyColumn: "TransporterId", - keyValue: 1, - column: "PositionUpdated", - value: new DateTime(2021, 6, 19, 17, 1, 54, 616, DateTimeKind.Local).AddTicks(17)); - - migrationBuilder.UpdateData( - table: "Transporter", - keyColumn: "TransporterId", - keyValue: 2, - column: "PositionUpdated", - value: new DateTime(2021, 6, 19, 17, 1, 54, 616, DateTimeKind.Local).AddTicks(684)); - - migrationBuilder.UpdateData( - table: "Transporter", - keyColumn: "TransporterId", - keyValue: 3, - column: "PositionUpdated", - value: new DateTime(2021, 6, 19, 17, 1, 54, 616, DateTimeKind.Local).AddTicks(694)); - - migrationBuilder.UpdateData( - table: "Transporter", - keyColumn: "TransporterId", - keyValue: 4, - column: "PositionUpdated", - value: new DateTime(2021, 6, 19, 17, 1, 54, 616, DateTimeKind.Local).AddTicks(696)); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "DtETA", - table: "Order"); - - migrationBuilder.UpdateData( - table: "Transporter", - keyColumn: "TransporterId", - keyValue: 1, - column: "PositionUpdated", - value: new DateTime(2021, 6, 7, 16, 4, 27, 345, DateTimeKind.Local).AddTicks(2116)); - - migrationBuilder.UpdateData( - table: "Transporter", - keyColumn: "TransporterId", - keyValue: 2, - column: "PositionUpdated", - value: new DateTime(2021, 6, 7, 16, 4, 27, 345, DateTimeKind.Local).AddTicks(2799)); - - migrationBuilder.UpdateData( - table: "Transporter", - keyColumn: "TransporterId", - keyValue: 3, - column: "PositionUpdated", - value: new DateTime(2021, 6, 7, 16, 4, 27, 345, DateTimeKind.Local).AddTicks(2809)); - - migrationBuilder.UpdateData( - table: "Transporter", - keyColumn: "TransporterId", - keyValue: 4, - column: "PositionUpdated", - value: new DateTime(2021, 6, 7, 16, 4, 27, 345, DateTimeKind.Local).AddTicks(2811)); - } - } -} diff --git a/GWMS.Data/Migrations/20210619150155_OrderETA.Designer.cs b/GWMS.Data/Migrations/20210622134348_InitDb.Designer.cs similarity index 65% rename from GWMS.Data/Migrations/20210619150155_OrderETA.Designer.cs rename to GWMS.Data/Migrations/20210622134348_InitDb.Designer.cs index 9c393f4..357ebb8 100644 --- a/GWMS.Data/Migrations/20210619150155_OrderETA.Designer.cs +++ b/GWMS.Data/Migrations/20210622134348_InitDb.Designer.cs @@ -3,34 +3,31 @@ using System; using GWMS.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace GWMS.Data.Migrations { [DbContext(typeof(GWMSContext))] - [Migration("20210619150155_OrderETA")] - partial class OrderETA + [Migration("20210622134348_InitDb")] + partial class InitDb { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("Relational:Collation", "SQL_Latin1_General_CP1_CI_AS") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("ProductVersion", "5.0.6") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasAnnotation("Relational:MaxIdentifierLength", 64) + .HasAnnotation("ProductVersion", "5.0.6"); modelBuilder.Entity("GWMS.Data.DatabaseModels.AnKeyValModel", b => { b.Property("KeyName") .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); + .HasColumnType("varchar(50)"); b.Property("Descript") .HasMaxLength(250) - .HasColumnType("nvarchar(250)") + .HasColumnType("varchar(250)") .HasComment("Descrizione dell'item"); b.Property("ValFloat") @@ -41,7 +38,7 @@ namespace GWMS.Data.Migrations b.Property("ValString") .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); + .HasColumnType("varchar(250)"); b.HasKey("KeyName"); @@ -52,12 +49,12 @@ namespace GWMS.Data.Migrations { b.Property("AuthRole") .HasMaxLength(50) - .HasColumnType("nvarchar(50)") + .HasColumnType("varchar(50)") .HasColumnName("AuthRole"); b.Property("Description") .HasMaxLength(250) - .HasColumnType("nvarchar(250)") + .HasColumnType("varchar(250)") .HasColumnName("Description"); b.HasKey("AuthRole"); @@ -67,18 +64,13 @@ namespace GWMS.Data.Migrations b.HasData( new { - AuthRole = "User", - Description = "Base User" + AuthRole = "SuperAdmin", + Description = "App SuperAdmin User" }, new { - AuthRole = "AppAdmin", - Description = "App Admin User" - }, - new - { - AuthRole = "Supervisor", - Description = "Supervisor User" + AuthRole = "Admin", + Description = "Main SUpervisor User" }, new { @@ -87,13 +79,13 @@ namespace GWMS.Data.Migrations }, new { - AuthRole = "SupplSuperUser", - Description = "Supplier Super User" + AuthRole = "Supplier", + Description = "Supplier User" }, new { - AuthRole = "SupplUser", - Description = "Supplier Standard User" + AuthRole = "Transporter", + Description = "Transporter User" }); }); @@ -101,19 +93,19 @@ namespace GWMS.Data.Migrations { b.Property("KeyName") .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); + .HasColumnType("varchar(50)"); b.Property("Note") .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); + .HasColumnType("varchar(250)"); b.Property("Val") .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); + .HasColumnType("varchar(50)"); b.Property("ValStd") .HasMaxLength(50) - .HasColumnType("nvarchar(50)") + .HasColumnType("varchar(50)") .HasComment("Valore di default/riferimento per la variabile"); b.HasKey("KeyName"); @@ -125,24 +117,23 @@ namespace GWMS.Data.Migrations { b.Property("ItemId") .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); b.Property("ItemCode") .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); + .HasColumnType("varchar(100)"); b.Property("ItemDesc") .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); + .HasColumnType("varchar(250)"); b.Property("ItemType") .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); + .HasColumnType("varchar(50)"); b.Property("UM") .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); + .HasColumnType("varchar(50)"); b.HasKey("ItemId"); @@ -153,22 +144,22 @@ namespace GWMS.Data.Migrations { b.Property("TabName") .HasMaxLength(50) - .HasColumnType("nvarchar(50)") + .HasColumnType("varchar(50)") .HasColumnName("TabName"); b.Property("FieldName") .HasMaxLength(50) - .HasColumnType("nvarchar(50)") + .HasColumnType("varchar(50)") .HasColumnName("FieldName"); b.Property("Val") .HasMaxLength(50) - .HasColumnType("nvarchar(50)") + .HasColumnType("varchar(50)") .HasColumnName("Val"); b.Property("Descript") .HasMaxLength(250) - .HasColumnType("nvarchar(250)") + .HasColumnType("varchar(250)") .HasColumnName("Descript"); b.Property("Ordinal") @@ -184,34 +175,33 @@ namespace GWMS.Data.Migrations { b.Property("OrderId") .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); b.Property("DtETA") - .HasColumnType("datetime2"); + .HasColumnType("datetime(6)"); b.Property("DtExecEnd") - .HasColumnType("datetime2"); + .HasColumnType("datetime(6)"); b.Property("DtExecStart") - .HasColumnType("datetime2"); + .HasColumnType("datetime(6)"); b.Property("DtOrder") - .HasColumnType("datetime2"); + .HasColumnType("datetime(6)"); b.Property("ExecutionQty") - .HasColumnType("float"); + .HasColumnType("double"); b.Property("OrderCode") .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); + .HasColumnType("varchar(100)"); b.Property("OrderDesc") .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); + .HasColumnType("varchar(250)"); b.Property("OrderQty") - .HasColumnType("float"); + .HasColumnType("double"); b.Property("PlantId") .HasColumnType("int"); @@ -237,40 +227,39 @@ namespace GWMS.Data.Migrations { b.Property("PlantId") .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); b.Property("LevelAct") - .HasColumnType("float"); + .HasColumnType("double"); b.Property("LevelMax") - .HasColumnType("float"); + .HasColumnType("double"); b.Property("PlantCode") .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); + .HasColumnType("varchar(100)"); b.Property("PlantDesc") .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); + .HasColumnType("varchar(250)"); b.Property("PressAct") - .HasColumnType("float"); + .HasColumnType("double"); b.Property("PressBHAct") - .HasColumnType("float"); + .HasColumnType("double"); b.Property("PressBHMax") - .HasColumnType("float"); + .HasColumnType("double"); b.Property("PressBLAct") - .HasColumnType("float"); + .HasColumnType("double"); b.Property("PressBLMax") - .HasColumnType("float"); + .HasColumnType("double"); b.Property("PressMax") - .HasColumnType("float"); + .HasColumnType("double"); b.HasKey("PlantId"); @@ -339,25 +328,24 @@ namespace GWMS.Data.Migrations { b.Property("PlantDataId") .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); b.Property("DtEvent") - .HasColumnType("datetime2"); + .HasColumnType("datetime(6)"); b.Property("FluxType") .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); + .HasColumnType("varchar(250)"); b.Property("PlantId") .HasColumnType("int"); b.Property("ValNumber") - .HasColumnType("float"); + .HasColumnType("double"); b.Property("ValString") .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); + .HasColumnType("varchar(250)"); b.HasKey("PlantDataId"); @@ -373,17 +361,17 @@ namespace GWMS.Data.Migrations b.Property("FluxType") .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); + .HasColumnType("varchar(250)"); b.Property("DtEvent") - .HasColumnType("datetime2"); + .HasColumnType("datetime(6)"); b.Property("ValNumber") - .HasColumnType("float"); + .HasColumnType("double"); b.Property("ValString") .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); + .HasColumnType("varchar(250)"); b.HasKey("PlantId", "FluxType"); @@ -403,7 +391,7 @@ namespace GWMS.Data.Migrations b.Property("Note") .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); + .HasColumnType("varchar(250)"); b.HasKey("PlantId", "SupplierId", "DayNum"); @@ -416,16 +404,15 @@ namespace GWMS.Data.Migrations { b.Property("SupplierId") .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); b.Property("SupplierCode") .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); + .HasColumnType("varchar(100)"); b.Property("SupplierDesc") .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); + .HasColumnType("varchar(250)"); b.HasKey("SupplierId"); @@ -435,14 +422,14 @@ namespace GWMS.Data.Migrations new { SupplierId = 1, - SupplierCode = "SUPSIM01", - SupplierDesc = "Fornitore 01" + SupplierCode = "LIQUIGAS", + SupplierDesc = "Fornitore Liquigas" }, new { SupplierId = 2, - SupplierCode = "SUPSIM02", - SupplierDesc = "Fornitore 02" + SupplierCode = "VULKANGAS", + SupplierDesc = "Fornitore Vulkangas" }); }); @@ -450,33 +437,27 @@ namespace GWMS.Data.Migrations { b.Property("TransporterId") .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); b.Property("PositionLatitude") - .HasColumnType("float"); + .HasColumnType("double"); b.Property("PositionLongitude") - .HasColumnType("float"); + .HasColumnType("double"); b.Property("PositionUpdated") - .HasColumnType("datetime2"); - - b.Property("SupplierId") - .HasColumnType("int"); + .HasColumnType("datetime(6)"); b.Property("TransporterCode") .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); + .HasColumnType("varchar(100)"); b.Property("TransporterDesc") .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); + .HasColumnType("varchar(250)"); b.HasKey("TransporterId"); - b.HasIndex("SupplierId"); - b.ToTable("Transporter"); b.HasData( @@ -485,8 +466,7 @@ namespace GWMS.Data.Migrations TransporterId = 1, PositionLatitude = 0.0, PositionLongitude = 0.0, - PositionUpdated = new DateTime(2021, 6, 19, 17, 1, 54, 616, DateTimeKind.Local).AddTicks(17), - SupplierId = 1, + PositionUpdated = new DateTime(2021, 6, 22, 15, 43, 47, 661, DateTimeKind.Local).AddTicks(7161), TransporterCode = "TSIM01", TransporterDesc = "Trasportatore SIM 01" }, @@ -495,8 +475,7 @@ namespace GWMS.Data.Migrations TransporterId = 2, PositionLatitude = 0.0, PositionLongitude = 0.0, - PositionUpdated = new DateTime(2021, 6, 19, 17, 1, 54, 616, DateTimeKind.Local).AddTicks(684), - SupplierId = 1, + PositionUpdated = new DateTime(2021, 6, 22, 15, 43, 47, 661, DateTimeKind.Local).AddTicks(7724), TransporterCode = "TSIM02", TransporterDesc = "Trasportatore SIM 02" }, @@ -505,8 +484,7 @@ namespace GWMS.Data.Migrations TransporterId = 3, PositionLatitude = 0.0, PositionLongitude = 0.0, - PositionUpdated = new DateTime(2021, 6, 19, 17, 1, 54, 616, DateTimeKind.Local).AddTicks(694), - SupplierId = 2, + PositionUpdated = new DateTime(2021, 6, 22, 15, 43, 47, 661, DateTimeKind.Local).AddTicks(7733), TransporterCode = "TSIM03", TransporterDesc = "Trasportatore SIM 03" }, @@ -515,8 +493,7 @@ namespace GWMS.Data.Migrations TransporterId = 4, PositionLatitude = 0.0, PositionLongitude = 0.0, - PositionUpdated = new DateTime(2021, 6, 19, 17, 1, 54, 616, DateTimeKind.Local).AddTicks(696), - SupplierId = 2, + PositionUpdated = new DateTime(2021, 6, 22, 15, 43, 47, 661, DateTimeKind.Local).AddTicks(7736), TransporterCode = "TSIM04", TransporterDesc = "Trasportatore SIM 04" }); @@ -528,7 +505,7 @@ namespace GWMS.Data.Migrations .HasColumnType("int"); b.Property("AuthRole") - .HasColumnType("nvarchar(50)"); + .HasColumnType("varchar(50)"); b.Property("AuthLevel") .HasColumnType("int"); @@ -543,38 +520,80 @@ namespace GWMS.Data.Migrations new { UserId = 1, - AuthRole = "AppAdmin", - AuthLevel = 0 + AuthRole = "SuperAdmin", + AuthLevel = 1 }, new { UserId = 2, - AuthRole = "AppAdmin", - AuthLevel = 0 + AuthRole = "SuperAdmin", + AuthLevel = 1 }, new { UserId = 3, - AuthRole = "Supervisor", - AuthLevel = 0 + AuthRole = "SuperAdmin", + AuthLevel = 1 }, new { UserId = 4, - AuthRole = "PlantUser", - AuthLevel = 0 + AuthRole = "Admin", + AuthLevel = 1 }, new { UserId = 5, - AuthRole = "SupplSuperUser", - AuthLevel = 0 + AuthRole = "Admin", + AuthLevel = 1 }, new { UserId = 6, - AuthRole = "SupplUser", - AuthLevel = 0 + AuthRole = "Supplier", + AuthLevel = 6 + }, + new + { + UserId = 7, + AuthRole = "Supplier", + AuthLevel = 7 + }, + new + { + UserId = 8, + AuthRole = "Transporter", + AuthLevel = 1 + }, + new + { + UserId = 9, + AuthRole = "Transporter", + AuthLevel = 2 + }, + new + { + UserId = 10, + AuthRole = "PlantUser", + AuthLevel = 1 + }, + new + { + UserId = 11, + AuthRole = "PlantUser", + AuthLevel = 2 + }, + new + { + UserId = 12, + AuthRole = "PlantUser", + AuthLevel = 3 + }, + new + { + UserId = 13, + AuthRole = "PlantUser", + AuthLevel = 4 }); }); @@ -582,43 +601,38 @@ namespace GWMS.Data.Migrations { b.Property("UserId") .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); b.Property("AuthKey") .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Domain") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); + .HasColumnType("varchar(100)"); b.Property("Email") .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("ExtCode") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); + .HasColumnType("varchar(250)"); b.Property("Firstname") .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); + .HasColumnType("varchar(50)"); b.Property("IsActive") - .HasColumnType("bit"); + .HasColumnType("tinyint(1)"); b.Property("Lang") .HasMaxLength(10) - .HasColumnType("nvarchar(10)"); + .HasColumnType("varchar(10)"); b.Property("Lastname") .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); + .HasColumnType("varchar(50)"); + + b.Property("SaltPasswd") + .HasMaxLength(250) + .HasColumnType("varchar(250)"); b.Property("UserName") .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); + .HasColumnType("varchar(50)"); b.HasKey("UserId"); @@ -628,80 +642,158 @@ namespace GWMS.Data.Migrations new { UserId = 1, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", + AuthKey = "th1sIsTh3R1vrOfThNgt98", Email = "samuele@steamware.net", - ExtCode = "", Firstname = "Samuele", IsActive = true, Lang = "IT", Lastname = "Locatelli", - UserName = "samuele" + SaltPasswd = "", + UserName = "samuele.locatelli" }, new { UserId = 2, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", + AuthKey = "th1sIsTh3R1vrOfThNgt91", Email = "giancarlo@steamware.net", - ExtCode = "", Firstname = "Giancarlo", IsActive = true, Lang = "IT", Lastname = "Rottoli", - UserName = "giancarlo" + SaltPasswd = "", + UserName = "giancarlo.rottoli" }, new { UserId = 3, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", + AuthKey = "th1sIsTh3R1vrOfThNgt93", Email = "info@steamware.net", - ExtCode = "", Firstname = "Steamware", IsActive = true, Lang = "IT", - Lastname = "User03", - UserName = "user03" + Lastname = "Admin", + SaltPasswd = "", + UserName = "steamw.admin" }, new { UserId = 4, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", - Email = "info@steamware.net", - ExtCode = "", - Firstname = "Steamware", + AuthKey = "th1sIsTh3R1vrOfThNgt97", + Email = "a.pizzaferri@pizzaferripetroli.it", + Firstname = "Angelo", IsActive = true, Lang = "IT", - Lastname = "User04", - UserName = "user04" + Lastname = "Pizzaferri", + SaltPasswd = "", + UserName = "angelo.pizzaferri" }, new { UserId = 5, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", - Email = "info@steamware.net", - ExtCode = "", - Firstname = "Steamware", + AuthKey = "th1sIsTh3R1vrOfThNgt99", + Email = "andrei.valeanu@winnlab.it", + Firstname = "Andrei", IsActive = true, Lang = "IT", - Lastname = "User05", - UserName = "user05" + Lastname = "Valeanu", + SaltPasswd = "", + UserName = "andrei.valeanu" }, new { UserId = 6, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", + AuthKey = "th1sIsTh3R1vrOfThNgt92", Email = "info@steamware.net", - ExtCode = "", - Firstname = "Steamware", + Firstname = "User", IsActive = true, Lang = "IT", - Lastname = "User06", - UserName = "user06" + Lastname = "LIQUIGAS", + SaltPasswd = "", + UserName = "liquigas.user01" + }, + new + { + UserId = 7, + AuthKey = "th1sIsTh3R1vrOfThNgt94", + Email = "info@steamware.net", + Firstname = "User", + IsActive = true, + Lang = "IT", + Lastname = "VULKANGAS", + SaltPasswd = "", + UserName = "vulkangas.user01" + }, + new + { + UserId = 8, + AuthKey = "th1sIsTh3R1vrOfThNgt95", + Email = "info@steamware.net", + Firstname = "User", + IsActive = true, + Lang = "IT", + Lastname = "LEVORATO", + SaltPasswd = "", + UserName = "levorato.user01" + }, + new + { + UserId = 9, + AuthKey = "th1sIsTh3R1vrOfThNgt96", + Email = "info@steamware.net", + Firstname = "User", + IsActive = true, + Lang = "IT", + Lastname = "TRAFFIK", + SaltPasswd = "", + UserName = "traffik.user01" + }, + new + { + UserId = 10, + AuthKey = "th1sIsTh3R1vrOfThNgt96", + Email = "info@steamware.net", + Firstname = "Stazione", + IsActive = true, + Lang = "IT", + Lastname = "Collecchio", + SaltPasswd = "", + UserName = "piz03.user01" + }, + new + { + UserId = 11, + AuthKey = "th1sIsTh3R1vrOfThNgt96", + Email = "info@steamware.net", + Firstname = "Stazione", + IsActive = true, + Lang = "IT", + Lastname = "Noceto", + SaltPasswd = "", + UserName = "piz04.user01" + }, + new + { + UserId = 12, + AuthKey = "th1sIsTh3R1vrOfThNgt96", + Email = "info@steamware.net", + Firstname = "Stazione", + IsActive = true, + Lang = "IT", + Lastname = "Baganzola", + SaltPasswd = "", + UserName = "piz05.user01" + }, + new + { + UserId = 13, + AuthKey = "th1sIsTh3R1vrOfThNgt96", + Email = "info@steamware.net", + Firstname = "Stazione", + IsActive = true, + Lang = "IT", + Lastname = "Pilastrello", + SaltPasswd = "", + UserName = "piz08.user01" }); }); @@ -773,17 +865,6 @@ namespace GWMS.Data.Migrations b.Navigation("Supplier"); }); - modelBuilder.Entity("GWMS.Data.DatabaseModels.TransporterModel", b => - { - b.HasOne("GWMS.Data.DatabaseModels.SupplierModel", "Supplier") - .WithMany() - .HasForeignKey("SupplierId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Supplier"); - }); - modelBuilder.Entity("GWMS.Data.DatabaseModels.UserAuthModel", b => { b.HasOne("GWMS.Data.DatabaseModels.AuthModel", "Role") diff --git a/GWMS.Data/Migrations/20210622134348_InitDb.cs b/GWMS.Data/Migrations/20210622134348_InitDb.cs new file mode 100644 index 0000000..557991b --- /dev/null +++ b/GWMS.Data/Migrations/20210622134348_InitDb.cs @@ -0,0 +1,506 @@ +using System; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace GWMS.Data.Migrations +{ + public partial class InitDb : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterDatabase() + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "AnKeyVal", + columns: table => new + { + KeyName = table.Column(type: "varchar(50)", maxLength: 50, nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ValInt = table.Column(type: "int", nullable: false), + ValFloat = table.Column(type: "int", nullable: false), + ValString = table.Column(type: "varchar(250)", maxLength: 250, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + Descript = table.Column(type: "varchar(250)", maxLength: 250, nullable: true, comment: "Descrizione dell'item") + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_AnKeyVal", x => x.KeyName); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "Auths", + columns: table => new + { + AuthRole = table.Column(type: "varchar(50)", maxLength: 50, nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Description = table.Column(type: "varchar(250)", maxLength: 250, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_Auths", x => x.AuthRole); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "Config", + columns: table => new + { + KeyName = table.Column(type: "varchar(50)", maxLength: 50, nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Val = table.Column(type: "varchar(50)", maxLength: 50, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + ValStd = table.Column(type: "varchar(50)", maxLength: 50, nullable: true, comment: "Valore di default/riferimento per la variabile") + .Annotation("MySql:CharSet", "utf8mb4"), + Note = table.Column(type: "varchar(250)", maxLength: 250, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_Config", x => x.KeyName); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "Items", + columns: table => new + { + ItemId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + ItemCode = table.Column(type: "varchar(100)", maxLength: 100, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + ItemDesc = table.Column(type: "varchar(250)", maxLength: 250, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + ItemType = table.Column(type: "varchar(50)", maxLength: 50, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + UM = table.Column(type: "varchar(50)", maxLength: 50, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_Items", x => x.ItemId); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ListVal", + columns: table => new + { + TabName = table.Column(type: "varchar(50)", maxLength: 50, nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + FieldName = table.Column(type: "varchar(50)", maxLength: 50, nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Val = table.Column(type: "varchar(50)", maxLength: 50, nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Descript = table.Column(type: "varchar(250)", maxLength: 250, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + Ordinal = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ListVal", x => new { x.TabName, x.FieldName, x.Val }); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "PlantDetail", + columns: table => new + { + PlantId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + PlantCode = table.Column(type: "varchar(100)", maxLength: 100, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + PlantDesc = table.Column(type: "varchar(250)", maxLength: 250, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + LevelMax = table.Column(type: "double", nullable: false), + LevelAct = table.Column(type: "double", nullable: false), + PressMax = table.Column(type: "double", nullable: false), + PressAct = table.Column(type: "double", nullable: false), + PressBHMax = table.Column(type: "double", nullable: false), + PressBHAct = table.Column(type: "double", nullable: false), + PressBLMax = table.Column(type: "double", nullable: false), + PressBLAct = table.Column(type: "double", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_PlantDetail", x => x.PlantId); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "Supplier", + columns: table => new + { + SupplierId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + SupplierCode = table.Column(type: "varchar(100)", maxLength: 100, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + SupplierDesc = table.Column(type: "varchar(250)", maxLength: 250, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_Supplier", x => x.SupplierId); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "Transporter", + columns: table => new + { + TransporterId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + TransporterCode = table.Column(type: "varchar(100)", maxLength: 100, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + TransporterDesc = table.Column(type: "varchar(250)", maxLength: 250, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + PositionLatitude = table.Column(type: "double", nullable: false), + PositionLongitude = table.Column(type: "double", nullable: false), + PositionUpdated = table.Column(type: "datetime(6)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Transporter", x => x.TransporterId); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "Users", + columns: table => new + { + UserId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + UserName = table.Column(type: "varchar(50)", maxLength: 50, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + SaltPasswd = table.Column(type: "varchar(250)", maxLength: 250, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + Lastname = table.Column(type: "varchar(50)", maxLength: 50, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + Firstname = table.Column(type: "varchar(50)", maxLength: 50, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + Email = table.Column(type: "varchar(250)", maxLength: 250, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + Lang = table.Column(type: "varchar(10)", maxLength: 10, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + AuthKey = table.Column(type: "varchar(100)", maxLength: 100, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + IsActive = table.Column(type: "tinyint(1)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Users", x => x.UserId); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "PlantLog", + columns: table => new + { + PlantDataId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + DtEvent = table.Column(type: "datetime(6)", nullable: false), + FluxType = table.Column(type: "varchar(250)", maxLength: 250, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + PlantId = table.Column(type: "int", nullable: false), + ValNumber = table.Column(type: "double", nullable: false), + ValString = table.Column(type: "varchar(250)", maxLength: 250, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_PlantLog", x => x.PlantDataId); + table.ForeignKey( + name: "FK_PlantLog_PlantDetail_PlantId", + column: x => x.PlantId, + principalTable: "PlantDetail", + principalColumn: "PlantId", + onDelete: ReferentialAction.Restrict); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "PlantStatus", + columns: table => new + { + PlantId = table.Column(type: "int", nullable: false), + FluxType = table.Column(type: "varchar(250)", maxLength: 250, nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + DtEvent = table.Column(type: "datetime(6)", nullable: false), + ValNumber = table.Column(type: "double", nullable: false), + ValString = table.Column(type: "varchar(250)", maxLength: 250, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_PlantStatus", x => new { x.PlantId, x.FluxType }); + table.ForeignKey( + name: "FK_PlantStatus_PlantDetail_PlantId", + column: x => x.PlantId, + principalTable: "PlantDetail", + principalColumn: "PlantId", + onDelete: ReferentialAction.Restrict); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "PlantSupplWeekPlan", + columns: table => new + { + PlantId = table.Column(type: "int", nullable: false), + SupplierId = table.Column(type: "int", nullable: false), + DayNum = table.Column(type: "int", nullable: false), + Note = table.Column(type: "varchar(250)", maxLength: 250, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_PlantSupplWeekPlan", x => new { x.PlantId, x.SupplierId, x.DayNum }); + table.ForeignKey( + name: "FK_PlantSupplWeekPlan_PlantDetail_PlantId", + column: x => x.PlantId, + principalTable: "PlantDetail", + principalColumn: "PlantId", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_PlantSupplWeekPlan_Supplier_SupplierId", + column: x => x.SupplierId, + principalTable: "Supplier", + principalColumn: "SupplierId", + onDelete: ReferentialAction.Restrict); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "Order", + columns: table => new + { + OrderId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + DtOrder = table.Column(type: "datetime(6)", nullable: false), + PlantId = table.Column(type: "int", nullable: false), + SupplierId = table.Column(type: "int", nullable: false), + TransporterId = table.Column(type: "int", nullable: false), + OrderCode = table.Column(type: "varchar(100)", maxLength: 100, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + OrderDesc = table.Column(type: "varchar(250)", maxLength: 250, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + OrderQty = table.Column(type: "double", nullable: false), + DtETA = table.Column(type: "datetime(6)", nullable: false), + DtExecStart = table.Column(type: "datetime(6)", nullable: false), + DtExecEnd = table.Column(type: "datetime(6)", nullable: false), + ExecutionQty = table.Column(type: "double", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Order", x => x.OrderId); + table.ForeignKey( + name: "FK_Order_PlantDetail_PlantId", + column: x => x.PlantId, + principalTable: "PlantDetail", + principalColumn: "PlantId", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_Order_Supplier_SupplierId", + column: x => x.SupplierId, + principalTable: "Supplier", + principalColumn: "SupplierId", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_Order_Transporter_TransporterId", + column: x => x.TransporterId, + principalTable: "Transporter", + principalColumn: "TransporterId", + onDelete: ReferentialAction.Restrict); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "UserAuth", + columns: table => new + { + UserId = table.Column(type: "int", nullable: false), + AuthRole = table.Column(type: "varchar(50)", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + AuthLevel = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_UserAuth", x => new { x.UserId, x.AuthRole }); + table.ForeignKey( + name: "FK_UserAuth_Auths_AuthRole", + column: x => x.AuthRole, + principalTable: "Auths", + principalColumn: "AuthRole", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_UserAuth_Users_UserId", + column: x => x.UserId, + principalTable: "Users", + principalColumn: "UserId", + onDelete: ReferentialAction.Restrict); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.InsertData( + table: "Auths", + columns: new[] { "AuthRole", "Description" }, + values: new object[,] + { + { "SuperAdmin", "App SuperAdmin User" }, + { "Admin", "Main SUpervisor User" }, + { "PlantUser", "Plant User" }, + { "Supplier", "Supplier User" }, + { "Transporter", "Transporter User" } + }); + + migrationBuilder.InsertData( + table: "PlantDetail", + columns: new[] { "PlantId", "LevelAct", "LevelMax", "PlantCode", "PlantDesc", "PressAct", "PressBHAct", "PressBHMax", "PressBLAct", "PressBLMax", "PressMax" }, + values: new object[,] + { + { 1, 0.0, 28000.0, "PIZ03", "Collecchio", 0.0, 0.0, 270.0, 0.0, 270.0, 19.0 }, + { 2, 0.0, 28000.0, "PIZ04", "Noceto", 0.0, 0.0, 270.0, 0.0, 270.0, 19.0 }, + { 3, 0.0, 24000.0, "PIZ05", "Baganzola", 0.0, 0.0, 270.0, 0.0, 270.0, 19.0 }, + { 4, 0.0, 24000.0, "PIZ08", "Pilastrello", 0.0, 0.0, 270.0, 0.0, 270.0, 19.0 } + }); + + migrationBuilder.InsertData( + table: "Supplier", + columns: new[] { "SupplierId", "SupplierCode", "SupplierDesc" }, + values: new object[,] + { + { 1, "LIQUIGAS", "Fornitore Liquigas" }, + { 2, "VULKANGAS", "Fornitore Vulkangas" } + }); + + migrationBuilder.InsertData( + table: "Transporter", + columns: new[] { "TransporterId", "PositionLatitude", "PositionLongitude", "PositionUpdated", "TransporterCode", "TransporterDesc" }, + values: new object[,] + { + { 4, 0.0, 0.0, new DateTime(2021, 6, 22, 15, 43, 47, 661, DateTimeKind.Local).AddTicks(7736), "TSIM04", "Trasportatore SIM 04" }, + { 3, 0.0, 0.0, new DateTime(2021, 6, 22, 15, 43, 47, 661, DateTimeKind.Local).AddTicks(7733), "TSIM03", "Trasportatore SIM 03" }, + { 1, 0.0, 0.0, new DateTime(2021, 6, 22, 15, 43, 47, 661, DateTimeKind.Local).AddTicks(7161), "TSIM01", "Trasportatore SIM 01" }, + { 2, 0.0, 0.0, new DateTime(2021, 6, 22, 15, 43, 47, 661, DateTimeKind.Local).AddTicks(7724), "TSIM02", "Trasportatore SIM 02" } + }); + + migrationBuilder.InsertData( + table: "Users", + columns: new[] { "UserId", "AuthKey", "Email", "Firstname", "IsActive", "Lang", "Lastname", "SaltPasswd", "UserName" }, + values: new object[,] + { + { 12, "th1sIsTh3R1vrOfThNgt96", "info@steamware.net", "Stazione", true, "IT", "Baganzola", "", "piz05.user01" }, + { 1, "th1sIsTh3R1vrOfThNgt98", "samuele@steamware.net", "Samuele", true, "IT", "Locatelli", "", "samuele.locatelli" }, + { 2, "th1sIsTh3R1vrOfThNgt91", "giancarlo@steamware.net", "Giancarlo", true, "IT", "Rottoli", "", "giancarlo.rottoli" }, + { 3, "th1sIsTh3R1vrOfThNgt93", "info@steamware.net", "Steamware", true, "IT", "Admin", "", "steamw.admin" }, + { 4, "th1sIsTh3R1vrOfThNgt97", "a.pizzaferri@pizzaferripetroli.it", "Angelo", true, "IT", "Pizzaferri", "", "angelo.pizzaferri" }, + { 5, "th1sIsTh3R1vrOfThNgt99", "andrei.valeanu@winnlab.it", "Andrei", true, "IT", "Valeanu", "", "andrei.valeanu" }, + { 6, "th1sIsTh3R1vrOfThNgt92", "info@steamware.net", "User", true, "IT", "LIQUIGAS", "", "liquigas.user01" }, + { 7, "th1sIsTh3R1vrOfThNgt94", "info@steamware.net", "User", true, "IT", "VULKANGAS", "", "vulkangas.user01" }, + { 8, "th1sIsTh3R1vrOfThNgt95", "info@steamware.net", "User", true, "IT", "LEVORATO", "", "levorato.user01" }, + { 9, "th1sIsTh3R1vrOfThNgt96", "info@steamware.net", "User", true, "IT", "TRAFFIK", "", "traffik.user01" }, + { 10, "th1sIsTh3R1vrOfThNgt96", "info@steamware.net", "Stazione", true, "IT", "Collecchio", "", "piz03.user01" }, + { 11, "th1sIsTh3R1vrOfThNgt96", "info@steamware.net", "Stazione", true, "IT", "Noceto", "", "piz04.user01" }, + { 13, "th1sIsTh3R1vrOfThNgt96", "info@steamware.net", "Stazione", true, "IT", "Pilastrello", "", "piz08.user01" } + }); + + migrationBuilder.InsertData( + table: "UserAuth", + columns: new[] { "AuthRole", "UserId", "AuthLevel" }, + values: new object[,] + { + { "SuperAdmin", 1, 1 }, + { "SuperAdmin", 2, 1 }, + { "SuperAdmin", 3, 1 }, + { "Admin", 4, 1 }, + { "Admin", 5, 1 }, + { "Supplier", 6, 6 }, + { "Supplier", 7, 7 }, + { "Transporter", 8, 1 }, + { "Transporter", 9, 2 }, + { "PlantUser", 10, 1 }, + { "PlantUser", 11, 2 }, + { "PlantUser", 12, 3 }, + { "PlantUser", 13, 4 } + }); + + migrationBuilder.CreateIndex( + name: "IX_Order_PlantId", + table: "Order", + column: "PlantId"); + + migrationBuilder.CreateIndex( + name: "IX_Order_SupplierId", + table: "Order", + column: "SupplierId"); + + migrationBuilder.CreateIndex( + name: "IX_Order_TransporterId", + table: "Order", + column: "TransporterId"); + + migrationBuilder.CreateIndex( + name: "IX_PlantLog_PlantId", + table: "PlantLog", + column: "PlantId"); + + migrationBuilder.CreateIndex( + name: "IX_PlantSupplWeekPlan_SupplierId", + table: "PlantSupplWeekPlan", + column: "SupplierId"); + + migrationBuilder.CreateIndex( + name: "IX_UserAuth_AuthRole", + table: "UserAuth", + column: "AuthRole"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "AnKeyVal"); + + migrationBuilder.DropTable( + name: "Config"); + + migrationBuilder.DropTable( + name: "Items"); + + migrationBuilder.DropTable( + name: "ListVal"); + + migrationBuilder.DropTable( + name: "Order"); + + migrationBuilder.DropTable( + name: "PlantLog"); + + migrationBuilder.DropTable( + name: "PlantStatus"); + + migrationBuilder.DropTable( + name: "PlantSupplWeekPlan"); + + migrationBuilder.DropTable( + name: "UserAuth"); + + migrationBuilder.DropTable( + name: "Transporter"); + + migrationBuilder.DropTable( + name: "PlantDetail"); + + migrationBuilder.DropTable( + name: "Supplier"); + + migrationBuilder.DropTable( + name: "Auths"); + + migrationBuilder.DropTable( + name: "Users"); + } + } +} diff --git a/GWMS.Data/Migrations/GWMSContextModelSnapshot.cs b/GWMS.Data/Migrations/GWMSContextModelSnapshot.cs index 8193313..1dc4f9d 100644 --- a/GWMS.Data/Migrations/GWMSContextModelSnapshot.cs +++ b/GWMS.Data/Migrations/GWMSContextModelSnapshot.cs @@ -3,7 +3,6 @@ using System; using GWMS.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace GWMS.Data.Migrations @@ -15,20 +14,18 @@ namespace GWMS.Data.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("Relational:Collation", "SQL_Latin1_General_CP1_CI_AS") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("ProductVersion", "5.0.6") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasAnnotation("Relational:MaxIdentifierLength", 64) + .HasAnnotation("ProductVersion", "5.0.6"); modelBuilder.Entity("GWMS.Data.DatabaseModels.AnKeyValModel", b => { b.Property("KeyName") .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); + .HasColumnType("varchar(50)"); b.Property("Descript") .HasMaxLength(250) - .HasColumnType("nvarchar(250)") + .HasColumnType("varchar(250)") .HasComment("Descrizione dell'item"); b.Property("ValFloat") @@ -39,7 +36,7 @@ namespace GWMS.Data.Migrations b.Property("ValString") .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); + .HasColumnType("varchar(250)"); b.HasKey("KeyName"); @@ -50,12 +47,12 @@ namespace GWMS.Data.Migrations { b.Property("AuthRole") .HasMaxLength(50) - .HasColumnType("nvarchar(50)") + .HasColumnType("varchar(50)") .HasColumnName("AuthRole"); b.Property("Description") .HasMaxLength(250) - .HasColumnType("nvarchar(250)") + .HasColumnType("varchar(250)") .HasColumnName("Description"); b.HasKey("AuthRole"); @@ -65,18 +62,13 @@ namespace GWMS.Data.Migrations b.HasData( new { - AuthRole = "User", - Description = "Base User" + AuthRole = "SuperAdmin", + Description = "App SuperAdmin User" }, new { - AuthRole = "AppAdmin", - Description = "App Admin User" - }, - new - { - AuthRole = "Supervisor", - Description = "Supervisor User" + AuthRole = "Admin", + Description = "Main SUpervisor User" }, new { @@ -85,13 +77,13 @@ namespace GWMS.Data.Migrations }, new { - AuthRole = "SupplSuperUser", - Description = "Supplier Super User" + AuthRole = "Supplier", + Description = "Supplier User" }, new { - AuthRole = "SupplUser", - Description = "Supplier Standard User" + AuthRole = "Transporter", + Description = "Transporter User" }); }); @@ -99,19 +91,19 @@ namespace GWMS.Data.Migrations { b.Property("KeyName") .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); + .HasColumnType("varchar(50)"); b.Property("Note") .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); + .HasColumnType("varchar(250)"); b.Property("Val") .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); + .HasColumnType("varchar(50)"); b.Property("ValStd") .HasMaxLength(50) - .HasColumnType("nvarchar(50)") + .HasColumnType("varchar(50)") .HasComment("Valore di default/riferimento per la variabile"); b.HasKey("KeyName"); @@ -123,24 +115,23 @@ namespace GWMS.Data.Migrations { b.Property("ItemId") .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); b.Property("ItemCode") .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); + .HasColumnType("varchar(100)"); b.Property("ItemDesc") .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); + .HasColumnType("varchar(250)"); b.Property("ItemType") .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); + .HasColumnType("varchar(50)"); b.Property("UM") .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); + .HasColumnType("varchar(50)"); b.HasKey("ItemId"); @@ -151,22 +142,22 @@ namespace GWMS.Data.Migrations { b.Property("TabName") .HasMaxLength(50) - .HasColumnType("nvarchar(50)") + .HasColumnType("varchar(50)") .HasColumnName("TabName"); b.Property("FieldName") .HasMaxLength(50) - .HasColumnType("nvarchar(50)") + .HasColumnType("varchar(50)") .HasColumnName("FieldName"); b.Property("Val") .HasMaxLength(50) - .HasColumnType("nvarchar(50)") + .HasColumnType("varchar(50)") .HasColumnName("Val"); b.Property("Descript") .HasMaxLength(250) - .HasColumnType("nvarchar(250)") + .HasColumnType("varchar(250)") .HasColumnName("Descript"); b.Property("Ordinal") @@ -182,34 +173,33 @@ namespace GWMS.Data.Migrations { b.Property("OrderId") .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); b.Property("DtETA") - .HasColumnType("datetime2"); + .HasColumnType("datetime(6)"); b.Property("DtExecEnd") - .HasColumnType("datetime2"); + .HasColumnType("datetime(6)"); b.Property("DtExecStart") - .HasColumnType("datetime2"); + .HasColumnType("datetime(6)"); b.Property("DtOrder") - .HasColumnType("datetime2"); + .HasColumnType("datetime(6)"); b.Property("ExecutionQty") - .HasColumnType("float"); + .HasColumnType("double"); b.Property("OrderCode") .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); + .HasColumnType("varchar(100)"); b.Property("OrderDesc") .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); + .HasColumnType("varchar(250)"); b.Property("OrderQty") - .HasColumnType("float"); + .HasColumnType("double"); b.Property("PlantId") .HasColumnType("int"); @@ -235,40 +225,39 @@ namespace GWMS.Data.Migrations { b.Property("PlantId") .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); b.Property("LevelAct") - .HasColumnType("float"); + .HasColumnType("double"); b.Property("LevelMax") - .HasColumnType("float"); + .HasColumnType("double"); b.Property("PlantCode") .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); + .HasColumnType("varchar(100)"); b.Property("PlantDesc") .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); + .HasColumnType("varchar(250)"); b.Property("PressAct") - .HasColumnType("float"); + .HasColumnType("double"); b.Property("PressBHAct") - .HasColumnType("float"); + .HasColumnType("double"); b.Property("PressBHMax") - .HasColumnType("float"); + .HasColumnType("double"); b.Property("PressBLAct") - .HasColumnType("float"); + .HasColumnType("double"); b.Property("PressBLMax") - .HasColumnType("float"); + .HasColumnType("double"); b.Property("PressMax") - .HasColumnType("float"); + .HasColumnType("double"); b.HasKey("PlantId"); @@ -337,25 +326,24 @@ namespace GWMS.Data.Migrations { b.Property("PlantDataId") .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); b.Property("DtEvent") - .HasColumnType("datetime2"); + .HasColumnType("datetime(6)"); b.Property("FluxType") .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); + .HasColumnType("varchar(250)"); b.Property("PlantId") .HasColumnType("int"); b.Property("ValNumber") - .HasColumnType("float"); + .HasColumnType("double"); b.Property("ValString") .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); + .HasColumnType("varchar(250)"); b.HasKey("PlantDataId"); @@ -371,17 +359,17 @@ namespace GWMS.Data.Migrations b.Property("FluxType") .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); + .HasColumnType("varchar(250)"); b.Property("DtEvent") - .HasColumnType("datetime2"); + .HasColumnType("datetime(6)"); b.Property("ValNumber") - .HasColumnType("float"); + .HasColumnType("double"); b.Property("ValString") .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); + .HasColumnType("varchar(250)"); b.HasKey("PlantId", "FluxType"); @@ -401,7 +389,7 @@ namespace GWMS.Data.Migrations b.Property("Note") .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); + .HasColumnType("varchar(250)"); b.HasKey("PlantId", "SupplierId", "DayNum"); @@ -414,16 +402,15 @@ namespace GWMS.Data.Migrations { b.Property("SupplierId") .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); b.Property("SupplierCode") .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); + .HasColumnType("varchar(100)"); b.Property("SupplierDesc") .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); + .HasColumnType("varchar(250)"); b.HasKey("SupplierId"); @@ -433,14 +420,14 @@ namespace GWMS.Data.Migrations new { SupplierId = 1, - SupplierCode = "SUPSIM01", - SupplierDesc = "Fornitore 01" + SupplierCode = "LIQUIGAS", + SupplierDesc = "Fornitore Liquigas" }, new { SupplierId = 2, - SupplierCode = "SUPSIM02", - SupplierDesc = "Fornitore 02" + SupplierCode = "VULKANGAS", + SupplierDesc = "Fornitore Vulkangas" }); }); @@ -448,33 +435,27 @@ namespace GWMS.Data.Migrations { b.Property("TransporterId") .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); b.Property("PositionLatitude") - .HasColumnType("float"); + .HasColumnType("double"); b.Property("PositionLongitude") - .HasColumnType("float"); + .HasColumnType("double"); b.Property("PositionUpdated") - .HasColumnType("datetime2"); - - b.Property("SupplierId") - .HasColumnType("int"); + .HasColumnType("datetime(6)"); b.Property("TransporterCode") .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); + .HasColumnType("varchar(100)"); b.Property("TransporterDesc") .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); + .HasColumnType("varchar(250)"); b.HasKey("TransporterId"); - b.HasIndex("SupplierId"); - b.ToTable("Transporter"); b.HasData( @@ -483,8 +464,7 @@ namespace GWMS.Data.Migrations TransporterId = 1, PositionLatitude = 0.0, PositionLongitude = 0.0, - PositionUpdated = new DateTime(2021, 6, 19, 17, 1, 54, 616, DateTimeKind.Local).AddTicks(17), - SupplierId = 1, + PositionUpdated = new DateTime(2021, 6, 22, 15, 43, 47, 661, DateTimeKind.Local).AddTicks(7161), TransporterCode = "TSIM01", TransporterDesc = "Trasportatore SIM 01" }, @@ -493,8 +473,7 @@ namespace GWMS.Data.Migrations TransporterId = 2, PositionLatitude = 0.0, PositionLongitude = 0.0, - PositionUpdated = new DateTime(2021, 6, 19, 17, 1, 54, 616, DateTimeKind.Local).AddTicks(684), - SupplierId = 1, + PositionUpdated = new DateTime(2021, 6, 22, 15, 43, 47, 661, DateTimeKind.Local).AddTicks(7724), TransporterCode = "TSIM02", TransporterDesc = "Trasportatore SIM 02" }, @@ -503,8 +482,7 @@ namespace GWMS.Data.Migrations TransporterId = 3, PositionLatitude = 0.0, PositionLongitude = 0.0, - PositionUpdated = new DateTime(2021, 6, 19, 17, 1, 54, 616, DateTimeKind.Local).AddTicks(694), - SupplierId = 2, + PositionUpdated = new DateTime(2021, 6, 22, 15, 43, 47, 661, DateTimeKind.Local).AddTicks(7733), TransporterCode = "TSIM03", TransporterDesc = "Trasportatore SIM 03" }, @@ -513,8 +491,7 @@ namespace GWMS.Data.Migrations TransporterId = 4, PositionLatitude = 0.0, PositionLongitude = 0.0, - PositionUpdated = new DateTime(2021, 6, 19, 17, 1, 54, 616, DateTimeKind.Local).AddTicks(696), - SupplierId = 2, + PositionUpdated = new DateTime(2021, 6, 22, 15, 43, 47, 661, DateTimeKind.Local).AddTicks(7736), TransporterCode = "TSIM04", TransporterDesc = "Trasportatore SIM 04" }); @@ -526,7 +503,7 @@ namespace GWMS.Data.Migrations .HasColumnType("int"); b.Property("AuthRole") - .HasColumnType("nvarchar(50)"); + .HasColumnType("varchar(50)"); b.Property("AuthLevel") .HasColumnType("int"); @@ -541,38 +518,80 @@ namespace GWMS.Data.Migrations new { UserId = 1, - AuthRole = "AppAdmin", - AuthLevel = 0 + AuthRole = "SuperAdmin", + AuthLevel = 1 }, new { UserId = 2, - AuthRole = "AppAdmin", - AuthLevel = 0 + AuthRole = "SuperAdmin", + AuthLevel = 1 }, new { UserId = 3, - AuthRole = "Supervisor", - AuthLevel = 0 + AuthRole = "SuperAdmin", + AuthLevel = 1 }, new { UserId = 4, - AuthRole = "PlantUser", - AuthLevel = 0 + AuthRole = "Admin", + AuthLevel = 1 }, new { UserId = 5, - AuthRole = "SupplSuperUser", - AuthLevel = 0 + AuthRole = "Admin", + AuthLevel = 1 }, new { UserId = 6, - AuthRole = "SupplUser", - AuthLevel = 0 + AuthRole = "Supplier", + AuthLevel = 6 + }, + new + { + UserId = 7, + AuthRole = "Supplier", + AuthLevel = 7 + }, + new + { + UserId = 8, + AuthRole = "Transporter", + AuthLevel = 1 + }, + new + { + UserId = 9, + AuthRole = "Transporter", + AuthLevel = 2 + }, + new + { + UserId = 10, + AuthRole = "PlantUser", + AuthLevel = 1 + }, + new + { + UserId = 11, + AuthRole = "PlantUser", + AuthLevel = 2 + }, + new + { + UserId = 12, + AuthRole = "PlantUser", + AuthLevel = 3 + }, + new + { + UserId = 13, + AuthRole = "PlantUser", + AuthLevel = 4 }); }); @@ -580,43 +599,38 @@ namespace GWMS.Data.Migrations { b.Property("UserId") .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); b.Property("AuthKey") .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Domain") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); + .HasColumnType("varchar(100)"); b.Property("Email") .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("ExtCode") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); + .HasColumnType("varchar(250)"); b.Property("Firstname") .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); + .HasColumnType("varchar(50)"); b.Property("IsActive") - .HasColumnType("bit"); + .HasColumnType("tinyint(1)"); b.Property("Lang") .HasMaxLength(10) - .HasColumnType("nvarchar(10)"); + .HasColumnType("varchar(10)"); b.Property("Lastname") .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); + .HasColumnType("varchar(50)"); + + b.Property("SaltPasswd") + .HasMaxLength(250) + .HasColumnType("varchar(250)"); b.Property("UserName") .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); + .HasColumnType("varchar(50)"); b.HasKey("UserId"); @@ -626,80 +640,158 @@ namespace GWMS.Data.Migrations new { UserId = 1, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", + AuthKey = "th1sIsTh3R1vrOfThNgt98", Email = "samuele@steamware.net", - ExtCode = "", Firstname = "Samuele", IsActive = true, Lang = "IT", Lastname = "Locatelli", - UserName = "samuele" + SaltPasswd = "", + UserName = "samuele.locatelli" }, new { UserId = 2, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", + AuthKey = "th1sIsTh3R1vrOfThNgt91", Email = "giancarlo@steamware.net", - ExtCode = "", Firstname = "Giancarlo", IsActive = true, Lang = "IT", Lastname = "Rottoli", - UserName = "giancarlo" + SaltPasswd = "", + UserName = "giancarlo.rottoli" }, new { UserId = 3, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", + AuthKey = "th1sIsTh3R1vrOfThNgt93", Email = "info@steamware.net", - ExtCode = "", Firstname = "Steamware", IsActive = true, Lang = "IT", - Lastname = "User03", - UserName = "user03" + Lastname = "Admin", + SaltPasswd = "", + UserName = "steamw.admin" }, new { UserId = 4, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", - Email = "info@steamware.net", - ExtCode = "", - Firstname = "Steamware", + AuthKey = "th1sIsTh3R1vrOfThNgt97", + Email = "a.pizzaferri@pizzaferripetroli.it", + Firstname = "Angelo", IsActive = true, Lang = "IT", - Lastname = "User04", - UserName = "user04" + Lastname = "Pizzaferri", + SaltPasswd = "", + UserName = "angelo.pizzaferri" }, new { UserId = 5, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", - Email = "info@steamware.net", - ExtCode = "", - Firstname = "Steamware", + AuthKey = "th1sIsTh3R1vrOfThNgt99", + Email = "andrei.valeanu@winnlab.it", + Firstname = "Andrei", IsActive = true, Lang = "IT", - Lastname = "User05", - UserName = "user05" + Lastname = "Valeanu", + SaltPasswd = "", + UserName = "andrei.valeanu" }, new { UserId = 6, - AuthKey = "thisIsTh3R1verOfTheNight90", - Domain = "", + AuthKey = "th1sIsTh3R1vrOfThNgt92", Email = "info@steamware.net", - ExtCode = "", - Firstname = "Steamware", + Firstname = "User", IsActive = true, Lang = "IT", - Lastname = "User06", - UserName = "user06" + Lastname = "LIQUIGAS", + SaltPasswd = "", + UserName = "liquigas.user01" + }, + new + { + UserId = 7, + AuthKey = "th1sIsTh3R1vrOfThNgt94", + Email = "info@steamware.net", + Firstname = "User", + IsActive = true, + Lang = "IT", + Lastname = "VULKANGAS", + SaltPasswd = "", + UserName = "vulkangas.user01" + }, + new + { + UserId = 8, + AuthKey = "th1sIsTh3R1vrOfThNgt95", + Email = "info@steamware.net", + Firstname = "User", + IsActive = true, + Lang = "IT", + Lastname = "LEVORATO", + SaltPasswd = "", + UserName = "levorato.user01" + }, + new + { + UserId = 9, + AuthKey = "th1sIsTh3R1vrOfThNgt96", + Email = "info@steamware.net", + Firstname = "User", + IsActive = true, + Lang = "IT", + Lastname = "TRAFFIK", + SaltPasswd = "", + UserName = "traffik.user01" + }, + new + { + UserId = 10, + AuthKey = "th1sIsTh3R1vrOfThNgt96", + Email = "info@steamware.net", + Firstname = "Stazione", + IsActive = true, + Lang = "IT", + Lastname = "Collecchio", + SaltPasswd = "", + UserName = "piz03.user01" + }, + new + { + UserId = 11, + AuthKey = "th1sIsTh3R1vrOfThNgt96", + Email = "info@steamware.net", + Firstname = "Stazione", + IsActive = true, + Lang = "IT", + Lastname = "Noceto", + SaltPasswd = "", + UserName = "piz04.user01" + }, + new + { + UserId = 12, + AuthKey = "th1sIsTh3R1vrOfThNgt96", + Email = "info@steamware.net", + Firstname = "Stazione", + IsActive = true, + Lang = "IT", + Lastname = "Baganzola", + SaltPasswd = "", + UserName = "piz05.user01" + }, + new + { + UserId = 13, + AuthKey = "th1sIsTh3R1vrOfThNgt96", + Email = "info@steamware.net", + Firstname = "Stazione", + IsActive = true, + Lang = "IT", + Lastname = "Pilastrello", + SaltPasswd = "", + UserName = "piz08.user01" }); }); @@ -771,17 +863,6 @@ namespace GWMS.Data.Migrations b.Navigation("Supplier"); }); - modelBuilder.Entity("GWMS.Data.DatabaseModels.TransporterModel", b => - { - b.HasOne("GWMS.Data.DatabaseModels.SupplierModel", "Supplier") - .WithMany() - .HasForeignKey("SupplierId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Supplier"); - }); - modelBuilder.Entity("GWMS.Data.DatabaseModels.UserAuthModel", b => { b.HasOne("GWMS.Data.DatabaseModels.AuthModel", "Role") diff --git a/GWMS.Data/ModelBuilderExtensions.cs b/GWMS.Data/ModelBuilderExtensions.cs index 08a3c4e..0dac642 100644 --- a/GWMS.Data/ModelBuilderExtensions.cs +++ b/GWMS.Data/ModelBuilderExtensions.cs @@ -20,32 +20,46 @@ namespace GWMS.Data { // inizializzazione dei valori di default x USER modelBuilder.Entity().HasData( - new UserModel { UserId = 1, AuthKey = "thisIsTh3R1verOfTheNight90", UserName = "samuele", Email = "samuele@steamware.net", Firstname = "Samuele", Lastname = "Locatelli" }, - new UserModel { UserId = 2, AuthKey = "thisIsTh3R1verOfTheNight90", UserName = "giancarlo", Email = "giancarlo@steamware.net", Firstname = "Giancarlo", Lastname = "Rottoli" }, - new UserModel { UserId = 3, AuthKey = "thisIsTh3R1verOfTheNight90", UserName = "user03", Email = "info@steamware.net", Firstname = "Steamware", Lastname = "User03" }, - new UserModel { UserId = 4, AuthKey = "thisIsTh3R1verOfTheNight90", UserName = "user04", Email = "info@steamware.net", Firstname = "Steamware", Lastname = "User04" }, - new UserModel { UserId = 5, AuthKey = "thisIsTh3R1verOfTheNight90", UserName = "user05", Email = "info@steamware.net", Firstname = "Steamware", Lastname = "User05" }, - new UserModel { UserId = 6, AuthKey = "thisIsTh3R1verOfTheNight90", UserName = "user06", Email = "info@steamware.net", Firstname = "Steamware", Lastname = "User06" } + new UserModel { UserId = 1, AuthKey = "th1sIsTh3R1vrOfThNgt98", UserName = "samuele.locatelli", Email = "samuele@steamware.net", Firstname = "Samuele", Lastname = "Locatelli" }, + new UserModel { UserId = 2, AuthKey = "th1sIsTh3R1vrOfThNgt91", UserName = "giancarlo.rottoli", Email = "giancarlo@steamware.net", Firstname = "Giancarlo", Lastname = "Rottoli" }, + new UserModel { UserId = 3, AuthKey = "th1sIsTh3R1vrOfThNgt93", UserName = "steamw.admin", Email = "info@steamware.net", Firstname = "Steamware", Lastname = "Admin" }, + new UserModel { UserId = 4, AuthKey = "th1sIsTh3R1vrOfThNgt97", UserName = "angelo.pizzaferri", Email = "a.pizzaferri@pizzaferripetroli.it", Firstname = "Angelo", Lastname = "Pizzaferri" }, + new UserModel { UserId = 5, AuthKey = "th1sIsTh3R1vrOfThNgt99", UserName = "andrei.valeanu", Email = "andrei.valeanu@winnlab.it", Firstname = "Andrei", Lastname = "Valeanu" }, + new UserModel { UserId = 6, AuthKey = "th1sIsTh3R1vrOfThNgt92", UserName = "liquigas.user01", Email = "info@steamware.net", Firstname = "User", Lastname = "LIQUIGAS" }, + new UserModel { UserId = 7, AuthKey = "th1sIsTh3R1vrOfThNgt94", UserName = "vulkangas.user01", Email = "info@steamware.net", Firstname = "User", Lastname = "VULKANGAS" }, + new UserModel { UserId = 8, AuthKey = "th1sIsTh3R1vrOfThNgt95", UserName = "levorato.user01", Email = "info@steamware.net", Firstname = "User", Lastname = "LEVORATO" }, + new UserModel { UserId = 9, AuthKey = "th1sIsTh3R1vrOfThNgt96", UserName = "traffik.user01", Email = "info@steamware.net", Firstname = "User", Lastname = "TRAFFIK" }, + new UserModel { UserId = 10, AuthKey = "th1sIsTh3R1vrOfThNgt96", UserName = "piz03.user01", Email = "info@steamware.net", Firstname = "Stazione", Lastname = "Collecchio" }, + new UserModel { UserId = 11, AuthKey = "th1sIsTh3R1vrOfThNgt96", UserName = "piz04.user01", Email = "info@steamware.net", Firstname = "Stazione", Lastname = "Noceto" }, + new UserModel { UserId = 12, AuthKey = "th1sIsTh3R1vrOfThNgt96", UserName = "piz05.user01", Email = "info@steamware.net", Firstname = "Stazione", Lastname = "Baganzola" }, + new UserModel { UserId = 13, AuthKey = "th1sIsTh3R1vrOfThNgt96", UserName = "piz08.user01", Email = "info@steamware.net", Firstname = "Stazione", Lastname = "Pilastrello" } ); // inizializzazione dei valori di default x AUTH modelBuilder.Entity().HasData( - new AuthModel { AuthRole = "User", Description = "Base User" }, - new AuthModel { AuthRole = "AppAdmin", Description = "App Admin User" }, - new AuthModel { AuthRole = "Supervisor", Description = "Supervisor User" }, + //new AuthModel { AuthRole = "User", Description = "Base User" }, + new AuthModel { AuthRole = "SuperAdmin", Description = "App SuperAdmin User" }, + new AuthModel { AuthRole = "Admin", Description = "Main SUpervisor User" }, new AuthModel { AuthRole = "PlantUser", Description = "Plant User" }, - new AuthModel { AuthRole = "SupplSuperUser", Description = "Supplier Super User" }, - new AuthModel { AuthRole = "SupplUser", Description = "Supplier Standard User" } + new AuthModel { AuthRole = "Supplier", Description = "Supplier User" }, + new AuthModel { AuthRole = "Transporter", Description = "Transporter User" } ); // inizializzazione dei valori di default x USER modelBuilder.Entity().HasData( - new UserAuthModel { UserId = 1, AuthRole = "AppAdmin" }, - new UserAuthModel { UserId = 2, AuthRole = "AppAdmin" }, - new UserAuthModel { UserId = 3, AuthRole = "Supervisor" }, - new UserAuthModel { UserId = 4, AuthRole = "PlantUser" }, - new UserAuthModel { UserId = 5, AuthRole = "SupplSuperUser" }, - new UserAuthModel { UserId = 6, AuthRole = "SupplUser" } + new UserAuthModel { UserId = 1, AuthRole = "SuperAdmin", AuthLevel = 1 }, + new UserAuthModel { UserId = 2, AuthRole = "SuperAdmin", AuthLevel = 1 }, + new UserAuthModel { UserId = 3, AuthRole = "SuperAdmin", AuthLevel = 1 }, + new UserAuthModel { UserId = 4, AuthRole = "Admin", AuthLevel = 1 }, + new UserAuthModel { UserId = 5, AuthRole = "Admin", AuthLevel = 1 }, + new UserAuthModel { UserId = 6, AuthRole = "Supplier", AuthLevel = 6 }, + new UserAuthModel { UserId = 7, AuthRole = "Supplier", AuthLevel = 7 }, + new UserAuthModel { UserId = 8, AuthRole = "Transporter", AuthLevel = 1 }, + new UserAuthModel { UserId = 9, AuthRole = "Transporter", AuthLevel = 2 }, + new UserAuthModel { UserId = 10, AuthRole = "PlantUser", AuthLevel = 1 }, + new UserAuthModel { UserId = 11, AuthRole = "PlantUser", AuthLevel = 2 }, + new UserAuthModel { UserId = 12, AuthRole = "PlantUser", AuthLevel = 3 }, + new UserAuthModel { UserId = 13, AuthRole = "PlantUser", AuthLevel = 4 } ); // inizializzazione dei valori di default x Plant @@ -58,16 +72,16 @@ namespace GWMS.Data // inizializzazione dei valori di default x Fornitori modelBuilder.Entity().HasData( - new SupplierModel { SupplierId = 1, SupplierCode = "SUPSIM01", SupplierDesc = "Fornitore 01" }, - new SupplierModel { SupplierId = 2, SupplierCode = "SUPSIM02", SupplierDesc = "Fornitore 02" } + new SupplierModel { SupplierId = 1, SupplierCode = "LIQUIGAS", SupplierDesc = "Fornitore Liquigas" }, + new SupplierModel { SupplierId = 2, SupplierCode = "VULKANGAS", SupplierDesc = "Fornitore Vulkangas" } ); // inizializzazione dei valori di default x Trasportatori modelBuilder.Entity().HasData( - new TransporterModel { TransporterId = 1, SupplierId = 1, TransporterCode = "TSIM01", TransporterDesc = "Trasportatore SIM 01" }, - new TransporterModel { TransporterId = 2, SupplierId = 1, TransporterCode = "TSIM02", TransporterDesc = "Trasportatore SIM 02" }, - new TransporterModel { TransporterId = 3, SupplierId = 2, TransporterCode = "TSIM03", TransporterDesc = "Trasportatore SIM 03" }, - new TransporterModel { TransporterId = 4, SupplierId = 2, TransporterCode = "TSIM04", TransporterDesc = "Trasportatore SIM 04" } + new TransporterModel { TransporterId = 1, TransporterCode = "TSIM01", TransporterDesc = "Trasportatore SIM 01" }, + new TransporterModel { TransporterId = 2, TransporterCode = "TSIM02", TransporterDesc = "Trasportatore SIM 02" }, + new TransporterModel { TransporterId = 3, TransporterCode = "TSIM03", TransporterDesc = "Trasportatore SIM 03" }, + new TransporterModel { TransporterId = 4, TransporterCode = "TSIM04", TransporterDesc = "Trasportatore SIM 04" } ); } diff --git a/GWMS.Data/Readme.md b/GWMS.Data/Readme.md index 4a0e6c3..4524f66 100644 --- a/GWMS.Data/Readme.md +++ b/GWMS.Data/Readme.md @@ -2,20 +2,24 @@ Per la gestione dell'accesso al DB si opera con EFCore --> app blazor server -## Scaffolding +## Versione MsSql iniziale + +Versione iniziale basata su SqlServer + +### Scaffolding Per generare le classi da un DB esistente con cui operare EFCore CodeFirst usare lo scaffolding coi seguenti comandi. Attenzione: la classe DbContext viene creata INSIEME alle viste nella folder DatabaseModel (nell'esempio seguente...) -### DB iniziale +#### DB iniziale Scaffold-DbContext "Server=SQL2016DEV;Database=GWMS;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir DatabaseModels -### SOLO di tabelle/viste selezionate (con force update) +#### SOLO di tabelle/viste selezionate (con force update) Scaffold-DbContext "Server=SQL2016DEV;Database=GWMS;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir DatabaseModels -Tables nome_tabella, nome_vista -### Reset DB MsSql +#### Reset DB MsSql Per resettare un db MsSql (cancellando tutto x poter ridare update) eseguire il seguente codice @@ -39,6 +43,32 @@ Il DB viene poi rigenerato dal Package Maganer console con Update-Database +## Versione MySql in produzione + +Messa variabile boolean x imporre versione MySql (si potrebbe fare una cosa più "fine-tuned" x selezione aruntime del provider) + +Pensata per impiego con MariaDB /MySql in caso linux dotnet 5 + +Impiegato provider dotnetcore **Pomelo**: + + * https://github.com/PomeloFoundation/Pomelo.EntityFrameworkCore.MySql + * https://www.tektutorialshub.com/entity-framework-core/using-mysql-mariadb-in-entity-framework-core/ + + +### Generazione script + + +Sono stati ricreati gli script di generazione x MySql cancellando TUTTE le migrations + stato db (ogni file in folder Migrations) + comandi + + + Add-Migration InitDb + Update-Database +### Generazione DB + utente DB MySql + +All'avvio applicazione, prima del seed di dati, viene eseguito un check dell'utente corrente dell'installazione x verifica se esista DB + Utente dedicati (come x applicazioni EgtBW ad esempio) + +...da completare codice + descrizione... + ## Impiego multi provider In caso di scelta per impiego di più providers (MsSql, MariaDB, SqlLite, ...) è necessario gestire in modo diverso le classi di inizializzazione del DbContenxt. Non ancora verificato, ma da approfondire secondo i seguenti links: diff --git a/GWMS.Data/Readme.pdf b/GWMS.Data/Readme.pdf index 71d9dbc..4a91de5 100644 Binary files a/GWMS.Data/Readme.pdf and b/GWMS.Data/Readme.pdf differ diff --git a/GWMS.UI/Components/OrderSupplierEditor.razor b/GWMS.UI/Components/OrderSupplierEditor.razor index 888eb7c..908eb4e 100644 --- a/GWMS.UI/Components/OrderSupplierEditor.razor +++ b/GWMS.UI/Components/OrderSupplierEditor.razor @@ -142,7 +142,7 @@ protected async Task ReloadAllData() { - transpList = await DataService.TransportersGetFilt(SupplierId); + transpList = await DataService.TransportersGetFilt(); } /// diff --git a/GWMS.UI/Components/OrderTranspEditor.razor b/GWMS.UI/Components/OrderTranspEditor.razor index ddbfa52..fd7a4eb 100644 --- a/GWMS.UI/Components/OrderTranspEditor.razor +++ b/GWMS.UI/Components/OrderTranspEditor.razor @@ -127,7 +127,7 @@ protected async Task ReloadAllData() { - transpList = await DataService.TransportersGetFilt(SupplierId); + transpList = await DataService.TransportersGetFilt(); } /// diff --git a/GWMS.UI/Data/GWMSDataService.cs b/GWMS.UI/Data/GWMSDataService.cs index a1fd1d2..7b7cab5 100644 --- a/GWMS.UI/Data/GWMSDataService.cs +++ b/GWMS.UI/Data/GWMSDataService.cs @@ -243,10 +243,10 @@ namespace GWMS.UI.Data return await Task.FromResult(dbResult); } - public async Task> TransportersGetFilt(int SupplierId) + public async Task> TransportersGetFilt() { List dbResult = new List(); - string cacheKey = $"GWMS:DATA:TRANSP:List:{SupplierId}"; + string cacheKey = $"GWMS:DATA:TRANSP:List"; string rawData; var redisDataList = await distributedCache.GetAsync(cacheKey); if (redisDataList != null) @@ -258,7 +258,7 @@ namespace GWMS.UI.Data { Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); - dbResult = dbController.GetTransporters(SupplierId); + dbResult = dbController.GetTransporters(); rawData = JsonConvert.SerializeObject(dbResult); redisDataList = Encoding.UTF8.GetBytes(rawData); await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(true)); diff --git a/GWMS.UI/GWMS.UI.csproj b/GWMS.UI/GWMS.UI.csproj index 7a1c719..353cd6c 100644 --- a/GWMS.UI/GWMS.UI.csproj +++ b/GWMS.UI/GWMS.UI.csproj @@ -30,6 +30,15 @@ + + + Transporters - Copy.razor.cs + + + Transporters.razor.cs + + + diff --git a/GWMS.UI/Pages/GasStation.razor b/GWMS.UI/Pages/GasStation.razor new file mode 100644 index 0000000..28d0443 --- /dev/null +++ b/GWMS.UI/Pages/GasStation.razor @@ -0,0 +1,46 @@ +@page "/GasStation" + +@using Blazorise.Components +@using GWMS.UI.Components + +
+
+
+
+
+
+ Registrazione +
+
+ +
+
+
+
+
+
+
+
+
+
+ Acquisizione barcode +
+ +
+
+
+ +

+ + Work IN progress, links: +

    +
  • https://github.com/sabitertan/BlazorBarcodeScanner
  • +
  • https://github.com/tallichet/ZXingBlazor
  • +
  • https://github.com/LorsSilvermort/BlazorBarcodeReader
  • +
  • https://www.bing.com/search?q=blazor+server+qrcode+scanner&qs=n&form=QBRE&sp=-1&pq=blazor+server+qrcode+scanner&sc=0-28&sk=&cvid=D827470C199B47BDB39F277EFC72A266
  • +
+

+
+ +
\ No newline at end of file diff --git a/GWMS.UI/Pages/GasStation.razor.cs b/GWMS.UI/Pages/GasStation.razor.cs new file mode 100644 index 0000000..3516544 --- /dev/null +++ b/GWMS.UI/Pages/GasStation.razor.cs @@ -0,0 +1,307 @@ +using GWMS.Data.DatabaseModels; +using GWMS.Data.DTO; +using GWMS.UI.Data; +using Microsoft.AspNetCore.Components; +using Microsoft.JSInterop; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace GWMS.UI.Pages +{ + public partial class GasStation : ComponentBase, IDisposable + { + #region Private Fields + + private OrderModel currRecord = null; + + private List ListRecords; + private List PlantsList; + private List SearchRecords; + private List TransportersList; + + #endregion Private Fields + + #region Private Properties + + private int _currPage { get; set; } = 1; + + private int _numRecord { get; set; } = 10; + + private int currPage + { + get => _currPage; + set + { + if (_currPage != value) + { + _currPage = value; + var pUpd = Task.Run(async () => await ReloadData()); + pUpd.Wait(); + } + } + } + + private bool isLoading { get; set; } = false; + + private int numRecord + { + get => _numRecord; + set + { + if (_numRecord != value) + { + _numRecord = value; + var pUpd = Task.Run(async () => await ReloadData()); + pUpd.Wait(); + } + } + } + + private int SelPlantId + { + get + { + int answ = 0; + if (MessageService.Order_Filter != null) + { + answ = MessageService.Order_Filter.PlantId; + } + return answ; + } + set + { + if (!MessageService.Order_Filter.PlantId.Equals(value)) + { + MessageService.Order_Filter.PlantId = value; + var pUpd = Task.Run(async () => await ReloadData()); + pUpd.Wait(); + } + } + } + + private int SelTranspId + { + get + { + int answ = 0; + if (MessageService.Order_Filter != null) + { + answ = MessageService.Order_Filter.TransporterId; + } + return answ; + } + set + { + if (!MessageService.Order_Filter.TransporterId.Equals(value)) + { + MessageService.Order_Filter.TransporterId = value; + var pUpd = Task.Run(async () => await ReloadData()); + pUpd.Wait(); + } + } + } + + private bool ShowCharts { get; set; } = false; + + #endregion Private Properties + + #region Protected Properties + + [Inject] + protected GWMSDataService DataService { get; set; } + + protected DateTime DateEnd + { + get + { + DateTime answ = DateTime.Today.AddDays(1); + if (MessageService.Order_Filter != null) + { + answ = MessageService.Order_Filter.DateEnd; + } + return answ; + } + set + { + if (!MessageService.Order_Filter.DateEnd.Equals(value)) + { + MessageService.Order_Filter.DateEnd = value; + var pUpd = Task.Run(async () => await ReloadData()); + pUpd.Wait(); + } + } + } + + protected DateTime DateStart + { + get + { + DateTime answ = DateTime.Today.AddDays(-1); + if (MessageService.Order_Filter != null) + { + answ = MessageService.Order_Filter.DateStart; + } + return answ; + } + set + { + if (!MessageService.Order_Filter.DateStart.Equals(value)) + { + MessageService.Order_Filter.DateStart = value; + var pUpd = Task.Run(async () => await ReloadData()); + pUpd.Wait(); + } + } + } + + [Inject] + protected IJSRuntime JSRuntime { get; set; } + + [Inject] + protected MessageService MessageService { get; set; } + + [Inject] + protected NavigationManager NavManager { get; set; } + + protected bool showBcodeScan { get; set; } = false; + + protected int totalCount + { + get + { + int answ = 0; + if (SearchRecords != null) + { + answ = SearchRecords.Count; + } + return answ; + } + } + + #endregion Protected Properties + + #region Private Methods + + private void OnDateEndChanged(DateTime? date) + { + DateEnd = (DateTime)date; + } + + private void OnDateStartChanged(DateTime? date) + { + DateStart = (DateTime)date; + } + + private async Task ReloadData() + { + isLoading = true; + SearchRecords = await DataService.OrdersGetFilt(MessageService.Order_Filter); + ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); + isLoading = false; + } + + #endregion Private Methods + + #region Protected Methods + + protected void Edit(OrderModel selRecord) + { + currRecord = selRecord; + } + + protected void ForceReload(int newNum) + { + numRecord = newNum; + } + + protected void ForceReloadPage(int newNum) + { + currPage = newNum; + } + + protected override async Task OnInitializedAsync() + { + MessageService.ShowSearch = false; + MessageService.PageName = "Fornitore"; + MessageService.PageIcon = "fas fa-industry pr-2"; + MessageService.EA_SearchUpdated += OnSeachUpdated; + await ReloadAllData(); + } + + protected async Task ReloadAllData() + { + PlantsList = await DataService.PlantsGetAll(); + TransportersList = await DataService.TransportersGetFilt(); + await ReloadData(); + } + + protected void ResetData() + { + DataService.rollBackEdit(currRecord); + currRecord = null; + } + + protected async Task ResetFilter(SelectOrderData newFilter) + { + currRecord = null; + SearchRecords = null; + ListRecords = null; + MessageService.Order_Filter = SelectOrderData.Init(5, 7); + await ReloadAllData(); + } + + protected void Select(OrderModel selRecord) + { + // applico filtro da selezione + currRecord = selRecord; + } + + protected void ToggleBCode() + { + showBcodeScan = !showBcodeScan; + } + + protected async Task UpdateData() + { + currRecord = null; + await ReloadData(); + } + + #endregion Protected Methods + + #region Public Methods + + public string checkSelect(int OrderId) + { + string answ = ""; + if (currRecord != null) + { + try + { + answ = (currRecord.OrderId == OrderId) ? "table-info" : ""; + } + catch + { } + } + return answ; + } + + public void Dispose() + { + MessageService.EA_SearchUpdated -= OnSeachUpdated; + } + + public async void OnSeachUpdated() + { + await InvokeAsync(() => + { + Task task = UpdateData(); + StateHasChanged(); + }); + } + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/GWMS.UI/Pages/Transporters.razor.cs b/GWMS.UI/Pages/Transporters.razor.cs index f7d68e1..4a2079f 100644 --- a/GWMS.UI/Pages/Transporters.razor.cs +++ b/GWMS.UI/Pages/Transporters.razor.cs @@ -235,7 +235,7 @@ namespace GWMS.UI.Pages protected async Task ReloadAllData() { PlantsList = await DataService.PlantsGetAll(); - TransportersList = await DataService.TransportersGetFilt(0); + TransportersList = await DataService.TransportersGetFilt(); await ReloadData(); } diff --git a/GWMS.UI/Pages/UserManager.razor b/GWMS.UI/Pages/UserManager.razor new file mode 100644 index 0000000..50316ec --- /dev/null +++ b/GWMS.UI/Pages/UserManager.razor @@ -0,0 +1,11 @@ +

UserManager

+ +Da definire: +
    +
  • username anonimo / email? email duplicate ammesse?
  • +
  • mappatura ruoli
  • +
+ +@code { + +} \ No newline at end of file diff --git a/GWMS.UI/Shared/NavMenu.razor b/GWMS.UI/Shared/NavMenu.razor index 5e671bc..678df4d 100644 --- a/GWMS.UI/Shared/NavMenu.razor +++ b/GWMS.UI/Shared/NavMenu.razor @@ -43,7 +43,7 @@ diff --git a/GWMS.UI/Startup.cs b/GWMS.UI/Startup.cs index 41d736f..fe379b8 100644 --- a/GWMS.UI/Startup.cs +++ b/GWMS.UI/Startup.cs @@ -111,10 +111,13 @@ namespace GWMS.UI services.AddSingleton(); services.AddScoped(); +#if false // aggiunta quartz scheduler var scheduler = StdSchedulerFactory.GetDefaultScheduler().GetAwaiter().GetResult(); services.AddSingleton(scheduler); services.AddHostedService(); + +#endif } #endregion Public Methods diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html index 09c5ca3..6b3928f 100644 --- a/Resources/ChangeLog.html +++ b/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo statistiche MAPO -

Versione: 1.0.2106.2209

+

Versione: 1.0.2106.2215


Note di rilascio:
    diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt index 667bfc4..7309315 100644 --- a/Resources/VersNum.txt +++ b/Resources/VersNum.txt @@ -1 +1 @@ -1.0.2106.2209 +1.0.2106.2215 diff --git a/Resources/manifest.xml b/Resources/manifest.xml index fed082d..5fb2559 100644 --- a/Resources/manifest.xml +++ b/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.0.2106.2209 + 1.0.2106.2215 http://nexus.steamware.net/repository/SWS/MP-STATS/stable/0/GWMS.UI.zip http://nexus.steamware.net/repository/SWS/MP-STATS/stable/0/ChangeLog.html false