From 981aa1aa04eebd3aba8380e686875024f2a5aaf6 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 10 Nov 2019 15:45:17 +0200 Subject: Added Color Conversion v3. Machine Studio v4.0.32 PPC v1.0.50 --- .../MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml index 50f6a6297..e34854046 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml @@ -191,7 +191,7 @@ - + -- cgit v1.3.1 From 856d12b6cc813697451fa200fb437c84ff2640c7 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 14 Nov 2019 17:00:20 +0200 Subject: Refactored IsLiquidVolumesOutOfRange to use process parameters. --- Software/DB/PPC/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/PPC/Tango_log.ldf | Bin 53673984 -> 53673984 bytes Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 22675456 -> 22675456 bytes .../ViewModels/MainViewVM.cs | 2 +- .../Views/JobView.xaml | 152 +++++++++++---------- .../ViewModels/ColorConversionViewVM.cs | 15 +- .../UWF/AlternativeUnifiedWriteFilterManager.cs | 13 +- .../PPC/Tango.PPC.UI/Resources/Colors.xaml | 2 + .../Visual_Studio/Tango.BL/Entities/BrushStop.cs | 19 ++- 10 files changed, 119 insertions(+), 84 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML') diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf index d5304a381..b7604d584 100644 Binary files a/Software/DB/PPC/Tango.mdf and b/Software/DB/PPC/Tango.mdf differ diff --git a/Software/DB/PPC/Tango_log.ldf b/Software/DB/PPC/Tango_log.ldf index c5bc583ac..ecab6b86c 100644 Binary files a/Software/DB/PPC/Tango_log.ldf and b/Software/DB/PPC/Tango_log.ldf differ diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 849baff99..34ed04aa3 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index 4c1df436f..38dc8f93b 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index fd20a0b1c..63cfa10b8 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs @@ -873,7 +873,7 @@ namespace Tango.MachineStudio.Developer.ViewModels foreach (var stop in stops) { - if (stop.ColorSpace.Code == BL.Enumerations.ColorSpaces.Volume.ToInt32() && !stop.IsLiquidVolumesOutOfRange) + if (stop.ColorSpace.Code == BL.Enumerations.ColorSpaces.Volume.ToInt32()) { try { diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml index e1bbad6a7..3e6ffd396 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml @@ -241,91 +241,93 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Liquid volumes exceeds the maximum range for color conversion! + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + - + Total: % ( nl ) - + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + Liquid volumes exceeds the maximum range for color conversion! + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorConversionViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorConversionViewVM.cs index b68239b4b..f583fa15e 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorConversionViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorConversionViewVM.cs @@ -309,6 +309,19 @@ namespace Tango.MachineStudio.RML.ViewModels } } + private double GetTotalMaximumLiquidVolumeLimit() + { + try + { + var tables = RML.GetActiveProcessGroup().ProcessParametersTables.OrderBy(x => x.TableIndex).ToList(); + return (tables[1].MaxInkUptake / tables[0].MaxInkUptake) * 100; + } + catch + { + return BrushStop.MAX_TOTAL_LIQUID_VOLUME; + } + } + private void OnLiquidVolumeChanged() { try @@ -316,7 +329,7 @@ namespace Tango.MachineStudio.RML.ViewModels if (LiquidsCalibrationData == null || _prevent_inverse_conversion) return; //TODO: This is temporary because of out of range volumes. - if (LiquidVolumes.Where(x => x.LiquidType.HasPigment).Sum(x => x.Volume) > 200) + if (LiquidVolumes.Where(x => x.LiquidType.HasPigment).Sum(x => x.Volume) > GetTotalMaximumLiquidVolumeLimit()) { IsVolumesOutOfRange = true; return; diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/UWF/AlternativeUnifiedWriteFilterManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/UWF/AlternativeUnifiedWriteFilterManager.cs index 5fb74b2fe..828bccf83 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/UWF/AlternativeUnifiedWriteFilterManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/UWF/AlternativeUnifiedWriteFilterManager.cs @@ -47,14 +47,15 @@ namespace Tango.PPC.Common.UWF command.OutputEncoding = CmdCommand.OutEncoding.Unicode; await command.Run(); - command = new CmdCommand("wmic", $"computersystem where name=\"%computername%\" set AutomaticManagedPagefile=False"); - await command.Run(); + //We don't use page file anymore since upgrade to 4GB RAM. But keep this just in case. + //command = new CmdCommand("wmic", $"computersystem where name=\"%computername%\" set AutomaticManagedPagefile=False"); + //await command.Run(); - command = new CmdCommand("wmic", $"pagefileset create name=\"p:\\pagefile.sys\""); - await command.Run(); + //command = new CmdCommand("wmic", $"pagefileset create name=\"p:\\pagefile.sys\""); + //await command.Run(); - command = new CmdCommand("wmic", $"pagefileset where name=\"p:\\\\pagefile.sys\" set InitialSize=16,MaximumSize=3870"); - await command.Run(); + //command = new CmdCommand("wmic", $"pagefileset where name=\"p:\\\\pagefile.sys\" set InitialSize=16,MaximumSize=3870"); + //await command.Run(); } /// diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Resources/Colors.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Resources/Colors.xaml index f0e872285..a0db8e2aa 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Resources/Colors.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Resources/Colors.xaml @@ -13,4 +13,6 @@ + + \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.BL/Entities/BrushStop.cs b/Software/Visual_Studio/Tango.BL/Entities/BrushStop.cs index d23e9b1f2..8c755455f 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/BrushStop.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/BrushStop.cs @@ -111,7 +111,7 @@ namespace Tango.BL.Entities { get { - return LiquidVolumes != null ? LiquidVolumes.Where(x => x.IdsPack.IdsPackFormula.Code == IdsPackFormulas.StandardColor.ToInt32()).Sum(x => x.Volume) > MAX_TOTAL_LIQUID_VOLUME : false; + return LiquidVolumes != null ? LiquidVolumes.Where(x => x.IdsPack.IdsPackFormula.Code == IdsPackFormulas.StandardColor.ToInt32()).Sum(x => x.Volume) > GetTotalMaximumLiquidVolumeLimit() : false; } } @@ -709,5 +709,22 @@ namespace Tango.BL.Entities } #endregion + + #region Private Methods + + private double GetTotalMaximumLiquidVolumeLimit() + { + try + { + var tables = Segment.Job.Rml.GetActiveProcessGroup().ProcessParametersTables.OrderBy(x => x.TableIndex).ToList(); + return (tables[1].MaxInkUptake / tables[0].MaxInkUptake) * 100; + } + catch + { + return MAX_TOTAL_LIQUID_VOLUME; + } + } + + #endregion } } -- cgit v1.3.1 From 3f069bb4a5303b2c732ba1263229f62526acc693 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Tue, 10 Dec 2019 00:39:06 +0200 Subject: Refactored Object mapping extension methods ! Removed FK from JOB_RUNS => JOBS Added MACHINE_GUID to JOB_RUNS Refactored MS Statistics module for the new changes. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 22675456 -> 22675456 bytes .../ViewModels/MainViewVM.cs | 2 +- .../ViewModels/MainViewVM.cs | 2 +- .../Models/JobRunModel.cs | 45 +++++++ .../Tango.MachineStudio.Statistics.csproj | 1 + .../ViewModels/MainViewVM.cs | 23 ++-- .../ViewModels/ConnectedMachineViewVM.cs | 6 +- .../ViewModels/MainViewVM.cs | 2 +- .../Tango.BL/Builders/JobRunsBuilder.cs | 12 -- .../Visual_Studio/Tango.BL/DTO/JobRunDTOBase.cs | 8 ++ Software/Visual_Studio/Tango.BL/Entities/Job.cs | 4 +- .../Visual_Studio/Tango.BL/Entities/JobBase.cs | 38 ------ .../Visual_Studio/Tango.BL/Entities/JobRunBase.cs | 67 ++++------ .../ExtensionMethods/ObjectExtensions.cs | 113 ++++++++-------- Software/Visual_Studio/Tango.DAL.Remote/DB/JOB.cs | 3 - .../Visual_Studio/Tango.DAL.Remote/DB/JOB_RUNS.cs | 3 +- .../Tango.DAL.Remote/DB/RemoteADO.Designer.cs | 2 +- .../Tango.DAL.Remote/DB/RemoteADO.edmx | 61 +++------ .../Tango.DAL.Remote/DB/RemoteADO.edmx.diagram | 147 ++++++++++----------- .../JobRuns/BasicJobRunsLogger.cs | 3 + .../Remote/RemoteDBComparer.cs | 4 +- Software/Visual_Studio/Tango.sln | 13 +- .../Utilities/Tango.JobRunsGenerator/Program.cs | 81 +++--------- 24 files changed, 278 insertions(+), 362 deletions(-) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Models/JobRunModel.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index f50c8b7fb..0336edc76 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index 5b78ee141..dd9945ab8 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs index 256ed24d6..9a80eb9d9 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs @@ -221,7 +221,7 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels private void CopyParameters(object obj) { - obj.MapPrimitivesTo(SelectedHardwareObject, + obj.MapPropertiesTo(SelectedHardwareObject, MappingFlags.PrimitivesOnly, (prop) => !prop.PropertyType.IsEnum && diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs index ee21b9ac3..9939e4876 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs @@ -471,7 +471,7 @@ namespace Tango.MachineStudio.RML.ViewModels var rml = await new RmlBuilder(context).Set(SelectedRML.Guid).WithActiveParametersGroup().WithLiquidFactors().BuildAsync(); Rml cloned = new Rml(); - rml.MapPrimitivesWithStrings(cloned); + rml.MapPropertiesTo(cloned, MappingFlags.NoReferenceTypes); cloned.Code = Rmls.Max(x => x.Code) + 1; cloned.Guid = Guid.NewGuid().ToString(); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Models/JobRunModel.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Models/JobRunModel.cs new file mode 100644 index 000000000..8e5642e3d --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Models/JobRunModel.cs @@ -0,0 +1,45 @@ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL; +using Tango.BL.Entities; +using Tango.Core.ExtensionMethods; + +namespace Tango.MachineStudio.Statistics.Models +{ + public class JobRunModel : JobRun + { + private static Dictionary _machines = new Dictionary(); + + public JobRunModel() + { + + } + + public JobRunModel(JobRun run) + { + run.MapPropertiesTo(this, MappingFlags.NoReferenceTypes); + } + + public Task LoadMachine(ObservablesContext context) + { + return Task.Factory.StartNew(() => + { + if (!_machines.ContainsKey(MachineGuid)) + { + Machine = context.Machines.SingleOrDefault(x => x.Guid == MachineGuid); + _machines.Add(MachineGuid, Machine); + } + else + { + Machine = _machines[MachineGuid]; + } + }); + } + + public Machine Machine { get; set; } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Tango.MachineStudio.Statistics.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Tango.MachineStudio.Statistics.csproj index 243663c5a..36c371165 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Tango.MachineStudio.Statistics.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Tango.MachineStudio.Statistics.csproj @@ -73,6 +73,7 @@ + PieChartTooltipControl.xaml diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/MainViewVM.cs index ef9561d0b..dfbfe2648 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/MainViewVM.cs @@ -7,20 +7,20 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Media; using Tango.BL; -using Tango.BL.Entities; using Tango.BL.Enumerations; using Tango.Core.Helpers; using Tango.MachineStudio.Common; using Tango.MachineStudio.Statistics.Models; using System.Data.Entity; using Tango.MachineStudio.Common.Notifications; +using Tango.BL.Entities; namespace Tango.MachineStudio.Statistics.ViewModels { public class MainViewVM : StudioViewModel { private ObservablesContext _context; - private List _job_runs; + private List _job_runs; private bool rendered; private INotificationProvider _notification; private bool _loaded; @@ -74,7 +74,6 @@ namespace Tango.MachineStudio.Statistics.ViewModels set { _maxDate = value; RaisePropertyChangedAuto(); } } - public MainViewVM(INotificationProvider notificationProvider) { _notification = notificationProvider; @@ -88,12 +87,12 @@ namespace Tango.MachineStudio.Statistics.ViewModels } - private List GetJobRunsByDateRange(DateTime startDate, DateTime endTime, JobRunStatus? status = null) + private List GetJobRunsByDateRange(DateTime startDate, DateTime endTime, JobRunStatus? status = null) { return _job_runs.Where(x => x.StartDate.ToLocalTime() >= startDate && x.StartDate.ToLocalTime() <= endTime && (status == null || x.JobRunStatus == status)).ToList(); } - private List GetJobRunsByDate(DateTime date, JobRunStatus? status = null) + private List GetJobRunsByDate(DateTime date, JobRunStatus? status = null) { return _job_runs.Where(x => x.StartDate.ToLocalTime().Date == date.Date && (status == null || x.JobRunStatus == status)).ToList(); } @@ -106,8 +105,6 @@ namespace Tango.MachineStudio.Statistics.ViewModels } } - - public override async void OnNavigatedTo() { base.OnNavigatedTo(); @@ -124,7 +121,11 @@ namespace Tango.MachineStudio.Statistics.ViewModels await Task.Factory.StartNew(() => { _context = ObservablesContext.CreateDefault(); - _job_runs = _context.JobRuns.Include(x => x.Job).Include(x => x.Job.Machine).OrderBy(x => x.StartDate).ToList(); + _job_runs = _context.JobRuns.OrderBy(x => x.StartDate).ToList().Select(x => new JobRunModel(x)).ToList(); + foreach (var run in _job_runs) + { + run.LoadMachine(_context).GetAwaiter().GetResult(); + } }); if (_job_runs.Count > 0) @@ -282,12 +283,12 @@ namespace Tango.MachineStudio.Statistics.ViewModels private void GeneratePrintPerWeekChart() { - List range_job_runs = GetJobRunsByDateRange(StartDate, EndDate); + List range_job_runs = GetJobRunsByDateRange(StartDate, EndDate); Dictionary> weeks_print_avg = new Dictionary>(); //Init machines weeks averages dictionary. - foreach (var machine in range_job_runs.Select(x => x.Job.Machine).OrderBy(x => x.Name).DistinctBy(x => x.Guid)) + foreach (var machine in range_job_runs.Select(x => x.Machine).OrderBy(x => x.Name).DistinctBy(x => x.Guid)) { weeks_print_avg[machine] = new List(); } @@ -305,7 +306,7 @@ namespace Tango.MachineStudio.Statistics.ViewModels { var week_job_runs = range_job_runs.Where(x => x.EndPosition > 10 && x.StartDate >= current_sunday && x.StartDate <= current_sunday.AddDays(7)).ToList(); - foreach (var machine_job_runs in week_job_runs.GroupBy(x => x.Job.Machine)) + foreach (var machine_job_runs in week_job_runs.GroupBy(x => x.Machine)) { weeks_print_avg[machine_job_runs.Key].Add(machine_job_runs.Select(x => x.EndPosition).Average()); } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectedMachineViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectedMachineViewVM.cs index 16f6938a0..40479895d 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectedMachineViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectedMachineViewVM.cs @@ -95,11 +95,11 @@ namespace Tango.MachineStudio.UI.ViewModels using (ObservablesContext db = ObservablesContext.CreateDefault()) { - var jobs = await db.Jobs.Include(x => x.JobRuns).Where(x => x.MachineGuid == ApplicationManager.Machine.Guid).ToListAsync(); + var jobRuns = await db.JobRuns.Where(x => x.MachineGuid == ApplicationManager.Machine.Guid).ToListAsync(); - TotalMachineWorkTime = TimeSpan.FromHours(jobs.SelectMany(x => x.JobRuns).Select(x => x.EndDate - x.StartDate).Sum(x => x.TotalHours)).ToString(@"hh\:mm\:ss"); + TotalMachineWorkTime = TimeSpan.FromHours(jobRuns.Select(x => x.EndDate - x.StartDate).Sum(x => x.TotalHours)).ToString(@"hh\:mm\:ss"); - int meters = (int)jobs.SelectMany(x => x.JobRuns).Select(x => x.EndPosition).Sum(); + int meters = (int)jobRuns.Select(x => x.EndPosition).Sum(); TotalMachineMeters = $"{meters.ToString("N0")} meters"; } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs index 598b1a194..3cceba6c9 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs @@ -155,7 +155,7 @@ namespace Tango.PPC.MachineSettings.ViewModels { Settings.SupportedJobTypes = SelectedJobTypes.SynchedSource.ToList(); Settings.SupportedColorSpaces = SelectedColorSpaces.SynchedSource.ToList(); - Machine.MapPrimitivesWithStrings(MachineProvider.Machine); + Machine.MapPropertiesTo(MachineProvider.Machine, MappingFlags.NoReferenceTypes); Settings.EnableHotSpot = EnableHotSpot; Settings.HotSpotPassword = HotSpotPassword; diff --git a/Software/Visual_Studio/Tango.BL/Builders/JobRunsBuilder.cs b/Software/Visual_Studio/Tango.BL/Builders/JobRunsBuilder.cs index 0a02c6a23..ca755a04c 100644 --- a/Software/Visual_Studio/Tango.BL/Builders/JobRunsBuilder.cs +++ b/Software/Visual_Studio/Tango.BL/Builders/JobRunsBuilder.cs @@ -15,17 +15,5 @@ namespace Tango.BL.Builders } - protected override IQueryable OnSetQuery(IQueryable query) - { - return query.Include(x => x.Job); - } - - public virtual JobRunsBuilder WithJobEvents() - { - return AddStep(2, () => - { - Context.MachinesEvents.Where(x => x.MachineGuid == Entity.Job.MachineGuid && x.DateTime >= Entity.StartDate && x.DateTime <= Entity.EndDate).OrderBy(x => x.DateTime).ToList(); - }); - } } } diff --git a/Software/Visual_Studio/Tango.BL/DTO/JobRunDTOBase.cs b/Software/Visual_Studio/Tango.BL/DTO/JobRunDTOBase.cs index 112694e1a..9726f16a7 100644 --- a/Software/Visual_Studio/Tango.BL/DTO/JobRunDTOBase.cs +++ b/Software/Visual_Studio/Tango.BL/DTO/JobRunDTOBase.cs @@ -26,6 +26,14 @@ namespace Tango.BL.DTO public abstract class JobRunDTOBase : ObservableEntityDTO { + /// + /// machine guid + /// + public String MachineGuid + { + get; set; + } + /// /// job guid /// diff --git a/Software/Visual_Studio/Tango.BL/Entities/Job.cs b/Software/Visual_Studio/Tango.BL/Entities/Job.cs index 3cb6494d4..19f374951 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/Job.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/Job.cs @@ -628,7 +628,7 @@ namespace Tango.BL.Entities foreach (var stop in segment.BrushStops.OrderBy(x => x.StopIndex)) { JobFileBrushStop st = new JobFileBrushStop(); - stop.MapPrimitivesWithStringsNoNullsTo(st); + stop.MapPropertiesTo(st, MappingFlags.NoReferenceTypes | MappingFlags.NoNullStrings); st.ColorCatalogItemGuid = stop.ColorCatalogsItemGuid.ToStringOrEmpty(); foreach (var idsPack in machine.Configuration.NoneEmptyIdsPacks) @@ -755,7 +755,7 @@ namespace Tango.BL.Entities BrushStop st = new BrushStop(); st.StopIndex = j + 1; st.SegmentGuid = s.Guid; - stop.MapPrimitivesWithStringsNoNullsTo(st); + stop.MapPropertiesTo(st, MappingFlags.NoReferenceTypes | MappingFlags.NoNullStrings); foreach (var volume in stop.LiquidVolumes) { diff --git a/Software/Visual_Studio/Tango.BL/Entities/JobBase.cs b/Software/Visual_Studio/Tango.BL/Entities/JobBase.cs index c5354f2c7..b356ecbfe 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/JobBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/JobBase.cs @@ -87,8 +87,6 @@ namespace Tango.BL.Entities public event EventHandler CustomerChanged; - public event EventHandler> JobRunsChanged; - public event EventHandler MachineChanged; public event EventHandler RmlChanged; @@ -1091,31 +1089,6 @@ namespace Tango.BL.Entities } } - protected SynchronizedObservableCollection _jobruns; - - /// - /// Gets or sets the jobbase job runs. - /// - - public virtual SynchronizedObservableCollection JobRuns - { - get - { - return _jobruns; - } - - set - { - if (_jobruns != value) - { - _jobruns = value; - - OnJobRunsChanged(value); - - } - } - } - protected Machine _machine; /// @@ -1553,15 +1526,6 @@ namespace Tango.BL.Entities RaisePropertyChanged(nameof(Customer)); } - /// - /// Called when the JobRuns has changed. - /// - protected virtual void OnJobRunsChanged(SynchronizedObservableCollection jobruns) - { - JobRunsChanged?.Invoke(this, jobruns); - RaisePropertyChanged(nameof(JobRuns)); - } - /// /// Called when the Machine has changed. /// @@ -1622,8 +1586,6 @@ namespace Tango.BL.Entities public JobBase() : base() { - JobRuns = new SynchronizedObservableCollection(); - Segments = new SynchronizedObservableCollection(); } diff --git a/Software/Visual_Studio/Tango.BL/Entities/JobRunBase.cs b/Software/Visual_Studio/Tango.BL/Entities/JobRunBase.cs index 4d53a6d66..16351179f 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/JobRunBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/JobRunBase.cs @@ -41,7 +41,30 @@ namespace Tango.BL.Entities public event EventHandler FailedMessageChanged; - public event EventHandler JobChanged; + protected String _machineguid; + + /// + /// Gets or sets the jobrunbase machine guid. + /// + + [Column("MACHINE_GUID")] + + public String MachineGuid + { + get + { + return _machineguid; + } + + set + { + if (_machineguid != value) + { + _machineguid = value; + + } + } + } protected String _jobguid; @@ -50,7 +73,6 @@ namespace Tango.BL.Entities /// [Column("JOB_GUID")] - [ForeignKey("Job")] public String JobGuid { @@ -206,38 +228,6 @@ namespace Tango.BL.Entities } } - protected Job _job; - - /// - /// Gets or sets the jobrunbase job. - /// - - [XmlIgnore] - [JsonIgnore] - public virtual Job Job - { - get - { - return _job; - } - - set - { - if (_job != value) - { - _job = value; - - if (Job != null) - { - JobGuid = Job.Guid; - } - - OnJobChanged(value); - - } - } - } - /// /// Called when the StartDate has changed. /// @@ -283,15 +273,6 @@ namespace Tango.BL.Entities RaisePropertyChanged(nameof(FailedMessage)); } - /// - /// Called when the Job has changed. - /// - protected virtual void OnJobChanged(Job job) - { - JobChanged?.Invoke(this, job); - RaisePropertyChanged(nameof(Job)); - } - /// /// Initializes a new instance of the class. /// diff --git a/Software/Visual_Studio/Tango.Core/ExtensionMethods/ObjectExtensions.cs b/Software/Visual_Studio/Tango.Core/ExtensionMethods/ObjectExtensions.cs index fe2c7ff9a..e8ef9addd 100644 --- a/Software/Visual_Studio/Tango.Core/ExtensionMethods/ObjectExtensions.cs +++ b/Software/Visual_Studio/Tango.Core/ExtensionMethods/ObjectExtensions.cs @@ -12,6 +12,34 @@ using Tango.Serialization; namespace Tango.Core.ExtensionMethods { + public enum MappingFlags + { + /// + /// All properties will be mapped. + /// + All = 1, + + /// + /// Do not map string properties. + /// + NoStrings = 2, + + /// + /// Do not map string properties with value of null. + /// + NoNullStrings = 4, + + /// + /// Do not map reference types. + /// + NoReferenceTypes = 8, + + /// + /// Map only primitive values. + /// + PrimitivesOnly, + } + /// /// Contains extension methods. /// @@ -58,85 +86,62 @@ namespace Tango.Core.ExtensionMethods } /// - /// Maps the object properties values to the destination object. + /// Maps the object primitive properties values to the destination object. /// - /// The source. - /// The destination. - public static void MapPrimitivesTo(this object source, object destination) + /// The source object. + /// The destination object. + /// The mapping flags. + /// Optional condition. + public static void MapPropertiesTo(this object source, object destination, MappingFlags flags = MappingFlags.NoReferenceTypes, Func condition = null) { - foreach (var prop in source.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(x => x.PropertyType.IsPrimitive)) + foreach (var prop in source.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance)) { - var desProp = destination.GetType().GetProperty(prop.Name, BindingFlags.Public | BindingFlags.Instance); + var propType = prop.PropertyType; + var value = prop.GetValue(source); - if (desProp != null && desProp.PropertyType.IsPrimitive && desProp.SetMethod != null) + if (condition != null) { - desProp.SetValue(destination, prop.GetValue(source)); + if (!condition(prop)) continue; } - } - } - /// - /// Maps the object properties values to the destination object including strings and without assigning null string values from the source. - /// - /// The source. - /// The destination. - public static void MapPrimitivesWithStringsNoNullsTo(this object source, object destination) - { - foreach (var prop in source.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(x => x.PropertyType.IsPrimitive || x.PropertyType == typeof(String))) - { - var desProp = destination.GetType().GetProperty(prop.Name, BindingFlags.Public | BindingFlags.Instance); + if (!propType.IsPrimitive && flags.HasFlag(MappingFlags.PrimitivesOnly)) + { + continue; + } - if (desProp != null && (desProp.PropertyType.IsPrimitive || desProp.PropertyType == typeof(String)) && desProp.SetMethod != null) + if (propType == typeof(String) && flags.HasFlag(MappingFlags.NoStrings)) { - var value = prop.GetValue(source); + continue; + } - if (desProp.PropertyType != typeof(String) || !String.IsNullOrEmpty(value as String)) - { - desProp.SetValue(destination, value); - } + if (propType.IsClass && propType != typeof(String) && flags.HasFlag(MappingFlags.NoReferenceTypes)) + { + continue; + } + + if (flags.HasFlag(MappingFlags.NoNullStrings) && propType == typeof(String) && String.IsNullOrEmpty(value as String)) + { + continue; } - } - } - /// - /// Maps the object properties values to the destination object including strings and without assigning null string values from the source. - /// - /// The source. - /// The destination. - public static void MapPrimitivesWithStrings(this object source, object destination) - { - foreach (var prop in source.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(x => x.PropertyType.IsPrimitive || x.PropertyType == typeof(String))) - { var desProp = destination.GetType().GetProperty(prop.Name, BindingFlags.Public | BindingFlags.Instance); - if (desProp != null && (desProp.PropertyType.IsPrimitive || desProp.PropertyType == typeof(String)) && desProp.SetMethod != null) + if (desProp != null && desProp.PropertyType == prop.PropertyType && desProp.SetMethod != null) { - var value = prop.GetValue(source); - desProp.SetValue(destination, value); } } } + /// - /// Maps the object properties values to the destination object. + /// Maps the object primitive properties values to the destination object. /// /// The source. /// The destination. - public static void MapPrimitivesTo(this object source, object destination, Func condition) + public static void MapPrimitivesTo(this object source, object destination) { - foreach (var prop in source.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(x => x.PropertyType.IsPrimitive)) - { - var desProp = destination.GetType().GetProperty(prop.Name, BindingFlags.Public | BindingFlags.Instance); - - if (desProp != null && desProp.PropertyType.IsPrimitive && desProp.SetMethod != null) - { - if (condition(prop)) - { - desProp.SetValue(destination, prop.GetValue(source)); - } - } - } + source.MapPropertiesTo(destination, MappingFlags.PrimitivesOnly); } /// diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/JOB.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/JOB.cs index eb8c0a998..17ec544c0 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/JOB.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/JOB.cs @@ -17,7 +17,6 @@ namespace Tango.DAL.Remote.DB [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] public JOB() { - this.JOB_RUNS = new HashSet(); this.SEGMENTS = new HashSet(); } @@ -61,8 +60,6 @@ namespace Tango.DAL.Remote.DB public virtual COLOR_CATALOGS COLOR_CATALOGS { get; set; } public virtual COLOR_SPACES COLOR_SPACES { get; set; } public virtual CUSTOMER CUSTOMER { get; set; } - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] - public virtual ICollection JOB_RUNS { get; set; } public virtual MACHINE MACHINE { get; set; } public virtual RML RML { get; set; } public virtual SPOOL_TYPES SPOOL_TYPES { get; set; } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/JOB_RUNS.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/JOB_RUNS.cs index fb591afa0..24f61f03c 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/JOB_RUNS.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/JOB_RUNS.cs @@ -17,13 +17,12 @@ namespace Tango.DAL.Remote.DB public int ID { get; set; } public string GUID { get; set; } public System.DateTime LAST_UPDATED { get; set; } + public string MACHINE_GUID { get; set; } public string JOB_GUID { get; set; } public System.DateTime START_DATE { get; set; } public System.DateTime END_DATE { get; set; } public int STATUS { get; set; } public double END_POSITION { get; set; } public string FAILED_MESSAGE { get; set; } - - public virtual JOB JOB { get; set; } } } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.Designer.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.Designer.cs index 17bc2683d..d26e67908 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.Designer.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.Designer.cs @@ -1,4 +1,4 @@ -// T4 code generation is enabled for model 'D:\Development\Tango\Software\Visual_Studio\Tango.DAL.Remote\DB\RemoteADO.edmx'. +// T4 code generation is enabled for model 'C:\DATA\Development\Tango\Software\Visual_Studio\Tango.DAL.Remote\DB\RemoteADO.edmx'. // To enable legacy code generation, change the value of the 'Code Generation Strategy' designer // property to 'Legacy ObjectContext'. This property is available in the Properties Window when the model // is open in the designer. diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx index 8607b9f07..8c8b66a5c 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx @@ -586,7 +586,8 @@ - + + @@ -1614,20 +1615,6 @@ - - - - - - - - - - - - - - @@ -1679,7 +1666,9 @@ - + + + @@ -2077,7 +2066,9 @@ - + + + @@ -2402,10 +2393,6 @@ - - - - @@ -2863,10 +2850,6 @@ - - - - @@ -3658,13 +3641,13 @@ - + + - @@ -3709,7 +3692,6 @@ - @@ -4925,20 +4907,6 @@ - - - - - - - - - - - - - - @@ -4954,7 +4922,9 @@ - + + + @@ -5286,7 +5256,9 @@ - + + + @@ -5958,6 +5930,7 @@ + diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram index c0574cb9e..2feb68642 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram @@ -5,80 +5,80 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -130,7 +130,6 @@ - diff --git a/Software/Visual_Studio/Tango.Integration/JobRuns/BasicJobRunsLogger.cs b/Software/Visual_Studio/Tango.Integration/JobRuns/BasicJobRunsLogger.cs index bacae9324..9eb010ec2 100644 --- a/Software/Visual_Studio/Tango.Integration/JobRuns/BasicJobRunsLogger.cs +++ b/Software/Visual_Studio/Tango.Integration/JobRuns/BasicJobRunsLogger.cs @@ -117,6 +117,7 @@ namespace Tango.Integration.JobRuns StartDate = _start_date, EndDate = DateTime.UtcNow, JobGuid = _job.Guid, + MachineGuid = _job.MachineGuid, JobRunStatus = JobRunStatus.Failed, EndPosition = e.JobHandler.Status.Progress, FailedMessage = e.Exception.Message, @@ -161,6 +162,7 @@ namespace Tango.Integration.JobRuns StartDate = _start_date, EndDate = DateTime.UtcNow, JobGuid = _job.Guid, + MachineGuid = _job.MachineGuid, EndPosition = e.JobHandler.Status.Progress, JobRunStatus = JobRunStatus.Aborted, }); @@ -204,6 +206,7 @@ namespace Tango.Integration.JobRuns StartDate = _start_date, EndDate = DateTime.UtcNow, JobGuid = _job.Guid, + MachineGuid = _job.MachineGuid, EndPosition = e.JobHandler.Status.Progress, JobRunStatus = JobRunStatus.Completed, }); diff --git a/Software/Visual_Studio/Tango.Synchronization/Remote/RemoteDBComparer.cs b/Software/Visual_Studio/Tango.Synchronization/Remote/RemoteDBComparer.cs index aaf4706a3..7022d1ae3 100644 --- a/Software/Visual_Studio/Tango.Synchronization/Remote/RemoteDBComparer.cs +++ b/Software/Visual_Studio/Tango.Synchronization/Remote/RemoteDBComparer.cs @@ -143,7 +143,7 @@ namespace Tango.Synchronization.Remote var remote_jobs = remote_machines.SelectMany(x => x.JOBS).ToList(); OnProgress(LogManager.Log("Querying all remote job runs...")); - var remote_jobs_runs = remote_jobs.SelectMany(x => x.JOB_RUNS).ToList(); + //var remote_jobs_runs = remote_jobs.SelectMany(x => x.JOB_RUNS).ToList(); OnProgress(LogManager.Log("Querying all remote segments...")); var remote_segments = remote_jobs.SelectMany(x => x.SEGMENTS).ToList(); @@ -196,7 +196,7 @@ namespace Tango.Synchronization.Remote CompareCollections(remote_jobs, local_jobs, _remoteDB.JOBS, _localDB.JOBS); OnProgress(LogManager.Log("Comparing job runs")); - CompareCollections(remote_jobs_runs, local_job_runs, _remoteDB.JOB_RUNS, _localDB.JOB_RUNS); + //CompareCollections(remote_jobs_runs, local_job_runs, _remoteDB.JOB_RUNS, _localDB.JOB_RUNS); OnProgress(LogManager.Log("Comparing segments")); CompareCollections(remote_segments, local_segments, _remoteDB.SEGMENTS, _localDB.SEGMENTS); diff --git a/Software/Visual_Studio/Tango.sln b/Software/Visual_Studio/Tango.sln index 5d601ae52..8dc160543 100644 --- a/Software/Visual_Studio/Tango.sln +++ b/Software/Visual_Studio/Tango.sln @@ -3841,6 +3841,7 @@ Global {4EDCF067-E377-42CB-A18C-8368CF484577}.AppVeyor|x86.ActiveCfg = Release|Any CPU {4EDCF067-E377-42CB-A18C-8368CF484577}.AppVeyor|x86.Build.0 = Release|Any CPU {4EDCF067-E377-42CB-A18C-8368CF484577}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4EDCF067-E377-42CB-A18C-8368CF484577}.Debug|Any CPU.Build.0 = Debug|Any CPU {4EDCF067-E377-42CB-A18C-8368CF484577}.Debug|ARM.ActiveCfg = Debug|Any CPU {4EDCF067-E377-42CB-A18C-8368CF484577}.Debug|ARM.Build.0 = Debug|Any CPU {4EDCF067-E377-42CB-A18C-8368CF484577}.Debug|ARM64.ActiveCfg = Debug|Any CPU @@ -5885,12 +5886,12 @@ Global {DA391B02-AE28-4EA1-A80F-D0F4C8029FFA} = {E728CBD9-1AF4-4814-A218-E4BD26E7EDEA} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {7986F7F4-A86A-4994-B1B6-0988D7F057B6} - BuildVersion_BuildVersioningStyle = None.None.Increment.DeltaBaseYearDayOfYear - BuildVersion_UpdateAssemblyVersion = True - BuildVersion_UpdateFileVersion = False - BuildVersion_StartDate = 2000/1/1 - BuildVersion_AssemblyInfoFilename = Properties\AssemblyInfo.cs BuildVersion_UseGlobalSettings = False + BuildVersion_AssemblyInfoFilename = Properties\AssemblyInfo.cs + BuildVersion_StartDate = 2000/1/1 + BuildVersion_UpdateFileVersion = False + BuildVersion_UpdateAssemblyVersion = True + BuildVersion_BuildVersioningStyle = None.None.Increment.DeltaBaseYearDayOfYear + SolutionGuid = {7986F7F4-A86A-4994-B1B6-0988D7F057B6} EndGlobalSection EndGlobal diff --git a/Software/Visual_Studio/Utilities/Tango.JobRunsGenerator/Program.cs b/Software/Visual_Studio/Utilities/Tango.JobRunsGenerator/Program.cs index 6c3c62606..61e74957c 100644 --- a/Software/Visual_Studio/Utilities/Tango.JobRunsGenerator/Program.cs +++ b/Software/Visual_Studio/Utilities/Tango.JobRunsGenerator/Program.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using Tango.BL; using Tango.BL.Builders; using Tango.BL.Entities; +using Tango.Core; namespace Tango.JobRunsGenerator { @@ -13,75 +14,27 @@ namespace Tango.JobRunsGenerator { static void Main(string[] args) { - Console.WriteLine("Job Runs Generator Started..."); - - DateTime now = DateTime.UtcNow; - DateTime yearago = DateTime.UtcNow.AddYears(-1); - Random rnd = new Random(); - List messages = new List() - { - "Timeout failure", - "Thread Break", - "Application Exception", - "Over Temperature", - "Communication Error" - }; - - int count = 0; - - using (ObservablesContext db = ObservablesContext.CreateDefault("localhost\\SQLEXPRESS")) + DataSource dataSource = new DataSource(); + dataSource.Catalog = "Tango_DEV"; + dataSource.Address = "twine.database.windows.net"; + dataSource.IntegratedSecurity = false; + dataSource.UserName = "Roy"; + dataSource.Password = "Aa123456"; + + using (ObservablesContext db = ObservablesContext.CreateDefault(dataSource)) { - var machines = db.Machines.ToList(); - - foreach (var machine in machines) + foreach (var run in db.JobRuns.OrderBy(x => x.JobGuid)) { - new MachineBuilder(db).Set(machine).WithJobs().Build(); - - foreach (var job in machine.Jobs) - { - using (ObservablesContext db2 = ObservablesContext.CreateDefault("localhost\\SQLEXPRESS")) - { - for (DateTime date = yearago; date < now; date = date.AddDays(1)) - { - Console.WriteLine($"Adding job runs for machine '{machine.SerialNumber}' job '{job.Name}' date {date.ToShortDateString()}..."); - - for (int i = 0; i < rnd.Next(0, 9); i++) - { - int status = rnd.Next(0, 3); - String message = messages[rnd.Next(0, messages.Count)]; - - db2.JobRuns.Add(new JobRun() - { - StartDate = date, - EndDate = date.AddMinutes(rnd.Next(10, 61)), - JobGuid = job.Guid, - EndPosition = job.Length / rnd.Next(1, 11), - Status = status, - FailedMessage = status == 2 ? message : null, - }); - - count++; - } - } - - db2.SaveChanges(); - } - } + var job = db.Jobs.SingleOrDefault(x => x.Guid == run.JobGuid); + Console.WriteLine($"Fixing job {job.Name}..."); + run.MachineGuid = job.MachineGuid; } - Console.WriteLine($"The generator is about to insert {count} job runs to the database are you sure? [Y/N]:"); - var key = Console.ReadKey().Key; + Console.WriteLine("Saving changed..."); + db.SaveChanges(); - if (key == ConsoleKey.Y) - { - Console.WriteLine("Saving changes to database..."); - Console.WriteLine("Done!"); - Console.ReadLine(); - } - else - { - return; - } + Console.WriteLine("Done!"); + Console.ReadLine(); } } } -- cgit v1.3.1 From 582c05b00aa1d0fd9086b4a245dcc987eee9fc39 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Sat, 21 Dec 2019 19:14:00 +0200 Subject: Working some more on ActionLogs across MS. --- .../ViewModels/MainViewVM.cs | 4 +-- .../ViewModels/MainViewVM.cs | 10 +++--- .../ViewModels/MainViewVM.cs | 6 ++-- .../ViewModels/MainViewVM.cs | 32 +++++++++++++++-- .../ViewModels/MainViewVM.cs | 28 ++++++++++++++- .../ViewModels/MainViewVM.cs | 13 +++++-- .../ViewModels/SiteDetailsViewVM.cs | 42 +++++++++++++++++++--- Software/Visual_Studio/Tango.BL/DTO/CatDTO.cs | 10 ++++++ .../Visual_Studio/Tango.BL/DTO/ConfigurationDTO.cs | 21 +++++++++++ Software/Visual_Studio/Tango.BL/DTO/IdsPackDTO.cs | 25 ++++++++++--- Software/Visual_Studio/Tango.BL/DTO/MachineDTO.cs | 16 +++++++++ Software/Visual_Studio/Tango.BL/DTO/RmlDTO.cs | 4 +++ Software/Visual_Studio/Tango.BL/DTO/SiteDTO.cs | 25 +++++++++++++ Software/Visual_Studio/Tango.BL/DTO/SitesRmlDTO.cs | 6 +++- Software/Visual_Studio/Tango.BL/DTO/SpoolDTO.cs | 7 ++++ .../Tango.BL/Enumerations/ActionLogType.cs | 6 ++++ .../Controllers/PPCController.cs | 2 ++ 17 files changed, 230 insertions(+), 27 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/ViewModels/MainViewVM.cs index ae763167b..e306d0997 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/ViewModels/MainViewVM.cs @@ -244,7 +244,7 @@ namespace Tango.MachineStudio.Catalogs.ViewModels { IsFree = false; await SelectedCatalog.DeleteCascadeAsync(_catalogsContext); - _actionLogManager.InsertLog(ActionLogType.CatalogDeleted, _authentication.CurrentUser, SelectedCatalog.Name, SelectedCatalog, "Catalog deleted using Machine Studio."); + _actionLogManager.InsertLog(ActionLogType.CatalogDeleted, _authentication.CurrentUser, SelectedCatalog.Name, SelectedCatalog, "Catalog deleted using Machine Studio.", false); SelectedCatalog = null; } catch (Exception ex) @@ -322,7 +322,7 @@ namespace Tango.MachineStudio.Catalogs.ViewModels await _activeCatalogContext.SaveChangesAsync(); var activeCatalogDTO = ColorCatalogDTO.FromObservable(ActiveCatalog); - _actionLogManager.InsertLog(ActionLogType.CatalogSaved, _authentication.CurrentUser, ActiveCatalog.Name, _catalogBeforeSave, activeCatalogDTO, "Catalog created using Machine Studio."); + _actionLogManager.InsertLog(ActionLogType.CatalogSaved, _authentication.CurrentUser, _catalogBeforeSave.Name, _catalogBeforeSave, activeCatalogDTO, "Catalog created using Machine Studio."); _catalogBeforeSave = activeCatalogDTO; await LoadCatalogs(); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index 8b235a13a..a641c87b6 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs @@ -1726,6 +1726,8 @@ namespace Tango.MachineStudio.Developer.ViewModels using (_notification.PushTaskItem("Saving Parameters Group...")) { + var processGroupBefore = ProcessParametersTablesGroupDTO.FromObservable(SelectedRML.GetActiveProcessGroup()); + using (var db = ObservablesContext.CreateDefault()) { var active_groups = db.ProcessParametersTablesGroups.Where(x => x.RmlGuid == SelectedRML.Guid && x.Active).ToList(); @@ -1753,8 +1755,6 @@ namespace Tango.MachineStudio.Developer.ViewModels tables.Add(newTable); } - var rmlBeforeDTO = RmlDTO.FromObservable(SelectedRML); - group.Active = true; group.ProcessParametersTables = tables.ToSynchronizedObservableCollection(); group.Rml = SelectedRML; @@ -1769,7 +1769,7 @@ namespace Tango.MachineStudio.Developer.ViewModels SelectedRML.ProcessParametersTablesGroups.Add(group); await SelectedRML.SaveAsync(_activeJobDbContext); - _actionLogManager.InsertLog(ActionLogType.RmlSaved, AuthenticationProvider.CurrentUser, SelectedRML.Name, rmlBeforeDTO, RmlDTO.FromObservable(SelectedRML), "Active process parameters changed from Machine Studio Research module."); + _actionLogManager.InsertLog(ActionLogType.RmlActiveProcessParametersChanged, AuthenticationProvider.CurrentUser, SelectedRML.Name, processGroupBefore, ProcessParametersTablesGroupDTO.FromObservable(SelectedRML.GetActiveProcessGroup()), "RML Active process parameters changed from Machine Studio Research module."); InvalidateLiquidFactorsAndProcessTables(); } @@ -2421,7 +2421,7 @@ namespace Tango.MachineStudio.Developer.ViewModels foreach (var job in SelectedJobs) { - _actionLogManager.InsertLog(ActionLogType.JobCreated, AuthenticationProvider.CurrentUser, job.Name, job, "Job created using Machine Studio."); + _actionLogManager.InsertLog(ActionLogType.JobCreated, AuthenticationProvider.CurrentUser, job.Name, job, "Job cloned using Machine Studio."); } CanWork = true; @@ -2664,7 +2664,7 @@ namespace Tango.MachineStudio.Developer.ViewModels foreach (var job in jobsToReport) { - _actionLogManager.InsertLog(ActionLogType.JobImported, AuthenticationProvider.CurrentUser, job.Name, job, "New job imported using Machine Studio."); + _actionLogManager.InsertLog(ActionLogType.JobImported, AuthenticationProvider.CurrentUser, job.Name, job, "Job imported using Machine Studio."); } IsFree = true; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs index 7c95ce270..0a8780346 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs @@ -193,6 +193,8 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels _db.HardwareVersions.Add(hv); await _db.SaveChangesAsync(); + _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.HardwareVersionImported, _authentication.CurrentUser, CurrentVersion.Name, CurrentVersion, "New hardware version imported using Machine Studio."); + RefreshVersions(); InvokeUI(() => @@ -436,7 +438,7 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels _db.SaveChanges(); var dtoAfter = HardwareVersionDTO.FromObservable(CurrentVersion); - _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.HardwareVersionSaved, _authentication.CurrentUser, CurrentVersion.Name, _hwBeforeSave, dtoAfter, "Hardware Version saved using Machine Studio."); + _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.HardwareVersionSaved, _authentication.CurrentUser, _hwBeforeSave.Name, _hwBeforeSave, dtoAfter, "Hardware Version saved using Machine Studio."); _hwBeforeSave = dtoAfter; RefreshVersions(); @@ -481,7 +483,7 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels _db.HardwareVersions.Add(cloned); _db.SaveChanges(); - _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.HardwareVersionCreated, _authentication.CurrentUser, cloned.Name, cloned, "New hardware version created (cloned) using Machine Studio."); + _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.HardwareVersionCreated, _authentication.CurrentUser, cloned.Name, cloned, "New hardware version cloned using Machine Studio."); RefreshVersions(); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs index fd31cd950..7b6ae7ef0 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs @@ -25,14 +25,21 @@ using Tango.Core.Threading; using Tango.MachineStudio.RML.ViewModels; using Tango.Settings; using Tango.MachineStudio.RML.Models; +using Tango.BL.ActionLogs; +using Tango.MachineStudio.Common.Authentication; +using Tango.BL.DTO; namespace Tango.MachineStudio.MachineDesigner.ViewModels { public class MainViewVM : StudioViewModel { private INotificationProvider _notification; + private IActionLogManager _actionLogManager; + private IAuthenticationProvider _authentication; private ActionTimer _machines_action_timer; private ActionTimer _dispensers_action_timer; + private MachineDTO _machineBeforeSave; + private bool _isNewMachine; #region Properties @@ -233,10 +240,12 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels /// /// Initializes a new instance of the class. /// - public MainViewVM(INotificationProvider notification) + public MainViewVM(INotificationProvider notification, IAuthenticationProvider authentication, IActionLogManager actionLogManager) { MachinesAdapter = new ObservablesStaticCollections(ObservablesContext.CreateDefault()); _notification = notification; + _authentication = authentication; + _actionLogManager = actionLogManager; _machines_action_timer = new ActionTimer(TimeSpan.FromMilliseconds(200)); _dispensers_action_timer = new ActionTimer(TimeSpan.FromMilliseconds(200)); @@ -428,6 +437,8 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels private async void LoadSelectedMachine(bool newMachine = false, bool clone = false, MachineVersion selectedVersion = null) { + _isNewMachine = false; + using (_notification.PushTaskItem("Loading machine details...")) { try @@ -462,9 +473,12 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels if (!newMachine) { ActiveMachine = (await new MachineBuilder(ActiveMachineAdapter.Context).Set(SelectedMachine.Guid).WithOrganization().WithConfiguration().WithSpools().BuildAsync()); + _machineBeforeSave = MachineDTO.FromObservable(ActiveMachine); + if (clone) { + _isNewMachine = true; ActiveMachine = ActiveMachine.Clone(); ActiveMachine.Name = ""; ActiveMachine.SerialNumber = ""; @@ -476,6 +490,8 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels } else { + _isNewMachine = true; + if (selectedVersion == null) { ActiveMachine = new Machine(); @@ -668,16 +684,25 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels ActiveMachine.ConfigurationGuid = ActiveMachine.Configuration.Guid; ActiveMachine.LastUpdated = DateTime.UtcNow; - ActiveMachine.ProductionDate = DateTime.UtcNow; ActiveMachine.SiteGuid = SelectedSite == null ? null : (SelectedSite.ID == -1 ? null : SelectedSite.Guid); ColorCalibrationViewVM.Save(); var hwConfig = HardwareConfigurationViewVM.GetResultingHardwareConfiguration(); ActiveMachine.Configuration.SetHardwareConfiguration(hwConfig); - await ActiveMachineAdapter.Context.SaveChangesAsync(); + if (_isNewMachine) + { + _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.MachineCreated, _authentication.CurrentUser, ActiveMachine.Name, ActiveMachine, "New machine created using Machine Studio."); + } + else + { + var machineAfterDTO = MachineDTO.FromObservable(ActiveMachine); + _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.MachineSaved, _authentication.CurrentUser, _machineBeforeSave.Name, _machineBeforeSave, machineAfterDTO, "Machine saved using Machine Studio."); + _machineBeforeSave = machineAfterDTO; + } + if (SelectedMachine != null) { await SelectedMachine.Reload(MachinesAdapter.Context); @@ -725,6 +750,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels IsFree = false; await SelectedMachine.DeleteCascadeAsync(MachinesAdapter.Context); MachinesAdapter.Context.Machines.Remove(SelectedMachine); + _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.MachineDeleted, _authentication.CurrentUser, SelectedMachine.Name, SelectedMachine, "Machine deleted using Machine Studio."); } catch (Exception ex) { diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs index 9939e4876..527159aa5 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs @@ -21,12 +21,18 @@ using Tango.MachineStudio.RML.Views; using Tango.PMR.ColorLab; using System.Data.Entity; using Tango.Core.ExtensionMethods; +using Tango.MachineStudio.Common.Authentication; +using Tango.BL.ActionLogs; +using Tango.BL.DTO; namespace Tango.MachineStudio.RML.ViewModels { public class MainViewVM : StudioViewModel { private INotificationProvider _notification; + private IAuthenticationProvider _authentication; + private IActionLogManager _actionLogManager; + private RmlDTO _rmlBeforeSave; private ObservablesContext _rmls_context; private ObservablesContext _active_context; @@ -185,9 +191,11 @@ namespace Tango.MachineStudio.RML.ViewModels public RelayCommand ImportRMLFileCommand { get; set; } - public MainViewVM(INotificationProvider notificationProvider) + public MainViewVM(INotificationProvider notificationProvider, IAuthenticationProvider authentication, IActionLogManager actionLogManager) { _notification = notificationProvider; + _authentication = authentication; + _actionLogManager = actionLogManager; ManageRmlCommand = new RelayCommand(() => LoadActiveRML(SelectedRML.Guid), () => SelectedRML != null); RemoveRmlCommand = new RelayCommand(RemoveSelectedRml, () => SelectedRML != null); CloneRmlCommand = new RelayCommand(CloneSelectedRml, () => SelectedRML != null); @@ -334,6 +342,8 @@ namespace Tango.MachineStudio.RML.ViewModels LiquidTypesRmls = LiquidTypesRmls, }; + _rmlBeforeSave = RmlDTO.FromObservable(ActiveRML); + View.NavigateTo(RmlNavigationView.RmlView); InvalidateRelayCommands(); @@ -423,6 +433,9 @@ namespace Tango.MachineStudio.RML.ViewModels _active_context.ProcessParametersTables.Add(group.ProcessParametersTables[0]); _active_context.Rmls.Add(rml); await _active_context.SaveChangesAsync(); + + _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.RmlCreated, _authentication.CurrentUser, rml.Name, rml, "Rml created using Machine Studio."); + LoadActiveRML(rml.Guid); IsFree = true; @@ -441,6 +454,9 @@ namespace Tango.MachineStudio.RML.ViewModels try { await SelectedRML.DeleteCascadeAsync(_rmls_context); + + _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.RmlDeleted, _authentication.CurrentUser, SelectedRML.Name, SelectedRML, "RML deleted from Machine Studio."); + LoadRmls(); } catch (Exception ex) @@ -504,6 +520,8 @@ namespace Tango.MachineStudio.RML.ViewModels context.Rmls.Add(cloned); await context.SaveChangesAsync(); + + _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.RmlCreated, _authentication.CurrentUser, cloned.Name, cloned, "RML cloned from Machine Studio."); } LoadRmls(); @@ -665,7 +683,13 @@ namespace Tango.MachineStudio.RML.ViewModels } } + var rmlAfter = RmlDTO.FromObservable(ActiveRML); + await _active_context.SaveChangesAsync(); + + _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.RmlSaved, _authentication.CurrentUser, _rmlBeforeSave.Name, _rmlBeforeSave, rmlAfter, "RML saved using Machine Studio."); + + _rmlBeforeSave = rmlAfter; } } catch (Exception ex) @@ -804,6 +828,8 @@ namespace Tango.MachineStudio.RML.ViewModels var rmlFile = await Rml.FromRmlFile(db, json); db.Rmls.Add(rmlFile); + + _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.RmlImported, _authentication.CurrentUser, rmlFile.Name, rmlFile, "RML imported from Machine Studio."); } await db.SaveChangesAsync(); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Sites/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Sites/ViewModels/MainViewVM.cs index 486c8b46f..bcbcb6d16 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Sites/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Sites/ViewModels/MainViewVM.cs @@ -5,10 +5,12 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.BL; +using Tango.BL.ActionLogs; using Tango.BL.Entities; using Tango.Core.Commands; using Tango.Core.Threading; using Tango.MachineStudio.Common; +using Tango.MachineStudio.Common.Authentication; using Tango.MachineStudio.Common.Notifications; using Tango.MachineStudio.Sites.Contracts; using Tango.MachineStudio.Sites.Models; @@ -19,6 +21,8 @@ namespace Tango.MachineStudio.Sites.ViewModels { private ObservablesContext _db; private INotificationProvider _notification; + private IAuthenticationProvider _authentication; + private IActionLogManager _actionLogManager; private ActionTimer _filter_timer; private List _sites; @@ -57,9 +61,11 @@ namespace Tango.MachineStudio.Sites.ViewModels public RelayCommand BackToSitesCommand { get; set; } - public MainViewVM(INotificationProvider notificationProvider) + public MainViewVM(INotificationProvider notificationProvider, IAuthenticationProvider authentication, IActionLogManager actionLogManager) { _notification = notificationProvider; + _authentication = authentication; + _actionLogManager = actionLogManager; _filter_timer = new ActionTimer(TimeSpan.FromMilliseconds(500)); ManageSiteCommand = new RelayCommand(() => LoadSelectedSite(), () => SelectedSite != null); @@ -82,6 +88,7 @@ namespace Tango.MachineStudio.Sites.ViewModels var site = _db.Sites.SingleOrDefault(x => x.Guid == SelectedSite.Guid); site.Delete(_db); _db.SaveChanges(); + _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.SiteDeleted, _authentication.CurrentUser, site.Name, site, "Site deleted using Machine Studio."); Sites.Remove(SelectedSite); LoadSites(); }); @@ -110,7 +117,7 @@ namespace Tango.MachineStudio.Sites.ViewModels IsFree = false; SiteDetailsViewVM = new SiteDetailsViewVM(); SiteDetailsViewVM.Saved += SiteDetailsViewVM_Saved; - await SiteDetailsViewVM.Init(SelectedSite?.Guid, _notification, true, name); + await SiteDetailsViewVM.Init(SelectedSite?.Guid, _notification, _authentication, _actionLogManager, true, name); View.NavigateTo(SitesNavigationView.SiteDetailsView); } } @@ -134,7 +141,7 @@ namespace Tango.MachineStudio.Sites.ViewModels IsFree = false; SiteDetailsViewVM = new SiteDetailsViewVM(); SiteDetailsViewVM.Saved += SiteDetailsViewVM_Saved; - await SiteDetailsViewVM.Init(SelectedSite.Guid, _notification, false); + await SiteDetailsViewVM.Init(SelectedSite.Guid, _notification, _authentication, _actionLogManager, false); View.NavigateTo(SitesNavigationView.SiteDetailsView); } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Sites/ViewModels/SiteDetailsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Sites/ViewModels/SiteDetailsViewVM.cs index 0e4dcbb47..73d4c49cb 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Sites/ViewModels/SiteDetailsViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Sites/ViewModels/SiteDetailsViewVM.cs @@ -10,6 +10,9 @@ using Tango.SharedUI; using Tango.SharedUI.Components; using System.Data.Entity; using Tango.MachineStudio.Common.Notifications; +using Tango.MachineStudio.Common.Authentication; +using Tango.BL.ActionLogs; +using Tango.BL.DTO; namespace Tango.MachineStudio.Sites.ViewModels { @@ -17,6 +20,10 @@ namespace Tango.MachineStudio.Sites.ViewModels { private ObservablesContext _db; private INotificationProvider _notification; + private IAuthenticationProvider _authentication; + private IActionLogManager _actionLogManager; + private bool _isNew; + private SiteDTO _siteBeforeSave; public event EventHandler Saved; @@ -69,9 +76,11 @@ namespace Tango.MachineStudio.Sites.ViewModels SaveCommand = new RelayCommand(Save, () => IsFree); } - public async Task Init(String siteGuid, INotificationProvider notification, bool isNew, string newSiteName = null) + public async Task Init(String siteGuid, INotificationProvider notification, IAuthenticationProvider authentication, IActionLogManager actionLogManager, bool isNew, string newSiteName = null) { _notification = notification; + _authentication = authentication; + _actionLogManager = actionLogManager; _db = ObservablesContext.CreateDefault(); Organizations = await _db.Organizations.ToListAsync(); @@ -82,9 +91,12 @@ namespace Tango.MachineStudio.Sites.ViewModels Site.Name = newSiteName; Site.Description = "My site description"; _db.Sites.Add(Site); + + _isNew = true; } else { + _isNew = false; Site = await _db.Sites.SingleOrDefaultAsync(x => x.Guid == siteGuid); } @@ -100,6 +112,8 @@ namespace Tango.MachineStudio.Sites.ViewModels Catalogs = new SelectedObjectCollection(catalogs.ToObservableCollection(), catalogs.Where(catalog => site_catalogs.Exists(siteCatalog => siteCatalog.CatalogGuid == catalog.Guid)).ToObservableCollection()); SelectedOrganization = Organizations.SingleOrDefault(x => x.Guid == Site.OrganizationGuid); + + _siteBeforeSave = SiteDTO.FromObservable(Site, site_rmls, site_catalogs, SelectedOrganization.Name); } private async void Save() @@ -121,20 +135,38 @@ namespace Tango.MachineStudio.Sites.ViewModels var site_rmls = await _db.SitesRmls.Where(x => x.SiteGuid == Site.Guid).ToListAsync(); var site_catalogs = await _db.SitesCatalogs.Where(x => x.SiteGuid == Site.Guid).ToListAsync(); - _db.SitesRmls.RemoveRange(site_rmls); - _db.SitesCatalogs.RemoveRange(site_catalogs); + //_db.SitesRmls.RemoveRange(site_rmls); + //_db.SitesCatalogs.RemoveRange(site_catalogs); + + //Remove site rmls. + site_rmls.ToList().Where(x => !Rmls.SynchedSource.ToList().Exists(y => y.Guid == x.RmlGuid)).ToList().ForEach(x => _db.SitesRmls.Remove(x)); + site_catalogs.ToList().Where(x => !Catalogs.SynchedSource.ToList().Exists(y => y.Guid == x.CatalogGuid)).ToList().ForEach(x => _db.SitesCatalogs.Remove(x)); - foreach (var selectedRml in Rmls.SynchedSource) + foreach (var selectedRml in Rmls.SynchedSource.Where(x => !site_rmls.Exists(y => y.RmlGuid == x.Guid))) { _db.SitesRmls.Add(new SitesRml() { SiteGuid = Site.Guid, RmlGuid = selectedRml.Guid }); } - foreach (var selectedCatalog in Catalogs.SynchedSource) + foreach (var selectedCatalog in Catalogs.SynchedSource.Where(x => !site_catalogs.Exists(y => y.CatalogGuid == x.Guid))) { _db.SitesCatalogs.Add(new SitesCatalog() { SiteGuid = Site.Guid, CatalogGuid = selectedCatalog.Guid }); } await _db.SaveChangesAsync(); + + var final_site_rmls = _db.SitesRmls.ToList(); + var final_site_catalogs = _db.SitesCatalogs.ToList(); + + if (_isNew) + { + _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.SiteCreated, _authentication.CurrentUser, Site.Name, Site, "Site created using Machine Studio."); + } + else + { + SiteDTO siteAfter = SiteDTO.FromObservable(Site, final_site_rmls, final_site_catalogs, SelectedOrganization.Name); + _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.SiteSaved, _authentication.CurrentUser, _siteBeforeSave.Name, _siteBeforeSave, siteAfter, "Site saved using Machine Studio."); + _siteBeforeSave = siteAfter; + } } _db.Dispose(); Saved?.Invoke(this, new EventArgs()); diff --git a/Software/Visual_Studio/Tango.BL/DTO/CatDTO.cs b/Software/Visual_Studio/Tango.BL/DTO/CatDTO.cs index 43d24848b..b5dc8e264 100644 --- a/Software/Visual_Studio/Tango.BL/DTO/CatDTO.cs +++ b/Software/Visual_Studio/Tango.BL/DTO/CatDTO.cs @@ -4,11 +4,21 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.BL.Entities; namespace Tango.BL.DTO { public class CatDTO : CatDTOBase { + [ObservableDTOProperty(MapsTo = nameof(Cat.LiquidType) + "." + nameof(Cat.LiquidType.Name))] + public String LiquidTypeName { get; set; } + [ObservableDTOProperty(MapsTo = nameof(Cat.Rml) + "." + nameof(Cat.Rml.Name))] + public String RmlName { get; set; } + + protected override string OnGetActionLogName() + { + return $"'{RmlName}' => '{LiquidTypeName}' Calibration"; + } } } diff --git a/Software/Visual_Studio/Tango.BL/DTO/ConfigurationDTO.cs b/Software/Visual_Studio/Tango.BL/DTO/ConfigurationDTO.cs index 605a905db..75049fa88 100644 --- a/Software/Visual_Studio/Tango.BL/DTO/ConfigurationDTO.cs +++ b/Software/Visual_Studio/Tango.BL/DTO/ConfigurationDTO.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.BL.Entities; namespace Tango.BL.DTO { @@ -11,9 +12,29 @@ namespace Tango.BL.DTO { public List IdsPacks { get; set; } + [ObservableDTOProperty(MapsTo = nameof(Configuration.ApplicationDisplayPanelVersion) + "." + nameof(Configuration.ApplicationDisplayPanelVersion.Name))] + public String ApplicationDisplayPanelVersionName { get; set; } + + [ObservableDTOProperty(MapsTo = nameof(Configuration.ApplicationFirmwareVersion) + "." + nameof(Configuration.ApplicationFirmwareVersion.Name))] + public String ApplicationFirmwareVersionName { get; set; } + + [ObservableDTOProperty(MapsTo = nameof(Configuration.ApplicationOsVersion) + "." + nameof(Configuration.ApplicationOsVersion.Name))] + public String ApplicationOsVersionName { get; set; } + + [ObservableDTOProperty(MapsTo = nameof(Configuration.EmbeddedFirmwareVersion) + "." + nameof(Configuration.EmbeddedFirmwareVersion.Name))] + public String EmbeddedFirmwareVersionName { get; set; } + + [ObservableDTOProperty(MapsTo = nameof(Configuration.HardwareVersion) + "." + nameof(Configuration.HardwareVersion.Name))] + public String HardwareVersionName { get; set; } + public ConfigurationDTO() { IdsPacks = new List(); } + + protected override string OnGetActionLogName() + { + return "Configuration"; + } } } diff --git a/Software/Visual_Studio/Tango.BL/DTO/IdsPackDTO.cs b/Software/Visual_Studio/Tango.BL/DTO/IdsPackDTO.cs index 3ca1e798b..071eb8bdf 100644 --- a/Software/Visual_Studio/Tango.BL/DTO/IdsPackDTO.cs +++ b/Software/Visual_Studio/Tango.BL/DTO/IdsPackDTO.cs @@ -4,15 +4,30 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.BL.Entities; namespace Tango.BL.DTO { public class IdsPackDTO : IdsPackDTOBase { - public CartridgeTypeDTO CartridgeType { get; set; } - public IdsPackFormulaDTO IdsPackFormula { get; set; } - public LiquidTypeDTO LiquidType { get; set; } - public MidTankTypeDTO MidTankType { get; set; } - public DispenserDTO Dispenser { get; set; } + [ObservableDTOProperty(MapsTo = nameof(IdsPack.CartridgeType) + "." + nameof(IdsPack.CartridgeType.Name))] + public String CartridgeTypeName { get; set; } + + [ObservableDTOProperty(MapsTo = nameof(IdsPack.IdsPackFormula) + "." + nameof(IdsPack.IdsPackFormula.Name))] + public String IdsPackFormulaName { get; set; } + + [ObservableDTOProperty(MapsTo = nameof(IdsPack.LiquidType) + "." + nameof(IdsPack.LiquidType.Name))] + public String LiquidTypeName { get; set; } + + [ObservableDTOProperty(MapsTo = nameof(IdsPack.MidTankType) + "." + nameof(IdsPack.MidTankType.Name))] + public String MidTankTypeName { get; set; } + + [ObservableDTOProperty(MapsTo = nameof(IdsPack.Dispenser) + "." + nameof(IdsPack.Dispenser.SerialNumber))] + public String DispenserSerialNumber { get; set; } + + protected override string OnGetActionLogName() + { + return $"IDS Pack '{PackIndex}'"; + } } } diff --git a/Software/Visual_Studio/Tango.BL/DTO/MachineDTO.cs b/Software/Visual_Studio/Tango.BL/DTO/MachineDTO.cs index 41eca6693..43535074d 100644 --- a/Software/Visual_Studio/Tango.BL/DTO/MachineDTO.cs +++ b/Software/Visual_Studio/Tango.BL/DTO/MachineDTO.cs @@ -9,6 +9,22 @@ namespace Tango.BL.DTO { public class MachineDTO : MachineDTOBase { + public ConfigurationDTO Configuration { get; set; } + //This is a bit more complicated to support. + //public List Cats { get; set; } + + public List Spools { get; set; } + + public MachineDTO() + { + //Cats = new List(); + Spools = new List(); + } + + protected override string OnGetActionLogName() + { + return $"Machine '{SerialNumber}'"; + } } } diff --git a/Software/Visual_Studio/Tango.BL/DTO/RmlDTO.cs b/Software/Visual_Studio/Tango.BL/DTO/RmlDTO.cs index a221a760c..8931a4b3e 100644 --- a/Software/Visual_Studio/Tango.BL/DTO/RmlDTO.cs +++ b/Software/Visual_Studio/Tango.BL/DTO/RmlDTO.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.BL.Entities; namespace Tango.BL.DTO { @@ -13,6 +14,9 @@ namespace Tango.BL.DTO public List LiquidTypesRmls { get; set; } + [ObservableDTOProperty(MapsTo = nameof(Rml.Cct) + "." + nameof(Rml.Cct.FileName))] + public String CctFileName { get; set; } + public RmlDTO() { ProcessParametersTablesGroups = new List(); diff --git a/Software/Visual_Studio/Tango.BL/DTO/SiteDTO.cs b/Software/Visual_Studio/Tango.BL/DTO/SiteDTO.cs index 320de2763..2ba9ca693 100644 --- a/Software/Visual_Studio/Tango.BL/DTO/SiteDTO.cs +++ b/Software/Visual_Studio/Tango.BL/DTO/SiteDTO.cs @@ -4,11 +4,36 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.BL.Entities; namespace Tango.BL.DTO { public class SiteDTO : SiteDTOBase { + public List SiteRmls { get; set; } + public List SiteCatalogs { get; set; } + + public String OrganizationName { get; set; } + + public SiteDTO() + { + SiteRmls = new List(); + SiteCatalogs = new List(); + } + + public static SiteDTO FromObservable(Site observable, IEnumerable siteRmls, IEnumerable siteCatalogs, String organizationName) + { + SiteDTO dto = FromObservable(observable); + dto.OrganizationName = organizationName; + dto.SiteRmls = siteRmls.Select(x => SitesRmlDTO.FromObservable(x)).ToList(); + dto.SiteCatalogs = siteCatalogs.Select(x => SitesCatalogDTO.FromObservable(x)).ToList(); + return dto; + } + + protected override string OnGetActionLogName() + { + return $"Site '{Name}'"; + } } } diff --git a/Software/Visual_Studio/Tango.BL/DTO/SitesRmlDTO.cs b/Software/Visual_Studio/Tango.BL/DTO/SitesRmlDTO.cs index 527d710d0..0a5089072 100644 --- a/Software/Visual_Studio/Tango.BL/DTO/SitesRmlDTO.cs +++ b/Software/Visual_Studio/Tango.BL/DTO/SitesRmlDTO.cs @@ -4,11 +4,15 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.BL.Entities; namespace Tango.BL.DTO { public class SitesRmlDTO : SitesRmlDTOBase { - + protected override string OnGetActionLogName() + { + return $"RML '{RmlGuid}'"; + } } } diff --git a/Software/Visual_Studio/Tango.BL/DTO/SpoolDTO.cs b/Software/Visual_Studio/Tango.BL/DTO/SpoolDTO.cs index bf25d1e71..d6d79b1be 100644 --- a/Software/Visual_Studio/Tango.BL/DTO/SpoolDTO.cs +++ b/Software/Visual_Studio/Tango.BL/DTO/SpoolDTO.cs @@ -4,11 +4,18 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.BL.Entities; namespace Tango.BL.DTO { public class SpoolDTO : SpoolDTOBase { + [ObservableDTOProperty(MapsTo = nameof(Spool.SpoolType) + "." + nameof(Spool.SpoolType.Name))] + public String SpoolTypeName { get; set; } + protected override string OnGetActionLogName() + { + return $"'{(SpoolTypeName != null ? SpoolTypeName : SpoolTypeGuid)}' Calibration"; + } } } diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/ActionLogType.cs b/Software/Visual_Studio/Tango.BL/Enumerations/ActionLogType.cs index 5114538ef..76c790a9f 100644 --- a/Software/Visual_Studio/Tango.BL/Enumerations/ActionLogType.cs +++ b/Software/Visual_Studio/Tango.BL/Enumerations/ActionLogType.cs @@ -34,6 +34,8 @@ namespace Tango.BL.Enumerations HardwareVersionDeleted = 101, [Description("Hardware Version Saved")] HardwareVersionSaved = 102, + [Description("Hardware Version Imported")] + HardwareVersionImported = 103, //RML [Description("RML Created")] @@ -42,6 +44,10 @@ namespace Tango.BL.Enumerations RmlDeleted = 201, [Description("RML Saved")] RmlSaved = 202, + [Description("RML Imported")] + RmlImported = 203, + [Description("RML Active Process Parameters Changed")] + RmlActiveProcessParametersChanged = 204, //Jobs [Description("Job Created")] diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs index 10a732221..ade8f88bc 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs @@ -160,6 +160,8 @@ namespace Tango.MachineService.Controllers tangoUpdate.UpdateStatus = TangoUpdateStatuses.SetupStarted; db.TangoUpdates.Add(tangoUpdate); + machine.ProductionDate = DateTime.UtcNow; + db.SaveChanges(); _pendingUpdates.Add(new PPCPendingUpdate() -- cgit v1.3.1 From cd670d0404673efd095ae2baec1873b916c49c81 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Sat, 21 Dec 2019 23:17:25 +0200 Subject: Implemented not existing deleted RML check for PPC update and error message. Added proper notification when trying to remove used RML onMS. --- .../ViewModels/MainViewVM.cs | 10 +++++++++- .../MachineUpdate/MachineUpdateManager.cs | 1 + .../Tango.PPC.Common/Web/CheckForUpdateRequest.cs | 2 ++ .../Tango.PPC.Common/Web/CheckForUpdateResponse.cs | 2 ++ .../Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs | 23 ++++++++++++++++++++++ .../Controllers/PPCController.cs | 4 ++++ 6 files changed, 41 insertions(+), 1 deletion(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs index 527159aa5..5c55892ba 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs @@ -445,7 +445,7 @@ namespace Tango.MachineStudio.RML.ViewModels private async void RemoveSelectedRml() { - if (_notification.ShowQuestion("Removing the selected RML will result in the loss of all related process parameters and default calibration data. Are you sure you want to delete the selected RML?")) + if (_notification.ShowQuestion("Removing the selected thread will result in the loss of all related process parameters and default calibration data. Are you sure you want to delete the selected RML?")) { IsFree = false; @@ -453,6 +453,14 @@ namespace Tango.MachineStudio.RML.ViewModels { try { + var rml_jobs = await _rmls_context.Jobs.Where(x => x.RmlGuid == SelectedRML.Guid).Include(x => x.Machine).OrderBy(x => x.Machine.SerialNumber).ToListAsync(); + + if (rml_jobs.Count > 0) + { + _notification.ShowError($"The following jobs must be removed or change thread type before the selected thread can be deleted:\n{String.Join("\n",rml_jobs.Select(x => $"{x.Machine.SerialNumber} => {x.Name}"))}"); + return; + } + await SelectedRML.DeleteCascadeAsync(_rmls_context); _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.RmlDeleted, _authentication.CurrentUser, SelectedRML.Name, SelectedRML, "RML deleted from Machine Studio."); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs index d0424254b..8d6e02020 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs @@ -852,6 +852,7 @@ namespace Tango.PPC.Common.MachineUpdate request.Rmls = db.Rmls.ToList().Select(x => new UpdatedEntity(x)).ToList(); request.HardwareVersions = db.HardwareVersions.ToList().Select(x => new UpdatedEntity(x)).ToList(); request.Catalogs = db.ColorCatalogs.ToList().Select(x => new UpdatedEntity(x)).ToList(); + request.UsedRmlsGuids = db.Jobs.Select(x => x.RmlGuid).Distinct().ToList(); } } catch (Exception ex) diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/CheckForUpdateRequest.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/CheckForUpdateRequest.cs index 3d606b918..0d86fa117 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/CheckForUpdateRequest.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/CheckForUpdateRequest.cs @@ -16,12 +16,14 @@ namespace Tango.PPC.Common.Web public List HardwareVersions { get; set; } public List Catalogs { get; set; } public DateTime MachineLastUpdated { get; set; } + public List UsedRmlsGuids { get; set; } public CheckForUpdateRequest() { Rmls = new List(); HardwareVersions = new List(); Catalogs = new List(); + UsedRmlsGuids = new List(); } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/CheckForUpdateResponse.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/CheckForUpdateResponse.cs index a857a20a1..2fb33ebdc 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/CheckForUpdateResponse.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/CheckForUpdateResponse.cs @@ -16,10 +16,12 @@ namespace Tango.PPC.Common.Web public bool SetupFirmware { get; set; } public bool SetupFPGA { get; set; } public UpdateDBResponse UpdateDBResponse { get; set; } + public List UsedNotExistingRmlsGuids { get; set; } public CheckForUpdateResponse() { UpdateDBResponse = new UpdateDBResponse(); + UsedNotExistingRmlsGuids = new List(); } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs index 49b2aef89..0af977614 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs @@ -1,10 +1,12 @@ using System; using System.Collections.Generic; +using System.Data.Entity; using System.Diagnostics; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.BL; using Tango.Core.Commands; using Tango.Core.Helpers; using Tango.Explorer; @@ -156,6 +158,27 @@ namespace Tango.PPC.UI.ViewModels } var response = await MachineUpdateManager.CheckForUpdate(MachineProvider.Machine.SerialNumber); + + try + { + if (response.UsedNotExistingRmlsGuids.Count > 0) + { + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + var arr = response.UsedNotExistingRmlsGuids.ToArray(); + var jobs = await db.Jobs.Where(x => arr.Contains(x.RmlGuid)).ToListAsync(); + FailedError = $"The following jobs must be removed or change thread type before the system can be updated:\n{String.Join("\n", jobs.Select(x => x.Name))}"; + _isChecking = false; + await NavigateTo(MachineUpdateView.UpdateFailedView); + return; + } + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error on used RML check procedure."); + } + _checkUpdateResponse = response; if (response.IsUpdateAvailable) diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs index ade8f88bc..1bb025217 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs @@ -330,6 +330,10 @@ namespace Tango.MachineService.Controllers var hardwareVersions = db.HardwareVersions.Select(x => new { x.Guid, x.LastUpdated }).ToList(); var catalogs = db.ColorCatalogs.Select(x => new { x.Guid, x.LastUpdated }).ToList(); + var arr = request.UsedRmlsGuids.ToArray(); + var existingRml = db.Rmls.Where(x => arr.Contains(x.Guid)).Select(x => x.Guid).Distinct().ToList(); + response.UsedNotExistingRmlsGuids = arr.Where(x => !existingRml.Exists(y => y == x)).ToList(); + bool hasDatabaseUpdates = false; hasDatabaseUpdates = machine.LastUpdated > request.MachineLastUpdated; -- cgit v1.3.1 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. --- .../Views/JobView.xaml | 2 +- .../Views/ProcessParametersView.xaml | 2 +- .../Visual_Studio/Tango.BL/DTO/EventTypeDTOBase.cs | 5 --- .../Tango.BL/DTO/HardwareBlowerDTOBase.cs | 5 --- .../Tango.BL/DTO/HardwareMotorDTOBase.cs | 5 --- Software/Visual_Studio/Tango.BL/DTO/JobDTOBase.cs | 5 --- .../Visual_Studio/Tango.BL/DTO/JobRunDTOBase.cs | 5 --- .../Visual_Studio/Tango.BL/DTO/TechValveDTOBase.cs | 5 --- .../Tango.BL/Entities/ActionLogBase.cs | 1 + .../Visual_Studio/Tango.BL/Entities/AddressBase.cs | 1 + .../Entities/ApplicationDisplayPanelVersionBase.cs | 1 + .../Entities/ApplicationFirmwareVersionBase.cs | 1 + .../Tango.BL/Entities/ApplicationOsVersionBase.cs | 1 + .../Tango.BL/Entities/BrushStopBase.cs | 1 + .../Tango.BL/Entities/CartridgeTypeBase.cs | 1 + .../Visual_Studio/Tango.BL/Entities/CatBase.cs | 1 + .../Visual_Studio/Tango.BL/Entities/CctBase.cs | 1 + .../Tango.BL/Entities/ColorCatalogBase.cs | 1 + .../Tango.BL/Entities/ColorCatalogsGroupBase.cs | 1 + .../Tango.BL/Entities/ColorCatalogsItemBase.cs | 1 + .../Entities/ColorCatalogsItemsRecipeBase.cs | 1 + .../Tango.BL/Entities/ColorSpaceBase.cs | 1 + .../Tango.BL/Entities/ConfigurationBase.cs | 1 + .../Visual_Studio/Tango.BL/Entities/ContactBase.cs | 1 + .../Tango.BL/Entities/CustomerBase.cs | 1 + .../Tango.BL/Entities/DispenserBase.cs | 1 + .../Tango.BL/Entities/DispenserTypeBase.cs | 1 + .../Entities/EmbeddedFirmwareVersionBase.cs | 1 + .../Tango.BL/Entities/EventTypeBase.cs | 6 +--- .../Tango.BL/Entities/FiberShapeBase.cs | 1 + .../Tango.BL/Entities/FiberSynthBase.cs | 1 + .../Tango.BL/Entities/HardwareBlowerBase.cs | 9 +++--- .../Tango.BL/Entities/HardwareBlowerTypeBase.cs | 1 + .../Tango.BL/Entities/HardwareBreakSensorBase.cs | 1 + .../Entities/HardwareBreakSensorTypeBase.cs | 1 + .../Tango.BL/Entities/HardwareDancerBase.cs | 1 + .../Tango.BL/Entities/HardwareDancerTypeBase.cs | 1 + .../Tango.BL/Entities/HardwareMotorBase.cs | 6 +--- .../Tango.BL/Entities/HardwareMotorTypeBase.cs | 1 + .../Tango.BL/Entities/HardwarePidControlBase.cs | 1 + .../Entities/HardwarePidControlTypeBase.cs | 1 + .../Tango.BL/Entities/HardwareSpeedSensorBase.cs | 1 + .../Entities/HardwareSpeedSensorTypeBase.cs | 1 + .../Tango.BL/Entities/HardwareVersionBase.cs | 1 + .../Tango.BL/Entities/HardwareWinderBase.cs | 1 + .../Tango.BL/Entities/HardwareWinderTypeBase.cs | 1 + .../Visual_Studio/Tango.BL/Entities/IdsPackBase.cs | 1 + .../Tango.BL/Entities/IdsPackFormulaBase.cs | 1 + .../Visual_Studio/Tango.BL/Entities/JobBase.cs | 6 +--- .../Visual_Studio/Tango.BL/Entities/JobRunBase.cs | 6 +--- .../Tango.BL/Entities/LinearMassDensityUnitBase.cs | 1 + .../Tango.BL/Entities/LiquidTypeBase.cs | 1 + .../Tango.BL/Entities/LiquidTypesRmlBase.cs | 1 + .../Visual_Studio/Tango.BL/Entities/MachineBase.cs | 1 + .../Tango.BL/Entities/MachineStudioVersionBase.cs | 1 + .../Tango.BL/Entities/MachineVersionBase.cs | 1 + .../Tango.BL/Entities/MachinesEventBase.cs | 1 + .../Tango.BL/Entities/MediaConditionBase.cs | 1 + .../Tango.BL/Entities/MediaMaterialBase.cs | 1 + .../Tango.BL/Entities/MediaPurposBase.cs | 1 + .../Tango.BL/Entities/MidTankTypeBase.cs | 1 + .../Tango.BL/Entities/OrganizationBase.cs | 1 + .../Tango.BL/Entities/PermissionBase.cs | 1 + .../Entities/ProcessParametersTableBase.cs | 3 ++ .../Entities/ProcessParametersTablesGroupBase.cs | 1 + .../Visual_Studio/Tango.BL/Entities/RmlBase.cs | 1 + .../Visual_Studio/Tango.BL/Entities/RoleBase.cs | 1 + .../Tango.BL/Entities/RolesPermissionBase.cs | 1 + .../Visual_Studio/Tango.BL/Entities/SegmentBase.cs | 1 + .../Visual_Studio/Tango.BL/Entities/SiteBase.cs | 1 + .../Tango.BL/Entities/SitesCatalogBase.cs | 1 + .../Tango.BL/Entities/SitesRmlBase.cs | 1 + .../Visual_Studio/Tango.BL/Entities/SpoolBase.cs | 1 + .../Tango.BL/Entities/SpoolTypeBase.cs | 1 + .../Tango.BL/Entities/SyncConfigurationBase.cs | 1 + .../Tango.BL/Entities/SysdiagramBase.cs | 1 + .../Tango.BL/Entities/TangoUpdateBase.cs | 1 + .../Tango.BL/Entities/TangoVersionBase.cs | 1 + .../Tango.BL/Entities/TechControllerBase.cs | 1 + .../Tango.BL/Entities/TechDispenserBase.cs | 1 + .../Tango.BL/Entities/TechHeaterBase.cs | 1 + .../Visual_Studio/Tango.BL/Entities/TechIoBase.cs | 1 + .../Tango.BL/Entities/TechMonitorBase.cs | 1 + .../Tango.BL/Entities/TechValveBase.cs | 6 +--- .../Visual_Studio/Tango.BL/Entities/UserBase.cs | 1 + .../Tango.BL/Entities/UsersRoleBase.cs | 1 + .../Tango.BL/Entities/WindingMethodBase.cs | 1 + .../DbPropertyExtensionModel.cs | 36 ++++++++++++++++++++++ .../Tango.CodeGeneration/EntityCodeFile.cs | 2 +- .../Tango.CodeGeneration/RangeDescriptionModel.cs | 15 --------- .../Tango.CodeGeneration.csproj | 4 +-- .../Templates/EntityCodeFile.cshtml | 25 ++++++++++++--- .../CustomAttributes/StringFormatAttribute.cs | 24 +++++++++++++++ .../ExtensionMethods/IParameterizedExtensions.cs | 7 +++++ Software/Visual_Studio/Tango.Core/ParameterItem.cs | 13 ++++++++ .../Visual_Studio/Tango.Core/Tango.Core.csproj | 3 +- .../ObservablesGenerator.cs | 21 ++++++++----- .../Utilities/Tango.PMRGenerator.CLI/Program.cs | 4 +-- 98 files changed, 207 insertions(+), 95 deletions(-) create mode 100644 Software/Visual_Studio/Tango.CodeGeneration/DbPropertyExtensionModel.cs delete mode 100644 Software/Visual_Studio/Tango.CodeGeneration/RangeDescriptionModel.cs create mode 100644 Software/Visual_Studio/Tango.Core/CustomAttributes/StringFormatAttribute.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml index 3e6ffd396..b49f1407c 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml @@ -1553,7 +1553,7 @@ - + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ProcessParametersView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ProcessParametersView.xaml index b85fd2c12..cae614aeb 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ProcessParametersView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ProcessParametersView.xaml @@ -70,7 +70,7 @@ - + diff --git a/Software/Visual_Studio/Tango.BL/DTO/EventTypeDTOBase.cs b/Software/Visual_Studio/Tango.BL/DTO/EventTypeDTOBase.cs index 7b8e30dff..a708cccaf 100644 --- a/Software/Visual_Studio/Tango.BL/DTO/EventTypeDTOBase.cs +++ b/Software/Visual_Studio/Tango.BL/DTO/EventTypeDTOBase.cs @@ -18,11 +18,6 @@ using Tango.BL.Entities; namespace Tango.BL.DTO { - - /// - /// - /// - public abstract class EventTypeDTOBase : ObservableEntityDTO { diff --git a/Software/Visual_Studio/Tango.BL/DTO/HardwareBlowerDTOBase.cs b/Software/Visual_Studio/Tango.BL/DTO/HardwareBlowerDTOBase.cs index 9fb6b0bdd..4420c2d2c 100644 --- a/Software/Visual_Studio/Tango.BL/DTO/HardwareBlowerDTOBase.cs +++ b/Software/Visual_Studio/Tango.BL/DTO/HardwareBlowerDTOBase.cs @@ -18,11 +18,6 @@ using Tango.BL.Entities; namespace Tango.BL.DTO { - - /// - /// - /// - public abstract class HardwareBlowerDTOBase : ObservableEntityDTO { diff --git a/Software/Visual_Studio/Tango.BL/DTO/HardwareMotorDTOBase.cs b/Software/Visual_Studio/Tango.BL/DTO/HardwareMotorDTOBase.cs index 4c3125bf7..fcd36bb5d 100644 --- a/Software/Visual_Studio/Tango.BL/DTO/HardwareMotorDTOBase.cs +++ b/Software/Visual_Studio/Tango.BL/DTO/HardwareMotorDTOBase.cs @@ -18,11 +18,6 @@ using Tango.BL.Entities; namespace Tango.BL.DTO { - - /// - /// - /// - public abstract class HardwareMotorDTOBase : ObservableEntityDTO { diff --git a/Software/Visual_Studio/Tango.BL/DTO/JobDTOBase.cs b/Software/Visual_Studio/Tango.BL/DTO/JobDTOBase.cs index 073d833f2..ddf76bff0 100644 --- a/Software/Visual_Studio/Tango.BL/DTO/JobDTOBase.cs +++ b/Software/Visual_Studio/Tango.BL/DTO/JobDTOBase.cs @@ -18,11 +18,6 @@ using Tango.BL.Entities; namespace Tango.BL.DTO { - - /// - /// - /// - public abstract class JobDTOBase : ObservableEntityDTO { diff --git a/Software/Visual_Studio/Tango.BL/DTO/JobRunDTOBase.cs b/Software/Visual_Studio/Tango.BL/DTO/JobRunDTOBase.cs index 40d0a14c4..61d36d1e5 100644 --- a/Software/Visual_Studio/Tango.BL/DTO/JobRunDTOBase.cs +++ b/Software/Visual_Studio/Tango.BL/DTO/JobRunDTOBase.cs @@ -18,11 +18,6 @@ using Tango.BL.Entities; namespace Tango.BL.DTO { - - /// - /// - /// - public abstract class JobRunDTOBase : ObservableEntityDTO { diff --git a/Software/Visual_Studio/Tango.BL/DTO/TechValveDTOBase.cs b/Software/Visual_Studio/Tango.BL/DTO/TechValveDTOBase.cs index 2e28dfce7..a7b07fb0c 100644 --- a/Software/Visual_Studio/Tango.BL/DTO/TechValveDTOBase.cs +++ b/Software/Visual_Studio/Tango.BL/DTO/TechValveDTOBase.cs @@ -18,11 +18,6 @@ using Tango.BL.Entities; namespace Tango.BL.DTO { - - /// - /// - /// - public abstract class TechValveDTOBase : ObservableEntityDTO { diff --git a/Software/Visual_Studio/Tango.BL/Entities/ActionLogBase.cs b/Software/Visual_Studio/Tango.BL/Entities/ActionLogBase.cs index 077c834d2..060d81f8b 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/ActionLogBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/ActionLogBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/AddressBase.cs b/Software/Visual_Studio/Tango.BL/Entities/AddressBase.cs index f88efdb71..7e1229b98 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/AddressBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/AddressBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/ApplicationDisplayPanelVersionBase.cs b/Software/Visual_Studio/Tango.BL/Entities/ApplicationDisplayPanelVersionBase.cs index 1671069b3..82a5ea94b 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/ApplicationDisplayPanelVersionBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/ApplicationDisplayPanelVersionBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/ApplicationFirmwareVersionBase.cs b/Software/Visual_Studio/Tango.BL/Entities/ApplicationFirmwareVersionBase.cs index c54fe23d6..a816c7ad3 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/ApplicationFirmwareVersionBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/ApplicationFirmwareVersionBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/ApplicationOsVersionBase.cs b/Software/Visual_Studio/Tango.BL/Entities/ApplicationOsVersionBase.cs index 0e06e48db..20b58dbf2 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/ApplicationOsVersionBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/ApplicationOsVersionBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/BrushStopBase.cs b/Software/Visual_Studio/Tango.BL/Entities/BrushStopBase.cs index 0f742cc0b..89114f2c3 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/BrushStopBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/BrushStopBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/CartridgeTypeBase.cs b/Software/Visual_Studio/Tango.BL/Entities/CartridgeTypeBase.cs index 6281c7606..e0684e304 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/CartridgeTypeBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/CartridgeTypeBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/CatBase.cs b/Software/Visual_Studio/Tango.BL/Entities/CatBase.cs index 17bfd3f87..0c73be9ab 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/CatBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/CatBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/CctBase.cs b/Software/Visual_Studio/Tango.BL/Entities/CctBase.cs index 92f4f17b9..158615777 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/CctBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/CctBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/ColorCatalogBase.cs b/Software/Visual_Studio/Tango.BL/Entities/ColorCatalogBase.cs index f19eda455..df1056469 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/ColorCatalogBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/ColorCatalogBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/ColorCatalogsGroupBase.cs b/Software/Visual_Studio/Tango.BL/Entities/ColorCatalogsGroupBase.cs index 3e0491ec5..bc20a0c2e 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/ColorCatalogsGroupBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/ColorCatalogsGroupBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/ColorCatalogsItemBase.cs b/Software/Visual_Studio/Tango.BL/Entities/ColorCatalogsItemBase.cs index fe026fc32..30d77a051 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/ColorCatalogsItemBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/ColorCatalogsItemBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/ColorCatalogsItemsRecipeBase.cs b/Software/Visual_Studio/Tango.BL/Entities/ColorCatalogsItemsRecipeBase.cs index a0a324b9f..19b3aed14 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/ColorCatalogsItemsRecipeBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/ColorCatalogsItemsRecipeBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/ColorSpaceBase.cs b/Software/Visual_Studio/Tango.BL/Entities/ColorSpaceBase.cs index 9098a2eab..b35ca0431 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/ColorSpaceBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/ColorSpaceBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/ConfigurationBase.cs b/Software/Visual_Studio/Tango.BL/Entities/ConfigurationBase.cs index 6b19ebb7f..d7a90bcfd 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/ConfigurationBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/ConfigurationBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/ContactBase.cs b/Software/Visual_Studio/Tango.BL/Entities/ContactBase.cs index 610fcc27b..6fd8c9f4c 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/ContactBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/ContactBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/CustomerBase.cs b/Software/Visual_Studio/Tango.BL/Entities/CustomerBase.cs index 1d3dd576c..68e6b2df1 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/CustomerBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/CustomerBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/DispenserBase.cs b/Software/Visual_Studio/Tango.BL/Entities/DispenserBase.cs index a908da29c..8343fdb65 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/DispenserBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/DispenserBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/DispenserTypeBase.cs b/Software/Visual_Studio/Tango.BL/Entities/DispenserTypeBase.cs index 04f4dc261..829ea0cba 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/DispenserTypeBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/DispenserTypeBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/EmbeddedFirmwareVersionBase.cs b/Software/Visual_Studio/Tango.BL/Entities/EmbeddedFirmwareVersionBase.cs index 148d53c6c..25c7df99f 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/EmbeddedFirmwareVersionBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/EmbeddedFirmwareVersionBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/EventTypeBase.cs b/Software/Visual_Studio/Tango.BL/Entities/EventTypeBase.cs index f0100fe06..49675a89b 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/EventTypeBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/EventTypeBase.cs @@ -19,14 +19,10 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { - - /// - /// - /// - [Table("EVENT_TYPES")] public abstract class EventTypeBase : ObservableEntity { diff --git a/Software/Visual_Studio/Tango.BL/Entities/FiberShapeBase.cs b/Software/Visual_Studio/Tango.BL/Entities/FiberShapeBase.cs index cdc9bb76c..cfb335f62 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/FiberShapeBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/FiberShapeBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/FiberSynthBase.cs b/Software/Visual_Studio/Tango.BL/Entities/FiberSynthBase.cs index d04050c4a..dfb34224b 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/FiberSynthBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/FiberSynthBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/HardwareBlowerBase.cs b/Software/Visual_Studio/Tango.BL/Entities/HardwareBlowerBase.cs index bbc55d245..5cc6c4931 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/HardwareBlowerBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/HardwareBlowerBase.cs @@ -19,14 +19,10 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { - - /// - /// - /// - [Table("HARDWARE_BLOWERS")] public abstract class HardwareBlowerBase : ObservableEntity { @@ -131,8 +127,11 @@ namespace Tango.BL.Entities [Column("VOLTAGE")] [Description("Voltage Description")] + [Range(-10000,1000000)] + [StringFormat("0.0")] + public Double Voltage { get diff --git a/Software/Visual_Studio/Tango.BL/Entities/HardwareBlowerTypeBase.cs b/Software/Visual_Studio/Tango.BL/Entities/HardwareBlowerTypeBase.cs index dc614bd0c..99dadd1f5 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/HardwareBlowerTypeBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/HardwareBlowerTypeBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/HardwareBreakSensorBase.cs b/Software/Visual_Studio/Tango.BL/Entities/HardwareBreakSensorBase.cs index 9cbaac688..1ca65ab51 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/HardwareBreakSensorBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/HardwareBreakSensorBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/HardwareBreakSensorTypeBase.cs b/Software/Visual_Studio/Tango.BL/Entities/HardwareBreakSensorTypeBase.cs index 5d69f19b5..77a53c9a0 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/HardwareBreakSensorTypeBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/HardwareBreakSensorTypeBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/HardwareDancerBase.cs b/Software/Visual_Studio/Tango.BL/Entities/HardwareDancerBase.cs index a3fa5c1aa..65d60714a 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/HardwareDancerBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/HardwareDancerBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/HardwareDancerTypeBase.cs b/Software/Visual_Studio/Tango.BL/Entities/HardwareDancerTypeBase.cs index 3cd885790..7bff7c035 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/HardwareDancerTypeBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/HardwareDancerTypeBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/HardwareMotorBase.cs b/Software/Visual_Studio/Tango.BL/Entities/HardwareMotorBase.cs index e08a2b5b0..a0fb6f66e 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/HardwareMotorBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/HardwareMotorBase.cs @@ -19,14 +19,10 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { - - /// - /// - /// - [Table("HARDWARE_MOTORS")] public abstract class HardwareMotorBase : ObservableEntity { diff --git a/Software/Visual_Studio/Tango.BL/Entities/HardwareMotorTypeBase.cs b/Software/Visual_Studio/Tango.BL/Entities/HardwareMotorTypeBase.cs index a63a148da..59ceeada9 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/HardwareMotorTypeBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/HardwareMotorTypeBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/HardwarePidControlBase.cs b/Software/Visual_Studio/Tango.BL/Entities/HardwarePidControlBase.cs index e12e40f32..ccd56bca3 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/HardwarePidControlBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/HardwarePidControlBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/HardwarePidControlTypeBase.cs b/Software/Visual_Studio/Tango.BL/Entities/HardwarePidControlTypeBase.cs index dbb8d2a1d..d148ea177 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/HardwarePidControlTypeBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/HardwarePidControlTypeBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/HardwareSpeedSensorBase.cs b/Software/Visual_Studio/Tango.BL/Entities/HardwareSpeedSensorBase.cs index 3b7bb1e72..5661225cb 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/HardwareSpeedSensorBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/HardwareSpeedSensorBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/HardwareSpeedSensorTypeBase.cs b/Software/Visual_Studio/Tango.BL/Entities/HardwareSpeedSensorTypeBase.cs index 74ff9761d..384462516 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/HardwareSpeedSensorTypeBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/HardwareSpeedSensorTypeBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/HardwareVersionBase.cs b/Software/Visual_Studio/Tango.BL/Entities/HardwareVersionBase.cs index c3bc80696..3d7d555dc 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/HardwareVersionBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/HardwareVersionBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/HardwareWinderBase.cs b/Software/Visual_Studio/Tango.BL/Entities/HardwareWinderBase.cs index 4c2808581..8bcc5bb14 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/HardwareWinderBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/HardwareWinderBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/HardwareWinderTypeBase.cs b/Software/Visual_Studio/Tango.BL/Entities/HardwareWinderTypeBase.cs index 8c8055c1e..340748f97 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/HardwareWinderTypeBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/HardwareWinderTypeBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/IdsPackBase.cs b/Software/Visual_Studio/Tango.BL/Entities/IdsPackBase.cs index b3e62f1fe..650d93098 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/IdsPackBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/IdsPackBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/IdsPackFormulaBase.cs b/Software/Visual_Studio/Tango.BL/Entities/IdsPackFormulaBase.cs index 0108dc3f5..62d88bc77 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/IdsPackFormulaBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/IdsPackFormulaBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/JobBase.cs b/Software/Visual_Studio/Tango.BL/Entities/JobBase.cs index 45e0e3437..a535a78bd 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/JobBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/JobBase.cs @@ -19,14 +19,10 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { - - /// - /// - /// - [Table("JOBS")] public abstract class JobBase : ObservableEntity { diff --git a/Software/Visual_Studio/Tango.BL/Entities/JobRunBase.cs b/Software/Visual_Studio/Tango.BL/Entities/JobRunBase.cs index 5e8a3b62c..7d56f3fa8 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/JobRunBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/JobRunBase.cs @@ -19,14 +19,10 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { - - /// - /// - /// - [Table("JOB_RUNS")] public abstract class JobRunBase : ObservableEntity { diff --git a/Software/Visual_Studio/Tango.BL/Entities/LinearMassDensityUnitBase.cs b/Software/Visual_Studio/Tango.BL/Entities/LinearMassDensityUnitBase.cs index ccd78a60b..8f3ca38e8 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/LinearMassDensityUnitBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/LinearMassDensityUnitBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/LiquidTypeBase.cs b/Software/Visual_Studio/Tango.BL/Entities/LiquidTypeBase.cs index 7683eadbc..723b8aaa7 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/LiquidTypeBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/LiquidTypeBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/LiquidTypesRmlBase.cs b/Software/Visual_Studio/Tango.BL/Entities/LiquidTypesRmlBase.cs index 5aad28034..ef9e80cb9 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/LiquidTypesRmlBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/LiquidTypesRmlBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/MachineBase.cs b/Software/Visual_Studio/Tango.BL/Entities/MachineBase.cs index c02b103dd..b1fd12a53 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/MachineBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/MachineBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/MachineStudioVersionBase.cs b/Software/Visual_Studio/Tango.BL/Entities/MachineStudioVersionBase.cs index 83bf72451..65630a630 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/MachineStudioVersionBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/MachineStudioVersionBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/MachineVersionBase.cs b/Software/Visual_Studio/Tango.BL/Entities/MachineVersionBase.cs index 30602025e..440eaf723 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/MachineVersionBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/MachineVersionBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/MachinesEventBase.cs b/Software/Visual_Studio/Tango.BL/Entities/MachinesEventBase.cs index 0a3377dce..161e25d77 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/MachinesEventBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/MachinesEventBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/MediaConditionBase.cs b/Software/Visual_Studio/Tango.BL/Entities/MediaConditionBase.cs index 12405642a..ec7501ba4 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/MediaConditionBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/MediaConditionBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/MediaMaterialBase.cs b/Software/Visual_Studio/Tango.BL/Entities/MediaMaterialBase.cs index 2d0529506..860337fae 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/MediaMaterialBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/MediaMaterialBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/MediaPurposBase.cs b/Software/Visual_Studio/Tango.BL/Entities/MediaPurposBase.cs index 91fd93bd4..7a099ebeb 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/MediaPurposBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/MediaPurposBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/MidTankTypeBase.cs b/Software/Visual_Studio/Tango.BL/Entities/MidTankTypeBase.cs index 2467bcd8c..34c40f2a0 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/MidTankTypeBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/MidTankTypeBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/OrganizationBase.cs b/Software/Visual_Studio/Tango.BL/Entities/OrganizationBase.cs index c83d1a7c9..7fb8699af 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/OrganizationBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/OrganizationBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/PermissionBase.cs b/Software/Visual_Studio/Tango.BL/Entities/PermissionBase.cs index 7f6ba7499..d86097af1 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/PermissionBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/PermissionBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/ProcessParametersTableBase.cs b/Software/Visual_Studio/Tango.BL/Entities/ProcessParametersTableBase.cs index 2757b0625..1cc189e70 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/ProcessParametersTableBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/ProcessParametersTableBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { @@ -186,6 +187,8 @@ namespace Tango.BL.Entities [Column("FEEDER_TENSION")] + [StringFormat("0.000")] + public Double FeederTension { get diff --git a/Software/Visual_Studio/Tango.BL/Entities/ProcessParametersTablesGroupBase.cs b/Software/Visual_Studio/Tango.BL/Entities/ProcessParametersTablesGroupBase.cs index 79e252b44..005dd5b40 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/ProcessParametersTablesGroupBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/ProcessParametersTablesGroupBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/RmlBase.cs b/Software/Visual_Studio/Tango.BL/Entities/RmlBase.cs index 86545b913..6901fb973 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/RmlBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/RmlBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/RoleBase.cs b/Software/Visual_Studio/Tango.BL/Entities/RoleBase.cs index cca6b7600..ed8d67233 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/RoleBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/RoleBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/RolesPermissionBase.cs b/Software/Visual_Studio/Tango.BL/Entities/RolesPermissionBase.cs index bdaaaac3c..6fa2adf77 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/RolesPermissionBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/RolesPermissionBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/SegmentBase.cs b/Software/Visual_Studio/Tango.BL/Entities/SegmentBase.cs index 40f86a34c..f98239bf3 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/SegmentBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/SegmentBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/SiteBase.cs b/Software/Visual_Studio/Tango.BL/Entities/SiteBase.cs index f4881ae79..071dd7ea9 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/SiteBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/SiteBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/SitesCatalogBase.cs b/Software/Visual_Studio/Tango.BL/Entities/SitesCatalogBase.cs index 15f7ef6df..4f4665203 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/SitesCatalogBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/SitesCatalogBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/SitesRmlBase.cs b/Software/Visual_Studio/Tango.BL/Entities/SitesRmlBase.cs index 6893099e4..d9111def7 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/SitesRmlBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/SitesRmlBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/SpoolBase.cs b/Software/Visual_Studio/Tango.BL/Entities/SpoolBase.cs index 5794da91b..303f2ecbb 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/SpoolBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/SpoolBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/SpoolTypeBase.cs b/Software/Visual_Studio/Tango.BL/Entities/SpoolTypeBase.cs index 55edff2e0..778369948 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/SpoolTypeBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/SpoolTypeBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/SyncConfigurationBase.cs b/Software/Visual_Studio/Tango.BL/Entities/SyncConfigurationBase.cs index 91b1ca9ac..ea816c4f3 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/SyncConfigurationBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/SyncConfigurationBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/SysdiagramBase.cs b/Software/Visual_Studio/Tango.BL/Entities/SysdiagramBase.cs index 2e99df9b0..6be908bb4 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/SysdiagramBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/SysdiagramBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/TangoUpdateBase.cs b/Software/Visual_Studio/Tango.BL/Entities/TangoUpdateBase.cs index 57475977b..677886b47 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/TangoUpdateBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/TangoUpdateBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/TangoVersionBase.cs b/Software/Visual_Studio/Tango.BL/Entities/TangoVersionBase.cs index ddf7561af..f39df936a 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/TangoVersionBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/TangoVersionBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/TechControllerBase.cs b/Software/Visual_Studio/Tango.BL/Entities/TechControllerBase.cs index 72fe76f3c..b060ded50 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/TechControllerBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/TechControllerBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/TechDispenserBase.cs b/Software/Visual_Studio/Tango.BL/Entities/TechDispenserBase.cs index ccb3e7c03..ba6309950 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/TechDispenserBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/TechDispenserBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/TechHeaterBase.cs b/Software/Visual_Studio/Tango.BL/Entities/TechHeaterBase.cs index 2fc68c69c..5dc7d2a5a 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/TechHeaterBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/TechHeaterBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/TechIoBase.cs b/Software/Visual_Studio/Tango.BL/Entities/TechIoBase.cs index 0b140690f..e027e81b1 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/TechIoBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/TechIoBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/TechMonitorBase.cs b/Software/Visual_Studio/Tango.BL/Entities/TechMonitorBase.cs index d7ff856b6..f9f9c7140 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/TechMonitorBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/TechMonitorBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/TechValveBase.cs b/Software/Visual_Studio/Tango.BL/Entities/TechValveBase.cs index 5275c924b..e22bd450e 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/TechValveBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/TechValveBase.cs @@ -19,14 +19,10 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { - - /// - /// - /// - [Table("TECH_VALVES")] public abstract class TechValveBase : ObservableEntity { diff --git a/Software/Visual_Studio/Tango.BL/Entities/UserBase.cs b/Software/Visual_Studio/Tango.BL/Entities/UserBase.cs index cb7692b2d..5e3fa1a8f 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/UserBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/UserBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/UsersRoleBase.cs b/Software/Visual_Studio/Tango.BL/Entities/UsersRoleBase.cs index 2927d05f1..877f66c72 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/UsersRoleBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/UsersRoleBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { diff --git a/Software/Visual_Studio/Tango.BL/Entities/WindingMethodBase.cs b/Software/Visual_Studio/Tango.BL/Entities/WindingMethodBase.cs index ce4c22313..e64f989aa 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/WindingMethodBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/WindingMethodBase.cs @@ -19,6 +19,7 @@ using System.Linq; using Tango.DAL.Remote.DB; using Tango.Core; using System.ComponentModel; +using Tango.Core.CustomAttributes; namespace Tango.BL.Entities { 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 @@ - +