diff --git a/EgtBEAMWALL.DataLayer/Controllers/MachGroupController.cs b/EgtBEAMWALL.DataLayer/Controllers/MachGroupController.cs
index f520785e..275328b6 100644
--- a/EgtBEAMWALL.DataLayer/Controllers/MachGroupController.cs
+++ b/EgtBEAMWALL.DataLayer/Controllers/MachGroupController.cs
@@ -6,165 +6,183 @@ using EgtBEAMWALL.DataLayer.DatabaseModels;
namespace EgtBEAMWALL.DataLayer.Controllers
{
- public class RawPartController : IDisposable
- {
- private DatabaseContext dbCtx;
+ public class MachGroupController : IDisposable
+ {
+ #region Private Fields
- public RawPartController()
- {
- // Initialize database context
- dbCtx = new DatabaseContext();
- }
+ private DatabaseContext dbCtx;
- public void Dispose()
- {
- // Clear database context
- dbCtx.Dispose();
- }
- ///
- /// Get record by RawPartDbId
- ///
- ///
- ///
- public RawPartModel FindByRawPartDbId(int RawPartDbId)
- {
- return dbCtx
- .RawPartList
- .Where(x => x.RawPartDbId == RawPartDbId)
- .SingleOrDefault();
- }
- ///
- /// Get record by RawPartId
- ///
- ///
- ///
- public RawPartModel FindByRawPartId(int RawPartId)
- {
- return dbCtx
- .RawPartList
- .Where(x => x.RawPartId == RawPartId)
- .SingleOrDefault();
- }
- ///
- /// Get paginated data from DB (ASC ordered)
- ///
- ///
- ///
- ///
- public List GetPaginatedAsc(int RawPartDbIdStart, int numRecord)
- {
- int numEnd = RawPartDbIdStart - numRecord;
- // check numEnd
- if (numEnd < 0)
- numEnd = 0;
- // retrieve
- return dbCtx
- .RawPartList
- .Where(x => x.RawPartDbId <= RawPartDbIdStart)
- .OrderBy(x => x.RawPartDbId)
- .Take(numRecord)
- .ToList();
- }
- ///
- /// Get paginated data from DB (DESC ordered)
- ///
- ///
- ///
- ///
- public List GetPaginatedDesc(int PartDbIdStart, int numRecord)
- {
- int numEnd = PartDbIdStart - numRecord;
- // check numEnd
- if (numEnd < 0)
- numEnd = 0;
- // retrieve
- return dbCtx
- .RawPartList
- .Where(x => x.RawPartDbId <= PartDbIdStart)
- .OrderByDescending(x => x.RawPartDbId)
- .Take(numRecord)
- .ToList();
- }
- ///
- /// Get filtered data by RawPartectId (ASC ordered)
- ///
- ///
- ///
- public List GetByProdAsc(int ProdDbId)
- {
- // retrieve
- return dbCtx
- .RawPartList
- .Where(x => x.ProdDbId == ProdDbId)
- .OrderBy(x => x.ProdDbId)
- .ToList();
- }
- ///
- /// Get filtered data by RawPartectId (DESC ordered)
- ///
- ///
- ///
- public List GetByProdDesc(int ProdDbId)
- {
- // retrieve
- return dbCtx
- .RawPartList
- .Where(x => x.ProdDbId == ProdDbId)
- .OrderByDescending(x => x.ProdDbId)
- .ToList();
- }
+ #endregion Private Fields
- ///
- /// Create record on DB
- ///
- ///
- ///
- ///
- public RawPartModel Create(int newRawPartId, string description)
- {
- RawPartModel newRawPart = new RawPartModel() { RawPartId=newRawPartId, Description=description, State= RawPartState.ND };
+ #region Public Constructors
- try
- {
- // Add to database
- dbCtx.RawPartList.Add(newRawPart);
- // Commit changes
- dbCtx.SaveChanges();
- }
- catch
- { }
+ public MachGroupController()
+ {
+ // Initialize database context
+ dbCtx = new DatabaseContext();
+ }
- return newRawPart;
- }
+ #endregion Public Constructors
- ///
- /// Update single RawPart
- ///
- /// Item to update (with updated values)
- ///
- public bool Update(RawPartModel updItem)
- {
- bool done = false;
- var item2update = dbCtx
- .RawPartList
- .Where(x => x.RawPartDbId == updItem.RawPartDbId)
- .SingleOrDefault();
- try
- {
- // update, vers 1...
- dbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
+ #region Public Methods
- //// update, vers 2
- //dbCtx.BTLPartList.Remove(item2del);
- //dbCtx.BTLPartList.Add(updItem);
+ ///
+ /// Create record on DB
+ ///
+ ///
+ ///
+ ///
+ public MachGroupModel Create(int newMachGroupId, string description)
+ {
+ MachGroupModel newMachGroup = new MachGroupModel() { MachGroupId = newMachGroupId, Description = description, State = MachGroupState.ND };
- // Commit changes
- dbCtx.SaveChanges();
- done = true;
- }
- catch
- { }
- return done;
- }
- }
-}
+ try
+ {
+ // Add to database
+ dbCtx.MachGroupList.Add(newMachGroup);
+ // Commit changes
+ dbCtx.SaveChanges();
+ }
+ catch
+ { }
+
+ return newMachGroup;
+ }
+
+ public void Dispose()
+ {
+ // Clear database context
+ dbCtx.Dispose();
+ }
+
+ ///
+ /// Get record by MachGroupDbId
+ ///
+ ///
+ ///
+ public MachGroupModel FindByMachGroupDbId(int MachGroupDbId)
+ {
+ return dbCtx
+ .MachGroupList
+ .Where(x => x.MachGroupDbId == MachGroupDbId)
+ .SingleOrDefault();
+ }
+
+ ///
+ /// Get record by MachGroupId
+ ///
+ ///
+ ///
+ public MachGroupModel FindByMachGroupId(int MachGroupId)
+ {
+ return dbCtx
+ .MachGroupList
+ .Where(x => x.MachGroupId == MachGroupId)
+ .SingleOrDefault();
+ }
+
+ ///
+ /// Get filtered data by MachGroupectId (ASC ordered)
+ ///
+ ///
+ ///
+ public List GetByProdAsc(int ProdDbId)
+ {
+ // retrieve
+ return dbCtx
+ .MachGroupList
+ .Where(x => x.ProdDbId == ProdDbId)
+ .OrderBy(x => x.ProdDbId)
+ .ToList();
+ }
+
+ ///
+ /// Get filtered data by MachGroupectId (DESC ordered)
+ ///
+ ///
+ ///
+ public List GetByProdDesc(int ProdDbId)
+ {
+ // retrieve
+ return dbCtx
+ .MachGroupList
+ .Where(x => x.ProdDbId == ProdDbId)
+ .OrderByDescending(x => x.ProdDbId)
+ .ToList();
+ }
+
+ ///
+ /// Get paginated data from DB (ASC ordered)
+ ///
+ ///
+ ///
+ ///
+ public List GetPaginatedAsc(int MachGroupDbIdStart, int numRecord)
+ {
+ int numEnd = MachGroupDbIdStart - numRecord;
+ // check numEnd
+ if (numEnd < 0)
+ numEnd = 0;
+ // retrieve
+ return dbCtx
+ .MachGroupList
+ .Where(x => x.MachGroupDbId <= MachGroupDbIdStart)
+ .OrderBy(x => x.MachGroupDbId)
+ .Take(numRecord)
+ .ToList();
+ }
+
+ ///
+ /// Get paginated data from DB (DESC ordered)
+ ///
+ ///
+ ///
+ ///
+ public List GetPaginatedDesc(int PartDbIdStart, int numRecord)
+ {
+ int numEnd = PartDbIdStart - numRecord;
+ // check numEnd
+ if (numEnd < 0)
+ numEnd = 0;
+ // retrieve
+ return dbCtx
+ .MachGroupList
+ .Where(x => x.MachGroupDbId <= PartDbIdStart)
+ .OrderByDescending(x => x.MachGroupDbId)
+ .Take(numRecord)
+ .ToList();
+ }
+
+ ///
+ /// Update single MachGroup
+ ///
+ /// Item to update (with updated values)
+ ///
+ public bool Update(MachGroupModel updItem)
+ {
+ bool done = false;
+ var item2update = dbCtx
+ .MachGroupList
+ .Where(x => x.MachGroupDbId == updItem.MachGroupDbId)
+ .SingleOrDefault();
+ try
+ {
+ // update, vers 1...
+ dbCtx.Entry(item2update).CurrentValues.SetValues(updItem);
+
+ //// update, vers 2
+ //dbCtx.BTLPartList.Remove(item2del);
+ //dbCtx.BTLPartList.Add(updItem);
+
+ // Commit changes
+ dbCtx.SaveChanges();
+ done = true;
+ }
+ catch
+ { }
+ return done;
+ }
+
+ #endregion Public Methods
+ }
+}
\ No newline at end of file
diff --git a/EgtBEAMWALL.DataLayer/Controllers/ProdController.cs b/EgtBEAMWALL.DataLayer/Controllers/ProdController.cs
index 5235d08a..7f7f0729 100644
--- a/EgtBEAMWALL.DataLayer/Controllers/ProdController.cs
+++ b/EgtBEAMWALL.DataLayer/Controllers/ProdController.cs
@@ -208,6 +208,31 @@ namespace EgtBEAMWALL.DataLayer.Controllers
return done;
}
+ public bool DeleteProd(int ProdId)
+ {
+ bool done = false;
+
+ var currProd = FindByProdId(ProdId);
+
+ // sel delle BTLParts da proj
+ var machGroup2del = dbCtx
+ .MachGroupList
+ .Where(x => x.ProdDbId == currProd.ProdDbId);
+
+ try
+ {
+ // remove from database
+ dbCtx.MachGroupList.RemoveRange(machGroup2del);
+ dbCtx.ProdList.Remove(currProd);
+ // Commit changes
+ dbCtx.SaveChanges();
+ done = true;
+ }
+ catch
+ { }
+ return done;
+ }
+
public void Dispose()
{
// Clear database context
diff --git a/EgtBEAMWALL.DataLayer/DatabaseContext.cs b/EgtBEAMWALL.DataLayer/DatabaseContext.cs
index 5c28c5d0..f421e05f 100644
--- a/EgtBEAMWALL.DataLayer/DatabaseContext.cs
+++ b/EgtBEAMWALL.DataLayer/DatabaseContext.cs
@@ -8,35 +8,58 @@ using System.Text;
using EgtBEAMWALL.DataLayer.DatabaseModels;
using EgtBEAMWALL.DataLayer.Migrations;
using System.ServiceProcess;
+
//using EgtBEAMWALL.DataLayer.Migrations;
//using EgtBEAMWALL.DataLayer.Controllers;
namespace EgtBEAMWALL.DataLayer
{
+ [DbConfigurationType(typeof(MySqlEFConfiguration))]
+ public class DatabaseContext : DbContext
+ {
+ #region Public Fields
- [DbConfigurationType(typeof(MySqlEFConfiguration))]
- public class DatabaseContext : DbContext
- {
- ///
- /// BTLParts management
- ///
- public DbSet BTLPartList { get; set; }
- ///
- /// Parts management
- ///
- public DbSet ProdList { get; set; }
- ///
- /// Parts management
- ///
- public DbSet ProjList { get; set; }
- ///
- /// Parts management
- ///
- public DbSet RawPartList { get; set; }
- ///
- /// Parts management
- ///
- public DbSet PartList { get; set; }
+ public static string CONNECTION_STRING = $"server={Constants.DATABASE_SERV};port=3306;database={Constants.DATABASE_NAME};uid={Constants.DATABASE_USER};pwd={Constants.DATABASE_PWD};sslmode=None";
+
+ #endregion Public Fields
+
+ #region Public Constructors
+
+ //providerName="System.Data.EntityClient"
+ public DatabaseContext() : base("DefaultConnection")
+ {
+ }
+
+ #endregion Public Constructors
+
+ #region Public Properties
+
+ ///
+ /// BTLParts management
+ ///
+ public DbSet BTLPartList { get; set; }
+
+ ///
+ /// Parts management
+ ///
+ public DbSet MachGroupList { get; set; }
+
+ ///
+ /// Parts management
+ ///
+ public DbSet PartList { get; set; }
+
+ ///
+ /// Parts management
+ ///
+ public DbSet ProdList { get; set; }
+
+ ///
+ /// Parts management
+ ///
+ public DbSet ProjList { get; set; }
+
+ #endregion Public Properties
#if false
///
@@ -45,76 +68,69 @@ namespace EgtBEAMWALL.DataLayer
public static bool AdvDataModel { get; set; } = false;
#endif
- //providerName="System.Data.EntityClient"
+ #region Private Methods
-
- public static string CONNECTION_STRING = $"server={Constants.DATABASE_SERV};port=3306;database={Constants.DATABASE_NAME};uid={Constants.DATABASE_USER};pwd={Constants.DATABASE_PWD};sslmode=None";
-
- public DatabaseContext() : base("DefaultConnection")
- {
- }
+ private static string getDbServiceName()
+ {
+ ServiceController[] services = ServiceController.GetServices();
+ var service = services.FirstOrDefault(s => s.ServiceName == "MariaDB");
+ if (service != null)
+ return service.DisplayName;
- public static DatabaseContext Create()
- {
- return new DatabaseContext();
- }
+ service = services.FirstOrDefault(s => s.ServiceName == "MySQL");
+ if (service != null)
+ return service.DisplayName;
- private static string getDbServiceName()
- {
- ServiceController[] services = ServiceController.GetServices();
- var service = services.FirstOrDefault(s => s.ServiceName == "MariaDB");
- if (service != null)
- return service.DisplayName;
+ return "";
+ }
- service = services.FirstOrDefault(s => s.ServiceName == "MySQL");
- if (service != null)
- return service.DisplayName;
+ #endregion Private Methods
- return "";
+ #region Public Methods
- }
+ public static DatabaseContext Create()
+ {
+ return new DatabaseContext();
+ }
- public static bool SetUpDbConnectionAndDbConfig()
- {
- try
- {
- String serviceName = getDbServiceName();
- if (serviceName.Equals(""))
- {
- return false;
- }
+ public static bool SetUpDbConnectionAndDbConfig()
+ {
+ try
+ {
+ String serviceName = getDbServiceName();
+ if (serviceName.Equals(""))
+ {
+ return false;
+ }
+ ServiceController service = new ServiceController(serviceName);
+ try
+ {
+ TimeSpan timeout = TimeSpan.FromSeconds(Constants.DATABASE_PROCESS_TIMEOUT);
+ service.WaitForStatus(ServiceControllerStatus.Running, timeout);
+ }
+ catch (Exception ex)
+ {
+ return false;
+ }
- ServiceController service = new ServiceController(serviceName);
- try
- {
- TimeSpan timeout = TimeSpan.FromSeconds(Constants.DATABASE_PROCESS_TIMEOUT);
- service.WaitForStatus(ServiceControllerStatus.Running, timeout);
- }
- catch (Exception ex)
- {
- return false;
- }
+ System.Data.Entity.Database.SetInitializer(null);
+ var migrator = new DbMigrator(new Configuration());
+ if (migrator.GetPendingMigrations().Any())
+ {
+ // Run migrations and seed.
+ migrator.Update();
+ }
+ }
+ catch (Exception ex)
+ {
+ return false;
+ }
+ return true;
+ }
- System.Data.Entity.Database.SetInitializer(null);
- var migrator = new DbMigrator(new Configuration());
-
- if (migrator.GetPendingMigrations().Any())
- {
- // Run migrations and seed.
- migrator.Update();
- }
-
- }
- catch (Exception ex)
- {
- return false;
- }
-
- return true;
- }
-
- }
+ #endregion Public Methods
+ }
}
\ No newline at end of file
diff --git a/EgtBEAMWALL.DataLayer/DatabaseModels/BTLPartModel.cs b/EgtBEAMWALL.DataLayer/DatabaseModels/BTLPartModel.cs
index cb470ae9..2f633905 100644
--- a/EgtBEAMWALL.DataLayer/DatabaseModels/BTLPartModel.cs
+++ b/EgtBEAMWALL.DataLayer/DatabaseModels/BTLPartModel.cs
@@ -7,74 +7,77 @@ using System.ComponentModel.DataAnnotations.Schema;
namespace EgtBEAMWALL.DataLayer.DatabaseModels
{
- ///
- /// Tabella di gestione dei PROTOTIPI dal file BTL (part + quantità)
- ///
- [Table("BTLPartList")]
- public class BTLPartModel
- {
- ///
- /// Chiave univoca
- ///
- [Key, Column("BTLPartDbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public int PartDbId { get; set; }
+ ///
+ /// Tabella di gestione dei PROTOTIPI dal file BTL (part + quantità)
+ ///
+ [Table("BTLPartList")]
+ public class BTLPartModel
+ {
+ #region Public Properties
- ///
- /// PartId dal programma
- ///
- [Column("BTLPartId")]
- public int PartId { get; set; }
+ [Column("BTLPart_CalcState")]
+ public int CALC_State { get; set; } = -1;
- [Column("BTLPart_PDN")]
- public int PDN { get; set; } = 0;
+ ///
+ /// Quantità richiesta
+ ///
+ [Column("BTLPart_CNT")]
+ public int CNT { get; set; } = 0;
- [Column("BTLPart_DO")]
- public bool DO { get; set; } = false;
+ [Column("BTLPart_DO")]
+ public bool DO { get; set; } = false;
- [Column("BTLPart_NAM")]
- public string NAM { get; set; } = "";
+ [Column("BTLPart_DON")]
+ public int DON { get; set; } = 0;
- [Column("BTLPart_W")]
- public double W { get; set; } = 0;
+ [Column("BTLPart_GRP")]
+ public string GRP { get; set; } = "";
- [Column("BTLPart_L")]
- public double L { get; set; } = 0;
+ [Column("BTLPart_H")]
+ public double H { get; set; } = 0;
- [Column("BTLPart_H")]
- public double H { get; set; } = 0;
+ [Column("BTLPart_L")]
+ public double L { get; set; } = 0;
- [Column("BTLPart_MAT")]
- public string MAT { get; set; } = "";
+ [Column("BTLPart_MAT")]
+ public string MAT { get; set; } = "";
- ///
- /// Quantità richiesta
- ///
- [Column("BTLPart_CNT")]
- public int CNT { get; set; } = 0;
+ [Column("BTLPart_NAM")]
+ public string NAM { get; set; } = "";
- [Column("BTLPart_TBP")]
- public int TBP { get; set; } = 0;
+ ///
+ /// Chiave univoca
+ ///
+ [Key, Column("BTLPartDbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+ public int PartDbId { get; set; }
- [Column("BTLPart_DON")]
- public int DON { get; set; } = 0;
+ ///
+ /// PartId dal programma
+ ///
+ [Column("BTLPartId")]
+ public int PartId { get; set; }
- [Column("BTLPart_ROT")]
- public int ROT { get; set; } = 0;
+ [Column("BTLPart_PDN")]
+ public int PDN { get; set; } = 0;
- [Column("BTLPart_GRP")]
- public string GRP { get; set; } = "";
+ [Column("ProjDbId")]
+ public int ProjDbId { get; set; }
- [Column("BTLPart_UNT")]
- public int UNT { get; set; } = 0;
+ [ForeignKey("ProjDbId")]
+ public ProjModel Project { get; set; }
- [Column("BTLPart_CalcState")]
- public int CALC_State { get; set; } = -1;
+ [Column("BTLPart_ROT")]
+ public int ROT { get; set; } = 0;
- [Column("ProjDbId")]
- public int ProjDbId { get; set; }
+ [Column("BTLPart_TBP")]
+ public int TBP { get; set; } = 0;
- [ForeignKey("ProjDbId")]
- public ProjModel Project { get; set; }
+ [Column("BTLPart_UNT")]
+ public int UNT { get; set; } = 0;
- }
-}
+ [Column("BTLPart_W")]
+ public double W { get; set; } = 0;
+
+ #endregion Public Properties
+ }
+}
\ No newline at end of file
diff --git a/EgtBEAMWALL.DataLayer/DatabaseModels/PartModel.cs b/EgtBEAMWALL.DataLayer/DatabaseModels/PartModel.cs
index 8c01a55d..b8f616d4 100644
--- a/EgtBEAMWALL.DataLayer/DatabaseModels/PartModel.cs
+++ b/EgtBEAMWALL.DataLayer/DatabaseModels/PartModel.cs
@@ -7,62 +7,65 @@ using System.ComponentModel.DataAnnotations.Schema;
namespace EgtBEAMWALL.DataLayer.DatabaseModels
{
- ///
- /// Tabelal delle singole istsanze prodotte\
- ///
- [Table("PartList")]
- public class PartModel
- {
- [Key, Column("PartDbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public int PartDbId { get; set; }
+ ///
+ /// Tabelal delle singole istsanze prodotte\
+ ///
+ [Table("PartList")]
+ public class PartModel
+ {
+ #region Public Properties
- [Column("PartId")]
- public int PartId { get; set; }
+ [ForeignKey("BTLPartDbId")]
+ public BTLPartModel BTLPart { get; set; }
- [Column("Part_PDN")]
- public int PDN { get; set; } = 0;
+ [Column("BTLPartDbId")]
+ public int BTLPartDbId { get; set; }
- [Column("Part_NAM")]
- public string NAM { get; set; } = "";
+ [Column("Part_CalcState")]
+ public int CALC_State { get; set; } = -1;
- [Column("Part_W")]
- public double W { get; set; } = 0;
-
- [Column("Part_L")]
- public double L { get; set; } = 0;
-
- [Column("Part_H")]
- public double H { get; set; } = 0;
+ [Column("Part_GRP")]
+ public string GRP { get; set; } = "";
- [Column("Part_MAT")]
- public string MAT { get; set; } = "";
+ [Column("Part_H")]
+ public double H { get; set; } = 0;
- [Column("Part_ROT")]
- public int ROT { get; set; } = 0;
+ [Column("Part_L")]
+ public double L { get; set; } = 0;
- [Column("Part_GRP")]
- public string GRP { get; set; } = "";
+ [Column("Part_MAT")]
+ public string MAT { get; set; } = "";
- [Column("Part_CalcState")]
- public int CALC_State { get; set; } = -1;
+ [Column("Part_NAM")]
+ public string NAM { get; set; } = "";
- ///
- /// Stato della singola Part (da enum)
- ///
- [Column("Part_State")]
- public PartState State { get; set; } = PartState.ND;
+ [Key, Column("PartDbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+ public int PartDbId { get; set; }
- [Column("BTLPartDbId")]
- public int BTLPartDbId { get; set; }
+ [Column("PartId")]
+ public int PartId { get; set; }
- [ForeignKey("BTLPartDbId")]
- public BTLPartModel BTLPart { get; set; }
+ [Column("Part_PDN")]
+ public int PDN { get; set; } = 0;
- [Column("RawPartDbId")]
- public int? RawPartDbId { get; set; }
+ [ForeignKey("RawPartDbId")]
+ public virtual MachGroupModel RawPart { get; set; }
- [ForeignKey("RawPartDbId")]
- public virtual MachGroupModel RawPart { get; set; }
+ [Column("RawPartDbId")]
+ public int? RawPartDbId { get; set; }
- }
-}
+ [Column("Part_ROT")]
+ public int ROT { get; set; } = 0;
+
+ ///
+ /// Stato della singola Part (da enum)
+ ///
+ [Column("Part_State")]
+ public PartState State { get; set; } = PartState.ND;
+
+ [Column("Part_W")]
+ public double W { get; set; } = 0;
+
+ #endregion Public Properties
+ }
+}
\ No newline at end of file
diff --git a/EgtBEAMWALL.DataLayer/DatabaseModels/ProdModel.cs b/EgtBEAMWALL.DataLayer/DatabaseModels/ProdModel.cs
index d434cc7e..6498cbc6 100644
--- a/EgtBEAMWALL.DataLayer/DatabaseModels/ProdModel.cs
+++ b/EgtBEAMWALL.DataLayer/DatabaseModels/ProdModel.cs
@@ -7,26 +7,29 @@ using System.ComponentModel.DataAnnotations.Schema;
namespace EgtBEAMWALL.DataLayer.DatabaseModels
{
- ///
- /// Tabella deiu raggruppamenti PROJ in forma di PROD
- ///
- [Table("ProdList")]
- public class ProdModel
- {
- [Key, Column("ProdDbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public int ProdDbId { get; set; }
+ ///
+ /// Tabella deiu raggruppamenti PROJ in forma di PROD
+ ///
+ [Table("ProdList")]
+ public class ProdModel
+ {
+ #region Public Properties
- [Column("ProdId")]
- public int ProdId { get; set; }
+ [Column("Prod_Description")]
+ public string Description { get; set; } = "";
- [Column("Prod_Description")]
- public string Description { get; set; } = "";
+ ///
+ /// Stato locked (quando aperto da un dispositivo in rete)
+ ///
+ [Column("Prod_Lock")]
+ public bool Locked { get; set; } = false;
- ///
- /// Stato locked (quando aperto da un dispositivo in rete)
- ///
- [Column("Prod_Lock")]
- public bool Locked { get; set; } = false;
+ [Key, Column("ProdDbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+ public int ProdDbId { get; set; }
- }
-}
+ [Column("ProdId")]
+ public int ProdId { get; set; }
+
+ #endregion Public Properties
+ }
+}
\ No newline at end of file
diff --git a/EgtBEAMWALL.DataLayer/DatabaseModels/ProjModel.cs b/EgtBEAMWALL.DataLayer/DatabaseModels/ProjModel.cs
index cedfa9f5..87945b91 100644
--- a/EgtBEAMWALL.DataLayer/DatabaseModels/ProjModel.cs
+++ b/EgtBEAMWALL.DataLayer/DatabaseModels/ProjModel.cs
@@ -13,11 +13,7 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
[Table("ProjList")]
public class ProjModel
{
- [Key, Column("ProjDbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public int ProjDbId { get; set; }
-
- [Column("ProjId")]
- public int ProjId { get; set; }
+ #region Public Properties
[Column("Proj_BTLFileName")]
public string BTLFileName { get; set; } = "";
@@ -27,17 +23,25 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
///
[Column("Proj_IsNew")]
public bool IsNew { get; set; } = true;
-
+
///
/// Stato locked (quando aperto da un dispositivo in rete)
///
[Column("Proj_Lock")]
public bool Locked { get; set; } = false;
+ [ForeignKey("ProdDbId")]
+ public virtual ProdModel Prod { get; set; }
+
[Column("ProdDbId")]
public int? ProdDbId { get; set; }
- [ForeignKey("ProdDbId")]
- public virtual ProdModel Prod { get; set; }
+ [Key, Column("ProjDbId"), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+ public int ProjDbId { get; set; }
+
+ [Column("ProjId")]
+ public int ProjId { get; set; }
+
+ #endregion Public Properties
}
-}
+}
\ No newline at end of file
diff --git a/EgtBEAMWALL.DataLayer/EgtBEAMWALL.DataLayer.csproj b/EgtBEAMWALL.DataLayer/EgtBEAMWALL.DataLayer.csproj
index fe1e0645..db5b2ad3 100644
--- a/EgtBEAMWALL.DataLayer/EgtBEAMWALL.DataLayer.csproj
+++ b/EgtBEAMWALL.DataLayer/EgtBEAMWALL.DataLayer.csproj
@@ -59,7 +59,7 @@
-
+
@@ -67,7 +67,7 @@
-
+