Merge branch 'feature/DeployInitDb' into develop

This commit is contained in:
Samuele Locatelli
2021-06-23 18:17:58 +02:00
18 changed files with 1273 additions and 35 deletions
+75
View File
@@ -0,0 +1,75 @@
using GWMS.Data.DatabaseModels;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GWMS.Data
{
public partial class AdminContext : DbContext
{
#region Private Fields
private IConfiguration _configuration;
#endregion Private Fields
#region Public Constructors
public AdminContext()
{
}
public AdminContext(IConfiguration configuration)
{
_configuration = configuration;
}
public AdminContext(DbContextOptions<GWMSContext> options) : base(options)
{
}
#endregion Public Constructors
#region Public Properties
/// <summary>
/// User management
/// </summary>
public DbSet<UserPriv> UserList { get; set; }
#endregion Public Properties
#region Private Methods
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
#endregion Private Methods
#region Protected Methods
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
string connString = DbConfig.ADMIN_CONNECTION_STRING;
if (!optionsBuilder.IsConfigured)
{
//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);
}
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<UserPriv>().HasKey(c => new { c.Host, c.User });
OnModelCreatingPartial(modelBuilder);
}
#endregion Protected Methods
}
}
+10
View File
@@ -235,6 +235,16 @@ namespace GWMS.Data.Controllers
return dbResult;
}
public bool HasPlantLog()
{
var answ =
dbCtx
.DbSetPlantLog
.Count();
return (answ > 0);
}
/// <summary>
/// Aggiorna un Ordine
/// </summary>
@@ -21,6 +21,8 @@ namespace GWMS.Data.DatabaseModels
public int SupplierId { get; set; }
public int TransporterId { get; set; }
public DayOfWeek DayNum { get; set; } = DayOfWeek.Monday;
[MaxLength(250)]
@@ -32,6 +34,9 @@ namespace GWMS.Data.DatabaseModels
[ForeignKey("SupplierId")]
public virtual SupplierModel Supplier { get; set; }
[ForeignKey("TransporterId")]
public virtual TransporterModel Transporter { get; set; }
#endregion Public Properties
}
}
+27
View File
@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GWMS.Data.DatabaseModels
{
/// <summary>
/// Tabella dei USER di MySql
/// </summary>
[Table("user")]
public class UserPriv
{
#region Public Properties
[Column("Host", Order = 1)]
public string Host { get; set; } = "";
[Column("User", Order = 2)]
public string User { get; set; } = "";
#endregion Public Properties
}
}
+75
View File
@@ -0,0 +1,75 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
namespace GWMS.Data
{
public class DbAdmin : IDisposable
{
#region Private Fields
private AdminContext adbCtx;
#endregion Private Fields
#region Public Fields
/// <summary>
/// Singleton gestione
/// </summary>
public static DbAdmin man = new DbAdmin();
#endregion Public Fields
#region Public Constructors
public DbAdmin()
{
// Initialize database context for ADMIN
adbCtx = new AdminContext();
}
#endregion Public Constructors
#region Public Methods
public bool checkCreateUser(string username, string pwd)
{
bool answ = false;
// ricerca utente...
var numUser = adbCtx
.UserList
.Where(x => x.User == username)
.ToList()
.Count;
if (numUser > 0)
{
answ = true;
}
if (!answ)
{
// creo utente
string sqlCommand = "FLUSH PRIVILEGES;";
adbCtx.Database.ExecuteSqlRaw(sqlCommand);
sqlCommand = $"CREATE USER '{username}'@'localhost' IDENTIFIED BY '{pwd}';";
adbCtx.Database.ExecuteSqlRaw(sqlCommand);
sqlCommand = $"GRANT ALL ON *.* TO '{username}'@'localhost';";
adbCtx.Database.ExecuteSqlRaw(sqlCommand);
sqlCommand = "FLUSH PRIVILEGES;";
adbCtx.Database.ExecuteSqlRaw(sqlCommand);
}
return answ;
}
public void Dispose()
{
// Clear database context
adbCtx.Dispose();
}
#endregion Public Methods
}
}
+60
View File
@@ -0,0 +1,60 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GWMS.Data
{
public static class DbConfig
{
#region Public Fields
public static string DATABASE_NAME = "GWMS";
public static int DATABASE_PROCESS_TIMEOUT = 5;
public static string DATABASE_PWD = "viadante16";
// Database config
public static string DATABASE_SERV = "127.0.0.1";
public static string DATABASE_USER = "GWMS_User";
#endregion Public Fields
#region Public Properties
/// <summary>
/// DB Connection string per azioni amministrative
/// </summary>
public static string ADMIN_CONNECTION_STRING { get; set; } = "";
/// <summary>
/// DB Connection string
/// </summary>
public static string CONNECTION_STRING { get; set; } = "";
#endregion Public Properties
#region Public Methods
public static bool CheckUser(string nKey, string sKey)
{
// esecuzione script di install locale
return DbAdmin.man.checkCreateUser(DATABASE_USER, DATABASE_PWD);
}
public static void InitDb(string server, string nKey, string sKey)
{
DATABASE_SERV = server;
DATABASE_NAME = $"GWMS_{nKey}";
DATABASE_USER = $"user_{nKey}";
DATABASE_PWD = $"pwd_{sKey}";
CONNECTION_STRING = $"server={DATABASE_SERV};port=3306;database={DATABASE_NAME};uid={DATABASE_USER};pwd={DATABASE_PWD};sslmode=None";
// stringa admin con utente root egalware...
ADMIN_CONNECTION_STRING = $"server={DATABASE_SERV};port=3306;database=mysql;uid=root;pwd=Egalware_24068!;sslmode=None";
}
#endregion Public Methods
}
}
+26 -23
View File
@@ -5,6 +5,7 @@ using Microsoft.Extensions.Configuration;
using GWMS.Data.DatabaseModels;
using NLog;
using System.Linq;
using GWMS.Data.Controllers;
namespace GWMS.Data
{
@@ -16,8 +17,6 @@ namespace GWMS.Data
private IConfiguration _configuration;
private bool useMysql = true;
#endregion Private Fields
#region Public Constructors
@@ -29,10 +28,14 @@ namespace GWMS.Data
public GWMSContext(IConfiguration configuration)
{
_configuration = configuration;
// se non ci fosse... crea!
Database.EnsureCreated();
}
public GWMSContext(DbContextOptions<GWMSContext> options) : base(options)
{
// se non ci fosse... crea!
Database.EnsureCreated();
}
#endregion Public Constructors
@@ -66,24 +69,29 @@ namespace GWMS.Data
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
string connString = "";
// default
string connString = "Server=localhost;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;";
// tento setup da config
try
{
string server = _configuration["DbConfig:Server"];
string nKey = _configuration["DbConfig:nKey"];
string sKey = _configuration["DbConfig:sKey"];
DbConfig.InitDb("localhost", nKey, sKey);
DbConfig.CheckUser(nKey, sKey);
// uso conn string calcolata
connString = DbConfig.CONNECTION_STRING;
}
catch
{ }
if (!optionsBuilder.IsConfigured)
{
// 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;");
}
//connString = "Server=localhost;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;";
var serverVersion = ServerVersion.AutoDetect(connString);
optionsBuilder.UseMySql(connString, serverVersion);
}
}
@@ -94,11 +102,6 @@ namespace GWMS.Data
relationship.DeleteBehavior = DeleteBehavior.Restrict;
}
if (!useMysql)
{
modelBuilder.HasAnnotation("Relational:Collation", "SQL_Latin1_General_CP1_CI_AS");
}
modelBuilder.Entity<ConfigModel>(entity =>
{
entity.Property(e => e.ValStd)
@@ -0,0 +1,787 @@
// <auto-generated />
using System;
using GWMS.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace GWMS.Data.Migrations
{
[DbContext(typeof(GWMSContext))]
[Migration("20210623161219_UpdatePlanner")]
partial class UpdatePlanner
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Relational:MaxIdentifierLength", 64)
.HasAnnotation("ProductVersion", "5.0.6");
modelBuilder.Entity("GWMS.Data.DatabaseModels.AnKeyValModel", b =>
{
b.Property<string>("KeyName")
.HasMaxLength(50)
.HasColumnType("varchar(50)");
b.Property<string>("Descript")
.HasMaxLength(250)
.HasColumnType("varchar(250)")
.HasComment("Descrizione dell'item");
b.Property<int>("ValFloat")
.HasColumnType("int");
b.Property<int>("ValInt")
.HasColumnType("int");
b.Property<string>("ValString")
.HasMaxLength(250)
.HasColumnType("varchar(250)");
b.HasKey("KeyName");
b.ToTable("AnKeyVal");
});
modelBuilder.Entity("GWMS.Data.DatabaseModels.ConfigModel", b =>
{
b.Property<string>("KeyName")
.HasMaxLength(50)
.HasColumnType("varchar(50)");
b.Property<string>("Note")
.HasMaxLength(250)
.HasColumnType("varchar(250)");
b.Property<string>("Val")
.HasMaxLength(50)
.HasColumnType("varchar(50)");
b.Property<string>("ValStd")
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.HasComment("Valore di default/riferimento per la variabile");
b.HasKey("KeyName");
b.ToTable("Config");
});
modelBuilder.Entity("GWMS.Data.DatabaseModels.ItemModel", b =>
{
b.Property<int>("ItemId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("ItemCode")
.HasMaxLength(100)
.HasColumnType("varchar(100)");
b.Property<string>("ItemDesc")
.HasMaxLength(250)
.HasColumnType("varchar(250)");
b.Property<string>("ItemType")
.HasMaxLength(50)
.HasColumnType("varchar(50)");
b.Property<string>("UM")
.HasMaxLength(50)
.HasColumnType("varchar(50)");
b.HasKey("ItemId");
b.ToTable("Items");
});
modelBuilder.Entity("GWMS.Data.DatabaseModels.ListValModel", b =>
{
b.Property<string>("TabName")
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.HasColumnName("TabName");
b.Property<string>("FieldName")
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.HasColumnName("FieldName");
b.Property<string>("Val")
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.HasColumnName("Val");
b.Property<string>("Descript")
.HasMaxLength(250)
.HasColumnType("varchar(250)")
.HasColumnName("Descript");
b.Property<int>("Ordinal")
.HasColumnType("int")
.HasColumnName("Ordinal");
b.HasKey("TabName", "FieldName", "Val");
b.ToTable("ListVal");
});
modelBuilder.Entity("GWMS.Data.DatabaseModels.OrderModel", b =>
{
b.Property<int>("OrderId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<DateTime>("DtETA")
.HasColumnType("datetime(6)");
b.Property<DateTime>("DtExecEnd")
.HasColumnType("datetime(6)");
b.Property<DateTime>("DtExecStart")
.HasColumnType("datetime(6)");
b.Property<DateTime>("DtOrder")
.HasColumnType("datetime(6)");
b.Property<double>("ExecutionQty")
.HasColumnType("double");
b.Property<string>("OrderCode")
.HasMaxLength(100)
.HasColumnType("varchar(100)");
b.Property<string>("OrderDesc")
.HasMaxLength(250)
.HasColumnType("varchar(250)");
b.Property<double>("OrderQty")
.HasColumnType("double");
b.Property<int>("PlantId")
.HasColumnType("int");
b.Property<int>("SupplierId")
.HasColumnType("int");
b.Property<int>("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<int>("PlantId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<double>("LevelAct")
.HasColumnType("double");
b.Property<double>("LevelMax")
.HasColumnType("double");
b.Property<string>("PlantCode")
.HasMaxLength(100)
.HasColumnType("varchar(100)");
b.Property<string>("PlantDesc")
.HasMaxLength(250)
.HasColumnType("varchar(250)");
b.Property<double>("PressAct")
.HasColumnType("double");
b.Property<double>("PressBHAct")
.HasColumnType("double");
b.Property<double>("PressBHMax")
.HasColumnType("double");
b.Property<double>("PressBLAct")
.HasColumnType("double");
b.Property<double>("PressBLMax")
.HasColumnType("double");
b.Property<double>("PressMax")
.HasColumnType("double");
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<int>("PlantDataId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<DateTime>("DtEvent")
.HasColumnType("datetime(6)");
b.Property<string>("FluxType")
.HasMaxLength(250)
.HasColumnType("varchar(250)");
b.Property<int>("PlantId")
.HasColumnType("int");
b.Property<double>("ValNumber")
.HasColumnType("double");
b.Property<string>("ValString")
.HasMaxLength(250)
.HasColumnType("varchar(250)");
b.HasKey("PlantDataId");
b.HasIndex("PlantId");
b.ToTable("PlantLog");
});
modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantStatusModel", b =>
{
b.Property<int>("PlantId")
.HasColumnType("int");
b.Property<string>("FluxType")
.HasMaxLength(250)
.HasColumnType("varchar(250)");
b.Property<DateTime>("DtEvent")
.HasColumnType("datetime(6)");
b.Property<double>("ValNumber")
.HasColumnType("double");
b.Property<string>("ValString")
.HasMaxLength(250)
.HasColumnType("varchar(250)");
b.HasKey("PlantId", "FluxType");
b.ToTable("PlantStatus");
});
modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantSupplWeekPlanModel", b =>
{
b.Property<int>("PlantId")
.HasColumnType("int");
b.Property<int>("SupplierId")
.HasColumnType("int");
b.Property<int>("DayNum")
.HasColumnType("int");
b.Property<string>("Note")
.HasMaxLength(250)
.HasColumnType("varchar(250)");
b.Property<int>("TransporterId")
.HasColumnType("int");
b.HasKey("PlantId", "SupplierId", "DayNum");
b.HasIndex("SupplierId");
b.HasIndex("TransporterId");
b.ToTable("PlantSupplWeekPlan");
});
modelBuilder.Entity("GWMS.Data.DatabaseModels.SupplierModel", b =>
{
b.Property<int>("SupplierId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("SupplierCode")
.HasMaxLength(100)
.HasColumnType("varchar(100)");
b.Property<string>("SupplierDesc")
.HasMaxLength(250)
.HasColumnType("varchar(250)");
b.HasKey("SupplierId");
b.ToTable("Supplier");
b.HasData(
new
{
SupplierId = 1,
SupplierCode = "LIQUIGAS",
SupplierDesc = "Fornitore Liquigas"
},
new
{
SupplierId = 2,
SupplierCode = "VULKANGAS",
SupplierDesc = "Fornitore Vulkangas"
});
});
modelBuilder.Entity("GWMS.Data.DatabaseModels.TransporterModel", b =>
{
b.Property<int>("TransporterId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<double>("PositionLatitude")
.HasColumnType("double");
b.Property<double>("PositionLongitude")
.HasColumnType("double");
b.Property<DateTime>("PositionUpdated")
.HasColumnType("datetime(6)");
b.Property<string>("TransporterCode")
.HasMaxLength(100)
.HasColumnType("varchar(100)");
b.Property<string>("TransporterDesc")
.HasMaxLength(250)
.HasColumnType("varchar(250)");
b.HasKey("TransporterId");
b.ToTable("Transporter");
b.HasData(
new
{
TransporterId = 1,
PositionLatitude = 0.0,
PositionLongitude = 0.0,
PositionUpdated = new DateTime(2021, 6, 23, 18, 12, 19, 514, DateTimeKind.Local).AddTicks(5589),
TransporterCode = "LEVO",
TransporterDesc = "Trasportatore Levorato"
},
new
{
TransporterId = 2,
PositionLatitude = 0.0,
PositionLongitude = 0.0,
PositionUpdated = new DateTime(2021, 6, 23, 18, 12, 19, 514, DateTimeKind.Local).AddTicks(6159),
TransporterCode = "TRAF",
TransporterDesc = "Trasportatore Traffik"
});
});
modelBuilder.Entity("GWMS.Data.DatabaseModels.UserModel", b =>
{
b.Property<int>("UserId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("AuthKey")
.HasMaxLength(100)
.HasColumnType("varchar(100)");
b.Property<string>("Email")
.HasMaxLength(250)
.HasColumnType("varchar(250)");
b.Property<string>("Firstname")
.HasMaxLength(50)
.HasColumnType("varchar(50)");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)");
b.Property<string>("Lang")
.HasMaxLength(10)
.HasColumnType("varchar(10)");
b.Property<string>("Lastname")
.HasMaxLength(50)
.HasColumnType("varchar(50)");
b.Property<int>("Livello")
.HasColumnType("int");
b.Property<int>("MaskPlantId")
.HasColumnType("int");
b.Property<int>("MaskSupplierId")
.HasColumnType("int");
b.Property<int>("MaskTranspId")
.HasColumnType("int");
b.Property<string>("SaltPasswd")
.HasMaxLength(250)
.HasColumnType("varchar(250)");
b.Property<string>("UserName")
.HasMaxLength(50)
.HasColumnType("varchar(50)");
b.HasKey("UserId");
b.ToTable("Users");
b.HasData(
new
{
UserId = 1,
AuthKey = "th1sIsTh3R1vrOfThNgt98",
Email = "samuele@steamware.net",
Firstname = "Samuele",
IsActive = true,
Lang = "IT",
Lastname = "Locatelli",
Livello = 1,
MaskPlantId = 0,
MaskSupplierId = 0,
MaskTranspId = 0,
SaltPasswd = "",
UserName = "samuele.locatelli"
},
new
{
UserId = 2,
AuthKey = "th1sIsTh3R1vrOfThNgt91",
Email = "giancarlo@steamware.net",
Firstname = "Giancarlo",
IsActive = true,
Lang = "IT",
Lastname = "Rottoli",
Livello = 1,
MaskPlantId = 0,
MaskSupplierId = 0,
MaskTranspId = 0,
SaltPasswd = "",
UserName = "giancarlo.rottoli"
},
new
{
UserId = 3,
AuthKey = "th1sIsTh3R1vrOfThNgt93",
Email = "info@steamware.net",
Firstname = "Steamware",
IsActive = true,
Lang = "IT",
Lastname = "Admin",
Livello = 1,
MaskPlantId = 0,
MaskSupplierId = 0,
MaskTranspId = 0,
SaltPasswd = "",
UserName = "steamw.admin"
},
new
{
UserId = 4,
AuthKey = "th1sIsTh3R1vrOfThNgt97",
Email = "a.pizzaferri@pizzaferripetroli.it",
Firstname = "Angelo",
IsActive = true,
Lang = "IT",
Lastname = "Pizzaferri",
Livello = 2,
MaskPlantId = 0,
MaskSupplierId = 0,
MaskTranspId = 0,
SaltPasswd = "",
UserName = "angelo.pizzaferri"
},
new
{
UserId = 5,
AuthKey = "th1sIsTh3R1vrOfThNgt99",
Email = "andrei.valeanu@winnlab.it",
Firstname = "Andrei",
IsActive = true,
Lang = "IT",
Lastname = "Valeanu",
Livello = 2,
MaskPlantId = 0,
MaskSupplierId = 0,
MaskTranspId = 0,
SaltPasswd = "",
UserName = "andrei.valeanu"
},
new
{
UserId = 6,
AuthKey = "th1sIsTh3R1vrOfThNgt92",
Email = "info@steamware.net",
Firstname = "User",
IsActive = true,
Lang = "IT",
Lastname = "LIQUIGAS",
Livello = 4,
MaskPlantId = 0,
MaskSupplierId = 1,
MaskTranspId = 0,
SaltPasswd = "",
UserName = "liquigas.user01"
},
new
{
UserId = 7,
AuthKey = "th1sIsTh3R1vrOfThNgt94",
Email = "info@steamware.net",
Firstname = "User",
IsActive = true,
Lang = "IT",
Lastname = "VULKANGAS",
Livello = 4,
MaskPlantId = 0,
MaskSupplierId = 2,
MaskTranspId = 0,
SaltPasswd = "",
UserName = "vulkangas.user01"
},
new
{
UserId = 8,
AuthKey = "th1sIsTh3R1vrOfThNgt95",
Email = "info@steamware.net",
Firstname = "User",
IsActive = true,
Lang = "IT",
Lastname = "LEVORATO",
Livello = 4,
MaskPlantId = 0,
MaskSupplierId = 0,
MaskTranspId = 1,
SaltPasswd = "",
UserName = "levorato.user01"
},
new
{
UserId = 9,
AuthKey = "th1sIsTh3R1vrOfThNgt96",
Email = "info@steamware.net",
Firstname = "User",
IsActive = true,
Lang = "IT",
Lastname = "TRAFFIK",
Livello = 4,
MaskPlantId = 0,
MaskSupplierId = 0,
MaskTranspId = 2,
SaltPasswd = "",
UserName = "traffik.user01"
},
new
{
UserId = 10,
AuthKey = "th1sIsTh3R1vrOfThNgt96",
Email = "info@steamware.net",
Firstname = "Stazione",
IsActive = true,
Lang = "IT",
Lastname = "Collecchio",
Livello = 3,
MaskPlantId = 1,
MaskSupplierId = 0,
MaskTranspId = 0,
SaltPasswd = "",
UserName = "piz03.user01"
},
new
{
UserId = 11,
AuthKey = "th1sIsTh3R1vrOfThNgt96",
Email = "info@steamware.net",
Firstname = "Stazione",
IsActive = true,
Lang = "IT",
Lastname = "Noceto",
Livello = 3,
MaskPlantId = 2,
MaskSupplierId = 0,
MaskTranspId = 0,
SaltPasswd = "",
UserName = "piz04.user01"
},
new
{
UserId = 12,
AuthKey = "th1sIsTh3R1vrOfThNgt96",
Email = "info@steamware.net",
Firstname = "Stazione",
IsActive = true,
Lang = "IT",
Lastname = "Baganzola",
Livello = 3,
MaskPlantId = 3,
MaskSupplierId = 0,
MaskTranspId = 0,
SaltPasswd = "",
UserName = "piz05.user01"
},
new
{
UserId = 13,
AuthKey = "th1sIsTh3R1vrOfThNgt96",
Email = "info@steamware.net",
Firstname = "Stazione",
IsActive = true,
Lang = "IT",
Lastname = "Pilastrello",
Livello = 3,
MaskPlantId = 4,
MaskSupplierId = 0,
MaskTranspId = 0,
SaltPasswd = "",
UserName = "piz08.user01"
});
});
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.HasOne("GWMS.Data.DatabaseModels.TransporterModel", "Transporter")
.WithMany()
.HasForeignKey("TransporterId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Plant");
b.Navigation("Supplier");
b.Navigation("Transporter");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,130 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace GWMS.Data.Migrations
{
public partial class UpdatePlanner : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "TransporterId",
table: "PlantSupplWeekPlan",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.UpdateData(
table: "Transporter",
keyColumn: "TransporterId",
keyValue: 1,
column: "PositionUpdated",
value: new DateTime(2021, 6, 23, 18, 12, 19, 514, DateTimeKind.Local).AddTicks(5589));
migrationBuilder.UpdateData(
table: "Transporter",
keyColumn: "TransporterId",
keyValue: 2,
column: "PositionUpdated",
value: new DateTime(2021, 6, 23, 18, 12, 19, 514, DateTimeKind.Local).AddTicks(6159));
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "UserId",
keyValue: 6,
column: "Livello",
value: 4);
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "UserId",
keyValue: 7,
column: "Livello",
value: 4);
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "UserId",
keyValue: 8,
column: "Livello",
value: 4);
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "UserId",
keyValue: 9,
column: "Livello",
value: 4);
migrationBuilder.CreateIndex(
name: "IX_PlantSupplWeekPlan_TransporterId",
table: "PlantSupplWeekPlan",
column: "TransporterId");
migrationBuilder.AddForeignKey(
name: "FK_PlantSupplWeekPlan_Transporter_TransporterId",
table: "PlantSupplWeekPlan",
column: "TransporterId",
principalTable: "Transporter",
principalColumn: "TransporterId",
onDelete: ReferentialAction.Restrict);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_PlantSupplWeekPlan_Transporter_TransporterId",
table: "PlantSupplWeekPlan");
migrationBuilder.DropIndex(
name: "IX_PlantSupplWeekPlan_TransporterId",
table: "PlantSupplWeekPlan");
migrationBuilder.DropColumn(
name: "TransporterId",
table: "PlantSupplWeekPlan");
migrationBuilder.UpdateData(
table: "Transporter",
keyColumn: "TransporterId",
keyValue: 1,
column: "PositionUpdated",
value: new DateTime(2021, 6, 22, 17, 52, 9, 697, DateTimeKind.Local).AddTicks(5955));
migrationBuilder.UpdateData(
table: "Transporter",
keyColumn: "TransporterId",
keyValue: 2,
column: "PositionUpdated",
value: new DateTime(2021, 6, 22, 17, 52, 9, 697, DateTimeKind.Local).AddTicks(6523));
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "UserId",
keyValue: 6,
column: "Livello",
value: 3);
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "UserId",
keyValue: 7,
column: "Livello",
value: 3);
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "UserId",
keyValue: 8,
column: "Livello",
value: 3);
migrationBuilder.UpdateData(
table: "Users",
keyColumn: "UserId",
keyValue: 9,
column: "Livello",
value: 3);
}
}
}
@@ -347,10 +347,15 @@ namespace GWMS.Data.Migrations
.HasMaxLength(250)
.HasColumnType("varchar(250)");
b.Property<int>("TransporterId")
.HasColumnType("int");
b.HasKey("PlantId", "SupplierId", "DayNum");
b.HasIndex("SupplierId");
b.HasIndex("TransporterId");
b.ToTable("PlantSupplWeekPlan");
});
@@ -420,7 +425,7 @@ namespace GWMS.Data.Migrations
TransporterId = 1,
PositionLatitude = 0.0,
PositionLongitude = 0.0,
PositionUpdated = new DateTime(2021, 6, 22, 17, 52, 9, 697, DateTimeKind.Local).AddTicks(5955),
PositionUpdated = new DateTime(2021, 6, 23, 18, 12, 19, 514, DateTimeKind.Local).AddTicks(5589),
TransporterCode = "LEVO",
TransporterDesc = "Trasportatore Levorato"
},
@@ -429,7 +434,7 @@ namespace GWMS.Data.Migrations
TransporterId = 2,
PositionLatitude = 0.0,
PositionLongitude = 0.0,
PositionUpdated = new DateTime(2021, 6, 22, 17, 52, 9, 697, DateTimeKind.Local).AddTicks(6523),
PositionUpdated = new DateTime(2021, 6, 23, 18, 12, 19, 514, DateTimeKind.Local).AddTicks(6159),
TransporterCode = "TRAF",
TransporterDesc = "Trasportatore Traffik"
});
@@ -578,7 +583,7 @@ namespace GWMS.Data.Migrations
IsActive = true,
Lang = "IT",
Lastname = "LIQUIGAS",
Livello = 3,
Livello = 4,
MaskPlantId = 0,
MaskSupplierId = 1,
MaskTranspId = 0,
@@ -594,7 +599,7 @@ namespace GWMS.Data.Migrations
IsActive = true,
Lang = "IT",
Lastname = "VULKANGAS",
Livello = 3,
Livello = 4,
MaskPlantId = 0,
MaskSupplierId = 2,
MaskTranspId = 0,
@@ -610,7 +615,7 @@ namespace GWMS.Data.Migrations
IsActive = true,
Lang = "IT",
Lastname = "LEVORATO",
Livello = 3,
Livello = 4,
MaskPlantId = 0,
MaskSupplierId = 0,
MaskTranspId = 1,
@@ -626,7 +631,7 @@ namespace GWMS.Data.Migrations
IsActive = true,
Lang = "IT",
Lastname = "TRAFFIK",
Livello = 3,
Livello = 4,
MaskPlantId = 0,
MaskSupplierId = 0,
MaskTranspId = 2,
@@ -762,9 +767,17 @@ namespace GWMS.Data.Migrations
.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");
});
#pragma warning restore 612, 618
}
+5
View File
@@ -129,6 +129,11 @@ namespace GWMS.UI.Data
return await Task.FromResult(dbResult);
}
public async Task<bool> HasPlantLog()
{
return await Task.FromResult(dbController.HasPlantLog());
}
public async Task<List<GWMS.Data.DatabaseModels.ItemModel>> ItemsGetAll()
{
//return Task.FromResult(dbController.ActionsGetAll());
+32 -1
View File
@@ -1,5 +1,9 @@
@page "/"
@using GWMS.UI.Data
@inject GWMSDataService DataService
<div class="jumbotron">
<div class="row">
<div class="col-12 col-lg-4">
@@ -14,4 +18,31 @@
</div>
</div>
</div>
</div>
</div>
@if (!DataOk)
{
<div class="row">
<div class="col-12">
<div class="alert alert-warning d-flex justify-content-around py-1">
<div class="p-2">
No data Found
</div>
<div class="p-2">
<NavLink class="btn btn-danger" href="Parameters">
<i class="fas fa-wrench pr-2" aria-hidden="true"></i> Setup Parametri
</NavLink>
</div>
</div>
</div>
</div>
}
@code
{
protected bool DataOk { get; set; } = false;
protected override async Task OnInitializedAsync()
{
DataOk = await DataService.HasPlantLog();
}
}
+7
View File
@@ -0,0 +1,7 @@
@page "/WeekPlan"
<h3>WeekPlan</h3>
@code {
}
+5
View File
@@ -47,6 +47,11 @@
<i class="fas fa-gas-pump pr-2" aria-hidden="true"></i> Scheda Stazione
</NavLink>
</li>
<li class="nav-item px-3">
<NavLink class="nav-link" href="WeekPlan">
<i class="fas fa-calendar pr-2" aria-hidden="true"></i> Planner Consegne
</NavLink>
</li>
<li class="nav-item px-3">
<NavLink class="nav-link" href="UserManager">
<i class="fas fa-users pr-2" aria-hidden="true"></i> Utenti
+7 -2
View File
@@ -8,8 +8,13 @@
},
"AllowedHosts": "*",
"ConnectionStrings": {
"DefaultConnection": "Server=SQL2016DEV;Database=GWMS;Trusted_Connection=True;MultipleActiveResultSets=true",
"GWMS.Data": "Server=SQL2016DEV;Database=GWMS;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=GWMS.UI;"
"DefaultConnection": "Server=localhost;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;",
"GWMS.Data": "Server=localhost;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;"
},
"DbConfig": {
"Server": "localhost",
"nKey": "PZZFRR",
"sKey": "M3T@n0"
},
"matrixUrl": "http://qrcode.steamware.net/"
}
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo statistiche MAPO</i>
<h4>Versione: 1.0.2106.2315</h4>
<h4>Versione: 1.0.2106.2318</h4>
<br />
Note di rilascio:
<ul>
+1 -1
View File
@@ -1 +1 @@
1.0.2106.2315
1.0.2106.2318
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.0.2106.2315</version>
<version>1.0.2106.2318</version>
<url>http://nexus.steamware.net/repository/SWS/MP-STATS/stable/0/GWMS.UI.zip</url>
<changelog>http://nexus.steamware.net/repository/SWS/MP-STATS/stable/0/ChangeLog.html</changelog>
<mandatory>false</mandatory>