aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Web/Tango.MachineService/Controllers
diff options
context:
space:
mode:
authorVictoria Plitt <Victoria.Plitt@twine-s.com>2019-12-09 17:00:30 +0200
committerVictoria Plitt <Victoria.Plitt@twine-s.com>2019-12-09 17:00:30 +0200
commit31ece903df45b0ab8ffb61fdd290d9fbea2a6836 (patch)
tree180be785ceb98fb828009eeae4dfa3bbc8a738b7 /Software/Visual_Studio/Web/Tango.MachineService/Controllers
parent4417c2eccb3795330144afa39e3bf271652bd31f (diff)
parentaeabb681d16451e191a1620d4eebf40549771491 (diff)
downloadTango-31ece903df45b0ab8ffb61fdd290d9fbea2a6836.tar.gz
Tango-31ece903df45b0ab8ffb61fdd290d9fbea2a6836.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/Web/Tango.MachineService/Controllers')
-rw-r--r--Software/Visual_Studio/Web/Tango.MachineService/Controllers/MachineStudioController.cs10
-rw-r--r--Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs40
2 files changed, 49 insertions, 1 deletions
diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/MachineStudioController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/MachineStudioController.cs
index dd8401570..2eeaa6e0e 100644
--- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/MachineStudioController.cs
+++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/MachineStudioController.cs
@@ -99,6 +99,11 @@ namespace Tango.MachineService.Controllers
response.BlobAddress = blob.GenerateReadSignature(TimeSpan.FromMinutes(60));
+ if (!String.IsNullOrWhiteSpace(MachineServiceConfig.CDN_ENDPOINT))
+ {
+ response.CdnAddress = MachineServiceConfig.CDN_ENDPOINT + blob.Uri.AbsolutePath;
+ }
+
response.IsUpdateAvailable = true;
response.Version = latestVersion.Version;
response.Comments = latestVersion.Comments;
@@ -133,6 +138,11 @@ namespace Tango.MachineService.Controllers
var container = manager.GetContainer(MachineServiceConfig.MACHINE_STUDIO_VERSIONS_CONTAINER);
var blob = container.GetBlockBlobReference(latestVersion.BlobName);
+ if (!String.IsNullOrWhiteSpace(MachineServiceConfig.CDN_ENDPOINT))
+ {
+ response.CdnAddress = MachineServiceConfig.CDN_ENDPOINT + blob.Uri.AbsolutePath;
+ }
+
response.BlobAddress = blob.GenerateReadSignature(TimeSpan.FromMinutes(60));
response.Version = latestVersion.Version;
}
diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs
index 4c39aad80..2dee09e69 100644
--- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs
+++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs
@@ -32,7 +32,7 @@ namespace Tango.MachineService.Controllers
private static List<PPCPendingUpload> _pendingUploads;
private static List<PPCPendingUpdate> _pendingUpdates;
private ActiveDirectoryManager _ad_manager;
- private const int SQL_TEMP_CREDENTIALS_EXP_MINUTS = 20;
+ private const int SQL_TEMP_CREDENTIALS_EXP_MINUTS = 20;
public class TokenObject
{
@@ -114,6 +114,11 @@ namespace Tango.MachineService.Controllers
response.BlobAddress = blob.GenerateReadSignature(TimeSpan.FromMinutes(60));
+ if (!String.IsNullOrWhiteSpace(MachineServiceConfig.CDN_ENDPOINT))
+ {
+ response.CdnAddress = MachineServiceConfig.CDN_ENDPOINT + blob.Uri.AbsolutePath;
+ }
+
DbCredentials credentials = new DbCredentials();
using (SmoManager smo = new SmoManager())
@@ -197,6 +202,11 @@ namespace Tango.MachineService.Controllers
response.BlobAddress = blob.GenerateReadSignature(TimeSpan.FromMinutes(60));
+ if (!String.IsNullOrWhiteSpace(MachineServiceConfig.CDN_ENDPOINT))
+ {
+ response.CdnAddress = MachineServiceConfig.CDN_ENDPOINT + blob.Uri.AbsolutePath;
+ }
+
DbCredentials credentials = new DbCredentials();
using (SmoManager smo = new SmoManager())
@@ -304,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;