From bf432bf7b7faa7c51e74462e19eb3e50c28b4aa8 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 22 Jan 2020 18:00:55 +0200 Subject: Implemented StringFormat control for db properties. Added StringFormat 0.000 for FeederTension on ProcessParameters. --- .../DbPropertyExtensionModel.cs | 36 ++++++++++++++++++++++ .../Tango.CodeGeneration/EntityCodeFile.cs | 2 +- .../Tango.CodeGeneration/RangeDescriptionModel.cs | 15 --------- .../Tango.CodeGeneration.csproj | 4 +-- .../Templates/EntityCodeFile.cshtml | 25 ++++++++++++--- 5 files changed, 59 insertions(+), 23 deletions(-) create mode 100644 Software/Visual_Studio/Tango.CodeGeneration/DbPropertyExtensionModel.cs delete mode 100644 Software/Visual_Studio/Tango.CodeGeneration/RangeDescriptionModel.cs (limited to 'Software/Visual_Studio/Tango.CodeGeneration') diff --git a/Software/Visual_Studio/Tango.CodeGeneration/DbPropertyExtensionModel.cs b/Software/Visual_Studio/Tango.CodeGeneration/DbPropertyExtensionModel.cs new file mode 100644 index 000000000..873aabe1e --- /dev/null +++ b/Software/Visual_Studio/Tango.CodeGeneration/DbPropertyExtensionModel.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.CodeGeneration +{ + public class DbPropertyExtensionModel + { + public String Description { get; set; } + public double Min { get; set; } + public double Max { get; set; } + public String StringFormat { get; set; } + + public bool HasDescription + { + get { return Description != null; } + } + + public bool HasRange + { + get { return Min != Max; } + } + + public bool HasStringFormat + { + get { return StringFormat != null; } + } + + public DbPropertyExtensionModel() + { + StringFormat = "0.0"; + } + } +} diff --git a/Software/Visual_Studio/Tango.CodeGeneration/EntityCodeFile.cs b/Software/Visual_Studio/Tango.CodeGeneration/EntityCodeFile.cs index 24d61bb0a..8126c8bc4 100644 --- a/Software/Visual_Studio/Tango.CodeGeneration/EntityCodeFile.cs +++ b/Software/Visual_Studio/Tango.CodeGeneration/EntityCodeFile.cs @@ -66,7 +66,7 @@ namespace Tango.CodeGeneration public String DbDescription { get; set; } - public RangeDescriptionModel RangeDescription { get; set; } + public DbPropertyExtensionModel PropertyExtension { get; set; } public bool IsForeignKey { get; set; } diff --git a/Software/Visual_Studio/Tango.CodeGeneration/RangeDescriptionModel.cs b/Software/Visual_Studio/Tango.CodeGeneration/RangeDescriptionModel.cs deleted file mode 100644 index 4600460b7..000000000 --- a/Software/Visual_Studio/Tango.CodeGeneration/RangeDescriptionModel.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tango.CodeGeneration -{ - public class RangeDescriptionModel - { - public String Description { get; set; } - public double Min { get; set; } - public double Max { get; set; } - } -} diff --git a/Software/Visual_Studio/Tango.CodeGeneration/Tango.CodeGeneration.csproj b/Software/Visual_Studio/Tango.CodeGeneration/Tango.CodeGeneration.csproj index 6bff5b42e..4c2793367 100644 --- a/Software/Visual_Studio/Tango.CodeGeneration/Tango.CodeGeneration.csproj +++ b/Software/Visual_Studio/Tango.CodeGeneration/Tango.CodeGeneration.csproj @@ -77,7 +77,7 @@ - + @@ -129,7 +129,7 @@ - +