diff --git a/WebDoorCreator.Core/ConfigItem.cs b/WebDoorCreator.Core/ConfigItem.cs
new file mode 100644
index 0000000..e85b846
--- /dev/null
+++ b/WebDoorCreator.Core/ConfigItem.cs
@@ -0,0 +1,46 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WebDoorCreator.Core
+{
+ public class ConfigItem
+ {
+ ///
+ /// Nome dell'item
+ ///
+ public string Name { get; set; } = "";
+
+ ///
+ /// Tipo dell'item (es: string, int, double, list...)
+ ///
+ public string Type { get; set; } = "";
+
+ ///
+ /// Valore dell'item
+ ///
+ public string ValString { get; set; } = "";
+
+ public int ValInt
+ {
+ get
+ {
+ int answ = 0;
+ int.TryParse(ValString, out answ);
+ return answ;
+ }
+ }
+ public double ValDouble
+ {
+ get
+ {
+ double answ = 0;
+ double.TryParse(ValString, out answ);
+ return answ;
+ }
+ }
+
+ }
+}
diff --git a/WebDoorCreator.Core/Enum.cs b/WebDoorCreator.Core/Enum.cs
index f374775..e869fc4 100644
--- a/WebDoorCreator.Core/Enum.cs
+++ b/WebDoorCreator.Core/Enum.cs
@@ -2,6 +2,18 @@
{
public class Enum
{
+ #region Public Enums
+
+ public enum OrderStatus
+ {
+ NA = 0,
+ DoorDef,
+ Sent,
+ ApprovedByMaker,
+ ApprovedByCustomer,
+ InProduction
+ }
+
public enum UserLevel
{
ND = 0,
@@ -12,14 +24,13 @@
User = 5
}
- public enum OrderStatus
+ public enum DoorDefStep
{
- NA=0,
- DoorDef,
- Sent,
- ApprovedByMaker,
- ApprovedByCustomer,
- InProduction
+ Door = 0,
+ Hardware,
+ report
}
+
+ #endregion Public Enums
}
}
\ No newline at end of file
diff --git a/WebDoorCreator.Core/IniFile.cs b/WebDoorCreator.Core/IniFile.cs
new file mode 100644
index 0000000..5bf73a2
--- /dev/null
+++ b/WebDoorCreator.Core/IniFile.cs
@@ -0,0 +1,112 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WebDoorCreator.Core
+{
+ public class IniFile
+ {
+ public string FileName;
+
+ ///
+ /// Constructor
+ ///
+ ///
+ public IniFile(string INIPath)
+ {
+ FileName = INIPath;
+ }
+
+ ///
+ /// Read data from the Ini file
+ ///
+ ///
+ ///
+ ///
+ public string ReadString(string Section, string Key)
+ {
+ StringBuilder temp = new StringBuilder(255);
+ int i = GetPrivateProfileString(Section, Key, "", temp, 255, FileName);
+ return temp.ToString();
+ }
+
+ ///
+ /// Read a string. If not found use default value
+ ///
+ ///
+ ///
+ ///
+ ///
+ public string ReadString(string Section, string Key, string DefaultVal)
+ {
+ string temp = ReadString(Section, Key);
+ if (temp == "") temp = DefaultVal;
+ return temp;
+ }
+
+ ///
+ /// GetPrivateProfileString: import windows dll functions
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ [DllImport("kernel32")]
+ private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath);
+
+ ///
+ /// GetPrivateProfileSection: import windows dll functions
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ [DllImport("kernel32")]
+ private static extern int GetPrivateProfileSection(string section, IntPtr retVal, uint size, string filePath);
+
+ ///
+ /// Read a complete section (keys=values)
+ ///
+ ///
+ /// Section name
+ ///
+ /// restituisce delle stringhe keys=values da suddividere appunto come key/val successivamente
+ ///
+ public string[] ReadSection(string Section)
+ {
+ const int bufferSize = 2048; // max is 32767
+
+ StringBuilder returnedString = new StringBuilder();
+
+ IntPtr pReturnedString = Marshal.AllocCoTaskMem(bufferSize);
+ try
+ {
+ int bytesReturned = GetPrivateProfileSection(Section, pReturnedString, bufferSize, FileName);
+ if (bytesReturned > 0)
+ {
+ //bytesReturned -1 to remove trailing \0
+ for (int i = 0; i < bytesReturned - 1; i++)
+ {
+ var currPointer = IntPtr.Add(pReturnedString, i);
+ var currChar = (char)Marshal.ReadByte(currPointer);
+ returnedString.Append(currChar);
+ }
+ }
+ }
+ finally
+ {
+ Marshal.FreeCoTaskMem(pReturnedString);
+ }
+
+ string sectionData = returnedString.ToString();
+ return sectionData.Split('\0');
+ }
+ }
+}
diff --git a/WebDoorCreator.Core/WebDoorCreator.Core.csproj b/WebDoorCreator.Core/WebDoorCreator.Core.csproj
index 1f04627..969c0c7 100644
--- a/WebDoorCreator.Core/WebDoorCreator.Core.csproj
+++ b/WebDoorCreator.Core/WebDoorCreator.Core.csproj
@@ -7,6 +7,7 @@
+
diff --git a/WebDoorCreator.Data/Controllers/WebDoorCreatorController.cs b/WebDoorCreator.Data/Controllers/WebDoorCreatorController.cs
index e227521..94ce7c1 100644
--- a/WebDoorCreator.Data/Controllers/WebDoorCreatorController.cs
+++ b/WebDoorCreator.Data/Controllers/WebDoorCreatorController.cs
@@ -2,6 +2,7 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using NLog;
+using System.Data;
using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.DTO;
@@ -9,63 +10,16 @@ namespace WebDoorCreator.Data.Controllers
{
public class WebDoorCreatorController : IDisposable
{
- private static IConfiguration _configuration;
- private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
+ #region Public Constructors
public WebDoorCreatorController(IConfiguration configuration)
{
_configuration = configuration;
}
- public void Dispose()
- {
- // Clear database context
- //Log.Info("Dispose di GWMSController");
- }
+ #endregion Public Constructors
- #region Company methods
-
- ///
- /// Company list (All)
- ///
- ///
- public List CompanyGetByKey(int id)
- {
- List dbResult = new List();
- // cerco su DB recuperando set di dati....
- using (WDCDataContext localDbCtx = new WDCDataContext(_configuration))
- {
- try
- {
- if (id == 0)
- {
-
- // extracting entire set
- dbResult = localDbCtx
- .DbSetCompany
- .OrderBy(x => x.CompanyName)
- .ToList();
- }
- else
- {
- var risultato = localDbCtx
- .DbSetCompany
- .Where(x => x.CompanyId == id)
- .OrderBy(x => x.CompanyName)
- .ToList();
- if (risultato != null)
- {
- dbResult = risultato;
- }
- }
- }
- catch (Exception exc)
- {
- Log.Error($"Error in CompanyAll:{Environment.NewLine}{exc}");
- }
- }
- return dbResult;
- }
+ #region Public Methods
///
/// Adding a new company
@@ -115,206 +69,53 @@ namespace WebDoorCreator.Data.Controllers
return fatto;
}
- #endregion Company methods
-
- #region User methods
-
///
- /// Populating DTO to handle users
- ///
- /// User id to search for
- ///
- public List GetUserRoleClaimByUserId()
- {
- List dbResult = new List();
- using (WDCDataContext localDbCtx = new WDCDataContext(_configuration))
- {
- var users = localDbCtx.DbSetUsers.ToList();
-
- foreach (var item in users)
- {
- var userRoles = localDbCtx.DbSetUserRoles
- .Where(x => x.UserId == item.Id)
- .Include(u => u.UsersNav)
- .Include(u => u.RolesNav)
- .ToList();
-
- //UserRoleClaimDTO userDTO = new UserRoleClaimDTO()
- //{
- // userName = item.UserName,
- // rolesName = userRoles
- //};
- //dbResult.Add(userDTO);
- }
- }
- return dbResult;
- }
-
- ///
- /// Retrieving data from user/roles relation
+ /// Company list (All)
///
///
- public List GetUserView()
+ public List CompanyGetByKey(int id)
{
- List dbResult = new List();
+ List dbResult = new List();
+ // cerco su DB recuperando set di dati....
using (WDCDataContext localDbCtx = new WDCDataContext(_configuration))
{
try
{
- // extracting entire set
- dbResult = localDbCtx
- .DbSetUsersView
- .OrderBy(x => x.UserId)
- .ToList();
- }
- catch (Exception exc)
- {
- Log.Error($"Error in GetUserRole:{Environment.NewLine}{exc}");
- }
- }
- return dbResult;
- }
-
- ///
- /// Retrieving data from users table
- ///
- ///
- public List GetUsersAll()
- {
- List dbResult = new List();
- using (WDCDataContext localDbCtx = new WDCDataContext(_configuration))
- {
- try
- {
- // extracting entire set
- dbResult = localDbCtx
- .DbSetUsers
- .OrderBy(x => x.Id)
- .ToList();
- }
- catch (Exception exc)
- {
- Log.Error($"Error in GetUserRole:{Environment.NewLine}{exc}");
- }
- }
- return dbResult;
- }
-
- ///
- /// Retrieving data from users table filtered by id
- ///
- ///
- public AspNetUsers GetUsersById(string userId)
- {
- AspNetUsers dbResult = new AspNetUsers();
- using (WDCDataContext localDbCtx = new WDCDataContext(_configuration))
- {
- try
- {
- // extracting entire set
- var risultato = localDbCtx
- .DbSetUsers
- .Where(x => x.Id == userId)
- .AsNoTracking()
- .OrderBy(x => x.Id)
- .FirstOrDefault();
-
- if (risultato != null)
+ if (id == 0)
{
- dbResult = risultato;
+ // extracting entire set
+ dbResult = localDbCtx
+ .DbSetCompany
+ .OrderBy(x => x.CompanyName)
+ .ToList();
}
else
{
- dbResult = new AspNetUsers();
+ var risultato = localDbCtx
+ .DbSetCompany
+ .Where(x => x.CompanyId == id)
+ .OrderBy(x => x.CompanyName)
+ .ToList();
+ if (risultato != null)
+ {
+ dbResult = risultato;
+ }
}
}
catch (Exception exc)
{
- Log.Error($"Error in GetUsersById:{Environment.NewLine}{exc}");
+ Log.Error($"Error in CompanyAll:{Environment.NewLine}{exc}");
}
}
return dbResult;
}
- #endregion User methods
-
- #region Roles methods
-
///
- /// Retrieving data from roles table
- ///
- ///
- public List GetRolesAll()
- {
- List dbResult = new List();
- using (WDCDataContext localDbCtx = new WDCDataContext(_configuration))
- {
- try
- {
- // extracting entire set
- dbResult = localDbCtx
- .DbSetRoles
- .OrderBy(x => x.Name)
- .ToList();
- }
- catch (Exception exc)
- {
- Log.Error($"Error in GetRolesAll:{Environment.NewLine}{exc}");
- }
- }
- return dbResult;
- }
-
- #endregion Roles methods
-
- #region Order status methods
-
- ///
- /// Order status
- ///
- ///
- ///
- ///
- ///
- ///
- public List GetOrderStatus(int companyId, int orderStatus, DateTime dataFrom, DateTime dataTo)
- {
- List dbResult = new List();
- using (var dbCtx = new WDCDataContext(_configuration))
- {
- try
- {
- var CompanyId = new SqlParameter("@CompanyId", companyId);
- var OrderStatus = new SqlParameter("@OrderStatus", orderStatus);
- var DataFrom = new SqlParameter("@DataFrom", dataFrom.Date);
- var DataTo = new SqlParameter("@DataTo", dataTo.Date);
-
- var k = $"exec dbo.stp_OrderList_getFilt {companyId}, {orderStatus}, '{dataFrom.Date.ToString("yyyy/MM/dd")}', '{dataTo.Date.ToString("yyyy/MM/dd")}'";
-
- dbResult = dbCtx
- .DbSetOrderStatus
- .FromSqlRaw("exec dbo.stp_OrderList_getFilt @CompanyId, @OrderStatus, @DataFrom, @DataTo", CompanyId, OrderStatus, DataFrom, DataTo)
- .AsNoTracking()
- .ToList();
- }
- catch (Exception exc)
- {
- Log.Error($"Error in GetOrderStatus:{Environment.NewLine}{exc}");
- }
- }
- return dbResult;
- }
-
- #endregion Order status methods
-
- #region Order methods
-
- ///
- /// Adding a new order
+ /// Adding a new Compo
///
/// Record to add
///
- public async Task OrderAdd(OrderModel addRec)
+ public async Task CompoAdd(HardwareModel addRec)
{
bool fatto = false;
using (WDCDataContext localDbCtx = new WDCDataContext(_configuration))
@@ -322,89 +123,93 @@ namespace WebDoorCreator.Data.Controllers
try
{
localDbCtx
- .DbSetOrders
+ .DbSetHardware
.Add(addRec);
await localDbCtx.SaveChangesAsync();
fatto = true;
}
catch (Exception exc)
{
- Log.Error($"Eccezione durante OrderAd: {Environment.NewLine}{exc}");
+ Log.Error($"Eccezione durante CompoAdd: {Environment.NewLine}{exc}");
}
}
return fatto;
}
- #endregion Order methods
-
- #region Door methods
-
- ///
- /// Getting door data by orderId
- ///
- ///
- public List DoorsGetByOrderId(int orderId)
+ public void Dispose()
{
- List dbResult = new List();
- // retrieving data from db
- using (WDCDataContext localDbCtx = new WDCDataContext(_configuration))
- {
- try
- {
- // extracting entire set
- dbResult = localDbCtx
- .DbSetDoor
- .Where(x => x.OrderId == orderId)
- .OrderBy(x => x.DoorId)
- .ToList();
- }
- catch (Exception exc)
- {
- Log.Error($"Error in DoorsGetByOrderId:{Environment.NewLine}{exc}");
- }
- }
- return dbResult;
+ // Clear database context
+ //Log.Info("Dispose di GWMSController");
}
///
- /// Modifying or adding a new door
+ /// Remove door
///
- /// Record to edit or add
+ /// ID da eliminare
///
- public async Task DoorUpsert(DoorModel addEditRec)
+ public async Task DoorDelete(int DoorId)
{
bool fatto = false;
- //List dbResult = new List();
using (WDCDataContext localDbCtx = new WDCDataContext(_configuration))
{
try
{
var currRec = localDbCtx
.DbSetDoor
- .Where(x => x.DoorId == addEditRec.DoorId)
+ .Where(x => x.DoorId == DoorId)
.FirstOrDefault();
- if (currRec != null) //if is not null edit the record found
+ // procedo solo se c'è
+ if (currRec != null)
{
- currRec.Quantity = addEditRec.Quantity;
- localDbCtx.Entry(currRec).State = EntityState.Modified;
+ var newDbRec = localDbCtx
+ .DbSetDoor
+ .Remove(currRec);
+ await localDbCtx.SaveChangesAsync();
+ fatto = true;
}
- else //if is null add the record as new in the table
- {
- localDbCtx
- .DbSetDoor
- .Add(addEditRec);
- }
- await localDbCtx.SaveChangesAsync();
- fatto = true;
}
catch (Exception exc)
{
- Log.Error($"Eccezione durante DoorsAddMod: {Environment.NewLine}{exc}");
+ Log.Error($"Eccezione durante DoorDelete: {Environment.NewLine}{exc}");
}
}
return fatto;
}
+ ///
+ /// Adding a new door
+ ///
+ /// Record to edit or add
+ ///
+ public async Task DoorInsert(DoorModel newRec)
+ {
+ int newId = 0;
+ using (WDCDataContext localDbCtx = new WDCDataContext(_configuration))
+ {
+ try
+ {
+ var currRec = localDbCtx
+ .DbSetDoor
+ .Where(x => x.DoorId == newRec.DoorId)
+ .FirstOrDefault();
+ // procedo solo se non c'è giÃ
+ if (currRec == null)
+ {
+ var newDbRec = localDbCtx
+ .DbSetDoor
+ .Add(newRec);
+ await localDbCtx.SaveChangesAsync();
+ newId = newRec.DoorId;
+ }
+ }
+ catch (Exception exc)
+ {
+ Log.Error($"Eccezione durante DoorInsert: {Environment.NewLine}{exc}");
+ }
+ }
+ return newId;
+ }
+
///
/// Adding or removing a single door
///
@@ -447,9 +252,248 @@ namespace WebDoorCreator.Data.Controllers
return fatto;
}
- #endregion Door methods
+ ///
+ /// Retrieving current data from door
+ ///
+ ///
+ public List DoorOpGetByDoorId(int doorId)
+ {
+ List dbResult = new List();
+ using (WDCDataContext localDbCtx = new WDCDataContext(_configuration))
+ {
+ try
+ {
+ // extracting entire set
+ dbResult = localDbCtx
+ .DbSetDoorOp
+ .Where(x => x.DoorId == doorId)
+ .ToList();
+ }
+ catch (Exception exc)
+ {
+ Log.Error($"Error in DoorOpGetByDoorId:{Environment.NewLine}{exc}");
+ }
+ }
+ return dbResult;
+ }
- #region ListValues Methods
+ ///
+ /// Adding door's OP
+ ///
+ /// Records to add
+ ///
+ public async Task DoorOpInsert(List newOpRec)
+ {
+ bool fatto = false;
+ using (WDCDataContext localDbCtx = new WDCDataContext(_configuration))
+ {
+ try
+ {
+ localDbCtx
+ .DbSetDoorOp
+ .AddRange(newOpRec);
+ await localDbCtx.SaveChangesAsync();
+ fatto = true;
+ }
+ catch (Exception exc)
+ {
+ Log.Error($"Eccezione durante DoorInsert: {Environment.NewLine}{exc}");
+ }
+ }
+ return fatto;
+ }
+
+ ///
+ /// Adding a new DoorOpType
+ ///
+ /// Record to add
+ ///
+ public async Task DoorOpTypeAdd(DoorOpTypeModel addRec)
+ {
+ bool fatto = false;
+ using (WDCDataContext localDbCtx = new WDCDataContext(_configuration))
+ {
+ try
+ {
+ localDbCtx
+ .DbSetDoorOpType
+ .Add(addRec);
+ await localDbCtx.SaveChangesAsync();
+ fatto = true;
+ }
+ catch (Exception exc)
+ {
+ Log.Error($"Eccezione durante DoorOpTypeAdd:{Environment.NewLine}{exc}");
+ }
+ }
+
+ return fatto;
+ }
+
+ ///
+ /// Adding a new DoorOpType
+ ///
+ /// Record to add
+ ///
+ public async Task DoorOpTypeAddRange(List listRec)
+ {
+ bool fatto = false;
+ using (WDCDataContext localDbCtx = new WDCDataContext(_configuration))
+ {
+ try
+ {
+ localDbCtx
+ .DbSetDoorOpType
+ .AddRange(listRec);
+ await localDbCtx.SaveChangesAsync();
+ fatto = true;
+ }
+ catch (Exception exc)
+ {
+ Log.Error($"Eccezione durante DoorOpTypeAddRange:{Environment.NewLine}{exc}");
+ }
+ }
+ return fatto;
+ }
+
+ ///
+ /// Retrieving data from door operation type table
+ ///
+ ///
+ public List DoorOpTypeGetAll()
+ {
+ List dbResult = new List();
+ using (WDCDataContext localDbCtx = new WDCDataContext(_configuration))
+ {
+ try
+ {
+ // extracting entire set
+ dbResult = localDbCtx
+ .DbSetDoorOpType
+ .OrderBy(x => x.DoorOpTypId)
+ .ToList();
+ }
+ catch (Exception exc)
+ {
+ Log.Error($"Error in DoorOpTypeGetAll:{Environment.NewLine}{exc}");
+ }
+ }
+ return dbResult;
+ }
+
+ public async Task> DoorOpTypeGetDefault()
+ {
+ List dbResult = new List();
+ using (WDCDataContext localDbCtx = new WDCDataContext(_configuration))
+ {
+ try
+ {
+ dbResult = localDbCtx
+ .DbSetDoorOpType
+ .Where(x => x.IsDefault)
+ .ToList();
+ }
+ catch (Exception exc)
+ {
+ Log.Error($"Eccezione durante DoorOpTypeGetDefault: {Environment.NewLine}{exc}");
+ }
+ }
+ await Task.Delay(1);
+ return dbResult;
+ }
+
+ ///
+ /// Getting door data by orderId
+ ///
+ ///
+ public List DoorsGetByOrderId(int orderId)
+ {
+ List dbResult = new List();
+ // retrieving data from db
+ using (WDCDataContext localDbCtx = new WDCDataContext(_configuration))
+ {
+ try
+ {
+ // extracting entire set
+ dbResult = localDbCtx
+ .DbSetDoor
+ .Where(x => x.OrderId == orderId)
+ .Include(o => o.OrderNav)
+ .Include(t => t.TypeNav)
+ .OrderBy(x => x.DoorId)
+ .AsNoTracking()
+ .ToList();
+ }
+ catch (Exception exc)
+ {
+ Log.Error($"Error in DoorsGetByOrderId:{Environment.NewLine}{exc}");
+ }
+ }
+ return dbResult;
+ }
+
+ ///
+ /// Modifying or adding a new door
+ ///
+ /// Record to edit or add
+ ///
+ public async Task DoorUpsert(DoorModel addEditRec)
+ {
+ bool fatto = false;
+ //List dbResult = new List();
+ using (WDCDataContext localDbCtx = new WDCDataContext(_configuration))
+ {
+ try
+ {
+ var currRec = localDbCtx
+ .DbSetDoor
+ .Where(x => x.DoorId == addEditRec.DoorId)
+ .FirstOrDefault();
+ if (currRec != null) //if is not null edit the record found
+ {
+ currRec.Quantity = addEditRec.Quantity;
+ localDbCtx.Entry(currRec).State = EntityState.Modified;
+ }
+ else //if is null add the record as new in the table
+ {
+ localDbCtx
+ .DbSetDoor
+ .Add(addEditRec);
+ }
+ await localDbCtx.SaveChangesAsync();
+ fatto = true;
+ }
+ catch (Exception exc)
+ {
+ Log.Error($"Eccezione durante DoorUpsert: {Environment.NewLine}{exc}");
+ }
+ }
+ return fatto;
+ }
+
+ ///
+ /// Estraggo tutte le lingue disponibili per questa applicazione
+ ///
+ ///
+ public List LanguageGetAll()
+ {
+ List dbResult = new List();
+ using (WDCDataContext localDbCtx = new WDCDataContext(_configuration))
+ {
+ try
+ {
+ // extracting entire set
+ dbResult = localDbCtx
+ .DbSetLanguages
+ .ToList();
+ }
+ catch (Exception exc)
+ {
+ Log.Error($"Error in LanguageGetAll:{Environment.NewLine}{exc}");
+ }
+ }
+ return dbResult;
+ }
///
/// ListValues list (All)
@@ -478,6 +522,436 @@ namespace WebDoorCreator.Data.Controllers
return dbResult;
}
- #endregion ListValues Methods
+ ///
+ /// Adding a new list value
+ ///
+ /// Record to add
+ ///
+ public async Task ListValuesAdd(List addList)
+ {
+ bool fatto = false;
+ using (WDCDataContext localDbCtx = new WDCDataContext(_configuration))
+ {
+ try
+ {
+
+ // stored di reset ListValues
+ var storedRes = localDbCtx
+ .Database
+ .ExecuteSqlRaw("exec dbo.stp_ListVal_Prepare");
+ await localDbCtx.SaveChangesAsync();
+
+ // import massivo dati in tab temp
+ localDbCtx
+ .DbSetValuesTemp
+ .AddRange(addList);
+ await localDbCtx.SaveChangesAsync();
+
+ // stored di merge dati in vocabolario
+ storedRes = localDbCtx
+ .Database
+ .ExecuteSqlRaw("exec dbo.stp_ListVal_Import");
+
+ fatto = true;
+
+
+ fatto = true;
+ }
+ catch (Exception exc)
+ {
+ Log.Error($"Eccezione durante ListValuesAdd: {Environment.NewLine}{exc}");
+ }
+ }
+ return fatto;
+ }
+
+ ///
+ /// Adding a new order
+ ///
+ /// Record to add
+ ///
+ public async Task OrderAdd(OrderModel addRec)
+ {
+ bool fatto = false;
+ using (WDCDataContext localDbCtx = new WDCDataContext(_configuration))
+ {
+ try
+ {
+ localDbCtx
+ .DbSetOrders
+ .Add(addRec);
+ await localDbCtx.SaveChangesAsync();
+ fatto = true;
+ }
+ catch (Exception exc)
+ {
+ Log.Error($"Eccezione durante OrderAd: {Environment.NewLine}{exc}");
+ }
+ }
+ return fatto;
+ }
+
+ ///
+ /// Remove order
+ ///
+ /// Record to add
+ ///
+ public async Task OrderRem(int OrdId)
+ {
+ bool fatto = false;
+ using (WDCDataContext localDbCtx = new WDCDataContext(_configuration))
+ {
+ try
+ {
+ var selRec = localDbCtx
+ .DbSetOrders
+ .Where(x => x.OrderId == OrdId)
+ .FirstOrDefault();
+ if (selRec != null)
+ {
+ localDbCtx.DbSetOrders.Remove(selRec);
+ await localDbCtx.SaveChangesAsync();
+ fatto = true;
+ }
+ }
+ catch (Exception exc)
+ {
+ Log.Error($"Eccezione durante OrderRem: {Environment.NewLine}{exc}");
+ }
+ }
+ return fatto;
+ }
+
+ ///
+ /// Order status
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public List OrderStatusGetAll(int companyId, int orderStatus, DateTime dataFrom, DateTime dataTo)
+ {
+ List dbResult = new List();
+ using (var dbCtx = new WDCDataContext(_configuration))
+ {
+ try
+ {
+ var CompanyId = new SqlParameter("@CompanyId", companyId);
+ var OrderStatus = new SqlParameter("@OrderStatus", orderStatus);
+ var DataFrom = new SqlParameter("@DataFrom", dataFrom);
+ var DataTo = new SqlParameter("@DataTo", dataTo);
+
+ dbResult = dbCtx
+ .DbSetOrderStatus
+ .FromSqlRaw("exec dbo.stp_OrderList_getFilt @CompanyId, @OrderStatus, @DataFrom, @DataTo", CompanyId, OrderStatus, DataFrom, DataTo)
+ .AsNoTracking()
+ .ToList();
+ }
+ catch (Exception exc)
+ {
+ Log.Error($"Error in GetOrderStatus:{Environment.NewLine}{exc}");
+ }
+ }
+ return dbResult;
+ }
+
+ ///
+ /// Adding a new graphic param
+ ///
+ /// Record to add
+ ///
+ public async Task ParamAdd(GraphicParamsModel addRec)
+ {
+ bool fatto = false;
+ using (WDCDataContext localDbCtx = new WDCDataContext(_configuration))
+ {
+ try
+ {
+ localDbCtx
+ .DbSetGraphicParams
+ .Add(addRec);
+ await localDbCtx.SaveChangesAsync();
+ fatto = true;
+ }
+ catch (Exception exc)
+ {
+ Log.Error($"Eccezione durante ParamAdd: {Environment.NewLine}{exc}");
+ }
+ }
+ return fatto;
+ }
+
+ ///
+ /// Getting all the graphic parameters by hw id
+ ///
+ /// Hardware's id to search for
+ ///
+ public List ParamGetByHwId(int hwId)
+ {
+ List dbResult = new List();
+ using (WDCDataContext localDbCtx = new WDCDataContext(_configuration))
+ {
+ try
+ {
+ dbResult = localDbCtx
+ .DbSetGraphicParams
+ .Where(x => x.compoId == hwId)
+ .ToList();
+ }
+ catch (Exception exc)
+ {
+ Log.Error($"Eccezione durante ParamGetByHwId: {Environment.NewLine}{exc}");
+ }
+ }
+ return dbResult;
+ }
+
+ ///
+ /// Retrieving data from roles table
+ ///
+ ///
+ public List RolesGetAll()
+ {
+ List dbResult = new List();
+ using (WDCDataContext localDbCtx = new WDCDataContext(_configuration))
+ {
+ try
+ {
+ // extracting entire set
+ dbResult = localDbCtx
+ .DbSetRoles
+ .OrderBy(x => x.Name)
+ .ToList();
+ }
+ catch (Exception exc)
+ {
+ Log.Error($"Error in GetRolesAll:{Environment.NewLine}{exc}");
+ }
+ }
+ return dbResult;
+ }
+
+ ///
+ /// truncate tables for testing purposes
+ ///
+ ///
+ public bool TestTablesTruncate()
+ {
+ bool dbResult = false;
+ using (var dbCtx = new WDCDataContext(_configuration))
+ {
+ try
+ {
+ dbCtx
+ .Database
+ .ExecuteSqlRaw("EXEC man.[stp_TruncTables]");
+
+ dbResult = true;
+ }
+ catch (Exception exc)
+ {
+ Log.Error($"Error in TablesTruncate:{Environment.NewLine}{exc}");
+ }
+ }
+ return dbResult;
+ }
+
+ ///
+ /// Populating DTO to handle users
+ ///
+ /// User id to search for
+ ///
+ public List UserRoleClaimGetByUserId()
+ {
+ List dbResult = new List();
+ using (WDCDataContext localDbCtx = new WDCDataContext(_configuration))
+ {
+ var users = localDbCtx.DbSetUsers.ToList();
+
+ foreach (var item in users)
+ {
+ var userRoles = localDbCtx.DbSetUserRoles
+ .Where(x => x.UserId == item.Id)
+ .Include(u => u.UsersNav)
+ .Include(u => u.RolesNav)
+ .ToList();
+ }
+ }
+ return dbResult;
+ }
+
+ ///
+ /// Retrieving data from users table
+ ///
+ ///
+ public List UsersGetAll()
+ {
+ List dbResult = new List();
+ using (WDCDataContext localDbCtx = new WDCDataContext(_configuration))
+ {
+ try
+ {
+ // extracting entire set
+ dbResult = localDbCtx
+ .DbSetUsers
+ .OrderBy(x => x.Id)
+ .ToList();
+ }
+ catch (Exception exc)
+ {
+ Log.Error($"Error in GetUserRole:{Environment.NewLine}{exc}");
+ }
+ }
+ return dbResult;
+ }
+
+ ///
+ /// Retrieving data from users table filtered by id
+ ///
+ ///
+ public AspNetUsers UsersGetById(string userId)
+ {
+ AspNetUsers dbResult = new AspNetUsers();
+ using (WDCDataContext localDbCtx = new WDCDataContext(_configuration))
+ {
+ try
+ {
+ // extracting entire set
+ var risultato = localDbCtx
+ .DbSetUsers
+ .Where(x => x.Id == userId)
+ .AsNoTracking()
+ .OrderBy(x => x.Id)
+ .FirstOrDefault();
+
+ if (risultato != null)
+ {
+ dbResult = risultato;
+ }
+ else
+ {
+ dbResult = new AspNetUsers();
+ }
+ }
+ catch (Exception exc)
+ {
+ Log.Error($"Error in GetUsersById:{Environment.NewLine}{exc}");
+ }
+ }
+ return dbResult;
+ }
+
+ ///
+ /// Retrieving data from user/roles relation
+ ///
+ ///
+ public List UserViewGetAll()
+ {
+ List dbResult = new List();
+ using (WDCDataContext localDbCtx = new WDCDataContext(_configuration))
+ {
+ try
+ {
+ // extracting entire set
+ dbResult = localDbCtx
+ .DbSetUsersView
+ .OrderBy(x => x.UserId)
+ .ToList();
+ }
+ catch (Exception exc)
+ {
+ Log.Error($"Error in GetUserRole:{Environment.NewLine}{exc}");
+ }
+ }
+ return dbResult;
+ }
+ public Dictionary> VocLemmaGetAll()
+ {
+ Dictionary> DTOResult = new Dictionary>();
+ using (WDCDataContext localDbCtx = new WDCDataContext(_configuration))
+ {
+ try
+ {
+ List lingue = new List()
+ {
+ "IT",
+ "EN"
+ };
+
+ // extracting entire set
+ var allVoc = localDbCtx
+ .DbSetVocabulary
+ .AsNoTracking()
+ .ToList();
+
+ foreach (var lingua in lingue)
+ {
+ Dictionary dict = new Dictionary();
+ foreach (var lemma in allVoc.Where(x => x.Lingua == lingua))
+ {
+ dict.Add(lemma.Lemma, lemma.Traduzione);
+ }
+ DTOResult.Add(lingua, dict);
+ }
+ }
+ catch (Exception exc)
+ {
+ Log.Error($"Error in VocLemmaGetAll:{Environment.NewLine}{exc}");
+ }
+ }
+ return DTOResult;
+ }
+
+ ///
+ /// Aggiunta di un nuovo set di lemmi
+ ///
+ ///
+ ///
+ public async Task VocLemmaInsert(List listNewTerms)
+ {
+ bool fatto = false;
+
+ //var o = listNewTerms.Where(x => x.Traduzione.Length > 200).ToList();
+
+ using (WDCDataContext localDbCtx = new WDCDataContext(_configuration))
+ {
+ try
+ {
+ // stored di reset vocabolario
+ var storedRes = localDbCtx
+ .Database
+ .ExecuteSqlRaw("exec dbo.stp_Voc_Prepare");
+ await localDbCtx.SaveChangesAsync();
+
+ // import massivo dati in tab temp
+ localDbCtx
+ .DbSetVocabularyTemp
+ .AddRange(listNewTerms);
+ await localDbCtx.SaveChangesAsync();
+
+ // stored di merge dati in vocabolario
+ storedRes = localDbCtx
+ .Database
+ .ExecuteSqlRaw("exec dbo.stp_Voc_Import");
+
+ fatto = true;
+ }
+ catch (Exception exc)
+ {
+ Log.Error($"Eccezione durante VocLemmaInsert: {Environment.NewLine}{exc}");
+ }
+ }
+ return fatto;
+ }
+
+ #endregion Public Methods
+
+ #region Private Fields
+
+ private static IConfiguration _configuration;
+ private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
+
+ #endregion Private Fields
}
}
\ No newline at end of file
diff --git a/WebDoorCreator.Data/DbModels/DoorModel.cs b/WebDoorCreator.Data/DbModels/DoorModel.cs
index c5853c1..6a65e06 100644
--- a/WebDoorCreator.Data/DbModels/DoorModel.cs
+++ b/WebDoorCreator.Data/DbModels/DoorModel.cs
@@ -12,7 +12,7 @@ using System.Threading.Tasks;
namespace WebDoorCreator.Data.DbModels
{
///
- /// Tabella dati Orders
+ /// Tabella dati Door
///
[Table("Door")]
public class DoorModel
@@ -25,6 +25,11 @@ namespace WebDoorCreator.Data.DbModels
///
public int OrderId { get; set; }
+ ///
+ /// Unità di misura
+ ///
+ public string MeasureUnit { get; set; } = "";
+
///
/// Door's Type
///
@@ -71,6 +76,16 @@ namespace WebDoorCreator.Data.DbModels
public decimal UnitCost { get; set; } = 0;
+ ///
+ /// Data scadenza Lock
+ ///
+ public DateTime DateLockExpiry { get; set; } = DateTime.Now;
+
+ ///
+ /// Codice utente che ha bloccato record
+ ///
+ public string UserIdLock { get; set; } = "";
+
[ForeignKey("OrderId")]
public virtual OrderModel? OrderNav { get; set; }
diff --git a/WebDoorCreator.Data/DbModels/DoorOpModel.cs b/WebDoorCreator.Data/DbModels/DoorOpModel.cs
new file mode 100644
index 0000000..ac10a90
--- /dev/null
+++ b/WebDoorCreator.Data/DbModels/DoorOpModel.cs
@@ -0,0 +1,69 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+//
+// This is here so CodeMaid doesn't reorganize this document
+//
+namespace WebDoorCreator.Data.DbModels
+{
+ ///
+ /// Tabella dati operation CONCRETE collegate alla porta
+ ///
+ [Table("DoorOp")]
+ public class DoorOpModel
+ {
+ [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+ public int DoorOpId { get; set; }
+
+ ///
+ /// porta di riferimento
+ ///
+ public int DoorId { get; set; } = 0;
+ ///
+ /// Tipo astratto di riferimento
+ ///
+ public int DoorOpTypId { get; set; } = 0;
+
+ ///
+ /// Descrizione
+ ///
+ public string Description { get; set; } = "";
+
+ ///
+ /// Data inserimento ordine
+ ///
+ public DateTime DateIns { get; set; } = DateTime.Now;
+
+ ///
+ /// Codice utente che ha creato
+ ///
+ public string UserIdIns { get; set; } = "";
+
+ ///
+ /// Data (ultima) modifica ordine
+ ///
+ public DateTime DateMod { get; set; } = DateTime.Now;
+
+ ///
+ /// Codice utente che ha creato
+ ///
+ public string UserIdMod { get; set; } = "";
+
+ ///
+ /// Oggetto Json per specifica configurazione VALORIZZATO
+ ///
+ public string JsoncConfigVal { get; set; } = "";
+
+
+ [ForeignKey("DoorId")]
+ public virtual DoorModel? DoorNav { get; set; }
+
+ [ForeignKey("DoorOpTypId")]
+ public virtual DoorOpTypeModel? DoorOpTypeNav { get; set; }
+ }
+}
diff --git a/WebDoorCreator.Data/DbModels/DoorOpTypeModel.cs b/WebDoorCreator.Data/DbModels/DoorOpTypeModel.cs
new file mode 100644
index 0000000..2bf2aca
--- /dev/null
+++ b/WebDoorCreator.Data/DbModels/DoorOpTypeModel.cs
@@ -0,0 +1,138 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Microsoft.EntityFrameworkCore;
+
+//
+// This is here so CodeMaid doesn't reorganize this document
+//
+namespace WebDoorCreator.Data.DbModels
+{
+ ///
+ /// Tabella dati Door Operation Type (astratte)
+ ///
+ [Table("DoorOpType")]
+ public class DoorOpTypeModel
+ {
+ [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+ public int DoorOpTypId { get; set; }
+
+ ///
+ /// Codice univoco dell'operazione da svolgere (calcolato, idealmente 4 char da 36 val 0..Z)
+ ///
+ public string OpCode { get; set; } = "";
+
+ ///
+ /// Descrizione
+ ///
+ public string Description { get; set; } = "";
+
+ ///
+ /// Indica se sia da creare sempre
+ ///
+ public bool IsDefault { get; set; } = false;
+
+ ///
+ /// Indica se ci sia un hardware correlato all'operazione
+ ///
+ public bool HasHw { get; set; } = true;
+
+ ///
+ /// Indica se sia un oggetto concreto (= con un file, che si può produrre) o abstract (ha figli, è un gruppo logico)
+ ///
+ public bool IsConcrete { get; set; } = true;
+
+ ///
+ /// Codice dell'HW collegato
+ ///
+ public string HwCode { get; set; } = "";
+
+ ///
+ /// Descrizione dell'HW collegato
+ ///
+ public string HwDescription { get; set; } = "";
+
+
+ ///
+ /// URL dell'immagine/link di riferimento
+ ///
+ public string DisplayUrl { get; set; } = "";
+
+ ///
+ /// Path folder/file di riferimento
+ ///
+ public string FPath { get; set; } = "";
+
+ ///
+ /// Idx univoco dell'elemento parent (se 0 = root)
+ ///
+ public int ParentDoorOpId { get; set; } = 0;
+
+#if false
+
+ ///
+ /// Codice tipo treeView
+ ///
+ public string TreeCode { get; set; } = "";
+#endif
+
+ ///
+ /// Idx univoco dell'elemento parent (se 0 = root)
+ ///
+ public HierarchyId? DoorOpIdPathFromPatriarch { get; set; }
+
+
+ ///
+ /// Oggetto Json per specifica configurazione (template)
+ ///
+ public string JsoncConfig { get; set; } = "";
+
+ ///
+ /// Codice esterno (opzionale)
+ ///
+ public string ExtOpCode { get; set; } = "";
+
+ ///
+ /// Descrizione esterna (opzionale)
+ ///
+ public string ExtDescript { get; set; } = "";
+
+ ///
+ /// Revisione dell'item
+ ///
+ public string Rev { get; set; } = "";
+
+ ///
+ /// Inizio validità item
+ ///
+ public DateTime ValidFrom { get; set; } = new DateTime(2000, 1, 1);
+
+ ///
+ /// Fine validità item
+ ///
+ public DateTime ValidUntil { get; set; } = new DateTime(3000, 1, 1);
+
+ ///
+ /// Check validità item
+ ///
+ [NotMapped]
+ public bool IsActive
+ {
+ get => DateTime.Today >= ValidFrom && DateTime.Today <= ValidUntil;
+ }
+
+ ///
+ /// Numero massimo associabile a singola Door
+ ///
+ public int MaxAllowed { get; set; } = 1;
+
+#if false
+ [ForeignKey("ParentDoorOpId")]
+ public virtual DoorOpModel? ParentNav { get; set; }
+#endif
+ }
+}
diff --git a/WebDoorCreator.Data/DbModels/DoorTypeModel.cs b/WebDoorCreator.Data/DbModels/DoorTypeModel.cs
index 624cae5..c219731 100644
--- a/WebDoorCreator.Data/DbModels/DoorTypeModel.cs
+++ b/WebDoorCreator.Data/DbModels/DoorTypeModel.cs
@@ -12,7 +12,7 @@ using System.Threading.Tasks;
namespace WebDoorCreator.Data.DbModels
{
///
- /// Tabella dati Orders
+ /// Tabella dati Door Type
///
[Table("DoorType")]
public class DoorTypeModel
diff --git a/WebDoorCreator.Data/DbModels/Edges.cs b/WebDoorCreator.Data/DbModels/Edges.cs
new file mode 100644
index 0000000..48b2b84
--- /dev/null
+++ b/WebDoorCreator.Data/DbModels/Edges.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WebDoorCreator.Data.DbModels
+{
+ public class Edges
+ {
+ public string lockEdge { get; set; } = "BV";
+ public string hingeEdge { get; set; } = "BV";
+ public string topEdge { get; set; } = "SQ";
+ public string bottomEdge { get; set; } = "SQ";
+ }
+}
diff --git a/WebDoorCreator.Data/DbModels/GraphicParamsModel.cs b/WebDoorCreator.Data/DbModels/GraphicParamsModel.cs
new file mode 100644
index 0000000..8c4dde8
--- /dev/null
+++ b/WebDoorCreator.Data/DbModels/GraphicParamsModel.cs
@@ -0,0 +1,59 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Microsoft.EntityFrameworkCore;
+
+//
+// This is here so CodeMaid doesn't reorganize this document
+//
+namespace WebDoorCreator.Data.DbModels
+{
+ ///
+ /// Tabella dati Hardware
+ ///
+ [Table("GraphicParams")]
+ public class GraphicParamsModel
+ {
+ [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+ public int GraphicParamId { get; set; }
+
+ ///
+ /// Id del componente di riferimento
+ ///
+ public int compoId { get; set; } = 0;
+
+ ///
+ /// Testata del gruppo di parametri
+ ///
+ public string graphicParamsN { get; set; } = "";
+
+ ///
+ /// Titolo del parametro
+ ///
+ public string graphicParamKey { get; set; } = "";
+
+ ///
+ /// Nome del parametro scritto nel file DDF
+ ///
+ public string graphicParamName { get; set; } = "";
+
+ ///
+ /// Nome del parametro visualizzato dall'utente
+ ///
+ public string graphicParamAlias { get; set; } = "";
+
+ ///
+ /// Tipo del parametro
+ ///
+ public string graphicParamType { get; set; } = "";
+
+ ///
+ /// Tipo del parametro
+ ///
+ public string graphicParamDefaultVal { get; set; } = "";
+ }
+}
diff --git a/WebDoorCreator.Data/DbModels/HardwareModel.cs b/WebDoorCreator.Data/DbModels/HardwareModel.cs
new file mode 100644
index 0000000..53da97e
--- /dev/null
+++ b/WebDoorCreator.Data/DbModels/HardwareModel.cs
@@ -0,0 +1,41 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Microsoft.EntityFrameworkCore;
+
+//
+// This is here so CodeMaid doesn't reorganize this document
+//
+namespace WebDoorCreator.Data.DbModels
+{
+ ///
+ /// Tabella dati Hardware
+ ///
+ [Table("Hardware")]
+ public class HardwareModel
+ {
+ [Key]
+ public int HardwareId { get; set; }
+
+ ///
+ /// Nome del componente che verrà scritto nel file DDF
+ ///
+ public string compoName { get; set; } = "";
+ ///
+ /// Nome del componente che verrà visualizzato a schermo (pescato dal file di sinonimi)
+ ///
+ public string compoAlias { get; set; } = "";
+ ///
+ /// Nome del layer legato al componente
+ ///
+ public string compoLayerName { get; set; } = "";
+ ///
+ /// Indica se il il componente deve risultare utilizzabile dal cliente
+ ///
+ public bool compoTemplateIsActive { get; set; } = true;
+ }
+}
diff --git a/WebDoorCreator.Data/DbModels/LanguageModel.cs b/WebDoorCreator.Data/DbModels/LanguageModel.cs
new file mode 100644
index 0000000..d6d3f9d
--- /dev/null
+++ b/WebDoorCreator.Data/DbModels/LanguageModel.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using static WebDoorCreator.Core.Enum;
+
+//
+// This is here so CodeMaid doesn't reorganize this document
+//
+namespace WebDoorCreator.Data.DbModels
+{
+ ///
+ /// Lingue conosciute per il programma
+ ///
+ [Table("Languages")]
+ public class LanguageModel
+ {
+ ///
+ /// codice lingua
+ ///
+ [Key, MaxLength(5)]
+ public string CodLingua { get; set; } = "";
+
+ ///
+ /// Descrizione della lingua (Lingua per esteso)
+ ///
+ [MaxLength(50)]
+ public string DescrizioneLingua { get; set; } = "";
+ }
+}
diff --git a/WebDoorCreator.Data/DbModels/ListValuesTempModel.cs b/WebDoorCreator.Data/DbModels/ListValuesTempModel.cs
new file mode 100644
index 0000000..80b9714
--- /dev/null
+++ b/WebDoorCreator.Data/DbModels/ListValuesTempModel.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WebDoorCreator.Data.DbModels
+{
+#nullable disable
+ //
+ // This is here so CodeMaid doesn't reorganize this document
+ //
+ [Table("ListValuesTemp")]
+ public partial class ListValuesTempModel
+ {
+ #region Public Properties
+
+ [MaxLength(50)]
+ public string TableName { get; set; }
+
+ [MaxLength(50)]
+ public string FieldName { get; set; }
+
+ [MaxLength(50)]
+ public string value { get; set; }
+
+ [MaxLength(50)]
+ public string label { get; set; }
+
+ public int ordinal { get; set; }
+
+ #endregion Public Properties
+ }
+}
diff --git a/WebDoorCreator.Data/DbModels/Opening.cs b/WebDoorCreator.Data/DbModels/Opening.cs
new file mode 100644
index 0000000..fddd4f9
--- /dev/null
+++ b/WebDoorCreator.Data/DbModels/Opening.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WebDoorCreator.Data.DbModels
+{
+ public class Opening
+ {
+ public string swing { get; set; } = "RH";
+ }
+}
diff --git a/WebDoorCreator.Data/DbModels/Sizing.cs b/WebDoorCreator.Data/DbModels/Sizing.cs
new file mode 100644
index 0000000..0068b75
--- /dev/null
+++ b/WebDoorCreator.Data/DbModels/Sizing.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WebDoorCreator.Data.DbModels
+{
+ public class Sizing
+ {
+ public string width { get; set; } = "33.8125";
+ public string height { get; set; } = "81.25";
+ public string thickness { get; set; } = "1.75";
+ }
+}
diff --git a/WebDoorCreator.Data/DbModels/VocabularyModel.cs b/WebDoorCreator.Data/DbModels/VocabularyModel.cs
new file mode 100644
index 0000000..140bf92
--- /dev/null
+++ b/WebDoorCreator.Data/DbModels/VocabularyModel.cs
@@ -0,0 +1,39 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using static WebDoorCreator.Core.Enum;
+
+//
+// This is here so CodeMaid doesn't reorganize this document
+//
+namespace WebDoorCreator.Data.DbModels
+{
+ ///
+ /// Vocabolario termini
+ ///
+ [Table("Vocabulary")]
+ public class VocabularyModel
+ {
+ ///
+ /// Lingua del lemma
+ ///
+ [MaxLength(5)]
+ public string Lingua { get; set; } = "";
+
+ ///
+ /// Lemma del termine
+ ///
+ [MaxLength(50)]
+ public string Lemma { get; set; } = "";
+
+ ///
+ /// Traduzione del lemma
+ ///
+ [MaxLength(500)]
+ public string Traduzione { get; set; } = "";
+ }
+}
diff --git a/WebDoorCreator.Data/DbModels/VocabularyTempModel.cs b/WebDoorCreator.Data/DbModels/VocabularyTempModel.cs
new file mode 100644
index 0000000..1ba7024
--- /dev/null
+++ b/WebDoorCreator.Data/DbModels/VocabularyTempModel.cs
@@ -0,0 +1,39 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using static WebDoorCreator.Core.Enum;
+
+//
+// This is here so CodeMaid doesn't reorganize this document
+//
+namespace WebDoorCreator.Data.DbModels
+{
+ ///
+ /// Vocabolario termini
+ ///
+ [Table("VocabularyTemp")]
+ public class VocabularyTempModel
+ {
+ ///
+ /// Lingua del lemma
+ ///
+ [MaxLength(5)]
+ public string Lingua { get; set; } = "";
+
+ ///
+ /// Lemma del termine
+ ///
+ [MaxLength(50)]
+ public string Lemma { get; set; } = "";
+
+ ///
+ /// Traduzione del lemma
+ ///
+ [MaxLength(500)]
+ public string Traduzione { get; set; } = "";
+ }
+}
diff --git a/WebDoorCreator.Data/DoorOpConfiguration.cs b/WebDoorCreator.Data/DoorOpConfiguration.cs
new file mode 100644
index 0000000..590fbbe
--- /dev/null
+++ b/WebDoorCreator.Data/DoorOpConfiguration.cs
@@ -0,0 +1,45 @@
+using Microsoft.AspNetCore.Identity;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Metadata.Builders;
+using WebDoorCreator.Data.DbModels;
+
+namespace WebDoorCreator.Data
+{
+ public class DoorOpConfiguration : IEntityTypeConfiguration
+ {
+
+
+ #region Public Methods
+
+ public void Configure(EntityTypeBuilder builder)
+ {
+
+ // Default seeded users
+
+ }
+
+ #endregion Public Methods
+
+ #region Protected Fields
+
+ #endregion Protected Fields
+
+ #region Protected Methods
+
+ //protected DoorOpModel getNewDoorOP(int DoorOpId, int DoorId, int DoorOpTypId, string Description, DateTime DateIns, string UserIdIns, DateTime DateMod, string UserIdMod, string JsoncConfigVal)
+ //{
+ // var newRec = new IdentityUser
+ // {
+ // UserName = email,
+ // NormalizedUserName = email.ToUpper(),
+ // Email = email,
+ // NormalizedEmail = email.ToUpper(),
+ // EmailConfirmed = true,
+ // PasswordHash = hasher.HashPassword(null!, passwd),
+ // };
+ // return newRec;
+ //}
+
+ #endregion Protected Methods
+ }
+}
\ No newline at end of file
diff --git a/WebDoorCreator.Data/LanguageConfiguration.cs b/WebDoorCreator.Data/LanguageConfiguration.cs
new file mode 100644
index 0000000..6cb29af
--- /dev/null
+++ b/WebDoorCreator.Data/LanguageConfiguration.cs
@@ -0,0 +1,38 @@
+using Microsoft.AspNetCore.Identity;
+using Microsoft.EntityFrameworkCore.Metadata.Builders;
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WebDoorCreator.Data.DbModels;
+using Org.BouncyCastle.Utilities.Collections;
+
+namespace WebDoorCreator.Data
+{
+ public class LanguageConfiguration : IEntityTypeConfiguration
+ {
+ #region Public Methods
+
+ public void Configure(EntityTypeBuilder builder)
+ {
+ builder.HasData(
+ getNewLang("EN", "English"),
+ getNewLang("IT", "Italiano")
+ );
+ }
+
+ #endregion Public Methods
+
+ protected LanguageModel getNewLang(string codeLang, string descLang)
+ {
+ var newRec = new LanguageModel
+ {
+ CodLingua = codeLang,
+ DescrizioneLingua = descLang
+ };
+ return newRec;
+ }
+ }
+}
diff --git a/WebDoorCreator.Data/Migrations/WDCData/20230322163704_DoorOpModelCreation.Designer.cs b/WebDoorCreator.Data/Migrations/WDCData/20230322163704_DoorOpModelCreation.Designer.cs
new file mode 100644
index 0000000..c8b72ff
--- /dev/null
+++ b/WebDoorCreator.Data/Migrations/WDCData/20230322163704_DoorOpModelCreation.Designer.cs
@@ -0,0 +1,635 @@
+//
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using WebDoorCreator.Data;
+
+#nullable disable
+
+namespace WebDoorCreator.Data.Migrations.WDCData
+{
+ [DbContext(typeof(WDCDataContext))]
+ [Migration("20230322163704_DoorOpModelCreation")]
+ partial class DoorOpModelCreation
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .UseCollation("Latin1_General_CI_AS")
+ .HasAnnotation("ProductVersion", "6.0.14")
+ .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+ SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
+
+ modelBuilder.Entity("WebDoorCreator.Data.DbModels.AspNetRoles", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("ConcurrencyStamp")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("NormalizedName")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.ToTable("AspNetRoles", null, t => t.ExcludeFromMigrations());
+ });
+
+ modelBuilder.Entity("WebDoorCreator.Data.DbModels.AspNetUserRoles", b =>
+ {
+ b.Property("UserId")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("RoleId")
+ .HasColumnType("nvarchar(450)");
+
+ b.HasKey("UserId", "RoleId");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("AspNetUserRoles", null, t => t.ExcludeFromMigrations());
+ });
+
+ modelBuilder.Entity("WebDoorCreator.Data.DbModels.AspNetUsers", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("AccessFailedCount")
+ .HasColumnType("int");
+
+ b.Property("ConcurrencyStamp")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Email")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("EmailConfirmed")
+ .HasColumnType("bit");
+
+ b.Property("LockoutEnabled")
+ .HasColumnType("bit");
+
+ b.Property("LockoutEnd")
+ .HasColumnType("datetimeoffset");
+
+ b.Property("NormalizedEmail")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("NormalizedUserName")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("PasswordHash")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("PhoneNumber")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("PhoneNumberConfirmed")
+ .HasColumnType("bit");
+
+ b.Property("SecurityStamp")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("TwoFactorEnabled")
+ .HasColumnType("bit");
+
+ b.Property("UserName")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.ToTable("AspNetUsers", null, t => t.ExcludeFromMigrations());
+ });
+
+ modelBuilder.Entity("WebDoorCreator.Data.DbModels.CompanyModel", b =>
+ {
+ b.Property("CompanyId")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("CompanyId"), 1L, 1);
+
+ b.Property("Address")
+ .IsRequired()
+ .HasMaxLength(250)
+ .HasColumnType("nvarchar(250)");
+
+ b.Property("City")
+ .IsRequired()
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("CompanyExtCode")
+ .IsRequired()
+ .HasMaxLength(250)
+ .HasColumnType("nvarchar(250)");
+
+ b.Property("CompanyName")
+ .IsRequired()
+ .HasMaxLength(500)
+ .HasColumnType("nvarchar(500)");
+
+ b.Property("CompanyToken")
+ .IsRequired()
+ .HasMaxLength(150)
+ .HasColumnType("nvarchar(150)");
+
+ b.Property("PrivateNote")
+ .IsRequired()
+ .HasMaxLength(500)
+ .HasColumnType("nvarchar(500)");
+
+ b.Property("State")
+ .IsRequired()
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("VAT")
+ .IsRequired()
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("ZipCode")
+ .HasColumnType("int");
+
+ b.HasKey("CompanyId");
+
+ b.ToTable("Company");
+ });
+
+ modelBuilder.Entity("WebDoorCreator.Data.DbModels.DoorModel", b =>
+ {
+ b.Property("DoorId")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("DoorId"), 1L, 1);
+
+ b.Property("DateIns")
+ .HasColumnType("datetime2");
+
+ b.Property("DateMod")
+ .HasColumnType("datetime2");
+
+ b.Property("DoorDescript")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("DoorExtCode")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("OrderId")
+ .HasColumnType("int");
+
+ b.Property("Quantity")
+ .HasColumnType("int");
+
+ b.Property("TypeId")
+ .HasColumnType("int");
+
+ b.Property("UnitCost")
+ .HasColumnType("decimal(18,2)");
+
+ b.Property("UserIdIns")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("UserIdMod")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("DoorId");
+
+ b.HasIndex("OrderId");
+
+ b.HasIndex("TypeId");
+
+ b.ToTable("Door");
+ });
+
+ modelBuilder.Entity("WebDoorCreator.Data.DbModels.DoorOpModel", b =>
+ {
+ b.Property("DoorOpId")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("DoorOpId"), 1L, 1);
+
+ b.Property("DateIns")
+ .HasColumnType("datetime2");
+
+ b.Property("DateMod")
+ .HasColumnType("datetime2");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("DoorId")
+ .HasColumnType("int");
+
+ b.Property("DoorOpTypId")
+ .HasColumnType("int");
+
+ b.Property("JsoncConfigVal")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("UserIdIns")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("UserIdMod")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("DoorOpId");
+
+ b.HasIndex("DoorId");
+
+ b.HasIndex("DoorOpTypId");
+
+ b.ToTable("DoorOp");
+ });
+
+ modelBuilder.Entity("WebDoorCreator.Data.DbModels.DoorOpTypeModel", b =>
+ {
+ b.Property("DoorOpTypId")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("DoorOpTypId"), 1L, 1);
+
+ b.Property("Description")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ExtDescript")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ExtOpCode")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("FPath")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("HasHw")
+ .HasColumnType("bit");
+
+ b.Property("HwCode")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("HwDescription")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("IsConcrete")
+ .HasColumnType("bit");
+
+ b.Property("JsoncConfig")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("OpCode")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ParentDoorOpId")
+ .HasColumnType("int");
+
+ b.Property("Rev")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("TreeCode")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ValidFrom")
+ .HasColumnType("datetime2");
+
+ b.Property("ValidUntil")
+ .HasColumnType("datetime2");
+
+ b.HasKey("DoorOpTypId");
+
+ b.ToTable("DoorOpType");
+ });
+
+ modelBuilder.Entity("WebDoorCreator.Data.DbModels.DoorTypeModel", b =>
+ {
+ b.Property("TypeId")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("TypeId"), 1L, 1);
+
+ b.Property("Description")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("TypeCode")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("TypeId");
+
+ b.ToTable("DoorType");
+ });
+
+ modelBuilder.Entity("WebDoorCreator.Data.DbModels.ListValuesModel", b =>
+ {
+ b.Property("TableName")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("FieldName")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("value")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("label")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("ordinal")
+ .HasColumnType("int");
+
+ b.HasKey("TableName", "FieldName", "value");
+
+ b.ToTable("ListValues");
+
+ b.HasData(
+ new
+ {
+ TableName = "Opening",
+ FieldName = "Swing",
+ value = "LH",
+ label = "Left Handed",
+ ordinal = 1
+ },
+ new
+ {
+ TableName = "Opening",
+ FieldName = "Swing",
+ value = "RH",
+ label = "Right Handed",
+ ordinal = 2
+ },
+ new
+ {
+ TableName = "Opening",
+ FieldName = "Swing",
+ value = "LHR",
+ label = "Left Handed Reverse",
+ ordinal = 3
+ },
+ new
+ {
+ TableName = "Opening",
+ FieldName = "Swing",
+ value = "RHR",
+ label = "Right Handed Reverse",
+ ordinal = 4
+ },
+ new
+ {
+ TableName = "Edges",
+ FieldName = "EdgeType",
+ value = "BV",
+ label = "Bevel",
+ ordinal = 1
+ },
+ new
+ {
+ TableName = "Edges",
+ FieldName = "EdgeType",
+ value = "SQ",
+ label = "Squared",
+ ordinal = 2
+ },
+ new
+ {
+ TableName = "Edges",
+ FieldName = "EdgeType",
+ value = "1B",
+ label = "Bull Nose 1",
+ ordinal = 3
+ });
+ });
+
+ modelBuilder.Entity("WebDoorCreator.Data.DbModels.OrderModel", b =>
+ {
+ b.Property("OrderId")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("OrderId"), 1L, 1);
+
+ b.Property("CompanyId")
+ .HasColumnType("int");
+
+ b.Property("DateIns")
+ .HasColumnType("datetime2");
+
+ b.Property("DateMod")
+ .HasColumnType("datetime2");
+
+ b.Property("OrderDescript")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("OrderExtCode")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Status")
+ .HasColumnType("int");
+
+ b.Property("UserIdIns")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("UserIdMod")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("OrderId");
+
+ b.HasIndex("CompanyId");
+
+ b.ToTable("Order");
+ });
+
+ modelBuilder.Entity("WebDoorCreator.Data.DbModels.OrderStatusViewModel", b =>
+ {
+ b.Property("OrderId")
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("OrderId"), 1L, 1);
+
+ b.Property("CompanyId")
+ .HasColumnType("int");
+
+ b.Property("DateIns")
+ .HasColumnType("datetime2");
+
+ b.Property("NumDoors")
+ .HasColumnType("int");
+
+ b.Property("NumType")
+ .HasColumnType("int");
+
+ b.Property("OrderDescript")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("OrderExtCode")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("OrderStatus")
+ .HasColumnType("int");
+
+ b.Property("TotCost")
+ .HasColumnType("decimal(18,2)");
+
+ b.Property("UserIdIns")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("UserIdMod")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("OrderId");
+
+ b.ToView("OrderStatusViewModel");
+ });
+
+ modelBuilder.Entity("WebDoorCreator.Data.DbModels.UsersViewModel", b =>
+ {
+ b.Property("UserId")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("RoleId")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("Email")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("RoleName")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("UserName")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("UserId", "RoleId");
+
+ b.ToView("UsersViewModel");
+ });
+
+ modelBuilder.Entity("WebDoorCreator.Data.DbModels.AspNetUserRoles", b =>
+ {
+ b.HasOne("WebDoorCreator.Data.DbModels.AspNetRoles", "RolesNav")
+ .WithMany()
+ .HasForeignKey("RoleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("WebDoorCreator.Data.DbModels.AspNetUsers", "UsersNav")
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("RolesNav");
+
+ b.Navigation("UsersNav");
+ });
+
+ modelBuilder.Entity("WebDoorCreator.Data.DbModels.DoorModel", b =>
+ {
+ b.HasOne("WebDoorCreator.Data.DbModels.OrderModel", "OrderNav")
+ .WithMany()
+ .HasForeignKey("OrderId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("WebDoorCreator.Data.DbModels.DoorTypeModel", "TypeNav")
+ .WithMany()
+ .HasForeignKey("TypeId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("OrderNav");
+
+ b.Navigation("TypeNav");
+ });
+
+ modelBuilder.Entity("WebDoorCreator.Data.DbModels.DoorOpModel", b =>
+ {
+ b.HasOne("WebDoorCreator.Data.DbModels.DoorModel", "DoorNav")
+ .WithMany()
+ .HasForeignKey("DoorId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("WebDoorCreator.Data.DbModels.DoorOpTypeModel", "DoorOpTypeNav")
+ .WithMany()
+ .HasForeignKey("DoorOpTypId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("DoorNav");
+
+ b.Navigation("DoorOpTypeNav");
+ });
+
+ modelBuilder.Entity("WebDoorCreator.Data.DbModels.OrderModel", b =>
+ {
+ b.HasOne("WebDoorCreator.Data.DbModels.CompanyModel", "CompanyNav")
+ .WithMany()
+ .HasForeignKey("CompanyId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("CompanyNav");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/WebDoorCreator.Data/Migrations/WDCData/20230322163704_DoorOpModelCreation.cs b/WebDoorCreator.Data/Migrations/WDCData/20230322163704_DoorOpModelCreation.cs
new file mode 100644
index 0000000..6c7e23d
--- /dev/null
+++ b/WebDoorCreator.Data/Migrations/WDCData/20230322163704_DoorOpModelCreation.cs
@@ -0,0 +1,91 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace WebDoorCreator.Data.Migrations.WDCData
+{
+ public partial class DoorOpModelCreation : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable(
+ name: "DoorOpType",
+ columns: table => new
+ {
+ DoorOpTypId = table.Column(type: "int", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ OpCode = table.Column(type: "nvarchar(max)", nullable: false),
+ Description = table.Column(type: "nvarchar(max)", nullable: false),
+ HasHw = table.Column(type: "bit", nullable: false),
+ IsConcrete = table.Column(type: "bit", nullable: false),
+ HwCode = table.Column(type: "nvarchar(max)", nullable: false),
+ HwDescription = table.Column(type: "nvarchar(max)", nullable: false),
+ FPath = table.Column(type: "nvarchar(max)", nullable: false),
+ ParentDoorOpId = table.Column(type: "int", nullable: false),
+ TreeCode = table.Column(type: "nvarchar(max)", nullable: false),
+ JsoncConfig = table.Column(type: "nvarchar(max)", nullable: false),
+ ExtOpCode = table.Column(type: "nvarchar(max)", nullable: false),
+ ExtDescript = table.Column(type: "nvarchar(max)", nullable: false),
+ Rev = table.Column(type: "nvarchar(max)", nullable: false),
+ ValidFrom = table.Column(type: "datetime2", nullable: false),
+ ValidUntil = table.Column(type: "datetime2", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_DoorOpType", x => x.DoorOpTypId);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "DoorOp",
+ columns: table => new
+ {
+ DoorOpId = table.Column(type: "int", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ DoorId = table.Column(type: "int", nullable: false),
+ DoorOpTypId = table.Column(type: "int", nullable: false),
+ Description = table.Column(type: "nvarchar(max)", nullable: false),
+ DateIns = table.Column(type: "datetime2", nullable: false),
+ UserIdIns = table.Column(type: "nvarchar(max)", nullable: false),
+ DateMod = table.Column(type: "datetime2", nullable: false),
+ UserIdMod = table.Column(type: "nvarchar(max)", nullable: false),
+ JsoncConfigVal = table.Column(type: "nvarchar(max)", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_DoorOp", x => x.DoorOpId);
+ table.ForeignKey(
+ name: "FK_DoorOp_Door_DoorId",
+ column: x => x.DoorId,
+ principalTable: "Door",
+ principalColumn: "DoorId",
+ onDelete: ReferentialAction.Cascade);
+ table.ForeignKey(
+ name: "FK_DoorOp_DoorOpType_DoorOpTypId",
+ column: x => x.DoorOpTypId,
+ principalTable: "DoorOpType",
+ principalColumn: "DoorOpTypId",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateIndex(
+ name: "IX_DoorOp_DoorId",
+ table: "DoorOp",
+ column: "DoorId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_DoorOp_DoorOpTypId",
+ table: "DoorOp",
+ column: "DoorOpTypId");
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "DoorOp");
+
+ migrationBuilder.DropTable(
+ name: "DoorOpType");
+ }
+ }
+}
diff --git a/WebDoorCreator.Data/Migrations/WDCData/20230323075059_DoorOpMigr.Designer.cs b/WebDoorCreator.Data/Migrations/WDCData/20230323075059_DoorOpMigr.Designer.cs
new file mode 100644
index 0000000..07df1ad
--- /dev/null
+++ b/WebDoorCreator.Data/Migrations/WDCData/20230323075059_DoorOpMigr.Designer.cs
@@ -0,0 +1,649 @@
+//
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using WebDoorCreator.Data;
+
+#nullable disable
+
+namespace WebDoorCreator.Data.Migrations.WDCData
+{
+ [DbContext(typeof(WDCDataContext))]
+ [Migration("20230323075059_DoorOpMigr")]
+ partial class DoorOpMigr
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .UseCollation("Latin1_General_CI_AS")
+ .HasAnnotation("ProductVersion", "6.0.14")
+ .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+ SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
+
+ modelBuilder.Entity("WebDoorCreator.Data.DbModels.AspNetRoles", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("ConcurrencyStamp")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("NormalizedName")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.ToTable("AspNetRoles", null, t => t.ExcludeFromMigrations());
+ });
+
+ modelBuilder.Entity("WebDoorCreator.Data.DbModels.AspNetUserRoles", b =>
+ {
+ b.Property("UserId")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("RoleId")
+ .HasColumnType("nvarchar(450)");
+
+ b.HasKey("UserId", "RoleId");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("AspNetUserRoles", null, t => t.ExcludeFromMigrations());
+ });
+
+ modelBuilder.Entity("WebDoorCreator.Data.DbModels.AspNetUsers", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("AccessFailedCount")
+ .HasColumnType("int");
+
+ b.Property("ConcurrencyStamp")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Email")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("EmailConfirmed")
+ .HasColumnType("bit");
+
+ b.Property("LockoutEnabled")
+ .HasColumnType("bit");
+
+ b.Property("LockoutEnd")
+ .HasColumnType("datetimeoffset");
+
+ b.Property("NormalizedEmail")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("NormalizedUserName")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("PasswordHash")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("PhoneNumber")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("PhoneNumberConfirmed")
+ .HasColumnType("bit");
+
+ b.Property("SecurityStamp")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("TwoFactorEnabled")
+ .HasColumnType("bit");
+
+ b.Property("UserName")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.ToTable("AspNetUsers", null, t => t.ExcludeFromMigrations());
+ });
+
+ modelBuilder.Entity("WebDoorCreator.Data.DbModels.CompanyModel", b =>
+ {
+ b.Property("CompanyId")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("CompanyId"), 1L, 1);
+
+ b.Property("Address")
+ .IsRequired()
+ .HasMaxLength(250)
+ .HasColumnType("nvarchar(250)");
+
+ b.Property("City")
+ .IsRequired()
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("CompanyExtCode")
+ .IsRequired()
+ .HasMaxLength(250)
+ .HasColumnType("nvarchar(250)");
+
+ b.Property("CompanyName")
+ .IsRequired()
+ .HasMaxLength(500)
+ .HasColumnType("nvarchar(500)");
+
+ b.Property("CompanyToken")
+ .IsRequired()
+ .HasMaxLength(150)
+ .HasColumnType("nvarchar(150)");
+
+ b.Property("PrivateNote")
+ .IsRequired()
+ .HasMaxLength(500)
+ .HasColumnType("nvarchar(500)");
+
+ b.Property("State")
+ .IsRequired()
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("VAT")
+ .IsRequired()
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("ZipCode")
+ .HasColumnType("int");
+
+ b.HasKey("CompanyId");
+
+ b.ToTable("Company");
+ });
+
+ modelBuilder.Entity("WebDoorCreator.Data.DbModels.DoorModel", b =>
+ {
+ b.Property("DoorId")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("DoorId"), 1L, 1);
+
+ b.Property("DateIns")
+ .HasColumnType("datetime2");
+
+ b.Property("DateMod")
+ .HasColumnType("datetime2");
+
+ b.Property("DoorDescript")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("DoorExtCode")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("OrderId")
+ .HasColumnType("int");
+
+ b.Property("Quantity")
+ .HasColumnType("int");
+
+ b.Property("TypeId")
+ .HasColumnType("int");
+
+ b.Property("UnitCost")
+ .HasColumnType("decimal(18,2)");
+
+ b.Property("UserIdIns")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("UserIdMod")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("DoorId");
+
+ b.HasIndex("OrderId");
+
+ b.HasIndex("TypeId");
+
+ b.ToTable("Door");
+ });
+
+ modelBuilder.Entity("WebDoorCreator.Data.DbModels.DoorOpModel", b =>
+ {
+ b.Property("DoorOpId")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("DoorOpId"), 1L, 1);
+
+ b.Property("DateIns")
+ .HasColumnType("datetime2");
+
+ b.Property("DateMod")
+ .HasColumnType("datetime2");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("DoorId")
+ .HasColumnType("int");
+
+ b.Property("DoorOpTypId")
+ .HasColumnType("int");
+
+ b.Property("JsoncConfigVal")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("UserIdIns")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("UserIdMod")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("DoorOpId");
+
+ b.HasIndex("DoorId");
+
+ b.HasIndex("DoorOpTypId");
+
+ b.ToTable("DoorOp");
+ });
+
+ modelBuilder.Entity("WebDoorCreator.Data.DbModels.DoorOpTypeModel", b =>
+ {
+ b.Property("DoorOpTypId")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("DoorOpTypId"), 1L, 1);
+
+ b.Property("Description")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ExtDescript")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ExtOpCode")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("FPath")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("HasHw")
+ .HasColumnType("bit");
+
+ b.Property("HwCode")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("HwDescription")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property