diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html
index 365dbb6..1936175 100644
--- a/Resources/ChangeLog.html
+++ b/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
WebDoorCreator - Egalware
- Version: 0.9.2306.0609
+ Version: 0.9.2306.0611
Release note:
-
diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt
index 361e0cc..b4efa0e 100644
--- a/Resources/VersNum.txt
+++ b/Resources/VersNum.txt
@@ -1 +1 @@
-0.9.2306.0609
+0.9.2306.0611
diff --git a/Resources/manifest.xml b/Resources/manifest.xml
index b9918cd..1fa6e91 100644
--- a/Resources/manifest.xml
+++ b/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 0.9.2306.0609
+ 0.9.2306.0611
http://nexus.steamware.net/repository/SWS/WDC/stable/WDC.UI.zip
http://nexus.steamware.net/repository/SWS/WDC/stable/ChangeLog.html
false
diff --git a/WebDoorCreator.Data/Controllers/WebDoorCreatorController.cs b/WebDoorCreator.Data/Controllers/WebDoorCreatorController.cs
index c20c453..5286565 100644
--- a/WebDoorCreator.Data/Controllers/WebDoorCreatorController.cs
+++ b/WebDoorCreator.Data/Controllers/WebDoorCreatorController.cs
@@ -525,14 +525,14 @@ namespace WebDoorCreator.Data.Controllers
/// Retrieving data from door operation type table filtered by Hw Code
///
///
- public List DoorOpTypeGetByHwCode(string hwCode)
+ public List DoorOpTypeGetFiltered(string hwCode, int parentId)
{
List dbResult = new List();
using (WDCDataContext localDbCtx = new WDCDataContext(_configuration))
{
try
{
- if (hwCode == "*")
+ if (hwCode == "*" && parentId == -1)
{
// extracting entire set
dbResult = localDbCtx
@@ -540,7 +540,7 @@ namespace WebDoorCreator.Data.Controllers
.OrderBy(x => x.DoorOpTypId)
.ToList();
}
- else
+ else if(hwCode != "*" && parentId == -1)
{
dbResult = localDbCtx
.DbSetDoorOpType
@@ -548,6 +548,22 @@ namespace WebDoorCreator.Data.Controllers
.OrderBy(x => x.DoorOpTypId)
.ToList();
}
+ else if(hwCode == "*" && parentId >= 0)
+ {
+ dbResult = localDbCtx
+ .DbSetDoorOpType
+ .Where(x => x.ParentId == parentId)
+ .OrderBy(x => x.DoorOpTypId)
+ .ToList();
+ }
+ else if(hwCode != "*" && parentId >= 0)
+ {
+ dbResult = localDbCtx
+ .DbSetDoorOpType
+ .Where(x => (x.ParentId == parentId) && x.HwCode == hwCode)
+ .OrderBy(x => x.DoorOpTypId)
+ .ToList();
+ }
}
catch (Exception exc)
{
diff --git a/WebDoorCreator.Data/Services/WebDoorCreatorService.cs b/WebDoorCreator.Data/Services/WebDoorCreatorService.cs
index 183576d..634043c 100644
--- a/WebDoorCreator.Data/Services/WebDoorCreatorService.cs
+++ b/WebDoorCreator.Data/Services/WebDoorCreatorService.cs
@@ -1793,7 +1793,7 @@ namespace WebDoorCreator.Data.Services
///
/// Door Operation Types
///
- public async Task
?> DoorOpTypeGetByHwCode(string hwCode)
+ public async Task?> DoorOpTypeGetByHwCode(string hwCode, int parentId)
{
string source = "DB";
@@ -1808,7 +1808,23 @@ namespace WebDoorCreator.Data.Services
{
currKey = $"{Constants.rKeyDoorOpType}:{hwCode}";
}
-
+ if (hwCode == "*" && parentId == -1)
+ {
+ // extracting entire set
+ currKey = $"{Constants.rKeyDoorOpType}";
+ }
+ else if (hwCode != "*" && parentId == -1)
+ {
+ currKey = $"{Constants.rKeyDoorOpType}:{hwCode}";
+ }
+ else if (hwCode == "*" && parentId >= 0)
+ {
+ currKey = $"{Constants.rKeyDoorOpType}:{parentId}";
+ }
+ else if (hwCode != "*" && parentId >= 0)
+ {
+ currKey = $"{Constants.rKeyDoorOpType}:{hwCode}:{parentId}";
+ }
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string? rawData = await redisDb.StringGetAsync(currKey);
@@ -1824,10 +1840,11 @@ namespace WebDoorCreator.Data.Services
{
dbResult = tempResult;
}
+
}
else
{
- dbResult = dbController.DoorOpTypeGetByHwCode(hwCode);
+ dbResult = dbController.DoorOpTypeGetFiltered(hwCode, parentId);
rawData = JsonConvert.SerializeObject(dbResult, JSSettings);
await redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
}
@@ -1845,9 +1862,45 @@ namespace WebDoorCreator.Data.Services
{
List values = new List();
List doorOpTypesList = new List();
+ List HwsList = new List();
string[] dirs = Directory.GetDirectories(rootPath);
+ bool hwAdded = false;
+ //ciclo nelle directrory per beccare tutti gli hw e le relatice path del file di origine
foreach (string dir in dirs)
{
+ string compoCode = "";
+ string[] templateDirectories = Directory.GetDirectories(dir);
+
+ string[] iniFiles = Directory.GetFiles(dir, "Config.ini");
+ DoorOpTypeModel tempHwType = new DoorOpTypeModel()
+ {
+ ParentId = 0,
+ Description = $"Hardware Type {compoCode.Replace(" ", "_")}",
+ OpCode = @$"{dir}",
+ HasHw = true,
+ IsConcrete = true,
+ HwCode = $"{compoCode}".Replace(" ", "_")
+ };
+ doorOpTypesList.Add(tempHwType);
+ }
+ //scrivo su db hws
+ hwAdded = await dbController.DoorOpTypeAddRange(doorOpTypesList);
+
+ if (hwAdded)
+ {
+ //estraggo lista di hardware in dooroptype
+ var temp = dbController.DoorOpTypeGetFiltered("*", 0);
+ if (temp != null)
+ {
+ HwsList = temp;
+ doorOpTypesList.Clear();
+ }
+ }
+
+ //ciclo nelle directories usando la colonna opcode
+ foreach (var item in HwsList)
+ {
+ string dir = item.OpCode;
string compoCode = "";
string compoTempOrShape = "";
string[] templateDirectories = Directory.GetDirectories(dir);
@@ -1870,15 +1923,7 @@ namespace WebDoorCreator.Data.Services
compoCode = compoName.Split("/")[0].Trim();
compoTempOrShape = compoT.Split("/")[0].Trim();
}
- DoorOpTypeModel tempHwType = new DoorOpTypeModel()
- {
- Description = $"Hardware Type {compoCode.Replace(" ", "_")}",
- OpCode = @$"{dir}",
- HasHw = true,
- IsConcrete = true,
- HwCode = $"{compoCode}".Replace(" ", "_")
- };
- doorOpTypesList.Add(tempHwType);
+
string[] templateFiles = Directory.GetFiles(templateDirectory);
if (templateFiles.Length > 0)
{
@@ -1938,6 +1983,7 @@ namespace WebDoorCreator.Data.Services
DoorOpTypeModel tempType = new DoorOpTypeModel()
{
+ ParentId = item.DoorOpTypId,
Description = $"Template for {compoCode.Replace(" ", "_")}",
OpCode = @$"{dir}\{tName[tName.Length - 1]}\{Path.GetFileName(templateFile)}",
HasHw = true,
diff --git a/WebDoorCreator.UI/Components/Hardware/HwMan.razor.cs b/WebDoorCreator.UI/Components/Hardware/HwMan.razor.cs
index d5856ac..289bde5 100644
--- a/WebDoorCreator.UI/Components/Hardware/HwMan.razor.cs
+++ b/WebDoorCreator.UI/Components/Hardware/HwMan.razor.cs
@@ -52,11 +52,11 @@ namespace WebDoorCreator.UI.Components.Hardware
protected async Task ReloadData()
{
- var temp = await WDCService.DoorOpTypeGetByHwCode("*");
- if(temp != null)
- {
- //doorOpTypes = temp.Where(x=>x.);
- }
+ //var temp = await WDCService.DoorOpTypeGetByHwCode("*");
+ //if(temp != null)
+ //{
+ // //doorOpTypes = temp.Where(x=>x.);
+ //}
}
}
}
\ No newline at end of file
diff --git a/WebDoorCreator.UI/WebDoorCreator.UI.csproj b/WebDoorCreator.UI/WebDoorCreator.UI.csproj
index b1869c7..12ae41e 100644
--- a/WebDoorCreator.UI/WebDoorCreator.UI.csproj
+++ b/WebDoorCreator.UI/WebDoorCreator.UI.csproj
@@ -3,7 +3,7 @@
net6.0
enable
- 0.9.2306.0609
+ 0.9.2306.0611
enable
aspnet-WebDoorCreator.UI-dfe95fed-1398-4144-bd43-8b3a765d6608