aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2019-12-08 00:19:54 +0200
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2019-12-08 00:19:54 +0200
commit3cd59dd3b04168ad91cb1fe51231e9b3ddd74705 (patch)
treeb7431f7fcdf3336a1811140a4e84d3660009d5f1 /Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs
parent00f7facd947e0e8ce05a43d4f9d036e8f9a6a69e (diff)
downloadTango-3cd59dd3b04168ad91cb1fe51231e9b3ddd74705.tar.gz
Tango-3cd59dd3b04168ad91cb1fe51231e9b3ddd74705.zip
Implemented fast database update detection of RMLL, Hardware Versions & Color Catalogs.
Related Work Items: #1622
Diffstat (limited to 'Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs')
-rw-r--r--Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs28
1 files changed, 28 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs
index f0239978f..2dee09e69 100644
--- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs
+++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs
@@ -314,6 +314,34 @@ namespace Tango.MachineService.Controllers
response.Version = latest_machine_version.Version;
+ //Compare database
+
+ var rmls = db.Rmls.Select(x => new { x.Guid, x.LastUpdated }).ToList();
+ var hardwareVersions = db.HardwareVersions.Select(x => new { x.Guid, x.LastUpdated }).ToList();
+ var catalogs = db.ColorCatalogs.Select(x => new { x.Guid, x.LastUpdated }).ToList();
+
+ bool hasDatabaseUpdates = false;
+
+ hasDatabaseUpdates = rmls.Exists(x => request.Rmls.Exists(y => x.Guid == y.Guid && x.LastUpdated > y.LastUpdated) || !request.Rmls.Exists(y => x.Guid == y.Guid));
+
+ if (!hasDatabaseUpdates)
+ {
+ hasDatabaseUpdates = hardwareVersions.Exists(x => request.HardwareVersions.Exists(y => x.Guid == y.Guid && x.LastUpdated > y.LastUpdated) || !request.HardwareVersions.Exists(y => x.Guid == y.Guid));
+ }
+
+ if (!hasDatabaseUpdates)
+ {
+ hasDatabaseUpdates = catalogs.Exists(x => request.Catalogs.Exists(y => x.Guid == y.Guid && x.LastUpdated > y.LastUpdated) || !request.Catalogs.Exists(y => x.Guid == y.Guid));
+ }
+
+ if (hasDatabaseUpdates)
+ {
+ response.IsDatabaseUpdateAvailable = true;
+ response.UpdateDBResponse = UpdateDB(new UpdateDBRequest() { SerialNumber = request.SerialNumber });
+ }
+
+ //Compare database
+
if (machine.ForceVersionUpdate)
{
response.IsUpdateAvailable = true;