aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.BL/Entities/ProcessParametersTable.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/Tango.BL/Entities/ProcessParametersTable.cs')
-rw-r--r--Software/Visual_Studio/Tango.BL/Entities/ProcessParametersTable.cs58
1 files changed, 58 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Tango.BL/Entities/ProcessParametersTable.cs b/Software/Visual_Studio/Tango.BL/Entities/ProcessParametersTable.cs
index 83a079700..3506510d0 100644
--- a/Software/Visual_Studio/Tango.BL/Entities/ProcessParametersTable.cs
+++ b/Software/Visual_Studio/Tango.BL/Entities/ProcessParametersTable.cs
@@ -107,6 +107,8 @@ namespace Tango.BL.Entities
public String Group { get; set; }
public int Index { get; set; }
public String StringFormat { get; set; }
+ public String Module { get; set; }
+ public int ModuleIndex { get; set; }
public ProcessParameterCsvModel()
{
@@ -124,6 +126,8 @@ namespace Tango.BL.Entities
public String Group { get; set; }
public int Index { get; set; }
public String StringFormat { get; set; }
+ public String Module { get; set; }
+ public int ModuleIndex { get; set; }
public bool HasDiff
{
@@ -181,6 +185,56 @@ namespace Tango.BL.Entities
}
}
+ public class ProcessParameterModule
+ {
+ public String Name { get; set; }
+ public int Index { get; set; }
+
+ public List<ProcessParameterGroup> Parameters { get; set; }
+
+ public ProcessParameterModule()
+ {
+ Parameters = new List<ProcessParameterGroup>();
+ }
+ }
+
+ [NotMapped]
+ [XmlIgnore]
+ [BsonIgnore]
+ [JsonIgnore]
+ [ParameterIgnore]
+ public List<ProcessParameterModule> ParametersModules
+ {
+ get
+ {
+ var source = VisualParameters ?? new List<ProcessParameter>();
+
+ var modules =
+ source
+ .GroupBy(p => new { Module = p.Module, ModuleIndex = p.ModuleIndex })
+ .OrderBy(g => g.Key.ModuleIndex)
+ .Select(moduleGroup => new ProcessParameterModule
+ {
+ Name = moduleGroup.Key.Module,
+ Index = moduleGroup.Key.ModuleIndex,
+ Parameters = moduleGroup
+ .GroupBy(p => p.Group) // group name may repeat across modules (that's fine)
+ //.OrderBy(g => g.Key) // optional: stable ordering of groups by name
+ .Select(group => new ProcessParameterGroup
+ {
+ Name = group.Key,
+ Parameters = group
+ .OrderBy(p => p.Index)
+ .ToList()
+ })
+ .ToList()
+ })
+ .ToList();
+
+ return modules;
+ }
+ }
+
public class ProcessParameterGroup
{
public String Name { get; set; }
@@ -247,6 +301,8 @@ namespace Tango.BL.Entities
csvModel.Group = row.Read("Group", "N/A");
csvModel.Index = row.Read("Index", 0);
csvModel.StringFormat = row.Read("StringFormat", "0.0");
+ csvModel.Module = row.Read("Module", "N/A");
+ csvModel.ModuleIndex = row.Read("ModuleIndex", 0);
String machineType = row.Read("MachineType", "ALL");
@@ -290,6 +346,8 @@ namespace Tango.BL.Entities
parameter.Group = csvModel.Group;
parameter.Index = csvModel.Index;
parameter.StringFormat = csvModel.StringFormat;
+ parameter.Module = csvModel.Module;
+ parameter.ModuleIndex = csvModel.ModuleIndex;
_visualParameters.Add(parameter);
}