aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio')
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.BL/DataResolver.cs38
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.BL/DataResolverNode.cs1
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.BL/EntityRepositoryBase.cs90
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.BL/Services/MachineEventsService.cs41
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.BL/Services/MachinesService.cs84
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.BL/Services/PublishedProcedureProjectsService.cs37
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.BL/Services/TangoVersionsService.cs36
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.BL/Services/TechComponentsService.cs8
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.BL/Services/UsersService.cs26
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.BL/Web/FSEWebClientBase.cs54
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetEventTypesRequest.cs14
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetEventTypesResponse.cs21
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetMachineRequest.cs17
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetMachineResponse.cs16
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetProceduresRequest.cs14
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetProceduresResponse.cs21
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetTangoVersionsRequest.cs14
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetTangoVersionsResponse.cs21
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetTechComponentsRequest.cs23
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetTechComponentsResponse.cs34
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetUserRequest.cs14
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetUserResponse.cs16
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.Web/Tango.FSE.Web.csproj16
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.Service/DB/TccDbContext.cs2
-rw-r--r--Software/Visual_Studio/Tango.BL/DTO/ConfigurationDTO.cs2
-rw-r--r--Software/Visual_Studio/Tango.BL/DTO/MachineDTO.cs10
-rw-r--r--Software/Visual_Studio/Tango.BL/DTO/PublishedProcedureProjectDTO.cs5
-rw-r--r--Software/Visual_Studio/Tango.BL/Entities/User.cs3
-rw-r--r--Software/Visual_Studio/Tango.Web/Helpers/ObservablesContextHelper.cs2
-rw-r--r--Software/Visual_Studio/Web/Tango.MachineService/Controllers/DataStoreController.cs6
-rw-r--r--Software/Visual_Studio/Web/Tango.MachineService/Controllers/DownloadsController.cs2
-rw-r--r--Software/Visual_Studio/Web/Tango.MachineService/Controllers/FSEAccountController.cs2
-rw-r--r--Software/Visual_Studio/Web/Tango.MachineService/Controllers/FSEController.cs178
-rw-r--r--Software/Visual_Studio/Web/Tango.MachineService/Controllers/FSEDownloadsController.cs2
-rw-r--r--Software/Visual_Studio/Web/Tango.MachineService/Controllers/MachineStudioController.cs18
-rw-r--r--Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs42
36 files changed, 868 insertions, 62 deletions
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.BL/DataResolver.cs b/Software/Visual_Studio/FSE/Tango.FSE.BL/DataResolver.cs
index 984a2e8ea..9504ae0af 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.BL/DataResolver.cs
+++ b/Software/Visual_Studio/FSE/Tango.FSE.BL/DataResolver.cs
@@ -21,6 +21,7 @@ namespace Tango.FSE.BL
private static object diskLock = new object();
private static IConnectivityProvider _connectivity;
private Func<DataResolverContext, T> _onlineAction;
+ private Func<DataResolverContext, T> _webAction;
private Func<DataResolverContext, T> _diskCacheAction;
private Func<DataResolverContext, T> _memoryCacheAction;
private Action<Exception> _onError;
@@ -73,7 +74,21 @@ namespace Tango.FSE.BL
fallingBackText = $" Falling back to {nodes[nodes.IndexOf(node) + 1]}...";
}
- if (node == DataResolverNode.Online)
+ if (node == DataResolverNode.Web)
+ {
+ try
+ {
+ if (_enableLogs) LogManager.Log($"Trying {_callingName} via web...");
+ result = ExecuteWebAction(context);
+ break;
+ }
+ catch (Exception ex)
+ {
+ if (_enableLogs) LogManager.Log($"{_callingName} via web failed with exception: {ex.FlattenMessage()}{fallingBackText}", LogCategory.Warning);
+ context.LastError = ex;
+ }
+ }
+ else if (node == DataResolverNode.Online)
{
try
{
@@ -159,6 +174,16 @@ namespace Tango.FSE.BL
return _onlineAction.Invoke(context);
}
+ private T ExecuteWebAction(DataResolverContext context)
+ {
+ if (!_connectivity.CheckOnline())
+ {
+ throw new InternetConnectionException();
+ }
+
+ return _webAction.Invoke(context);
+ }
+
#region Context
/// <summary>
@@ -235,6 +260,17 @@ namespace Tango.FSE.BL
}
/// <summary>
+ /// Specify the method for the web client node.
+ /// </summary>
+ /// <param name="func">The method.</param>
+ /// <returns></returns>
+ public Builder Web(Func<DataResolverContext, T> func)
+ {
+ _resolver._webAction = func;
+ return this;
+ }
+
+ /// <summary>
/// Specify the method for the disk cache node.
/// </summary>
/// <param name="func">The method.</param>
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.BL/DataResolverNode.cs b/Software/Visual_Studio/FSE/Tango.FSE.BL/DataResolverNode.cs
index 4c5643e2b..d95e3a745 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.BL/DataResolverNode.cs
+++ b/Software/Visual_Studio/FSE/Tango.FSE.BL/DataResolverNode.cs
@@ -12,6 +12,7 @@ namespace Tango.FSE.BL
public enum DataResolverNode
{
Online,
+ Web,
DiskCache,
InMemoryCache
}
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.BL/EntityRepositoryBase.cs b/Software/Visual_Studio/FSE/Tango.FSE.BL/EntityRepositoryBase.cs
index 3bc183d11..06bd67c08 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.BL/EntityRepositoryBase.cs
+++ b/Software/Visual_Studio/FSE/Tango.FSE.BL/EntityRepositoryBase.cs
@@ -8,6 +8,8 @@ using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Tango.BL;
+using Tango.BL.Entities;
+using Tango.FSE.Web.Messages;
namespace Tango.FSE.BL
{
@@ -40,6 +42,94 @@ namespace Tango.FSE.BL
.Select(x => ConvertToEntity(x))
.ToList();
})
+ .Web((context) =>
+ {
+ List<TEntity> entities = new List<TEntity>();
+
+ if (typeof(TEntity) == typeof(TechMonitor))
+ {
+ entities = WebClient.GetTechComponents(new GetTechComponentsRequest() { Monitors = true }).GetAwaiter().GetResult()
+ .Monitors.Select(x => x.ToObservable())
+ .Cast<TEntity>().ToList();
+ }
+ else if (typeof(TEntity) == typeof(TechIo))
+ {
+ entities = WebClient.GetTechComponents(new GetTechComponentsRequest() { IOs = true }).GetAwaiter().GetResult()
+ .IOs.Select(x => x.ToObservable())
+ .Cast<TEntity>().ToList();
+ }
+ else if (typeof(TEntity) == typeof(TechDispenser))
+ {
+ entities = WebClient.GetTechComponents(new GetTechComponentsRequest() { Dispensers = true }).GetAwaiter().GetResult()
+ .Dispensers.Select(x => x.ToObservable())
+ .Cast<TEntity>().ToList();
+ }
+ else if (typeof(TEntity) == typeof(TechController))
+ {
+ entities = WebClient.GetTechComponents(new GetTechComponentsRequest() { Controllers = true }).GetAwaiter().GetResult()
+ .Controllers.Select(x => x.ToObservable())
+ .Cast<TEntity>().ToList();
+ }
+ else if (typeof(TEntity) == typeof(TechHeater))
+ {
+ entities = WebClient.GetTechComponents(new GetTechComponentsRequest() { Heaters = true }).GetAwaiter().GetResult()
+ .Heaters.Select(x => x.ToObservable())
+ .Cast<TEntity>().ToList();
+ }
+ else if (typeof(TEntity) == typeof(TechValve))
+ {
+ entities = WebClient.GetTechComponents(new GetTechComponentsRequest() { Valves = true }).GetAwaiter().GetResult()
+ .Valves.Select(x => x.ToObservable())
+ .Cast<TEntity>().ToList();
+ }
+ else if (typeof(TEntity) == typeof(HardwareMotorType))
+ {
+ entities = WebClient.GetTechComponents(new GetTechComponentsRequest() { Motors = true }).GetAwaiter().GetResult()
+ .Motors.Select(x => x.ToObservable())
+ .Cast<TEntity>().ToList();
+ }
+ else if (typeof(TEntity) == typeof(HardwareBlowerType))
+ {
+ entities = WebClient.GetTechComponents(new GetTechComponentsRequest() { Blowers = true }).GetAwaiter().GetResult()
+ .Blowers.Select(x => x.ToObservable())
+ .Cast<TEntity>().ToList();
+ }
+
+ List<TCachedEntity> cachedEntities = new List<TCachedEntity>();
+
+ try
+ {
+ foreach (var entity in entities)
+ {
+ var cachedEntity = ConvertToCached(entity);
+ cachedEntities.Add(cachedEntity);
+ _memoryCache.Put(entity.Guid, cachedEntity);
+ }
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, $"Error occurred while trying to cache entities of type '{typeof(TEntity).Name}' to memory.");
+ }
+
+ try
+ {
+ using (var cache = DiskCache.CreateContext())
+ {
+ var collection = cache.Database.GetCollection<TCachedEntity>();
+
+ foreach (var cachedEntity in cachedEntities)
+ {
+ collection.Upsert(cachedEntity);
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, $"Error occurred while trying to cache entities of type '{typeof(TEntity).Name}' to disk.");
+ }
+
+ return entities;
+ })
.Online((context) =>
{
using (ObservablesContext db = ObservablesContext.CreateDefault())
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.BL/Services/MachineEventsService.cs b/Software/Visual_Studio/FSE/Tango.FSE.BL/Services/MachineEventsService.cs
index 4b2609a94..2c74ad8de 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.BL/Services/MachineEventsService.cs
+++ b/Software/Visual_Studio/FSE/Tango.FSE.BL/Services/MachineEventsService.cs
@@ -6,6 +6,7 @@ using System.Threading.Tasks;
using Tango.BL;
using Tango.BL.Entities;
using Tango.FSE.BL.CacheEntities;
+using Tango.FSE.Web.Messages;
namespace Tango.FSE.BL.Services
{
@@ -22,7 +23,7 @@ namespace Tango.FSE.BL.Services
public Task<List<EventType>> GetAllEventTypes()
{
return DataResolver<List<EventType>>.Builder.New()
- .ConfigureCascade(DataResolverNode.InMemoryCache, DataResolverNode.Online, DataResolverNode.DiskCache)
+ .ConfigureCascade(DataResolverNode.InMemoryCache, DataResolverNode.Web, DataResolverNode.Online, DataResolverNode.DiskCache)
.InMemoryCache((context) =>
{
var eventTypes = _eventTypesCache
@@ -37,6 +38,44 @@ namespace Tango.FSE.BL.Services
return eventTypes;
})
+ .Web((context) =>
+ {
+ var eventTypes = WebClient.GetEventTypes(new GetEventTypesRequest()).GetAwaiter().GetResult().EventTypes.Select(x => x.ToObservable()).ToList();
+
+ List<CachedEventType> cachedEventTypes = new List<CachedEventType>();
+
+ try
+ {
+ foreach (var eventType in eventTypes)
+ {
+ var cachedEventType = CachedEventType.FromObservable<CachedEventType>(eventType);
+ _eventTypesCache.Put(cachedEventType.Guid, cachedEventType);
+ }
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, "Error caching event types on memory.");
+ }
+
+ try
+ {
+ using (var cache = DiskCache.CreateContext())
+ {
+ var collection = cache.Database.GetCollection<CachedEventType>(EVENT_TYPES_COLLECTION);
+
+ foreach (var cachedEventType in cachedEventTypes)
+ {
+ collection.Upsert(cachedEventType);
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, "Error caching event types to disk.");
+ }
+
+ return eventTypes;
+ })
.Online((context) =>
{
using (ObservablesContext db = ObservablesContext.CreateDefault())
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.BL/Services/MachinesService.cs b/Software/Visual_Studio/FSE/Tango.FSE.BL/Services/MachinesService.cs
index db1965397..5ad99f692 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.BL/Services/MachinesService.cs
+++ b/Software/Visual_Studio/FSE/Tango.FSE.BL/Services/MachinesService.cs
@@ -15,6 +15,7 @@ using Z.EntityFramework.Plus;
using Z.EntityFramework.Extensions;
using Tango.BL.Enumerations;
using Tango.Settings;
+using Tango.FSE.Web.Messages;
namespace Tango.FSE.BL.Services
{
@@ -54,11 +55,49 @@ namespace Tango.FSE.BL.Services
bool allowAll = CurrentUser.HasPermission(Permissions.FSE_ConnectAnyMachine);
return DataResolver<Machine>.Builder.New()
- .ConfigureCascade(DataResolverNode.InMemoryCache, DataResolverNode.Online, DataResolverNode.DiskCache)
+ .ConfigureCascade(DataResolverNode.InMemoryCache, DataResolverNode.Web, DataResolverNode.Online, DataResolverNode.DiskCache)
.InMemoryCache((context) =>
{
return _machinesCache.Get(serialNumber).ToObservable();
})
+ .Web((context) =>
+ {
+ var response = WebClient.GetMachine(new GetMachineRequest()
+ {
+ AllowAllMachines = allowAll,
+ OrganizationGuid = CurrentUser.OrganizationGuid,
+ SerialNumber = serialNumber
+ }).GetAwaiter().GetResult();
+
+ if (response.Machine != null)
+ {
+ var machine = response.Machine.ToObservable();
+
+ LogManager.Log("Machine retrieved successfully. Caching machine...");
+
+ var cachedMachine = CachedMachine.FromObservable<CachedMachine>(machine);
+
+ //Store in memory cache.
+ _machinesCache.Put(serialNumber, cachedMachine);
+
+ //Store disk cache.
+ try
+ {
+ using (var cache = DiskCache.CreateContext())
+ {
+ cache.Database.GetCollection<CachedMachine>(MACHINES_COLLECTION).Upsert(cachedMachine);
+ }
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, "Error caching machine on disk.");
+ }
+
+ return machine;
+ }
+
+ throw new ArgumentOutOfRangeException($"Could not locate machine with serial number '{serialNumber}' using the remote server.");
+ })
.Online((context) =>
{
using (ObservablesContext db = ObservablesContext.CreateDefault())
@@ -132,11 +171,52 @@ namespace Tango.FSE.BL.Services
return DataResolver<Machine>.Builder.New()
.EnableLogs(enableLogs)
- .ConfigureCascade(DataResolverNode.InMemoryCache, DataResolverNode.Online, DataResolverNode.DiskCache)
+ .ConfigureCascade(DataResolverNode.InMemoryCache, DataResolverNode.Web, DataResolverNode.Online, DataResolverNode.DiskCache)
.InMemoryCache((context) =>
{
return _machinesCacheFull.Get(serialNumber).ToObservable();
})
+ .Web((context) =>
+ {
+ var response = WebClient.GetMachine(new GetMachineRequest()
+ {
+ AllowAllMachines = allowAll,
+ OrganizationGuid = CurrentUser.OrganizationGuid,
+ SerialNumber = serialNumber,
+ GetExtendedInfo = true
+ }).GetAwaiter().GetResult();
+
+ if (response.Machine != null)
+ {
+ var machine = response.Machine.ToObservable();
+
+ if (enableLogs) LogManager.Log("Machine retrieved successfully. Caching machine on disk and in memory...");
+
+ var cachedMachine = CachedMachine.FromObservable<CachedMachine>(machine);
+
+ //Store in memory cache.
+ _machinesCacheFull.Put(serialNumber, cachedMachine);
+
+ //Store disk cache.
+ try
+ {
+ using (var cache = DiskCache.CreateContext())
+ {
+ cache.Database.GetCollection<CachedMachine>(FULL_MACHINES_COLLECTION).Upsert(cachedMachine);
+ }
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, $"Error caching machine '{serialNumber}' on disk.");
+ }
+
+ return machine;
+ }
+ else
+ {
+ throw new ArgumentOutOfRangeException($"Could not locate machine with serial number '{serialNumber}' on the remote database.");
+ }
+ })
.Online((context) =>
{
using (ObservablesContext db = ObservablesContext.CreateDefault())
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.BL/Services/PublishedProcedureProjectsService.cs b/Software/Visual_Studio/FSE/Tango.FSE.BL/Services/PublishedProcedureProjectsService.cs
index 9416fd0e4..c34b2eb86 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.BL/Services/PublishedProcedureProjectsService.cs
+++ b/Software/Visual_Studio/FSE/Tango.FSE.BL/Services/PublishedProcedureProjectsService.cs
@@ -8,6 +8,7 @@ using Tango.BL;
using Tango.BL.Entities;
using Tango.BL.Enumerations;
using Tango.FSE.BL.CacheEntities;
+using Tango.FSE.Web.Messages;
using Z.EntityFramework.Plus;
namespace Tango.FSE.BL.Services
@@ -26,7 +27,7 @@ namespace Tango.FSE.BL.Services
public Task<List<PublishedProcedureProject>> GetPublishedProcedureProjects(bool visibleOnly = true)
{
return DataResolver<List<PublishedProcedureProject>>.Builder.New()
- .ConfigureCascade(DataResolverNode.InMemoryCache, DataResolverNode.Online, DataResolverNode.DiskCache)
+ .ConfigureCascade(DataResolverNode.InMemoryCache, DataResolverNode.Web, DataResolverNode.Online, DataResolverNode.DiskCache)
.InMemoryCache((context) =>
{
var projects = _projectsCache.ToList().Where(x => x.IsVisible || !visibleOnly).Select(x => x.ToObservable()).ToList();
@@ -43,6 +44,40 @@ namespace Tango.FSE.BL.Services
return projects.OrderBy(x => x.SortingIndex).ToList();
})
+ .Web((context) =>
+ {
+ var response = WebClient.GetProcedures(new GetProceduresRequest() { GetOnlyVisible = visibleOnly }).GetAwaiter().GetResult();
+
+ var projects = response.Projects.Select(x => x.ToObservable()).ToList();
+
+ if (!CurrentUser.HasPermission(Permissions.FSE_ViewInternalPublishedProcedures))
+ {
+ projects.RemoveAll(x => x.ProjectVisibility == PublishedProcedureProjectVisibilities.Internal);
+ }
+
+ try
+ {
+ using (var cache = DiskCache.CreateContext())
+ {
+ var collection = cache.Database.GetCollection<CachedPublishedProcedureProject>(PUBLISHED_Procedure_PROJECTS_COLLECTION);
+
+ foreach (var project in projects)
+ {
+ var cachedProject = CachedPublishedProcedureProject.FromObservable<CachedPublishedProcedureProject>(project);
+ _projectsCache.Put(cachedProject.Guid, cachedProject);
+
+ collection.Upsert(cachedProject);
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, "Error caching published procedure projects.");
+ }
+
+
+ return projects.OrderBy(x => x.SortingIndex).ToList();
+ })
.Online((context) =>
{
using (ObservablesContext db = ObservablesContext.CreateDefault())
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.BL/Services/TangoVersionsService.cs b/Software/Visual_Studio/FSE/Tango.FSE.BL/Services/TangoVersionsService.cs
index 32c7b5b04..40783a989 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.BL/Services/TangoVersionsService.cs
+++ b/Software/Visual_Studio/FSE/Tango.FSE.BL/Services/TangoVersionsService.cs
@@ -9,6 +9,7 @@ using Tango.BL;
using Tango.BL.DTO;
using Tango.BL.Entities;
using Tango.FSE.BL.CacheEntities;
+using Tango.FSE.Web.Messages;
namespace Tango.FSE.BL.Services
{
@@ -29,7 +30,7 @@ namespace Tango.FSE.BL.Services
public Task<List<TangoVersion>> GetAllTangoVersions()
{
return DataResolver<List<TangoVersion>>.Builder.New()
- .ConfigureCascade(DataResolverNode.InMemoryCache, DataResolverNode.Online, DataResolverNode.DiskCache)
+ .ConfigureCascade(DataResolverNode.InMemoryCache, DataResolverNode.Web, DataResolverNode.Online, DataResolverNode.DiskCache)
.InMemoryCache((context) =>
{
var tangoVersions = _tangoVersionsCache
@@ -46,6 +47,39 @@ namespace Tango.FSE.BL.Services
return tangoVersions;
})
+ .Web((context) =>
+ {
+ var tangoVersions = WebClient.GetTangoVersions(new GetTangoVersionsRequest()).GetAwaiter().GetResult()
+ .Versions
+ .Select(x => x.ToObservable())
+ .ToList();
+
+ using (var cache = DiskCache.CreateContext())
+ {
+ var collection = cache.Database.GetCollection<CachedTangoVersion>(TANGO_VERSIONS_COLLECTION);
+
+ foreach (var tangoVersion in tangoVersions)
+ {
+ try
+ {
+ var tangoVersionDTO = TangoVersionDTO.FromObservable(tangoVersion);
+ CachedTangoVersion cachedTangoVersion = new CachedTangoVersion();
+ cachedTangoVersion.EnvironmentID = Authentication.CurrentEnvironment.ID;
+ cachedTangoVersion.TangoVersion = tangoVersionDTO;
+
+ _tangoVersionsCache.Put(tangoVersion.Version, Authentication.CurrentEnvironment.ID, cachedTangoVersion);
+
+ collection.Upsert(cachedTangoVersion);
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, $"Error caching Tango version '{tangoVersion.Version}' on disk.");
+ }
+ }
+ }
+
+ return tangoVersions;
+ })
.Online((context) =>
{
using (ObservablesContext db = ObservablesContext.CreateDefault())
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.BL/Services/TechComponentsService.cs b/Software/Visual_Studio/FSE/Tango.FSE.BL/Services/TechComponentsService.cs
index 418c03409..5277b5539 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.BL/Services/TechComponentsService.cs
+++ b/Software/Visual_Studio/FSE/Tango.FSE.BL/Services/TechComponentsService.cs
@@ -28,6 +28,7 @@ namespace Tango.FSE.BL.Services
x => x.ToObservable(),
x => TechMonitorDTO.FromObservable(x),
DataResolverNode.InMemoryCache,
+ DataResolverNode.Web,
DataResolverNode.Online,
DataResolverNode.DiskCache);
@@ -35,6 +36,7 @@ namespace Tango.FSE.BL.Services
x => x.ToObservable(),
x => TechIoDTO.FromObservable(x),
DataResolverNode.InMemoryCache,
+ DataResolverNode.Web,
DataResolverNode.Online,
DataResolverNode.DiskCache);
@@ -42,6 +44,7 @@ namespace Tango.FSE.BL.Services
x => x.ToObservable(),
x => TechDispenserDTO.FromObservable(x),
DataResolverNode.InMemoryCache,
+ DataResolverNode.Web,
DataResolverNode.Online,
DataResolverNode.DiskCache);
@@ -49,6 +52,7 @@ namespace Tango.FSE.BL.Services
x => x.ToObservable(),
x => TechControllerDTO.FromObservable(x),
DataResolverNode.InMemoryCache,
+ DataResolverNode.Web,
DataResolverNode.Online,
DataResolverNode.DiskCache);
@@ -56,6 +60,7 @@ namespace Tango.FSE.BL.Services
x => x.ToObservable(),
x => TechHeaterDTO.FromObservable(x),
DataResolverNode.InMemoryCache,
+ DataResolverNode.Web,
DataResolverNode.Online,
DataResolverNode.DiskCache);
@@ -63,6 +68,7 @@ namespace Tango.FSE.BL.Services
x => x.ToObservable(),
x => TechValveDTO.FromObservable(x),
DataResolverNode.InMemoryCache,
+ DataResolverNode.Web,
DataResolverNode.Online,
DataResolverNode.DiskCache);
@@ -70,6 +76,7 @@ namespace Tango.FSE.BL.Services
x => x.ToObservable(),
x => HardwareMotorTypeDTO.FromObservable(x),
DataResolverNode.InMemoryCache,
+ DataResolverNode.Web,
DataResolverNode.Online,
DataResolverNode.DiskCache);
@@ -77,6 +84,7 @@ namespace Tango.FSE.BL.Services
x => x.ToObservable(),
x => HardwareBlowerTypeDTO.FromObservable(x),
DataResolverNode.InMemoryCache,
+ DataResolverNode.Web,
DataResolverNode.Online,
DataResolverNode.DiskCache);
}
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.BL/Services/UsersService.cs b/Software/Visual_Studio/FSE/Tango.FSE.BL/Services/UsersService.cs
index 93a8c1548..36c249084 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.BL/Services/UsersService.cs
+++ b/Software/Visual_Studio/FSE/Tango.FSE.BL/Services/UsersService.cs
@@ -10,6 +10,7 @@ using Tango.BL.Builders;
using Tango.BL.DTO;
using Tango.BL.Entities;
using Tango.FSE.BL.CacheEntities;
+using Tango.FSE.Web.Messages;
namespace Tango.FSE.BL.Services
{
@@ -30,7 +31,30 @@ namespace Tango.FSE.BL.Services
public Task<User> GetUserFull(String email)
{
return DataResolver<User>.Builder.New()
- .ConfigureCascade(DataResolverNode.Online, DataResolverNode.DiskCache)
+ .ConfigureCascade(DataResolverNode.Web, DataResolverNode.Online, DataResolverNode.DiskCache)
+ .Web((context) =>
+ {
+ var response = WebClient.GetUser(new GetUserRequest() { Email = email }).GetAwaiter().GetResult();
+
+ var user = response.User.ToObservable();
+
+ LogManager.Log($"User '{email}' successfully retrieved. Caching user on disk...");
+
+ try
+ {
+ using (var cache = DiskCache.CreateContext())
+ {
+ var cachedUser = CachedUser.FromObservable<CachedUser>(user);
+ cache.Database.GetCollection<CachedUser>(FULL_USERS_COLLECTION).Upsert(cachedUser);
+ }
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, "Error caching user on disk.");
+ }
+
+ return user;
+ })
.Online((context) =>
{
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.BL/Web/FSEWebClientBase.cs b/Software/Visual_Studio/FSE/Tango.FSE.BL/Web/FSEWebClientBase.cs
index 3cb9bc170..12a2b543b 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.BL/Web/FSEWebClientBase.cs
+++ b/Software/Visual_Studio/FSE/Tango.FSE.BL/Web/FSEWebClientBase.cs
@@ -50,6 +50,60 @@ namespace Tango.FSE.BL.Web
}
/// <summary>
+ /// Executes the GetUser action and returns Tango.FSE.Web.Messages.GetUserResponse.
+ /// </summary>
+ /// <returns></returns>
+ public Task<Tango.FSE.Web.Messages.GetUserResponse> GetUser(Tango.FSE.Web.Messages.GetUserRequest request)
+ {
+ return Post<Tango.FSE.Web.Messages.GetUserRequest, Tango.FSE.Web.Messages.GetUserResponse>("GetUser", request);
+ }
+
+ /// <summary>
+ /// Executes the GetMachine action and returns Tango.FSE.Web.Messages.GetMachineResponse.
+ /// </summary>
+ /// <returns></returns>
+ public Task<Tango.FSE.Web.Messages.GetMachineResponse> GetMachine(Tango.FSE.Web.Messages.GetMachineRequest request)
+ {
+ return Post<Tango.FSE.Web.Messages.GetMachineRequest, Tango.FSE.Web.Messages.GetMachineResponse>("GetMachine", request);
+ }
+
+ /// <summary>
+ /// Executes the GetEventTypes action and returns Tango.FSE.Web.Messages.GetEventTypesResponse.
+ /// </summary>
+ /// <returns></returns>
+ public Task<Tango.FSE.Web.Messages.GetEventTypesResponse> GetEventTypes(Tango.FSE.Web.Messages.GetEventTypesRequest request)
+ {
+ return Post<Tango.FSE.Web.Messages.GetEventTypesRequest, Tango.FSE.Web.Messages.GetEventTypesResponse>("GetEventTypes", request);
+ }
+
+ /// <summary>
+ /// Executes the GetProcedures action and returns Tango.FSE.Web.Messages.GetProceduresResponse.
+ /// </summary>
+ /// <returns></returns>
+ public Task<Tango.FSE.Web.Messages.GetProceduresResponse> GetProcedures(Tango.FSE.Web.Messages.GetProceduresRequest request)
+ {
+ return Post<Tango.FSE.Web.Messages.GetProceduresRequest, Tango.FSE.Web.Messages.GetProceduresResponse>("GetProcedures", request);
+ }
+
+ /// <summary>
+ /// Executes the GetTangoVersions action and returns Tango.FSE.Web.Messages.GetTangoVersionsResponse.
+ /// </summary>
+ /// <returns></returns>
+ public Task<Tango.FSE.Web.Messages.GetTangoVersionsResponse> GetTangoVersions(Tango.FSE.Web.Messages.GetTangoVersionsRequest request)
+ {
+ return Post<Tango.FSE.Web.Messages.GetTangoVersionsRequest, Tango.FSE.Web.Messages.GetTangoVersionsResponse>("GetTangoVersions", request);
+ }
+
+ /// <summary>
+ /// Executes the GetTechComponents action and returns Tango.FSE.Web.Messages.GetTechComponentsResponse.
+ /// </summary>
+ /// <returns></returns>
+ public Task<Tango.FSE.Web.Messages.GetTechComponentsResponse> GetTechComponents(Tango.FSE.Web.Messages.GetTechComponentsRequest request)
+ {
+ return Post<Tango.FSE.Web.Messages.GetTechComponentsRequest, Tango.FSE.Web.Messages.GetTechComponentsResponse>("GetTechComponents", request);
+ }
+
+ /// <summary>
/// Executes the GetBugReportInfo action and returns Tango.FSE.Web.Messages.BugReportingInfoResponse.
/// </summary>
/// <returns></returns>
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetEventTypesRequest.cs b/Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetEventTypesRequest.cs
new file mode 100644
index 000000000..be9387e52
--- /dev/null
+++ b/Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetEventTypesRequest.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Transport.Web;
+
+namespace Tango.FSE.Web.Messages
+{
+ public class GetEventTypesRequest : WebRequestMessage
+ {
+
+ }
+}
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetEventTypesResponse.cs b/Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetEventTypesResponse.cs
new file mode 100644
index 000000000..edb477af7
--- /dev/null
+++ b/Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetEventTypesResponse.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.BL.DTO;
+using Tango.BL.Entities;
+using Tango.Transport.Web;
+
+namespace Tango.FSE.Web.Messages
+{
+ public class GetEventTypesResponse : WebResponseMessage
+ {
+ public List<EventTypeDTO> EventTypes { get; set; }
+
+ public GetEventTypesResponse()
+ {
+ EventTypes = new List<EventTypeDTO>();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetMachineRequest.cs b/Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetMachineRequest.cs
new file mode 100644
index 000000000..53e4136dd
--- /dev/null
+++ b/Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetMachineRequest.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Transport.Web;
+
+namespace Tango.FSE.Web.Messages
+{
+ public class GetMachineRequest : WebRequestMessage
+ {
+ public String OrganizationGuid { get; set; }
+ public String SerialNumber { get; set; }
+ public bool AllowAllMachines { get; set; }
+ public bool GetExtendedInfo { get; set; }
+ }
+}
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetMachineResponse.cs b/Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetMachineResponse.cs
new file mode 100644
index 000000000..b0c1eb7d4
--- /dev/null
+++ b/Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetMachineResponse.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.BL.DTO;
+using Tango.BL.Entities;
+using Tango.Transport.Web;
+
+namespace Tango.FSE.Web.Messages
+{
+ public class GetMachineResponse : WebResponseMessage
+ {
+ public MachineDTO Machine { get; set; }
+ }
+}
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetProceduresRequest.cs b/Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetProceduresRequest.cs
new file mode 100644
index 000000000..ea777cce0
--- /dev/null
+++ b/Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetProceduresRequest.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Transport.Web;
+
+namespace Tango.FSE.Web.Messages
+{
+ public class GetProceduresRequest : WebRequestMessage
+ {
+ public bool GetOnlyVisible { get; set; }
+ }
+}
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetProceduresResponse.cs b/Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetProceduresResponse.cs
new file mode 100644
index 000000000..64353ad6f
--- /dev/null
+++ b/Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetProceduresResponse.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.BL.DTO;
+using Tango.BL.Entities;
+using Tango.Transport.Web;
+
+namespace Tango.FSE.Web.Messages
+{
+ public class GetProceduresResponse : WebResponseMessage
+ {
+ public List<PublishedProcedureProjectDTO> Projects { get; set; }
+
+ public GetProceduresResponse()
+ {
+ Projects = new List<PublishedProcedureProjectDTO>();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetTangoVersionsRequest.cs b/Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetTangoVersionsRequest.cs
new file mode 100644
index 000000000..c3399221c
--- /dev/null
+++ b/Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetTangoVersionsRequest.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Transport.Web;
+
+namespace Tango.FSE.Web.Messages
+{
+ public class GetTangoVersionsRequest : WebRequestMessage
+ {
+
+ }
+}
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetTangoVersionsResponse.cs b/Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetTangoVersionsResponse.cs
new file mode 100644
index 000000000..e8c0e7bfd
--- /dev/null
+++ b/Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetTangoVersionsResponse.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.BL.DTO;
+using Tango.BL.Entities;
+using Tango.Transport.Web;
+
+namespace Tango.FSE.Web.Messages
+{
+ public class GetTangoVersionsResponse : WebResponseMessage
+ {
+ public List<TangoVersionDTO> Versions { get; set; }
+
+ public GetTangoVersionsResponse()
+ {
+ Versions = new List<TangoVersionDTO>();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetTechComponentsRequest.cs b/Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetTechComponentsRequest.cs
new file mode 100644
index 000000000..88ab6adca
--- /dev/null
+++ b/Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetTechComponentsRequest.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.BL;
+using Tango.BL.DTO;
+using Tango.Transport.Web;
+
+namespace Tango.FSE.Web.Messages
+{
+ public class GetTechComponentsRequest : WebRequestMessage
+ {
+ public bool Monitors { get; set; }
+ public bool IOs { get; set; }
+ public bool Dispensers { get; set; }
+ public bool Controllers { get; set; }
+ public bool Heaters { get; set; }
+ public bool Valves { get; set; }
+ public bool Motors { get; set; }
+ public bool Blowers { get; set; }
+ }
+}
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetTechComponentsResponse.cs b/Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetTechComponentsResponse.cs
new file mode 100644
index 000000000..d08054737
--- /dev/null
+++ b/Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetTechComponentsResponse.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.BL.DTO;
+using Tango.BL.Entities;
+using Tango.Transport.Web;
+
+namespace Tango.FSE.Web.Messages
+{
+ public class GetTechComponentsResponse : WebResponseMessage
+ {
+ public List<TechMonitorDTO> Monitors { get; set; }
+ public List<TechIoDTO> IOs { get; set; }
+ public List<TechDispenserDTO> Dispensers { get; set; }
+ public List<TechControllerDTO> Controllers { get; set; }
+ public List<TechHeaterDTO> Heaters { get; set; }
+ public List<TechValveDTO> Valves { get; set; }
+ public List<HardwareMotorTypeDTO> Motors { get; set; }
+ public List<HardwareBlowerTypeDTO> Blowers { get; set; }
+
+ public GetTechComponentsResponse()
+ {
+ Monitors = new List<TechMonitorDTO>();
+ IOs = new List<TechIoDTO>();
+ Dispensers = new List<TechDispenserDTO>();
+ Heaters = new List<TechHeaterDTO>();
+ Valves = new List<TechValveDTO>();
+ Motors = new List<HardwareMotorTypeDTO>();
+ Blowers = new List<HardwareBlowerTypeDTO>();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetUserRequest.cs b/Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetUserRequest.cs
new file mode 100644
index 000000000..4cad290b7
--- /dev/null
+++ b/Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetUserRequest.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Transport.Web;
+
+namespace Tango.FSE.Web.Messages
+{
+ public class GetUserRequest : WebRequestMessage
+ {
+ public String Email { get; set; }
+ }
+}
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetUserResponse.cs b/Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetUserResponse.cs
new file mode 100644
index 000000000..1e8f60e90
--- /dev/null
+++ b/Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/GetUserResponse.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.BL.DTO;
+using Tango.BL.Entities;
+using Tango.Transport.Web;
+
+namespace Tango.FSE.Web.Messages
+{
+ public class GetUserResponse : WebResponseMessage
+ {
+ public UserDTO User { get; set; }
+ }
+}
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Web/Tango.FSE.Web.csproj b/Software/Visual_Studio/FSE/Tango.FSE.Web/Tango.FSE.Web.csproj
index 1da2ea638..a906e6240 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.Web/Tango.FSE.Web.csproj
+++ b/Software/Visual_Studio/FSE/Tango.FSE.Web/Tango.FSE.Web.csproj
@@ -68,6 +68,18 @@
<Compile Include="Messages\DownloadTangoVersionResponse.cs" />
<Compile Include="Messages\ForgotPasswordRequest.cs" />
<Compile Include="Messages\ForgotPasswordResponse.cs" />
+ <Compile Include="Messages\GetMachineRequest.cs" />
+ <Compile Include="Messages\GetEventTypesRequest.cs" />
+ <Compile Include="Messages\GetProceduresRequest.cs" />
+ <Compile Include="Messages\GetTangoVersionsRequest.cs" />
+ <Compile Include="Messages\GetTechComponentsRequest.cs" />
+ <Compile Include="Messages\GetUserRequest.cs" />
+ <Compile Include="Messages\GetMachineResponse.cs" />
+ <Compile Include="Messages\GetEventTypesResponse.cs" />
+ <Compile Include="Messages\GetProceduresResponse.cs" />
+ <Compile Include="Messages\GetTangoVersionsResponse.cs" />
+ <Compile Include="Messages\GetTechComponentsResponse.cs" />
+ <Compile Include="Messages\GetUserResponse.cs" />
<Compile Include="Messages\LatestVersionRequest.cs" />
<Compile Include="Messages\LatestVersionResponse.cs" />
<Compile Include="Messages\LoginRequest.cs" />
@@ -83,6 +95,10 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
+ <ProjectReference Include="..\..\Tango.BL\Tango.BL.csproj">
+ <Project>{F441FEEE-322A-4943-B566-110E12FD3B72}</Project>
+ <Name>Tango.BL</Name>
+ </ProjectReference>
<ProjectReference Include="..\..\Tango.Core\Tango.Core.csproj">
<Project>{A34EE0F0-649D-41C8-8489-B6F1CC6924EE}</Project>
<Name>Tango.Core</Name>
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/DB/TccDbContext.cs b/Software/Visual_Studio/TCC/Tango.TCC.Service/DB/TccDbContext.cs
index 95c00f748..5a2e24b31 100644
--- a/Software/Visual_Studio/TCC/Tango.TCC.Service/DB/TccDbContext.cs
+++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/DB/TccDbContext.cs
@@ -14,7 +14,7 @@ namespace Tango.TCC.Service.DB
{
public static ObservablesContext CreateTango()
{
- return ObservablesContextHelper.CreateContext(TCCServiceConfig.TANGO_DB_CATALOG);
+ return ObservablesWebContext.CreateContext(TCCServiceConfig.TANGO_DB_CATALOG);
}
public static TCCContext CreateTCC()
diff --git a/Software/Visual_Studio/Tango.BL/DTO/ConfigurationDTO.cs b/Software/Visual_Studio/Tango.BL/DTO/ConfigurationDTO.cs
index 75049fa88..5e54c70c1 100644
--- a/Software/Visual_Studio/Tango.BL/DTO/ConfigurationDTO.cs
+++ b/Software/Visual_Studio/Tango.BL/DTO/ConfigurationDTO.cs
@@ -12,6 +12,8 @@ namespace Tango.BL.DTO
{
public List<IdsPackDTO> IdsPacks { get; set; }
+ public HardwareVersionDTO HardwareVersion { get; set; }
+
[ObservableDTOProperty(MapsTo = nameof(Configuration.ApplicationDisplayPanelVersion) + "." + nameof(Configuration.ApplicationDisplayPanelVersion.Name))]
public String ApplicationDisplayPanelVersionName { get; set; }
diff --git a/Software/Visual_Studio/Tango.BL/DTO/MachineDTO.cs b/Software/Visual_Studio/Tango.BL/DTO/MachineDTO.cs
index c6758aeff..4b8dcbeee 100644
--- a/Software/Visual_Studio/Tango.BL/DTO/MachineDTO.cs
+++ b/Software/Visual_Studio/Tango.BL/DTO/MachineDTO.cs
@@ -11,21 +11,17 @@ namespace Tango.BL.DTO
{
public ConfigurationDTO Configuration { get; set; }
- //public List<CatDTO> Cats { get; set; }
+ public OrganizationDTO Organization { get; set; }
+
+ public MachineVersionDTO MachineVersion { get; set; }
public List<SpoolDTO> Spools { get; set; }
public MachineDTO()
{
- //Cats = new List<CatDTO>();
Spools = new List<SpoolDTO>();
}
- //protected override bool OnShouldActionLogIgnore(string propName)
- //{
- // return propName == nameof(MachineDTO.Cats);
- //}
-
protected override string OnGetActionLogName()
{
return $"Machine '{SerialNumber}'";
diff --git a/Software/Visual_Studio/Tango.BL/DTO/PublishedProcedureProjectDTO.cs b/Software/Visual_Studio/Tango.BL/DTO/PublishedProcedureProjectDTO.cs
index e6253c85c..db6b5d1ee 100644
--- a/Software/Visual_Studio/Tango.BL/DTO/PublishedProcedureProjectDTO.cs
+++ b/Software/Visual_Studio/Tango.BL/DTO/PublishedProcedureProjectDTO.cs
@@ -9,6 +9,11 @@ namespace Tango.BL.DTO
{
public class PublishedProcedureProjectDTO : PublishedProcedureProjectDTOBase
{
+ public List<PublishedProcedureProjectsVersionDTO> PublishedProcedureProjectsVersions { get; set; }
+ public PublishedProcedureProjectDTO()
+ {
+ PublishedProcedureProjectsVersions = new List<PublishedProcedureProjectsVersionDTO>();
+ }
}
}
diff --git a/Software/Visual_Studio/Tango.BL/Entities/User.cs b/Software/Visual_Studio/Tango.BL/Entities/User.cs
index f13a5e20c..f0bad3bef 100644
--- a/Software/Visual_Studio/Tango.BL/Entities/User.cs
+++ b/Software/Visual_Studio/Tango.BL/Entities/User.cs
@@ -51,6 +51,7 @@ namespace Tango.BL.Entities
/// Gets the aggregated user roles.
/// </summary>
[NotMapped]
+ [JsonIgnore]
public List<Role> Roles
{
get { return UsersRoles.Select(x => x.Role).ToList(); }
@@ -60,6 +61,7 @@ namespace Tango.BL.Entities
/// Gets the aggregated FSE user roles.
/// </summary>
[NotMapped]
+ [JsonIgnore]
public List<Role> FSERoles
{
get { return UsersRoles.Select(x => x.Role).Where(x => x.Name.StartsWith("FSE")).ToList(); }
@@ -69,6 +71,7 @@ namespace Tango.BL.Entities
/// Gets the aggregated user permissions as enumerations.
/// </summary>
[NotMapped]
+ [JsonIgnore]
public List<Permission> Permissions
{
get
diff --git a/Software/Visual_Studio/Tango.Web/Helpers/ObservablesContextHelper.cs b/Software/Visual_Studio/Tango.Web/Helpers/ObservablesContextHelper.cs
index b0ef6b104..e54ef3161 100644
--- a/Software/Visual_Studio/Tango.Web/Helpers/ObservablesContextHelper.cs
+++ b/Software/Visual_Studio/Tango.Web/Helpers/ObservablesContextHelper.cs
@@ -8,7 +8,7 @@ using Tango.Core;
namespace Tango.Web.Helpers
{
- public static class ObservablesContextHelper
+ public static class ObservablesWebContext
{
public static ObservablesContext CreateContext(String catalog = null)
{
diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/DataStoreController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/DataStoreController.cs
index 383a59850..aea5da254 100644
--- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/DataStoreController.cs
+++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/DataStoreController.cs
@@ -48,7 +48,7 @@ namespace Tango.MachineService.Controllers
IHashGenerator hash = new BasicHashGenerator();
var password = hash.Encrypt(request.Password);
- using (var db = ObservablesContextHelper.CreateContext())
+ using (var db = ObservablesWebContext.CreateContext())
{
user = new UserBuilder(db).Set(x => x.Email.ToLower() == request.Email.ToLower() && x.Password == password).WithRolesAndPermissions().WithDeleted().Build();
@@ -98,7 +98,7 @@ namespace Tango.MachineService.Controllers
ValidateCollectionAndKey(collection, key);
- using (var db = ObservablesContextHelper.CreateContext())
+ using (var db = ObservablesWebContext.CreateContext())
{
if (sn != null)
{
@@ -167,7 +167,7 @@ namespace Tango.MachineService.Controllers
ValidateCollectionAndKey(item.Collection, item.Key);
- using (var db = ObservablesContextHelper.CreateContext())
+ using (var db = ObservablesWebContext.CreateContext())
{
if (item.MachineSerialNumber != null)
{
diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/DownloadsController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/DownloadsController.cs
index e65a8ebbc..b2de177aa 100644
--- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/DownloadsController.cs
+++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/DownloadsController.cs
@@ -26,7 +26,7 @@ namespace Tango.MachineService.Controllers
{
List<DownloadModel> downloads = new List<DownloadModel>();
- using (ObservablesContext db = ObservablesContextHelper.CreateContext())
+ using (ObservablesContext db = ObservablesWebContext.CreateContext())
{
foreach (var item in db.MachineStudioVersions.Where(x => x.InstallerBlobName != null).Include(x => x.User).Include(x => x.User.Contact).ToList())
{
diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/FSEAccountController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/FSEAccountController.cs
index b7728af6a..c8b1628b1 100644
--- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/FSEAccountController.cs
+++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/FSEAccountController.cs
@@ -33,7 +33,7 @@ namespace Tango.MachineService.Controllers
if (reset != null)
{
- using (ObservablesContext db = ObservablesContextHelper.CreateContext())
+ using (ObservablesContext db = ObservablesWebContext.CreateContext())
{
var user = db.Users.SingleOrDefault(x => x.Guid == reset.UserGuid);
diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/FSEController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/FSEController.cs
index cf03b367c..9df3a2d11 100644
--- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/FSEController.cs
+++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/FSEController.cs
@@ -27,6 +27,7 @@ using System.Data.Entity;
using static Tango.MachineService.Controllers.FSEController;
using Tango.MachineService.Models;
using Tango.BL.Enumerations;
+using Tango.BL.DTO;
namespace Tango.MachineService.Controllers
{
@@ -70,7 +71,7 @@ namespace Tango.MachineService.Controllers
var password = hash.Encrypt(request.Password);
- using (var db = ObservablesContextHelper.CreateContext())
+ using (var db = ObservablesWebContext.CreateContext())
{
user = new UserBuilder(db).Set(x => x.Email.ToLower() == request.Email.ToLower() && x.Password == password).WithRolesAndPermissions().WithDeleted().Build();
@@ -124,6 +125,163 @@ namespace Tango.MachineService.Controllers
}
[HttpPost]
+ public GetUserResponse GetUser(GetUserRequest request)
+ {
+ using (var db = ObservablesWebContext.CreateContext())
+ {
+ var user = new UserBuilder(db).Set(x => !x.Deleted && x.Email.ToLower() == request.Email.ToLower())
+ .WithOrganization()
+ .WithRolesAndPermissions()
+ .Build();
+
+ if (user == null) throw new AuthenticationException("User not found.");
+
+ var userDTO = UserDTO.FromObservable(user);
+
+ return new GetUserResponse() { User = userDTO };
+ }
+ }
+
+ [HttpPost]
+ public GetMachineResponse GetMachine(GetMachineRequest request)
+ {
+ using (var db = ObservablesWebContext.CreateContext())
+ {
+ Machine machine = null;
+
+ if (request.GetExtendedInfo)
+ {
+ machine = new MachineBuilder(db)
+ .Set(x => (request.AllowAllMachines || x.OrganizationGuid == request.OrganizationGuid) && x.SerialNumber == request.SerialNumber)
+ .WithOrganization()
+ .WithVersion()
+ .WithSpools()
+ .WithConfiguration().Build();
+ }
+ else
+ {
+ machine = new MachineBuilder(db)
+ .Set(x => (request.AllowAllMachines || x.OrganizationGuid == request.OrganizationGuid) && x.SerialNumber == request.SerialNumber)
+ .WithOrganization()
+ .Build();
+ }
+
+ if (machine != null)
+ {
+ return new GetMachineResponse()
+ {
+ Machine = MachineDTO.FromObservable(machine)
+ };
+ }
+
+ return new GetMachineResponse();
+ }
+ }
+
+ [HttpPost]
+ public GetEventTypesResponse GetEventTypes(GetEventTypesRequest request)
+ {
+ GetEventTypesResponse response = new GetEventTypesResponse();
+
+ using (ObservablesContext db = ObservablesWebContext.CreateContext())
+ {
+ var eventTypes = db.EventTypes.ToList();
+ response.EventTypes = eventTypes.Select(x => EventTypeDTO.FromObservable(x)).ToList();
+ }
+
+ return response;
+ }
+
+ [HttpPost]
+ public GetProceduresResponse GetProcedures(GetProceduresRequest request)
+ {
+ GetProceduresResponse response = new GetProceduresResponse();
+
+ using (ObservablesContext db = ObservablesWebContext.CreateContext())
+ {
+ var select = db.PublishedProcedureProjects
+ .Where(x => x.IsVisible || !request.GetOnlyVisible)
+ .Include(x => x.PublishedProcedureProjectsVersions)
+ .Select(x => new
+ {
+ Project = x,
+ LatestVersion = x.PublishedProcedureProjectsVersions.OrderByDescending(v => v.Version).FirstOrDefault()
+ }).ToList();
+
+ List<PublishedProcedureProject> projects = new List<PublishedProcedureProject>();
+
+ foreach (var p in select)
+ {
+ PublishedProcedureProject project = p.Project;
+ projects.Add(project);
+ }
+
+ response.Projects = projects.Select(x => PublishedProcedureProjectDTO.FromObservable(x)).ToList();
+ }
+
+ return response;
+ }
+
+ [HttpPost]
+ public GetTangoVersionsResponse GetTangoVersions(GetTangoVersionsRequest request)
+ {
+ GetTangoVersionsResponse response = new GetTangoVersionsResponse();
+
+ using (ObservablesContext db = ObservablesWebContext.CreateContext())
+ {
+ var tangoVersions = db.TangoVersions.ToList().OrderByDescending(x => Version.Parse(x.Version)).ToList();
+
+ response.Versions = tangoVersions.Select(x => TangoVersionDTO.FromObservable(x)).ToList();
+ }
+
+ return response;
+ }
+
+ [HttpPost]
+ public GetTechComponentsResponse GetTechComponents(GetTechComponentsRequest request)
+ {
+ GetTechComponentsResponse response = new GetTechComponentsResponse();
+
+ using (var db = ObservablesWebContext.CreateContext())
+ {
+ if (request.Blowers)
+ {
+ response.Blowers = db.HardwareBlowerTypes.ToList().Select(x => HardwareBlowerTypeDTO.FromObservable(x)).ToList();
+ }
+ if (request.Controllers)
+ {
+ response.Controllers = db.TechControllers.ToList().Select(x => TechControllerDTO.FromObservable(x)).ToList();
+ }
+ if (request.Dispensers)
+ {
+ response.Dispensers = db.TechDispensers.ToList().Select(x => TechDispenserDTO.FromObservable(x)).ToList();
+ }
+ if (request.Heaters)
+ {
+ response.Heaters = db.TechHeaters.ToList().Select(x => TechHeaterDTO.FromObservable(x)).ToList();
+ }
+ if (request.IOs)
+ {
+ response.IOs = db.TechIos.ToList().Select(x => TechIoDTO.FromObservable(x)).ToList();
+ }
+ if (request.Monitors)
+ {
+ response.Monitors = db.TechMonitors.ToList().Select(x => TechMonitorDTO.FromObservable(x)).ToList();
+ }
+ if (request.Motors)
+ {
+ response.Motors = db.HardwareMotorTypes.ToList().Select(x => HardwareMotorTypeDTO.FromObservable(x)).ToList();
+ }
+ if (request.Valves)
+ {
+ response.Valves = db.TechValves.ToList().Select(x => TechValveDTO.FromObservable(x)).ToList();
+ }
+ }
+
+ return response;
+ }
+
+ [HttpPost]
[JwtTokenFilter]
public BugReportingInfoResponse GetBugReportInfo(BugReportingInfoRequest request)
{
@@ -141,7 +299,7 @@ namespace Tango.MachineService.Controllers
{
DownloadTangoVersionResponse response = new DownloadTangoVersionResponse();
- using (ObservablesContext db = ObservablesContextHelper.CreateContext())
+ using (ObservablesContext db = ObservablesWebContext.CreateContext())
{
var tangoVersion = db.TangoVersions.SingleOrDefault(x => x.Guid == request.TangoVersionGuid);
@@ -198,7 +356,7 @@ namespace Tango.MachineService.Controllers
{
CheckForUpdatesResponse response = new CheckForUpdatesResponse();
- using (ObservablesContext db = ObservablesContextHelper.CreateContext())
+ using (ObservablesContext db = ObservablesWebContext.CreateContext())
{
var versions = db.FseVersions.ToList().Where(x => x.BuildVariant == request.Build.ToInt32()).ToList();
@@ -254,7 +412,7 @@ namespace Tango.MachineService.Controllers
{
User user;
- using (ObservablesContext db = ObservablesContextHelper.CreateContext())
+ using (ObservablesContext db = ObservablesWebContext.CreateContext())
{
user = db.Users.Include(x => x.Contact).SingleOrDefault(x => x.Guid == request.UserGuid);
@@ -295,7 +453,7 @@ namespace Tango.MachineService.Controllers
{
User user;
- using (ObservablesContext db = ObservablesContextHelper.CreateContext())
+ using (ObservablesContext db = ObservablesWebContext.CreateContext())
{
user = db.Users.Include(x => x.Contact).SingleOrDefault(x => x.Email.ToLower() == request.Email.ToLower());
@@ -344,7 +502,7 @@ namespace Tango.MachineService.Controllers
[HttpPost]
public LatestVersionResponse GetLatestVersion(LatestVersionRequest request)
{
- using (ObservablesContext db = ObservablesContextHelper.CreateContext())
+ using (ObservablesContext db = ObservablesWebContext.CreateContext())
{
var version = db.FseVersions.ToList().Where(x => x.BuildVariant == request.Build.ToInt32()).OrderByDescending(x => Version.Parse(x.Version)).FirstOrDefault();
return new LatestVersionResponse() { Version = version != null ? version.Version : "0.0.0.0" };
@@ -357,15 +515,15 @@ namespace Tango.MachineService.Controllers
{
UploadVersionResponse response = new UploadVersionResponse();
- using (ObservablesContext db = ObservablesContextHelper.CreateContext())
+ using (ObservablesContext db = ObservablesWebContext.CreateContext())
{
String userID = RequestToken.Object.UserGuid;
var user = new UserBuilder(db).Set(userID).WithRolesAndPermissions().Build();
if (user != null && user.HasPermission(Permissions.PublishMachineStudioVersions))
-
-{
+
+ {
var latestVersion = db.FseVersions.ToList().Where(x => x.BuildVariant == request.Build.ToInt32()).ToList().OrderByDescending(x => Version.Parse(x.Version)).FirstOrDefault();
Version local_version = Version.Parse(request.Version);
@@ -415,7 +573,7 @@ namespace Tango.MachineService.Controllers
{
_pendingUploads.RemoveAll(x => x.Token == upload.Token);
- using (ObservablesContext db = ObservablesContextHelper.CreateContext())
+ using (ObservablesContext db = ObservablesWebContext.CreateContext())
{
db.FseVersions.Add(new FseVersion()
{
diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/FSEDownloadsController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/FSEDownloadsController.cs
index dddb8cb38..782bef3a2 100644
--- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/FSEDownloadsController.cs
+++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/FSEDownloadsController.cs
@@ -26,7 +26,7 @@ namespace Tango.MachineService.Controllers
{
IndexViewModel model = new IndexViewModel();
- using (var db = ObservablesContextHelper.CreateContext())
+ using (var db = ObservablesWebContext.CreateContext())
{
int build = buildVariant.Value;
diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/MachineStudioController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/MachineStudioController.cs
index 5f697f979..7eda111d0 100644
--- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/MachineStudioController.cs
+++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/MachineStudioController.cs
@@ -77,7 +77,7 @@ namespace Tango.MachineService.Controllers
CheckForUpdatesResponse response = new CheckForUpdatesResponse();
- using (ObservablesContext db = ObservablesContextHelper.CreateContext())
+ using (ObservablesContext db = ObservablesWebContext.CreateContext())
{
var versions = db.MachineStudioVersions.ToList();
@@ -122,7 +122,7 @@ namespace Tango.MachineService.Controllers
{
DownloadLatestVersionResponse response = new DownloadLatestVersionResponse();
- using (ObservablesContext db = ObservablesContextHelper.CreateContext())
+ using (ObservablesContext db = ObservablesWebContext.CreateContext())
{
var versions = db.MachineStudioVersions.ToList();
@@ -160,7 +160,7 @@ namespace Tango.MachineService.Controllers
{
UploadVersionResponse response = new UploadVersionResponse();
- using (ObservablesContext db = ObservablesContextHelper.CreateContext())
+ using (ObservablesContext db = ObservablesWebContext.CreateContext())
{
String userID = RequestToken.Object.UserGuid;
@@ -231,7 +231,7 @@ namespace Tango.MachineService.Controllers
{
_pendingUploads.RemoveAll(x => x.Token == upload.Token);
- using (ObservablesContext db = ObservablesContextHelper.CreateContext())
+ using (ObservablesContext db = ObservablesWebContext.CreateContext())
{
db.MachineStudioVersions.Add(new MachineStudioVersion()
{
@@ -261,7 +261,7 @@ namespace Tango.MachineService.Controllers
[HttpPost]
public LatestVersionResponse GetLatestVersion(LatestVersionRequest request)
{
- using (ObservablesContext db = ObservablesContextHelper.CreateContext())
+ using (ObservablesContext db = ObservablesWebContext.CreateContext())
{
var version = db.MachineStudioVersions.ToList().OrderByDescending(x => Version.Parse(x.Version)).FirstOrDefault();
return new LatestVersionResponse() { Version = version != null ? version.Version : "0.0.0.0" };
@@ -317,7 +317,7 @@ namespace Tango.MachineService.Controllers
throw new AuthenticationException($"You do not have permissions to access the {MachineServiceConfig.DEPLOYMENT_SLOT.ToDescription()} environment.");
}
- using (ObservablesContext db = ObservablesContextHelper.CreateContext())
+ using (ObservablesContext db = ObservablesWebContext.CreateContext())
{
db.Roles.ToList();
db.Permissions.ToList();
@@ -385,7 +385,7 @@ namespace Tango.MachineService.Controllers
{
var password = hash.Encrypt(request.Password);
- using (var db = ObservablesContextHelper.CreateContext())
+ using (var db = ObservablesWebContext.CreateContext())
{
user = new UserBuilder(db).Set(x => x.Email.ToLower() == request.Email.ToLower() && (isPasswordOK || x.Password == password)).WithRolesAndPermissions().WithDeleted().Build();
@@ -420,7 +420,7 @@ namespace Tango.MachineService.Controllers
//Enforce Machine Studio Version ?
if (MachineServiceConfig.ENFORCE_MACHINE_STUDIO_VERSION)
{
- using (var db = ObservablesContextHelper.CreateContext())
+ using (var db = ObservablesWebContext.CreateContext())
{
var latest_version = db.MachineStudioVersions.ToList().OrderByDescending(x => Version.Parse(x.Version)).FirstOrDefault();
@@ -468,7 +468,7 @@ namespace Tango.MachineService.Controllers
{
DownloadLatestPPCVersionResponse response = new DownloadLatestPPCVersionResponse();
- using (ObservablesContext db = ObservablesContextHelper.CreateContext())
+ using (ObservablesContext db = ObservablesWebContext.CreateContext())
{
var machine = db.Machines.SingleOrDefault(x => x.SerialNumber == request.SerialNumber);
diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs
index 9cbc17abf..06b2fd232 100644
--- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs
+++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs
@@ -68,7 +68,7 @@ namespace Tango.MachineService.Controllers
LogManager.Log("Setup request received: " + request.ToString());
- using (ObservablesContext db = ObservablesContextHelper.CreateContext())
+ using (ObservablesContext db = ObservablesWebContext.CreateContext())
{
String machine_guid = RequestToken.Object.MachineGuid;
@@ -177,7 +177,7 @@ namespace Tango.MachineService.Controllers
Task.Factory.StartNew(() =>
{
- using (ObservablesContext b = ObservablesContextHelper.CreateContext())
+ using (ObservablesContext b = ObservablesWebContext.CreateContext())
{
//Reset Job Runs.
try
@@ -216,7 +216,7 @@ namespace Tango.MachineService.Controllers
DownloadUpdateResponse response = new DownloadUpdateResponse();
response.NotifyCompletedToken = Guid.NewGuid().ToString();
- using (ObservablesContext db = ObservablesContextHelper.CreateContext())
+ using (ObservablesContext db = ObservablesWebContext.CreateContext())
{
db.Configuration.LazyLoadingEnabled = false;
String machine_guid = RequestToken.Object.MachineGuid;
@@ -302,7 +302,7 @@ namespace Tango.MachineService.Controllers
{
_pendingUpdates.Remove(pendingUpdate);
- using (ObservablesContext db = ObservablesContextHelper.CreateContext())
+ using (ObservablesContext db = ObservablesWebContext.CreateContext())
{
var tangoUpdate = db.TangoUpdates.SingleOrDefault(x => x.Guid == pendingUpdate.TangoUpdateGuid);
@@ -333,7 +333,7 @@ namespace Tango.MachineService.Controllers
{
CheckForUpdateResponse response = new CheckForUpdateResponse();
- using (ObservablesContext db = ObservablesContextHelper.CreateContext())
+ using (ObservablesContext db = ObservablesWebContext.CreateContext())
{
String machine_guid = RequestToken.Object.MachineGuid;
@@ -435,7 +435,7 @@ namespace Tango.MachineService.Controllers
UpdateDBResponse response = new UpdateDBResponse();
response.NotifyCompletedToken = Guid.NewGuid().ToString();
- using (ObservablesContext db = ObservablesContextHelper.CreateContext())
+ using (ObservablesContext db = ObservablesWebContext.CreateContext())
{
String machine_guid = RequestToken.Object.MachineGuid;
@@ -506,7 +506,7 @@ namespace Tango.MachineService.Controllers
UploadMachineDataResponse response = new UploadMachineDataResponse();
response.NotifyCompletedToken = Guid.NewGuid().ToString();
- using (ObservablesContext db = ObservablesContextHelper.CreateContext())
+ using (ObservablesContext db = ObservablesWebContext.CreateContext())
{
var machine = db.Machines.SingleOrDefault(x => x.Guid == RequestToken.Object.MachineGuid);
@@ -534,7 +534,7 @@ namespace Tango.MachineService.Controllers
try
{
- using (ObservablesContext db = ObservablesContextHelper.CreateContext())
+ using (ObservablesContext db = ObservablesWebContext.CreateContext())
{
var machine = db.Machines.SingleOrDefault(x => x.Guid == RequestToken.Object.MachineGuid);
@@ -547,7 +547,7 @@ namespace Tango.MachineService.Controllers
//Insert/Replace Jobs.
foreach (var dto in request.Jobs)
{
- using (ObservablesContext db = ObservablesContextHelper.CreateContext())
+ using (ObservablesContext db = ObservablesWebContext.CreateContext())
{
try
{
@@ -586,7 +586,7 @@ namespace Tango.MachineService.Controllers
//Insert Update DataStore Items
foreach (var dto in request.DataStoreItems)
{
- using (ObservablesContext db = ObservablesContextHelper.CreateContext())
+ using (ObservablesContext db = ObservablesWebContext.CreateContext())
{
try
{
@@ -626,7 +626,7 @@ namespace Tango.MachineService.Controllers
//Insert JobRuns.
foreach (var dto in request.JobRuns)
{
- using (ObservablesContext db = ObservablesContextHelper.CreateContext())
+ using (ObservablesContext db = ObservablesWebContext.CreateContext())
{
try
{
@@ -654,7 +654,7 @@ namespace Tango.MachineService.Controllers
//Insert TangoUpdates.
foreach (var dto in request.OfflineUpdates)
{
- using (ObservablesContext db = ObservablesContextHelper.CreateContext())
+ using (ObservablesContext db = ObservablesWebContext.CreateContext())
{
try
{
@@ -682,7 +682,7 @@ namespace Tango.MachineService.Controllers
//Insert MachineEvents.
foreach (var dto in request.MachineEvents)
{
- using (ObservablesContext db = ObservablesContextHelper.CreateContext())
+ using (ObservablesContext db = ObservablesWebContext.CreateContext())
{
try
{
@@ -728,7 +728,7 @@ namespace Tango.MachineService.Controllers
{
DownloadMachineDataResponse response = new DownloadMachineDataResponse();
- using (ObservablesContext db = ObservablesContextHelper.CreateContext())
+ using (ObservablesContext db = ObservablesWebContext.CreateContext())
{
var machine = db.Machines.SingleOrDefault(x => x.Guid == RequestToken.Object.MachineGuid);
@@ -795,7 +795,7 @@ namespace Tango.MachineService.Controllers
{
var response = new NotifyMachineDataDownloadCompletedResponse();
- using (ObservablesContext db = ObservablesContextHelper.CreateContext())
+ using (ObservablesContext db = ObservablesWebContext.CreateContext())
{
var machine = db.Machines.SingleOrDefault(x => x.Guid == RequestToken.Object.MachineGuid);
@@ -837,7 +837,7 @@ namespace Tango.MachineService.Controllers
{
LatestVersionResponse response = new LatestVersionResponse();
- using (ObservablesContext db = ObservablesContextHelper.CreateContext())
+ using (ObservablesContext db = ObservablesWebContext.CreateContext())
{
var versions = db.TangoVersions.Where(x => x.MachineVersionGuid == request.MachineVersionGuid && request.Tag == x.Tag).ToList();
@@ -863,7 +863,7 @@ namespace Tango.MachineService.Controllers
{
GetTagsResponse response = new GetTagsResponse();
- using (ObservablesContext db = ObservablesContextHelper.CreateContext())
+ using (ObservablesContext db = ObservablesWebContext.CreateContext())
{
var versions = db.TangoVersions.Where(x => x.MachineVersionGuid == request.MachineVersionGuid).ToList();
@@ -884,7 +884,7 @@ namespace Tango.MachineService.Controllers
{
UploadVersionResponse response = new UploadVersionResponse();
- using (ObservablesContext db = ObservablesContextHelper.CreateContext())
+ using (ObservablesContext db = ObservablesWebContext.CreateContext())
{
//Load relations first...
db.Roles.ToList();
@@ -974,7 +974,7 @@ namespace Tango.MachineService.Controllers
{
_pendingUploads.RemoveAll(x => x.Token == upload.Token);
- using (ObservablesContext db = ObservablesContextHelper.CreateContext())
+ using (ObservablesContext db = ObservablesWebContext.CreateContext())
{
db.TangoVersions.Add(new TangoVersion()
{
@@ -1002,7 +1002,7 @@ namespace Tango.MachineService.Controllers
[HttpPost]
public MachineVersionsResponse GetMachineVersions(MachineVersionsRequest request)
{
- using (var db = ObservablesContextHelper.CreateContext())
+ using (var db = ObservablesWebContext.CreateContext())
{
return new MachineVersionsResponse()
{
@@ -1016,7 +1016,7 @@ namespace Tango.MachineService.Controllers
{
LoginResponse response = new LoginResponse();
- using (ObservablesContext db = ObservablesContextHelper.CreateContext())
+ using (ObservablesContext db = ObservablesWebContext.CreateContext())
{
if (request.Mode == LoginMode.User)
{