aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2018-12-24 09:08:25 +0200
committerShlomo Hecht <shlomo@twine-s.com>2018-12-24 09:08:25 +0200
commit2f77ad3cebf771bdf02188174c9712027b004d41 (patch)
tree32d819fbbb57063b9289d39f1cacf4febb83ea28 /Software/Visual_Studio
parent0cc8f5b14286302880f56aaa20a7078b92579a97 (diff)
parent99a48d7c388792c96ce7ac1b4e1436d395c4aec1 (diff)
downloadTango-2f77ad3cebf771bdf02188174c9712027b004d41.tar.gz
Tango-2f77ad3cebf771bdf02188174c9712027b004d41.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio')
-rw-r--r--Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnkbin1471 -> 1445 bytes
-rw-r--r--Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnkbin1516 -> 1581 bytes
-rw-r--r--Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnkbin1464 -> 1444 bytes
-rw-r--r--Software/Visual_Studio/Build/Shortcuts/Stubs Execution GUI.lnkbin1547 -> 1462 bytes
-rw-r--r--Software/Visual_Studio/Build/Shortcuts/Transport Router.lnkbin1578 -> 1493 bytes
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Authentication/LoginRequest.cs15
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Authentication/LoginResponse.cs15
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs5
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj6
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs19
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs5
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs16
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs35
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupResponse.cs6
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/DownloadUpdateResponse.cs5
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs47
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/UpdateDBResponse.cs5
-rw-r--r--Software/Visual_Studio/Tango.BL/Entities/Machine.cs92
-rw-r--r--Software/Visual_Studio/Tango.BL/Entities/Rml.cs60
-rw-r--r--Software/Visual_Studio/Tango.BL/Enumerations/Permissions.cs30
-rw-r--r--Software/Visual_Studio/Tango.BL/Enumerations/Roles.cs32
-rw-r--r--Software/Visual_Studio/Tango.Core/Components/DataBaseDescriptionsHelper.cs31
-rw-r--r--Software/Visual_Studio/Tango.Core/DB/DbManager.cs5
-rw-r--r--Software/Visual_Studio/Tango.Core/DataSource.cs14
-rw-r--r--Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs3
-rw-r--r--Software/Visual_Studio/Tango.DAL.Remote/DB/RML.cs2
-rw-r--r--Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx31
-rw-r--r--Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram150
-rw-r--r--Software/Visual_Studio/Tango.SQLExaminer/ExaminerConfigurationBuilder.cs34
-rw-r--r--Software/Visual_Studio/Tango.SQLExaminer/ExaminerSequenceConfigurationRunner.cs14
-rw-r--r--Software/Visual_Studio/Tango.UnitTesting/SQLExaminer_TST.cs66
-rw-r--r--Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/ObservablesGenerator.cs41
-rw-r--r--Software/Visual_Studio/Web/Tango.MachineService/Controllers/MachineStudioController.cs69
-rw-r--r--Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs40
-rw-r--r--Software/Visual_Studio/Web/Tango.MachineService/Helpers/AzureDirectoryHelper.cs19
-rw-r--r--Software/Visual_Studio/Web/Tango.MachineService/Tango.MachineService.csproj9
-rw-r--r--Software/Visual_Studio/Web/Tango.MachineService/Web.config4
-rw-r--r--Software/Visual_Studio/Web/Tango.MachineService/packages.config1
38 files changed, 695 insertions, 231 deletions
diff --git a/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk b/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk
index 612ccab34..7bbdf66b4 100644
--- a/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk
+++ b/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk
Binary files differ
diff --git a/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk b/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk
index adc17d481..9c594a6b0 100644
--- a/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk
+++ b/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk
Binary files differ
diff --git a/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk b/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk
index 6f203ca29..ab1bc5eed 100644
--- a/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk
+++ b/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk
Binary files differ
diff --git a/Software/Visual_Studio/Build/Shortcuts/Stubs Execution GUI.lnk b/Software/Visual_Studio/Build/Shortcuts/Stubs Execution GUI.lnk
index 26bdb7c64..5b8ad68a5 100644
--- a/Software/Visual_Studio/Build/Shortcuts/Stubs Execution GUI.lnk
+++ b/Software/Visual_Studio/Build/Shortcuts/Stubs Execution GUI.lnk
Binary files differ
diff --git a/Software/Visual_Studio/Build/Shortcuts/Transport Router.lnk b/Software/Visual_Studio/Build/Shortcuts/Transport Router.lnk
index 355f4b364..febffabca 100644
--- a/Software/Visual_Studio/Build/Shortcuts/Transport Router.lnk
+++ b/Software/Visual_Studio/Build/Shortcuts/Transport Router.lnk
Binary files differ
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Authentication/LoginRequest.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Authentication/LoginRequest.cs
new file mode 100644
index 000000000..762fb5dd5
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Authentication/LoginRequest.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Transport.Web;
+
+namespace Tango.MachineStudio.Common.Authentication
+{
+ public class LoginRequest : WebRequestMessage
+ {
+ public String Email { get; set; }
+ public String Password { get; set; }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Authentication/LoginResponse.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Authentication/LoginResponse.cs
new file mode 100644
index 000000000..075a5ec10
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Authentication/LoginResponse.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Core;
+using Tango.Transport.Web;
+
+namespace Tango.MachineStudio.Common.Authentication
+{
+ public class LoginResponse : WebResponseMessage
+ {
+ public DataSource DataSource { get; set; }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs
index cab3d2bfc..1d3660c5f 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs
@@ -39,10 +39,8 @@ namespace Tango.MachineStudio.Common
public String LastVirtualMachineSerialNumber { get; set; }
/// <summary>
- /// Gets or sets the update service address.
+ /// Gets or sets the machine service address.
/// </summary>
- public String UpdateServiceAddress { get; set; }
-
public String MachineServiceAddress { get; set; }
/// <summary>
@@ -97,7 +95,6 @@ namespace Tango.MachineStudio.Common
{
LastBounds = new Rect();
LoggingCategories = new List<LogCategory>();
- UpdateServiceAddress = "http://twine01/MachineStudioUpdateService/MachineStudioUpdateService.svc";
MachineServiceAddress = "http://machineservice.twine-srv.com/";
DefaultIssueReportTags = new List<string>();
StudioModulesBounds = new List<StudioModuleBounds>();
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj
index 31d28def8..cd99b00d0 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj
@@ -75,6 +75,8 @@
<Compile Include="..\..\Versioning\GlobalVersionInfo.cs">
<Link>GlobalVersionInfo.cs</Link>
</Compile>
+ <Compile Include="Authentication\LoginRequest.cs" />
+ <Compile Include="Authentication\LoginResponse.cs" />
<Compile Include="AutoComplete\MachinesProvider.cs" />
<Compile Include="Automation\Developer.cs" />
<Compile Include="Automation\UI.cs" />
@@ -125,7 +127,7 @@
<Compile Include="Update\LatestVersionRequest.cs" />
<Compile Include="Update\LatestVersionResponse.cs" />
<Compile Include="Update\MachineStudioUpdateService.cs" />
- <Compile Include="Update\UpdateServiceHelper.cs" />
+ <None Include="Update\UpdateServiceHelper.cs" />
<Compile Include="Update\UploadCompletedRequest.cs" />
<Compile Include="Update\UploadCompletedResponse.cs" />
<Compile Include="Update\UploadVersionRequest.cs" />
@@ -308,7 +310,7 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
- <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" />
+ <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" />
</VisualStudio>
</ProjectExtensions>
</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs
index fd68ed8d1..3293dab3f 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs
@@ -10,6 +10,9 @@ using Tango.MachineStudio.Common.Authentication;
using Tango.BL;
using Tango.BL.Enumerations;
using System.Data.Entity;
+using Tango.Transport.Web;
+using Tango.Settings;
+using Tango.MachineStudio.Common;
namespace Tango.MachineStudio.UI.Authentication
{
@@ -49,11 +52,21 @@ namespace Tango.MachineStudio.UI.Authentication
/// <exception cref="AuthenticationException">Login failed for user " + email</exception>
public User Login(string email, string password)
{
- using (ObservablesContext db = ObservablesContext.CreateDefault())
+ var settings = SettingsManager.Default.GetOrCreate<MachineStudioSettings>();
+
+ IWebTransportClient service = new WebTransportClient();
+ var response = service.PostJson<LoginRequest, LoginResponse>(settings.MachineServiceAddress + "/api/MachineStudio/Login", new LoginRequest()
{
- String hash = User.GetPasswordHash(password);
+ Email = email,
+ Password = password,
+
+ }).Result;
+ ObservablesContext.OverrideSettingsDataSource(response.DataSource);
+
+ using (ObservablesContext db = ObservablesContext.CreateDefault())
+ {
db.Roles.Load();
db.Permissions.Load();
db.RolesPermissions.Load();
@@ -62,7 +75,7 @@ namespace Tango.MachineStudio.UI.Authentication
.Include(x => x.UsersRoles)
.Include(x => x.Contact)
.Include(x => x.Address)
- .Include(x => x.Organization).SingleOrDefault(x => x.Email.ToLower() == email.ToLower() && x.Password == hash);
+ .Include(x => x.Organization).SingleOrDefault(x => x.Email.ToLower() == email.ToLower());
if (user == null)
{
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs
index 545d51ef2..6e8d0488b 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs
@@ -144,9 +144,8 @@ namespace Tango.MachineStudio.UI.ViewModels
Status = "Loading, please wait...";
- ObservablesStaticCollections.Instance.Initialize();
-
- _eventLogger.Log(EventTypes.ApplicationStarted, "Application Started!");
+ //ObservablesStaticCollections.Instance.Initialize();
+ //_eventLogger.Log(EventTypes.ApplicationStarted, "Application Started!");
Status = "Starting application...";
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs
index a37879a5e..4e659d46a 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs
@@ -6,6 +6,8 @@ using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using Tango.BL;
+using Tango.BL.Enumerations;
using Tango.Core.Commands;
using Tango.Core.Cryptography;
using Tango.MachineStudio.Common;
@@ -90,7 +92,7 @@ namespace Tango.MachineStudio.UI.ViewModels
_navigationManager = navigationManager;
_authenticationProvider = authenticationProvider;
_eventLogger = eventLogger;
- LoginCommand = new RelayCommand(Login,() => !IsLogging);
+ LoginCommand = new RelayCommand(Login, () => !IsLogging);
cryptographer = new Rfc2898Cryptographer();
Email = _settings.LastLoginEmail;
@@ -121,6 +123,10 @@ namespace Tango.MachineStudio.UI.ViewModels
await Task.Factory.StartNew(() =>
{
_authenticationProvider.Login(Email, Password);
+
+ ObservablesStaticCollections.Instance.Initialize();
+ _eventLogger.Log(EventTypes.ApplicationStarted, "Application Started!");
+
_navigationManager.NavigateTo(NavigationView.MainView);
_settings.LastLoginEmail = Email;
_settings.RememberMe = RememberMe;
@@ -128,13 +134,13 @@ namespace Tango.MachineStudio.UI.ViewModels
_settings.LastLoginPassword = RememberMe ? cryptographer.Encrypt(Password) : null;
_settings.Save();
- _eventLogger.Log("User logged in");
+ _eventLogger.Log("User logged in.");
});
}
- catch (Exception)
+ catch (Exception ex)
{
-
- _notificationProvider.ShowError("Invalid credentials. Please try again.");
+ LogManager.Log(ex, "Login Error.");
+ _notificationProvider.ShowError($"The specified email or password was incorrect, or you don't have a permission to run this application.\nError: {ex.Message}");
}
finally
{
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs
index 1f86e0953..b8638b158 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs
@@ -207,22 +207,20 @@ namespace Tango.PPC.Common.MachineSetup
//Synchronize database
UpdateProgress("Updating Database", "Initializing...");
- String db_name = "Tango";
- String localAddress = SettingsManager.Default.GetOrCreate<CoreSettings>().DataSource.Address;
- String remote_address = setup_response.DbAddress;
+ var localDataSource = SettingsManager.Default.GetOrCreate<CoreSettings>().DataSource;
- LogManager.Log($"Synchronizing database '{remote_address}\\{db_name}' => '{localAddress}\\{db_name}'...");
+ LogManager.Log($"Synchronizing database '{setup_response.DataSource.ToString()}' => '{localDataSource.ToString()}'...");
UpdateProgress("Updating Database", "Connecting to local database...");
- LogManager.Log($"Connecting to local database at {localAddress}...");
- DbManager db = DbManager.FromAddress(localAddress);
+ LogManager.Log($"Connecting to local database at {localDataSource}...");
+ DbManager db = DbManager.FromAddress(localDataSource.Address);
- LogManager.Log($"Ensuring {db_name} database exists on the local machine...");
- if (!db.Exists(db_name))
+ LogManager.Log($"Ensuring {localDataSource.Catalog} database exists on the local machine...");
+ if (!db.Exists(localDataSource.Catalog))
{
UpdateProgress("Updating Database", "Creating new database...");
LogManager.Log("Database does not exist. Creating new database...");
- db.Create(db_name);
+ db.Create(localDataSource.Catalog);
}
else
{
@@ -232,7 +230,7 @@ namespace Tango.PPC.Common.MachineSetup
db.Dispose();
LogManager.Log("Initializing database manager...");
- db = DbManager.FromAddressAndName(localAddress, db_name);
+ db = DbManager.FromDataSource(localDataSource);
UpdateProgress("Updating Database", "Clearing current database...");
LogManager.Log("Clearing database...");
@@ -248,20 +246,9 @@ namespace Tango.PPC.Common.MachineSetup
ExaminerSequenceConfigurationRunner runner = new ExaminerSequenceConfigurationRunner(
Path.Combine(_newPackageTempFolder, "Provision Scripts", "config.xml"),
Path.Combine(_newPackageTempFolder, "Provision Scripts"),
- new ExaminerSequenceDataSource()
- {
- Address = remote_address,
- DataBaseName = db_name,
- IntegratedSecurity = false,
- UserName = setup_response.DbUserName,
- Password = setup_response.DbPassword,
- },
- new ExaminerSequenceDataSource()
- {
- Address = localAddress,
- DataBaseName = db_name,
- IntegratedSecurity = true,
- }, serialNumber);
+ setup_response.DataSource,
+ localDataSource,
+ serialNumber);
runner.Log += (x, msg) =>
{
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupResponse.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupResponse.cs
index 89450a1d1..5e8885af7 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupResponse.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupResponse.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using Tango.Core;
using Tango.Transport.Web;
namespace Tango.PPC.Common.MachineSetup
@@ -13,9 +14,7 @@ namespace Tango.PPC.Common.MachineSetup
public String BlobAddress { get; set; }
- public String DbAddress { get; set; }
- public String DbUserName { get; set; }
- public String DbPassword { get; set; }
+ public DataSource DataSource { get; set; }
public String OSKey { get; set; }
@@ -23,6 +22,7 @@ namespace Tango.PPC.Common.MachineSetup
public bool SetupRemoteAssistance { get; set; }
public bool SetupUWF { get; set; }
public bool SetupFirmware { get; set; }
+ public bool SetupFPGA { get; set; }
public bool IsDemo { get; set; }
}
}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/DownloadUpdateResponse.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/DownloadUpdateResponse.cs
index c42c06f3b..de978ed66 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/DownloadUpdateResponse.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/DownloadUpdateResponse.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using Tango.Core;
using Tango.Transport.Web;
namespace Tango.PPC.Common.MachineUpdate
@@ -13,8 +14,6 @@ namespace Tango.PPC.Common.MachineUpdate
public String BlobAddress { get; set; }
- public String DbAddress { get; set; }
- public String DbUserName { get; set; }
- public String DbPassword { get; set; }
+ public DataSource DataSource { get; set; }
}
}
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 6df7117d7..69df627fb 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs
@@ -164,18 +164,16 @@ namespace Tango.PPC.Common.MachineUpdate
//Synchronize database
UpdateProgress("Updating Database", "Initializing...");
- String db_name = "Tango";
- String localAddress = SettingsManager.Default.GetOrCreate<CoreSettings>().DataSource.Address;
- String remote_address = update_response.DbAddress;
+ var localDataSource = SettingsManager.Default.GetOrCreate<CoreSettings>().DataSource;
- LogManager.Log($"Synchronizing database '{remote_address}\\{db_name}' => '{localAddress}\\{db_name}'...");
+ LogManager.Log($"Synchronizing database '{update_response.DataSource.ToString()}' => '{localDataSource.ToString()}'...");
UpdateProgress("Updating Database", "Connecting to local database...");
LogManager.Log("Initializing database manager...");
- DbManager db = DbManager.FromAddressAndName(localAddress, db_name);
+ DbManager db = DbManager.FromDataSource(localDataSource);
LogManager.Log("Checking Tango database exists on the local machine...");
- if (!db.Exists(db_name))
+ if (!db.Exists(localDataSource.Catalog))
{
throw new InvalidProgramException("Database tango does not exists.");
}
@@ -190,20 +188,9 @@ namespace Tango.PPC.Common.MachineUpdate
ExaminerSequenceConfigurationRunner runner = new ExaminerSequenceConfigurationRunner(
Path.Combine(_newPackageTempFolder, "Update Scripts", "config.xml"),
Path.Combine(_newPackageTempFolder, "Update Scripts"),
- new ExaminerSequenceDataSource()
- {
- Address = remote_address,
- DataBaseName = db_name,
- IntegratedSecurity = false,
- UserName = update_response.DbUserName,
- Password = update_response.DbPassword,
- },
- new ExaminerSequenceDataSource()
- {
- Address = localAddress,
- DataBaseName = db_name,
- IntegratedSecurity = true,
- }, serialNumber);
+ update_response.DataSource,
+ localDataSource,
+ serialNumber);
runner.Log += (x, msg) =>
{
@@ -331,15 +318,13 @@ namespace Tango.PPC.Common.MachineUpdate
UpdateDBResponse update_response = dbCompareResult.UpdateDBResponse;
- String db_name = "Tango";
- String localAddress = SettingsManager.Default.GetOrCreate<CoreSettings>().DataSource.Address;
- String remote_address = update_response.DbAddress;
+ var localDataSource = SettingsManager.Default.GetOrCreate<CoreSettings>().DataSource;
- LogManager.Log($"Overriding database static tables '{remote_address}\\{db_name}' => '{localAddress}\\{db_name}'...");
+ LogManager.Log($"Overriding database static tables '{update_response.DataSource.ToString()}' => '{localDataSource.ToString()}'...");
ExaminerConfigurationBuilder builder = new ExaminerConfigurationBuilder(config_file);
- builder.SetSourceServer(remote_address, db_name, false, update_response.DbUserName, update_response.DbPassword);
- builder.SetTargetServer(localAddress, db_name, true);
+ builder.SetSource(update_response.DataSource);
+ builder.SetTarget(localDataSource);
builder.Synchronize();
var config = builder.Build();
@@ -410,17 +395,15 @@ namespace Tango.PPC.Common.MachineUpdate
LogManager.Log($"Update DB response received: {Environment.NewLine}{update_response.ToJsonString()}");
- String db_name = "Tango";
- String localAddress = SettingsManager.Default.GetOrCreate<CoreSettings>().DataSource.Address;
- String remote_address = update_response.DbAddress;
+ var localDataSource = SettingsManager.Default.GetOrCreate<CoreSettings>().DataSource;
- LogManager.Log($"Comparing database static tables '{remote_address}\\{db_name}' => '{localAddress}\\{db_name}'...");
+ LogManager.Log($"Comparing database static tables '{update_response.DataSource.ToString()}' => '{localDataSource.ToString()}'...");
var report_file = TemporaryManager.CreateFile(".xml");
ExaminerConfigurationBuilder builder = new ExaminerConfigurationBuilder(config_file);
- builder.SetSourceServer(remote_address, db_name, false, update_response.DbUserName, update_response.DbPassword);
- builder.SetTargetServer(localAddress, db_name, true);
+ builder.SetSource(update_response.DataSource);
+ builder.SetTarget(localDataSource);
builder.SetReportFile(report_file);
var config = builder.Build();
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/UpdateDBResponse.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/UpdateDBResponse.cs
index 212cd02d2..36be14750 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/UpdateDBResponse.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/UpdateDBResponse.cs
@@ -3,14 +3,13 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using Tango.Core;
using Tango.Transport.Web;
namespace Tango.PPC.Common.MachineUpdate
{
public class UpdateDBResponse : WebResponseMessage
{
- public String DbAddress { get; set; }
- public String DbUserName { get; set; }
- public String DbPassword { get; set; }
+ public DataSource DataSource { get; set; }
}
}
diff --git a/Software/Visual_Studio/Tango.BL/Entities/Machine.cs b/Software/Visual_Studio/Tango.BL/Entities/Machine.cs
index 383492905..38926d3e4 100644
--- a/Software/Visual_Studio/Tango.BL/Entities/Machine.cs
+++ b/Software/Visual_Studio/Tango.BL/Entities/Machine.cs
@@ -21,6 +21,11 @@ using Tango.Core;
namespace Tango.BL.Entities
{
+
+ /// <summary>
+ ///
+ /// </summary>
+
[Table("MACHINES")]
public partial class Machine : ObservableEntity<Machine>
{
@@ -51,8 +56,12 @@ namespace Tango.BL.Entities
public event EventHandler<Boolean> SetupFirmwareChanged;
+ public event EventHandler<Boolean> SetupFpgaChanged;
+
public event EventHandler<Boolean> IsDemoChanged;
+ public event EventHandler<Int32> EnvironmentChanged;
+
public event EventHandler<SynchronizedObservableCollection<Cat>> CatsChanged;
public event EventHandler<ColorSpace> DefaultColorSpaceChanged;
@@ -261,6 +270,31 @@ namespace Tango.BL.Entities
}
}
+ protected String _loadedrmlguid;
+
+ /// <summary>
+ /// Gets or sets the machine loaded rml guid.
+ /// </summary>
+
+ [Column("LOADED_RML_GUID")]
+
+ public String LoadedRmlGuid
+ {
+ get
+ {
+ return _loadedrmlguid;
+ }
+
+ set
+ {
+ if (_loadedrmlguid != value)
+ {
+ _loadedrmlguid = value;
+ RaisePropertyChanged(nameof(LoadedRmlGuid));
+ }
+ }
+ }
+
protected String _targetjobtypes;
/// <summary>
@@ -593,6 +627,34 @@ namespace Tango.BL.Entities
}
}
+ protected Boolean _setupfpga;
+
+ /// <summary>
+ /// Gets or sets the machine setup fpga.
+ /// </summary>
+
+ [Column("SETUP_FPGA")]
+
+ public Boolean SetupFpga
+ {
+ get
+ {
+ return _setupfpga;
+ }
+
+ set
+ {
+ if (_setupfpga != value)
+ {
+ _setupfpga = value;
+
+ SetupFpgaChanged?.Invoke(this, value);
+
+ RaisePropertyChanged(nameof(SetupFpga));
+ }
+ }
+ }
+
protected Boolean _isdemo;
/// <summary>
@@ -621,6 +683,36 @@ namespace Tango.BL.Entities
}
}
+ protected Int32 _environment;
+
+ /// <summary>
+ /// 0 = DEV
+ /// 1 = TEST
+ /// 2 = PROD
+ /// </summary>
+
+ [Column("ENVIRONMENT")]
+
+ public Int32 Environment
+ {
+ get
+ {
+ return _environment;
+ }
+
+ set
+ {
+ if (_environment != value)
+ {
+ _environment = value;
+
+ EnvironmentChanged?.Invoke(this, value);
+
+ RaisePropertyChanged(nameof(Environment));
+ }
+ }
+ }
+
protected SynchronizedObservableCollection<Cat> _cats;
/// <summary>
diff --git a/Software/Visual_Studio/Tango.BL/Entities/Rml.cs b/Software/Visual_Studio/Tango.BL/Entities/Rml.cs
index c7c3077d7..3bbdd3fab 100644
--- a/Software/Visual_Studio/Tango.BL/Entities/Rml.cs
+++ b/Software/Visual_Studio/Tango.BL/Entities/Rml.cs
@@ -51,6 +51,10 @@ namespace Tango.BL.Entities
public event EventHandler<Double> EstimatedThreadDiameterChanged;
+ public event EventHandler<Int32> RankChanged;
+
+ public event EventHandler<Byte[]> ThumbnailChanged;
+
public event EventHandler<SynchronizedObservableCollection<Cat>> CatsChanged;
public event EventHandler<SynchronizedObservableCollection<Cct>> CctsChanged;
@@ -623,6 +627,62 @@ namespace Tango.BL.Entities
}
}
+ protected Int32 _rank;
+
+ /// <summary>
+ /// Gets or sets the rml rank.
+ /// </summary>
+
+ [Column("RANK")]
+
+ public Int32 Rank
+ {
+ get
+ {
+ return _rank;
+ }
+
+ set
+ {
+ if (_rank != value)
+ {
+ _rank = value;
+
+ RankChanged?.Invoke(this, value);
+
+ RaisePropertyChanged(nameof(Rank));
+ }
+ }
+ }
+
+ protected Byte[] _thumbnail;
+
+ /// <summary>
+ /// Gets or sets the rml thumbnail.
+ /// </summary>
+
+ [Column("THUMBNAIL")]
+
+ public Byte[] Thumbnail
+ {
+ get
+ {
+ return _thumbnail;
+ }
+
+ set
+ {
+ if (_thumbnail != value)
+ {
+ _thumbnail = value;
+
+ ThumbnailChanged?.Invoke(this, value);
+
+ RaisePropertyChanged(nameof(Thumbnail));
+ }
+ }
+ }
+
protected SynchronizedObservableCollection<Cat> _cats;
/// <summary>
diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/Permissions.cs b/Software/Visual_Studio/Tango.BL/Enumerations/Permissions.cs
index 5e5c7390d..721057ad0 100644
--- a/Software/Visual_Studio/Tango.BL/Enumerations/Permissions.cs
+++ b/Software/Visual_Studio/Tango.BL/Enumerations/Permissions.cs
@@ -50,10 +50,10 @@ namespace Tango.BL.Enumerations
RunMachineStudio = 6,
/// <summary>
- /// (Allows publishing of new Machine Studio release version to the Machine Studio Service.)
+ /// (Allows publishing of new Machine Studio versions.)
/// </summary>
- [Description("Allows publishing of new Machine Studio release version to the Machine Studio Service.")]
- PublishMachineStudioVersion = 7,
+ [Description("Allows publishing of new Machine Studio versions.")]
+ PublishMachineStudioVersions = 7,
/// <summary>
/// (Allows loading the stubs module in machine studio)
@@ -127,5 +127,29 @@ namespace Tango.BL.Enumerations
[Description("Allows running the hardware versions module in Machine Studio.")]
RunHardwareVersionsModule = 19,
+ /// <summary>
+ /// (Grants access to the development environment.)
+ /// </summary>
+ [Description("Grants access to the development environment.")]
+ AccessDevelopmentDataSource = 20,
+
+ /// <summary>
+ /// (Grants access to the test environment.)
+ /// </summary>
+ [Description("Grants access to the test environment.")]
+ AccessTestDataSource = 21,
+
+ /// <summary>
+ /// (Grants access to the production environment.)
+ /// </summary>
+ [Description("Grants access to the production environment.")]
+ AccessProductionDataSource = 22,
+
+ /// <summary>
+ /// (Allows publishing of new PPC application versions.)
+ /// </summary>
+ [Description("Allows publishing of new PPC application versions.")]
+ PublishPPCVersions = 23,
+
}
}
diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/Roles.cs b/Software/Visual_Studio/Tango.BL/Enumerations/Roles.cs
index 626dc8f40..0ee332c6a 100644
--- a/Software/Visual_Studio/Tango.BL/Enumerations/Roles.cs
+++ b/Software/Visual_Studio/Tango.BL/Enumerations/Roles.cs
@@ -38,9 +38,9 @@ namespace Tango.BL.Enumerations
Technician = 2,
/// <summary>
- /// (Publish new Machine Studio Versions)
+ /// (Machine Studio versions publisher.)
/// </summary>
- [Description("Publish new Machine Studio Versions")]
+ [Description("Machine Studio versions publisher.")]
MachineStudioPublisher = 4,
/// <summary>
@@ -56,9 +56,9 @@ namespace Tango.BL.Enumerations
PPCUser = 9,
/// <summary>
- /// (Manage organizations users and roles)
+ /// (Manages organizations users and roles)
/// </summary>
- [Description("Manage organizations users and roles")]
+ [Description("Manages organizations users and roles")]
UsersAndRolesManager = 7,
/// <summary>
@@ -79,5 +79,29 @@ namespace Tango.BL.Enumerations
[Description("Twine Software Developer")]
SoftwareDeveloper = 6,
+ /// <summary>
+ /// (Specifies that a user should work against a development environment data source.)
+ /// </summary>
+ [Description("Specifies that a user should work against a development environment data source.")]
+ DevelopmentEnvironmentUser = 10,
+
+ /// <summary>
+ /// (Specifies that a user should work against a testing environment data source.)
+ /// </summary>
+ [Description("Specifies that a user should work against a testing environment data source.")]
+ TestEnvironmentUser = 11,
+
+ /// <summary>
+ /// (Specifies that a user should work against a production environment data source.)
+ /// </summary>
+ [Description("Specifies that a user should work against a production environment data source.")]
+ ProductionEnvironmentUser = 12,
+
+ /// <summary>
+ /// (PPC Application Publisher)
+ /// </summary>
+ [Description("PPC Application Publisher")]
+ PPCPublisher = 13,
+
}
}
diff --git a/Software/Visual_Studio/Tango.Core/Components/DataBaseDescriptionsHelper.cs b/Software/Visual_Studio/Tango.Core/Components/DataBaseDescriptionsHelper.cs
index 0f1193c6c..620fe9dbc 100644
--- a/Software/Visual_Studio/Tango.Core/Components/DataBaseDescriptionsHelper.cs
+++ b/Software/Visual_Studio/Tango.Core/Components/DataBaseDescriptionsHelper.cs
@@ -18,6 +18,12 @@ namespace Tango.Core.Components
public String ColumnDescription { get; set; }
}
+ public class ForeignKeyDescription
+ {
+ public String TableName { get; set; }
+ public String ColumnName { get; set; }
+ }
+
public static List<DbDescription> GetDescriptions(DbConnection connection)
{
List<DbDescription> dbDescriptions = new List<DbDescription>();
@@ -67,5 +73,30 @@ ORDER BY t.name, c.colorder";
return dbDescriptions;
}
+
+ public static List<ForeignKeyDescription> GetForeignKeys(DbConnection connection)
+ {
+ List<ForeignKeyDescription> keys = new List<ForeignKeyDescription>();
+
+ var command = connection.CreateCommand();
+ command.CommandText = "SELECT a.TABLE_NAME, a.COLUMN_NAME FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS b JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE a ON a.CONSTRAINT_CATALOG = b.CONSTRAINT_CATALOG AND a.CONSTRAINT_NAME = b.CONSTRAINT_NAME";
+
+ DataTable table = new DataTable();
+ table.Load(command.ExecuteReader());
+
+ foreach (var row in table.Rows.OfType<DataRow>())
+ {
+ String table_name = row.ItemArray.GetValue(0).ToString();
+ String column_name = row.ItemArray.GetValue(1).ToString();
+
+ keys.Add(new ForeignKeyDescription()
+ {
+ TableName = table_name,
+ ColumnName = column_name
+ });
+ }
+
+ return keys;
+ }
}
}
diff --git a/Software/Visual_Studio/Tango.Core/DB/DbManager.cs b/Software/Visual_Studio/Tango.Core/DB/DbManager.cs
index 0a9123164..1d90b30e8 100644
--- a/Software/Visual_Studio/Tango.Core/DB/DbManager.cs
+++ b/Software/Visual_Studio/Tango.Core/DB/DbManager.cs
@@ -41,6 +41,11 @@ namespace Tango.Core.DB
return new DbManager(new SqlConnection(String.Format("Server={0};Integrated security=SSPI;Initial Catalog={1}", address, database)));
}
+ public static DbManager FromDataSource(DataSource dataSource)
+ {
+ return new DbManager(dataSource.ToConnection() as SqlConnection);
+ }
+
public static DbManager FromCredentials(String address, String database, String userName, String password)
{
return new DbManager(new SqlConnection(String.Format("Server={0};Initial Catalog={1};User Id={2};Password={3}", address, database, userName, password)));
diff --git a/Software/Visual_Studio/Tango.Core/DataSource.cs b/Software/Visual_Studio/Tango.Core/DataSource.cs
index c5c58cf09..27ca921f9 100644
--- a/Software/Visual_Studio/Tango.Core/DataSource.cs
+++ b/Software/Visual_Studio/Tango.Core/DataSource.cs
@@ -66,6 +66,7 @@ namespace Tango.Core
/// <returns></returns>
public DbConnection ToConnection()
{
+
switch (Type)
{
case DataSourceType.SQLite:
@@ -106,10 +107,8 @@ namespace Tango.Core
builder.UserID = UserName;
builder.Password = Password;
builder.IntegratedSecurity = false;
- //builder.TrustServerCertificate = true;
builder.MultipleActiveResultSets = true;
builder.ApplicationName = "EntityFramework";
- //builder.ConnectTimeout = 15;
builder.Authentication = SqlAuthenticationMethod.ActiveDirectoryPassword;
SqlConnection sqlConnection = new SqlConnection(builder.ConnectionString);
@@ -121,5 +120,16 @@ namespace Tango.Core
return null;
}
}
+
+ /// <summary>
+ /// Returns a <see cref="System.String" /> that represents this instance.
+ /// </summary>
+ /// <returns>
+ /// A <see cref="System.String" /> that represents this instance.
+ /// </returns>
+ public override string ToString()
+ {
+ return $"{Address}\\{Catalog}";
+ }
}
}
diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs
index 341f2aa2a..f49eba95a 100644
--- a/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs
+++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs
@@ -33,6 +33,7 @@ namespace Tango.DAL.Remote.DB
public string MACHINE_VERSION_GUID { get; set; }
public string CONFIGURATION_GUID { get; set; }
public string DEFAULT_RML_GUID { get; set; }
+ public string LOADED_RML_GUID { get; set; }
public string TARGET_JOB_TYPES { get; set; }
public string DEFAULT_COLOR_SPACE_GUID { get; set; }
public double DEFAULT_SEGMENT_LENGTH { get; set; }
@@ -45,7 +46,9 @@ namespace Tango.DAL.Remote.DB
public bool SETUP_REMOTE_ASSISTANCE { get; set; }
public bool SETUP_UWF { get; set; }
public bool SETUP_FIRMWARE { get; set; }
+ public bool SETUP_FPGA { get; set; }
public bool IS_DEMO { get; set; }
+ public int ENVIRONMENT { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<CAT> CATS { get; set; }
diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RML.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/RML.cs
index ab767508c..5b4ca71ff 100644
--- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RML.cs
+++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RML.cs
@@ -48,6 +48,8 @@ namespace Tango.DAL.Remote.DB
public double TENSILE_STRENGTH { get; set; }
public double ELONGATION_AT_BREAK_PERCENTAGE { get; set; }
public double ESTIMATED_THREAD_DIAMETER { get; set; }
+ public int RANK { get; set; }
+ public byte[] THUMBNAIL { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<CAT> CATS { get; set; }
diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx
index 86cf4ed6a..c51caf219 100644
--- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx
+++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx
@@ -700,6 +700,7 @@
<Property Name="MACHINE_VERSION_GUID" Type="varchar" MaxLength="36" Nullable="false" />
<Property Name="CONFIGURATION_GUID" Type="varchar" MaxLength="36" Nullable="false" />
<Property Name="DEFAULT_RML_GUID" Type="varchar" MaxLength="36" />
+ <Property Name="LOADED_RML_GUID" Type="varchar" MaxLength="36" />
<Property Name="TARGET_JOB_TYPES" Type="varchar" MaxLength="50" />
<Property Name="DEFAULT_COLOR_SPACE_GUID" Type="varchar" MaxLength="36" />
<Property Name="DEFAULT_SEGMENT_LENGTH" Type="float" Nullable="false" />
@@ -712,7 +713,9 @@
<Property Name="SETUP_REMOTE_ASSISTANCE" Type="bit" Nullable="false" />
<Property Name="SETUP_UWF" Type="bit" Nullable="false" />
<Property Name="SETUP_FIRMWARE" Type="bit" Nullable="false" />
+ <Property Name="SETUP_FPGA" Type="bit" Nullable="false" />
<Property Name="IS_DEMO" Type="bit" Nullable="false" />
+ <Property Name="ENVIRONMENT" Type="int" Nullable="false" />
</EntityType>
<EntityType Name="MACHINES_CONFIGURATIONS">
<Key>
@@ -810,7 +813,7 @@
<Property Name="GUID" Type="varchar" MaxLength="36" Nullable="false" />
<Property Name="LAST_UPDATED" Type="datetime2" Precision="3" Nullable="false" />
<Property Name="CODE" Type="int" Nullable="false" />
- <Property Name="NAME" Type="nvarchar" MaxLength="30" Nullable="false" />
+ <Property Name="NAME" Type="nvarchar" MaxLength="40" Nullable="false" />
<Property Name="DESCRIPTION" Type="nvarchar" MaxLength="100" Nullable="false" />
</EntityType>
<EntityType Name="PROCESS_PARAMETERS_TABLES">
@@ -882,6 +885,8 @@
<Property Name="TENSILE_STRENGTH" Type="float" Nullable="false" />
<Property Name="ELONGATION_AT_BREAK_PERCENTAGE" Type="float" Nullable="false" />
<Property Name="ESTIMATED_THREAD_DIAMETER" Type="float" Nullable="false" />
+ <Property Name="RANK" Type="int" Nullable="false" />
+ <Property Name="THUMBNAIL" Type="image" />
</EntityType>
<EntityType Name="ROLES">
<Key>
@@ -1864,7 +1869,7 @@
</Dependent>
</ReferentialConstraint>
</Association>
- <Association Name="FK_MACHINES_RMLS">
+ <Association Name="FK_MACHINES_RMLS2">
<End Role="RMLS" Type="Self.RMLS" Multiplicity="0..1" />
<End Role="MACHINES" Type="Self.MACHINES" Multiplicity="*" />
<ReferentialConstraint>
@@ -2479,7 +2484,7 @@
<End Role="ORGANIZATIONS" EntitySet="ORGANIZATIONS" />
<End Role="MACHINES" EntitySet="MACHINES" />
</AssociationSet>
- <AssociationSet Name="FK_MACHINES_RMLS" Association="Self.FK_MACHINES_RMLS">
+ <AssociationSet Name="FK_MACHINES_RMLS2" Association="Self.FK_MACHINES_RMLS2">
<End Role="RMLS" EntitySet="RMLS" />
<End Role="MACHINES" EntitySet="MACHINES" />
</AssociationSet>
@@ -2925,7 +2930,7 @@
<End Role="ORGANIZATION" EntitySet="ORGANIZATIONS" />
<End Role="MACHINE" EntitySet="MACHINES" />
</AssociationSet>
- <AssociationSet Name="FK_MACHINES_RMLS" Association="RemoteModel.FK_MACHINES_RMLS">
+ <AssociationSet Name="FK_MACHINES_RMLS2" Association="RemoteModel.FK_MACHINES_RMLS2">
<End Role="RML" EntitySet="RMLS" />
<End Role="MACHINE" EntitySet="MACHINES" />
</AssociationSet>
@@ -3792,6 +3797,7 @@
<Property Name="MACHINE_VERSION_GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" />
<Property Name="CONFIGURATION_GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" />
<Property Name="DEFAULT_RML_GUID" Type="String" MaxLength="36" FixedLength="false" Unicode="false" />
+ <Property Name="LOADED_RML_GUID" Type="String" MaxLength="36" FixedLength="false" Unicode="false" />
<Property Name="TARGET_JOB_TYPES" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
<Property Name="DEFAULT_COLOR_SPACE_GUID" Type="String" MaxLength="36" FixedLength="false" Unicode="false" />
<Property Name="DEFAULT_SEGMENT_LENGTH" Type="Double" Nullable="false" />
@@ -3804,7 +3810,9 @@
<Property Name="SETUP_REMOTE_ASSISTANCE" Type="Boolean" Nullable="false" />
<Property Name="SETUP_UWF" Type="Boolean" Nullable="false" />
<Property Name="SETUP_FIRMWARE" Type="Boolean" Nullable="false" />
+ <Property Name="SETUP_FPGA" Type="Boolean" Nullable="false" />
<Property Name="IS_DEMO" Type="Boolean" Nullable="false" />
+ <Property Name="ENVIRONMENT" Type="Int32" Nullable="false" />
<NavigationProperty Name="CATS" Relationship="RemoteModel.FK_CATS_MACHINES" FromRole="MACHINE" ToRole="CAT" />
<NavigationProperty Name="COLOR_SPACES" Relationship="RemoteModel.FK_MACHINES_COLOR_SPACES" FromRole="MACHINE" ToRole="COLOR_SPACES" />
<NavigationProperty Name="CONFIGURATION" Relationship="RemoteModel.FK_MACHINES_CONFIGURATIONS" FromRole="MACHINE" ToRole="CONFIGURATION" />
@@ -3813,7 +3821,7 @@
<NavigationProperty Name="MACHINES_CONFIGURATIONS" Relationship="RemoteModel.FK_MACHINES_CONFIGURATIONS_MACHINES" FromRole="MACHINE" ToRole="MACHINES_CONFIGURATIONS" />
<NavigationProperty Name="MACHINES_EVENTS" Relationship="RemoteModel.FK_MACHINES_EVENTS_MACHINES" FromRole="MACHINE" ToRole="MACHINES_EVENTS" />
<NavigationProperty Name="ORGANIZATION" Relationship="RemoteModel.FK_MACHINES_ORGANIZATIONS" FromRole="MACHINE" ToRole="ORGANIZATION" />
- <NavigationProperty Name="RML" Relationship="RemoteModel.FK_MACHINES_RMLS" FromRole="MACHINE" ToRole="RML" />
+ <NavigationProperty Name="RML" Relationship="RemoteModel.FK_MACHINES_RMLS2" FromRole="MACHINE" ToRole="RML" />
<NavigationProperty Name="SPOOL_TYPES" Relationship="RemoteModel.FK_MACHINES_SPOOL_TYPES" FromRole="MACHINE" ToRole="SPOOL_TYPES" />
</EntityType>
<EntityType Name="MACHINES_CONFIGURATIONS">
@@ -3927,7 +3935,7 @@
<Property Name="GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" />
<Property Name="LAST_UPDATED" Type="DateTime" Nullable="false" Precision="3" />
<Property Name="CODE" Type="Int32" Nullable="false" />
- <Property Name="NAME" Type="String" Nullable="false" MaxLength="30" FixedLength="false" Unicode="true" />
+ <Property Name="NAME" Type="String" Nullable="false" MaxLength="40" FixedLength="false" Unicode="true" />
<Property Name="DESCRIPTION" Type="String" Nullable="false" MaxLength="100" FixedLength="false" Unicode="true" />
<NavigationProperty Name="ROLES_PERMISSIONS" Relationship="RemoteModel.FK_ROLES_PERMISSIONS_PERMISSIONS" FromRole="PERMISSION" ToRole="ROLES_PERMISSIONS" />
</EntityType>
@@ -4003,6 +4011,8 @@
<Property Name="TENSILE_STRENGTH" Type="Double" Nullable="false" />
<Property Name="ELONGATION_AT_BREAK_PERCENTAGE" Type="Double" Nullable="false" />
<Property Name="ESTIMATED_THREAD_DIAMETER" Type="Double" Nullable="false" />
+ <Property Name="RANK" Type="Int32" Nullable="false" />
+ <Property Name="THUMBNAIL" Type="Binary" MaxLength="Max" FixedLength="false" />
<NavigationProperty Name="CATS" Relationship="RemoteModel.FK_CATS_RMLS" FromRole="RML" ToRole="CAT" />
<NavigationProperty Name="CCTS" Relationship="RemoteModel.FK_CCTS_RMLS" FromRole="RML" ToRole="CCT" />
<NavigationProperty Name="FIBER_SHAPES" Relationship="RemoteModel.FK_RML_FIBER_SHAPES" FromRole="RML" ToRole="FIBER_SHAPES" />
@@ -4010,7 +4020,7 @@
<NavigationProperty Name="JOBS" Relationship="RemoteModel.FK_JOBS_RMLS" FromRole="RML" ToRole="JOB" />
<NavigationProperty Name="LINEAR_MASS_DENSITY_UNITS" Relationship="RemoteModel.FK_RML_LINEAR_MASS_DENSITY_UNITS" FromRole="RML" ToRole="LINEAR_MASS_DENSITY_UNITS" />
<NavigationProperty Name="LIQUID_TYPES_RMLS" Relationship="RemoteModel.FK_LIQUID_TYPES_RMLS_RMLS" FromRole="RML" ToRole="LIQUID_TYPES_RMLS" />
- <NavigationProperty Name="MACHINES" Relationship="RemoteModel.FK_MACHINES_RMLS" FromRole="RML" ToRole="MACHINE" />
+ <NavigationProperty Name="MACHINES" Relationship="RemoteModel.FK_MACHINES_RMLS2" FromRole="RML" ToRole="MACHINE" />
<NavigationProperty Name="MEDIA_COLORS" Relationship="RemoteModel.FK_RML_MEDIA_COLORS" FromRole="RML" ToRole="MEDIA_COLORS" />
<NavigationProperty Name="MEDIA_CONDITIONS" Relationship="RemoteModel.FK_RML_MEDIA_CONDITIONS" FromRole="RML" ToRole="MEDIA_CONDITIONS" />
<NavigationProperty Name="MEDIA_MATERIALS" Relationship="RemoteModel.FK_RML_MEDIA_MATERIALS" FromRole="RML" ToRole="MEDIA_MATERIALS" />
@@ -5117,7 +5127,7 @@
</Dependent>
</ReferentialConstraint>
</Association>
- <Association Name="FK_MACHINES_RMLS">
+ <Association Name="FK_MACHINES_RMLS2">
<End Type="RemoteModel.RML" Role="RML" Multiplicity="0..1" />
<End Type="RemoteModel.MACHINE" Role="MACHINE" Multiplicity="*" />
<ReferentialConstraint>
@@ -6055,7 +6065,9 @@
<EntitySetMapping Name="MACHINES">
<EntityTypeMapping TypeName="RemoteModel.MACHINE">
<MappingFragment StoreEntitySet="MACHINES">
+ <ScalarProperty Name="ENVIRONMENT" ColumnName="ENVIRONMENT" />
<ScalarProperty Name="IS_DEMO" ColumnName="IS_DEMO" />
+ <ScalarProperty Name="SETUP_FPGA" ColumnName="SETUP_FPGA" />
<ScalarProperty Name="SETUP_FIRMWARE" ColumnName="SETUP_FIRMWARE" />
<ScalarProperty Name="SETUP_UWF" ColumnName="SETUP_UWF" />
<ScalarProperty Name="SETUP_REMOTE_ASSISTANCE" ColumnName="SETUP_REMOTE_ASSISTANCE" />
@@ -6068,6 +6080,7 @@
<ScalarProperty Name="DEFAULT_SEGMENT_LENGTH" ColumnName="DEFAULT_SEGMENT_LENGTH" />
<ScalarProperty Name="DEFAULT_COLOR_SPACE_GUID" ColumnName="DEFAULT_COLOR_SPACE_GUID" />
<ScalarProperty Name="TARGET_JOB_TYPES" ColumnName="TARGET_JOB_TYPES" />
+ <ScalarProperty Name="LOADED_RML_GUID" ColumnName="LOADED_RML_GUID" />
<ScalarProperty Name="DEFAULT_RML_GUID" ColumnName="DEFAULT_RML_GUID" />
<ScalarProperty Name="CONFIGURATION_GUID" ColumnName="CONFIGURATION_GUID" />
<ScalarProperty Name="MACHINE_VERSION_GUID" ColumnName="MACHINE_VERSION_GUID" />
@@ -6236,6 +6249,8 @@
<EntitySetMapping Name="RMLS">
<EntityTypeMapping TypeName="RemoteModel.RML">
<MappingFragment StoreEntitySet="RMLS">
+ <ScalarProperty Name="THUMBNAIL" ColumnName="THUMBNAIL" />
+ <ScalarProperty Name="RANK" ColumnName="RANK" />
<ScalarProperty Name="ESTIMATED_THREAD_DIAMETER" ColumnName="ESTIMATED_THREAD_DIAMETER" />
<ScalarProperty Name="ELONGATION_AT_BREAK_PERCENTAGE" ColumnName="ELONGATION_AT_BREAK_PERCENTAGE" />
<ScalarProperty Name="TENSILE_STRENGTH" ColumnName="TENSILE_STRENGTH" />
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 cf9ff4f22..4c3b4610a 100644
--- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram
+++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram
@@ -5,81 +5,81 @@
<!-- Diagram content (shape and connector positions) -->
<edmx:Diagrams>
<Diagram DiagramId="f9ae01d708754bbd997add25a4bacc79" Name="Diagram1">
- <EntityTypeShape EntityType="RemoteModel.ACTION_TYPES" Width="1.5" PointX="11.25" PointY="3.875" />
- <EntityTypeShape EntityType="RemoteModel.ADDRESS" Width="1.5" PointX="3.75" PointY="8.375" />
- <EntityTypeShape EntityType="RemoteModel.APPLICATION_DISPLAY_PANEL_VERSIONS" Width="1.5" PointX="3.75" PointY="64.625" />
- <EntityTypeShape EntityType="RemoteModel.APPLICATION_FIRMWARE_VERSIONS" Width="1.5" PointX="3.75" PointY="61.75" />
- <EntityTypeShape EntityType="RemoteModel.APPLICATION_OS_VERSIONS" Width="1.5" PointX="3.75" PointY="67.625" />
- <EntityTypeShape EntityType="RemoteModel.BRUSH_STOPS" Width="1.5" PointX="18" PointY="16" />
- <EntityTypeShape EntityType="RemoteModel.CARTRIDGE_TYPES" Width="1.5" PointX="11.25" PointY="7.25" />
- <EntityTypeShape EntityType="RemoteModel.CAT" Width="1.5" PointX="10.5" PointY="20.5" />
- <EntityTypeShape EntityType="RemoteModel.CCT" Width="1.5" PointX="5.25" PointY="42.75" />
- <EntityTypeShape EntityType="RemoteModel.COLOR_CATALOGS" Width="1.5" PointX="15.75" PointY="12.75" />
- <EntityTypeShape EntityType="RemoteModel.COLOR_SPACES" Width="1.5" PointX="6" PointY="12.75" />
- <EntityTypeShape EntityType="RemoteModel.CONFIGURATION" Width="1.5" PointX="6" PointY="59.75" />
- <EntityTypeShape EntityType="RemoteModel.CONTACT" Width="1.5" PointX="3.75" PointY="4.375" />
- <EntityTypeShape EntityType="RemoteModel.CUSTOMER" Width="1.5" PointX="11.25" PointY="32" />
- <EntityTypeShape EntityType="RemoteModel.DISPENSER_TYPES" Width="1.5" PointX="11.25" PointY="35.5" />
- <EntityTypeShape EntityType="RemoteModel.EMBEDDED_FIRMWARE_VERSIONS" Width="1.5" PointX="3.75" PointY="58.75" />
- <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES" Width="1.5" PointX="8.25" PointY="32" />
- <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES_ACTIONS" Width="1.5" PointX="13.5" PointY="36.875" />
- <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES_CATEGORIES" Width="1.5" PointX="6" PointY="36.125" />
- <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES_GROUPS" Width="1.5" PointX="6" PointY="29.625" />
- <EntityTypeShape EntityType="RemoteModel.FIBER_SHAPES" Width="1.5" PointX="0.75" PointY="30.5" />
- <EntityTypeShape EntityType="RemoteModel.FIBER_SYNTHS" Width="1.5" PointX="0.75" PointY="21" />
- <EntityTypeShape EntityType="RemoteModel.HARDWARE_BLOWER_TYPES" Width="1.5" PointX="3.75" PointY="39.125" />
- <EntityTypeShape EntityType="RemoteModel.HARDWARE_BLOWERS" Width="1.5" PointX="6" PointY="54.75" />
- <EntityTypeShape EntityType="RemoteModel.HARDWARE_BREAK_SENSOR_TYPES" Width="1.5" PointX="10.75" PointY="46.125" />
- <EntityTypeShape EntityType="RemoteModel.HARDWARE_BREAK_SENSORS" Width="1.5" PointX="13" PointY="49.875" />
- <EntityTypeShape EntityType="RemoteModel.HARDWARE_DANCER_TYPES" Width="1.5" PointX="9.75" PointY="66.125" />
- <EntityTypeShape EntityType="RemoteModel.HARDWARE_DANCERS" Width="1.5" PointX="12" PointY="54" />
- <EntityTypeShape EntityType="RemoteModel.HARDWARE_MOTOR_TYPES" Width="1.5" PointX="9.75" PointY="70" />
- <EntityTypeShape EntityType="RemoteModel.HARDWARE_MOTORS" Width="1.5" PointX="12" PointY="59.75" />
- <EntityTypeShape EntityType="RemoteModel.HARDWARE_PID_CONTROL_TYPES" Width="1.5" PointX="6.75" PointY="66.125" />
- <EntityTypeShape EntityType="RemoteModel.HARDWARE_PID_CONTROLS" Width="1.5" PointX="9" PointY="54.25" />
- <EntityTypeShape EntityType="RemoteModel.HARDWARE_SPEED_SENSOR_TYPES" Width="1.5" PointX="6.75" PointY="70.125" />
- <EntityTypeShape EntityType="RemoteModel.HARDWARE_SPEED_SENSORS" Width="1.5" PointX="9" PointY="61.875" />
- <EntityTypeShape EntityType="RemoteModel.HARDWARE_VERSIONS" Width="1.5" PointX="3.75" PointY="54.5" />
- <EntityTypeShape EntityType="RemoteModel.HARDWARE_WINDER_TYPES" Width="1.5" PointX="7.75" PointY="43.125" />
- <EntityTypeShape EntityType="RemoteModel.HARDWARE_WINDERS" Width="1.5" PointX="10" PointY="49.875" />
- <EntityTypeShape EntityType="RemoteModel.HTML_PAGES" Width="1.5" PointX="6" PointY="32.75" />
- <EntityTypeShape EntityType="RemoteModel.IDS_PACK_FORMULAS" Width="1.5" PointX="11.25" PointY="42" />
- <EntityTypeShape EntityType="RemoteModel.IDS_PACKS" Width="1.5" PointX="13.5" PointY="31.25" />
- <EntityTypeShape EntityType="RemoteModel.JOB_RUNS" Width="1.5" PointX="15.75" PointY="22.375" />
- <EntityTypeShape EntityType="RemoteModel.JOB" Width="1.5" PointX="13.5" PointY="17.25" />
- <EntityTypeShape EntityType="RemoteModel.LINEAR_MASS_DENSITY_UNITS" Width="1.5" PointX="0.75" PointY="13.5" />
- <EntityTypeShape EntityType="RemoteModel.LIQUID_TYPES" Width="1.5" PointX="8.25" PointY="2.5" />
- <EntityTypeShape EntityType="RemoteModel.LIQUID_TYPES_RMLS" Width="1.5" PointX="5.25" PointY="20.625" />
- <EntityTypeShape EntityType="RemoteModel.MACHINE_STUDIO_VERSIONS" Width="1.5" PointX="13.5" PointY="8.5" />
- <EntityTypeShape EntityType="RemoteModel.MACHINE_VERSIONS" Width="1.5" PointX="6" PointY="17" />
- <EntityTypeShape EntityType="RemoteModel.MACHINE" Width="1.5" PointX="8.25" PointY="18.375" />
- <EntityTypeShape EntityType="RemoteModel.MACHINES_CONFIGURATIONS" Width="1.5" PointX="10.5" PointY="16.875" />
- <EntityTypeShape EntityType="RemoteModel.MACHINES_EVENTS" Width="1.5" PointX="10.5" PointY="24.375" />
- <EntityTypeShape EntityType="RemoteModel.MEDIA_COLORS" Width="1.5" PointX="0.75" PointY="27.25" />
- <EntityTypeShape EntityType="RemoteModel.MEDIA_CONDITIONS" Width="1.5" PointX="0.75" PointY="33.5" />
- <EntityTypeShape EntityType="RemoteModel.MEDIA_MATERIALS" Width="1.5" PointX="0.75" PointY="16.375" />
- <EntityTypeShape EntityType="RemoteModel.MEDIA_PURPOSES" Width="1.5" PointX="0.75" PointY="24.25" />
- <EntityTypeShape EntityType="RemoteModel.MID_TANK_TYPES" Width="1.5" PointX="11.25" PointY="38.875" />
- <EntityTypeShape EntityType="RemoteModel.ORGANIZATION" Width="1.5" PointX="6" PointY="6.625" />
- <EntityTypeShape EntityType="RemoteModel.PERMISSION" Width="1.5" PointX="14.25" PointY="0.75" />
- <EntityTypeShape EntityType="RemoteModel.PROCESS_PARAMETERS_TABLES" Width="1.5" PointX="7.5" PointY="46.75" />
- <EntityTypeShape EntityType="RemoteModel.PROCESS_PARAMETERS_TABLES_GROUPS" Width="1.5" PointX="5.25" PointY="48.5" />
+ <EntityTypeShape EntityType="RemoteModel.ACTION_TYPES" Width="1.5" PointX="5.25" PointY="71.125" />
+ <EntityTypeShape EntityType="RemoteModel.ADDRESS" Width="1.5" PointX="1.5" PointY="59.125" />
+ <EntityTypeShape EntityType="RemoteModel.APPLICATION_DISPLAY_PANEL_VERSIONS" Width="1.5" PointX="0.75" PointY="41.25" />
+ <EntityTypeShape EntityType="RemoteModel.APPLICATION_FIRMWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="8.25" />
+ <EntityTypeShape EntityType="RemoteModel.APPLICATION_OS_VERSIONS" Width="1.5" PointX="0.75" PointY="2" />
+ <EntityTypeShape EntityType="RemoteModel.BRUSH_STOPS" Width="1.5" PointX="13.75" PointY="14.25" />
+ <EntityTypeShape EntityType="RemoteModel.CARTRIDGE_TYPES" Width="1.5" PointX="9" PointY="4.75" />
+ <EntityTypeShape EntityType="RemoteModel.CAT" Width="1.5" PointX="10.5" PointY="25.125" />
+ <EntityTypeShape EntityType="RemoteModel.CCT" Width="1.5" PointX="5.25" PointY="17.25" />
+ <EntityTypeShape EntityType="RemoteModel.COLOR_CATALOGS" Width="1.5" PointX="11.5" PointY="11.125" />
+ <EntityTypeShape EntityType="RemoteModel.COLOR_SPACES" Width="1.5" PointX="6" PointY="38.25" />
+ <EntityTypeShape EntityType="RemoteModel.CONFIGURATION" Width="1.5" PointX="3" PointY="2.875" />
+ <EntityTypeShape EntityType="RemoteModel.CONTACT" Width="1.5" PointX="1.5" PointY="55.125" />
+ <EntityTypeShape EntityType="RemoteModel.CUSTOMER" Width="1.5" PointX="6" PointY="57.75" />
+ <EntityTypeShape EntityType="RemoteModel.DISPENSER_TYPES" Width="1.5" PointX="9" PointY="1.375" />
+ <EntityTypeShape EntityType="RemoteModel.EMBEDDED_FIRMWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="5.125" />
+ <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES" Width="1.5" PointX="5.25" PointY="66.25" />
+ <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES_ACTIONS" Width="1.5" PointX="7.5" PointY="70.125" />
+ <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES_CATEGORIES" Width="1.5" PointX="3" PointY="67.25" />
+ <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES_GROUPS" Width="1.5" PointX="3" PointY="70.375" />
+ <EntityTypeShape EntityType="RemoteModel.FIBER_SHAPES" Width="1.5" PointX="0.75" PointY="27.75" />
+ <EntityTypeShape EntityType="RemoteModel.FIBER_SYNTHS" Width="1.5" PointX="0.75" PointY="16.875" />
+ <EntityTypeShape EntityType="RemoteModel.HARDWARE_BLOWER_TYPES" Width="1.5" PointX="0.75" PointY="63.5" />
+ <EntityTypeShape EntityType="RemoteModel.HARDWARE_BLOWERS" Width="1.5" PointX="3" PointY="46.125" />
+ <EntityTypeShape EntityType="RemoteModel.HARDWARE_BREAK_SENSOR_TYPES" Width="1.5" PointX="0.75" PointY="44.5" />
+ <EntityTypeShape EntityType="RemoteModel.HARDWARE_BREAK_SENSORS" Width="1.5" PointX="3" PointY="38.25" />
+ <EntityTypeShape EntityType="RemoteModel.HARDWARE_DANCER_TYPES" Width="1.5" PointX="6.75" PointY="54.5" />
+ <EntityTypeShape EntityType="RemoteModel.HARDWARE_DANCERS" Width="1.5" PointX="9" PointY="37.5" />
+ <EntityTypeShape EntityType="RemoteModel.HARDWARE_MOTOR_TYPES" Width="1.5" PointX="10.75" PointY="51.5" />
+ <EntityTypeShape EntityType="RemoteModel.HARDWARE_MOTORS" Width="1.5" PointX="13" PointY="37.125" />
+ <EntityTypeShape EntityType="RemoteModel.HARDWARE_PID_CONTROL_TYPES" Width="1.5" PointX="7.75" PointY="62.5" />
+ <EntityTypeShape EntityType="RemoteModel.HARDWARE_PID_CONTROLS" Width="1.5" PointX="10" PointY="43.625" />
+ <EntityTypeShape EntityType="RemoteModel.HARDWARE_SPEED_SENSOR_TYPES" Width="1.5" PointX="0.75" PointY="48.5" />
+ <EntityTypeShape EntityType="RemoteModel.HARDWARE_SPEED_SENSORS" Width="1.5" PointX="3" PointY="42.25" />
+ <EntityTypeShape EntityType="RemoteModel.HARDWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="37" />
+ <EntityTypeShape EntityType="RemoteModel.HARDWARE_WINDER_TYPES" Width="1.5" PointX="8.75" PointY="58.5" />
+ <EntityTypeShape EntityType="RemoteModel.HARDWARE_WINDERS" Width="1.5" PointX="11" PointY="33.375" />
+ <EntityTypeShape EntityType="RemoteModel.HTML_PAGES" Width="1.5" PointX="3" PointY="64" />
+ <EntityTypeShape EntityType="RemoteModel.IDS_PACK_FORMULAS" Width="1.5" PointX="9" PointY="54.75" />
+ <EntityTypeShape EntityType="RemoteModel.IDS_PACKS" Width="1.5" PointX="11.25" PointY="5.125" />
+ <EntityTypeShape EntityType="RemoteModel.JOB_RUNS" Width="1.5" PointX="10.5" PointY="29.625" />
+ <EntityTypeShape EntityType="RemoteModel.JOB" Width="1.5" PointX="8.25" PointY="17.625" />
+ <EntityTypeShape EntityType="RemoteModel.LINEAR_MASS_DENSITY_UNITS" Width="1.5" PointX="0.75" PointY="33.625" />
+ <EntityTypeShape EntityType="RemoteModel.LIQUID_TYPES" Width="1.5" PointX="9" PointY="12.875" />
+ <EntityTypeShape EntityType="RemoteModel.LIQUID_TYPES_RMLS" Width="1.5" PointX="11.25" PointY="21" />
+ <EntityTypeShape EntityType="RemoteModel.MACHINE_STUDIO_VERSIONS" Width="1.5" PointX="8.25" PointY="66.125" />
+ <EntityTypeShape EntityType="RemoteModel.MACHINE_VERSIONS" Width="1.5" PointX="3" PointY="29.625" />
+ <EntityTypeShape EntityType="RemoteModel.MACHINE" Width="1.5" PointX="5.25" PointY="21.375" />
+ <EntityTypeShape EntityType="RemoteModel.MACHINES_CONFIGURATIONS" Width="1.5" PointX="13.5" PointY="24.125" />
+ <EntityTypeShape EntityType="RemoteModel.MACHINES_EVENTS" Width="1.5" PointX="7.5" PointY="28.625" />
+ <EntityTypeShape EntityType="RemoteModel.MEDIA_COLORS" Width="1.5" PointX="0.75" PointY="21.125" />
+ <EntityTypeShape EntityType="RemoteModel.MEDIA_CONDITIONS" Width="1.5" PointX="0.75" PointY="24.75" />
+ <EntityTypeShape EntityType="RemoteModel.MEDIA_MATERIALS" Width="1.5" PointX="0.75" PointY="30.625" />
+ <EntityTypeShape EntityType="RemoteModel.MEDIA_PURPOSES" Width="1.5" PointX="0.75" PointY="14" />
+ <EntityTypeShape EntityType="RemoteModel.MID_TANK_TYPES" Width="1.5" PointX="9" PointY="7.625" />
+ <EntityTypeShape EntityType="RemoteModel.ORGANIZATION" Width="1.5" PointX="3.75" PointY="57.25" />
+ <EntityTypeShape EntityType="RemoteModel.PERMISSION" Width="1.5" PointX="11" PointY="63.125" />
+ <EntityTypeShape EntityType="RemoteModel.PROCESS_PARAMETERS_TABLES" Width="1.5" PointX="7.5" PointY="47.625" />
+ <EntityTypeShape EntityType="RemoteModel.PROCESS_PARAMETERS_TABLES_GROUPS" Width="1.5" PointX="5.25" PointY="49.375" />
<EntityTypeShape EntityType="RemoteModel.RML" Width="1.5" PointX="3" PointY="18.125" />
- <EntityTypeShape EntityType="RemoteModel.ROLE" Width="1.5" PointX="14.25" PointY="4.625" />
- <EntityTypeShape EntityType="RemoteModel.ROLES_PERMISSIONS" Width="1.5" PointX="16.5" PointY="4.75" />
- <EntityTypeShape EntityType="RemoteModel.SEGMENT" Width="1.5" PointX="15.75" PointY="18.875" />
- <EntityTypeShape EntityType="RemoteModel.SPOOL_TYPES" Width="1.5" PointX="6" PointY="24.375" />
- <EntityTypeShape EntityType="RemoteModel.sysdiagram" Width="1.5" PointX="0.75" PointY="0.75" />
- <EntityTypeShape EntityType="RemoteModel.TANGO_VERSIONS" Width="1.5" PointX="13.5" PointY="12.75" />
- <EntityTypeShape EntityType="RemoteModel.TECH_CONTROLLERS" Width="1.5" PointX="2.75" PointY="0.75" />
- <EntityTypeShape EntityType="RemoteModel.TECH_DISPENSERS" Width="1.5" PointX="4.75" PointY="0.75" />
- <EntityTypeShape EntityType="RemoteModel.TECH_HEATERS" Width="1.5" PointX="0.75" PointY="4.75" />
- <EntityTypeShape EntityType="RemoteModel.TECH_IOS" Width="1.5" PointX="0.75" PointY="7.75" />
- <EntityTypeShape EntityType="RemoteModel.TECH_MONITORS" Width="1.5" PointX="2.75" PointY="12.75" />
- <EntityTypeShape EntityType="RemoteModel.TECH_VALVES" Width="1.5" PointX="16.75" PointY="0.75" />
- <EntityTypeShape EntityType="RemoteModel.USER" Width="1.5" PointX="11.25" PointY="10.75" />
- <EntityTypeShape EntityType="RemoteModel.USERS_ROLES" Width="1.5" PointX="16.5" PointY="8.625" />
- <EntityTypeShape EntityType="RemoteModel.WINDING_METHODS" Width="1.5" PointX="11.25" PointY="28.875" />
+ <EntityTypeShape EntityType="RemoteModel.ROLE" Width="1.5" PointX="11" PointY="59" />
+ <EntityTypeShape EntityType="RemoteModel.ROLES_PERMISSIONS" Width="1.5" PointX="13.25" PointY="59.125" />
+ <EntityTypeShape EntityType="RemoteModel.SEGMENT" Width="1.5" PointX="10.5" PointY="17.125" />
+ <EntityTypeShape EntityType="RemoteModel.SPOOL_TYPES" Width="1.5" PointX="3" PointY="33.125" />
+ <EntityTypeShape EntityType="RemoteModel.sysdiagram" Width="1.5" PointX="5.75" PointY="0.75" />
+ <EntityTypeShape EntityType="RemoteModel.TANGO_VERSIONS" Width="1.5" PointX="8.25" PointY="33.125" />
+ <EntityTypeShape EntityType="RemoteModel.TECH_CONTROLLERS" Width="1.5" PointX="5.75" PointY="3.75" />
+ <EntityTypeShape EntityType="RemoteModel.TECH_DISPENSERS" Width="1.5" PointX="5.75" PointY="7.75" />
+ <EntityTypeShape EntityType="RemoteModel.TECH_HEATERS" Width="1.5" PointX="2.75" PointY="8.75" />
+ <EntityTypeShape EntityType="RemoteModel.TECH_IOS" Width="1.5" PointX="4.75" PointY="10.75" />
+ <EntityTypeShape EntityType="RemoteModel.TECH_MONITORS" Width="1.5" PointX="11.75" PointY="0.75" />
+ <EntityTypeShape EntityType="RemoteModel.TECH_VALVES" Width="1.5" PointX="13.75" PointY="0.75" />
+ <EntityTypeShape EntityType="RemoteModel.USER" Width="1.5" PointX="6" PointY="33" />
+ <EntityTypeShape EntityType="RemoteModel.USERS_ROLES" Width="1.5" PointX="13.25" PointY="33" />
+ <EntityTypeShape EntityType="RemoteModel.WINDING_METHODS" Width="1.5" PointX="6" PointY="42" />
<AssociationConnector Association="RemoteModel.FK_EVENTS_ACTIONS_ACTIONS" />
<AssociationConnector Association="RemoteModel.FK_ORGANIZATIONS_ADDRESSES" />
<AssociationConnector Association="RemoteModel.FK_USERS_ADDRESSES" />
@@ -148,7 +148,7 @@
<AssociationConnector Association="RemoteModel.FK_MACHINES_CONFIGURATIONS_MACHINES" />
<AssociationConnector Association="RemoteModel.FK_MACHINES_EVENTS_MACHINES" />
<AssociationConnector Association="RemoteModel.FK_MACHINES_ORGANIZATIONS" />
- <AssociationConnector Association="RemoteModel.FK_MACHINES_RMLS" />
+ <AssociationConnector Association="RemoteModel.FK_MACHINES_RMLS2" />
<AssociationConnector Association="RemoteModel.FK_MACHINES_SPOOL_TYPES" />
<AssociationConnector Association="RemoteModel.FK_MACHINES_EVENTS_USERS" />
<AssociationConnector Association="RemoteModel.FK_RML_MEDIA_COLORS" />
diff --git a/Software/Visual_Studio/Tango.SQLExaminer/ExaminerConfigurationBuilder.cs b/Software/Visual_Studio/Tango.SQLExaminer/ExaminerConfigurationBuilder.cs
index 7123553a6..dbed95b77 100644
--- a/Software/Visual_Studio/Tango.SQLExaminer/ExaminerConfigurationBuilder.cs
+++ b/Software/Visual_Studio/Tango.SQLExaminer/ExaminerConfigurationBuilder.cs
@@ -30,7 +30,7 @@ namespace Tango.SQLExaminer
_config.DataSources.Clear();
}
- public ExaminerConfigurationBuilder SetSourceServer(String address, String databaseName, bool integratedSecurity = true, String userName = null, String password = null)
+ public ExaminerConfigurationBuilder SetSource(Core.DataSource dataSource)
{
DataSource d1 = _config.DataSources.SingleOrDefault(x => x.ID == 1);
@@ -41,20 +41,25 @@ namespace Tango.SQLExaminer
}
d1.ID = 1;
- d1.DataBase = databaseName;
- d1.Server = address;
- d1.UserName = userName;
- d1.Password = password;
+ d1.DataBase = dataSource.Catalog;
+ d1.Server = dataSource.Address;
+ d1.UserName = dataSource.UserName;
+ d1.Password = dataSource.Password;
- if (integratedSecurity)
+ if (dataSource.IntegratedSecurity)
{
d1.IntegratedSecurity = "True";
}
+ if (dataSource.Type == Core.DataSourceType.Azure)
+ {
+ d1.Type = "SqlAzure";
+ }
+
return this;
}
- public ExaminerConfigurationBuilder SetTargetServer(String address, String databaseName, bool integratedSecurity = true, String userName = null, String password = null)
+ public ExaminerConfigurationBuilder SetTarget(Core.DataSource dataSource)
{
DataSource d2 = _config.DataSources.SingleOrDefault(x => x.ID == 2);
@@ -65,17 +70,22 @@ namespace Tango.SQLExaminer
}
d2.ID = 2;
- d2.DataBase = databaseName;
- d2.Server = address;
- d2.UserName = userName;
- d2.Password = password;
+ d2.DataBase = dataSource.Catalog;
+ d2.Server = dataSource.Address;
+ d2.UserName = dataSource.UserName;
+ d2.Password = dataSource.Password;
- if (integratedSecurity)
+ if (dataSource.IntegratedSecurity)
{
d2.IntegratedSecurity = "True";
}
+ if (dataSource.Type == Core.DataSourceType.Azure)
+ {
+ d2.Type = "SqlAzure";
+ }
+
return this;
}
diff --git a/Software/Visual_Studio/Tango.SQLExaminer/ExaminerSequenceConfigurationRunner.cs b/Software/Visual_Studio/Tango.SQLExaminer/ExaminerSequenceConfigurationRunner.cs
index b9ee986bc..de146ead3 100644
--- a/Software/Visual_Studio/Tango.SQLExaminer/ExaminerSequenceConfigurationRunner.cs
+++ b/Software/Visual_Studio/Tango.SQLExaminer/ExaminerSequenceConfigurationRunner.cs
@@ -14,9 +14,9 @@ namespace Tango.SQLExaminer
public String SequenceFile { get; private set; }
- public ExaminerSequenceDataSource Source { get; private set; }
+ public Core.DataSource Source { get; private set; }
- public ExaminerSequenceDataSource Target { get; private set; }
+ public Core.DataSource Target { get; private set; }
public String MachineSerialNumber { get; private set; }
@@ -24,7 +24,7 @@ namespace Tango.SQLExaminer
public ExaminerSequenceConfiguration Configuration { get; private set; }
- public ExaminerSequenceConfigurationRunner(String sequenceFile, String scriptsFolder, ExaminerSequenceDataSource source, ExaminerSequenceDataSource target, String machineSerialNumber)
+ public ExaminerSequenceConfigurationRunner(String sequenceFile, String scriptsFolder, Core.DataSource source, Core.DataSource target, String machineSerialNumber)
{
SequenceFile = sequenceFile;
ScriptsFolder = scriptsFolder;
@@ -49,13 +49,13 @@ namespace Tango.SQLExaminer
if (item.Direction == ExaminerSequenceItemDirection.SourceToTarget)
{
- builder.SetSourceServer(Source.Address, Source.DataBaseName, Source.IntegratedSecurity, Source.UserName, Source.Password);
- builder.SetTargetServer(Target.Address, Target.DataBaseName, Target.IntegratedSecurity, Target.UserName, Target.Password);
+ builder.SetSource(Source);
+ builder.SetTarget(Target);
}
else
{
- builder.SetSourceServer(Target.Address, Target.DataBaseName, Target.IntegratedSecurity, Target.UserName, Target.Password);
- builder.SetTargetServer(Source.Address, Source.DataBaseName, Source.IntegratedSecurity, Source.UserName, Source.Password);
+ builder.SetSource(Target);
+ builder.SetTarget(Source);
}
if (item.RequiresSerialNumber)
diff --git a/Software/Visual_Studio/Tango.UnitTesting/SQLExaminer_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/SQLExaminer_TST.cs
index 5b7ce16ca..5863aca74 100644
--- a/Software/Visual_Studio/Tango.UnitTesting/SQLExaminer_TST.cs
+++ b/Software/Visual_Studio/Tango.UnitTesting/SQLExaminer_TST.cs
@@ -20,6 +20,28 @@ namespace Tango.UnitTesting
[TestCategory("SQL Examiner")]
public class SQLExaminer_TST
{
+ private Core.DataSource GetSource(String catalog = "Tango")
+ {
+ return new Core.DataSource()
+ {
+ Type = DataSourceType.SQLServer,
+ Address = "localhost\\SQLEXPRESS",
+ Catalog = catalog,
+ IntegratedSecurity = true,
+ };
+ }
+
+ private Core.DataSource GetTarget(String catalog = "Test")
+ {
+ return new Core.DataSource()
+ {
+ Type = DataSourceType.SQLServer,
+ Address = "localhost\\SQLEXPRESS",
+ Catalog = catalog,
+ IntegratedSecurity = true,
+ };
+ }
+
[TestMethod]
public void Generate_Schema_Synchronization_Script()
{
@@ -28,8 +50,8 @@ namespace Tango.UnitTesting
var temp_folder = Helper.GetTempFolderPath();
builder.
- SetSourceServer("localhost\\SQLEXPRESS", "Tango", false, "Synchronizer", "Aa123456").
- SetTargetServer("twine01\\SQLTWINE", "Tango").
+ SetSource(GetSource()).
+ SetTarget(GetTarget()).
SetBackupFile(Path.Combine(temp_folder, "db.bak")).
SetReportFile(Path.Combine(temp_folder, "report.xml"));
@@ -50,8 +72,8 @@ namespace Tango.UnitTesting
var temp_folder = Helper.GetTempFolderPath();
builder.
- SetSourceServer("localhost\\SQLEXPRESS", "Tango", false, "Synchronizer", "Aa123456").
- SetTargetServer("twine01\\SQLTWINE", "Tango").
+ SetSource(GetSource()).
+ SetTarget(GetTarget()).
SetReportFile(Path.Combine(temp_folder, "report.xml")).
SetMachineSerialNumber("1111");
@@ -72,8 +94,8 @@ namespace Tango.UnitTesting
var temp_folder = Helper.GetTempFolderPath();
builder.
- SetSourceServer("localhost\\SQLEXPRESS", "Tango", false, "Synchronizer", "Aa123456").
- SetTargetServer("twine01\\SQLTWINE", "Tango").
+ SetSource(GetSource()).
+ SetTarget(GetTarget()).
SetReportFile(Path.Combine(temp_folder, "report.xml"));
var config = builder.Build();
@@ -101,8 +123,8 @@ namespace Tango.UnitTesting
var temp_folder = Helper.GetTempFolderPath();
builder.
- SetSourceServer("localhost\\SQLEXPRESS", "Tango").
- SetTargetServer("localhost\\SQLEXPRESS", "Test").
+ SetSource(GetSource()).
+ SetTarget(GetTarget()).
SetReportFile("C:\\Data\\Report.xml");
var config = builder.Build();
@@ -125,8 +147,8 @@ namespace Tango.UnitTesting
var temp_folder = Helper.GetTempFolderPath();
builder.
- SetSourceServer("localhost\\SQLEXPRESS", "Tango").
- SetTargetServer("localhost\\SQLEXPRESS", "Test").
+ SetSource(GetSource()).
+ SetTarget(GetTarget()).
SetReportFile("C:\\DATA\\report_data.xml");
var config = builder.Build();
@@ -153,8 +175,8 @@ namespace Tango.UnitTesting
var temp_folder = Helper.GetTempFolderPath();
builder.
- SetSourceServer("localhost\\SQLEXPRESS", "Tango").
- SetTargetServer("localhost\\SQLEXPRESS", "Test").
+ SetSource(GetSource()).
+ SetTarget(GetTarget()).
SetMachineSerialNumber("1111");
var config = builder.Build();
@@ -216,8 +238,8 @@ namespace Tango.UnitTesting
ExaminerConfigurationBuilder builder = new ExaminerConfigurationBuilder(ExaminerConfigurationType.Schema);
builder.
- SetSourceServer("localhost\\SQLEXPRESS", source_db).
- SetTargetServer("localhost\\SQLEXPRESS", target_db).
+ SetSource(GetSource(source_db)).
+ SetTarget(GetTarget(target_db)).
Synchronize().
SetReportFile(report_file);
@@ -236,8 +258,8 @@ namespace Tango.UnitTesting
builder = new ExaminerConfigurationBuilder(ExaminerConfigurationType.OverrideData);
builder.
- SetSourceServer("localhost\\SQLEXPRESS", source_db).
- SetTargetServer("localhost\\SQLEXPRESS", target_db).
+ SetSource(GetSource(source_db)).
+ SetTarget(GetTarget(target_db)).
Synchronize().
SetReportFile(report_file);
@@ -255,8 +277,8 @@ namespace Tango.UnitTesting
builder = new ExaminerConfigurationBuilder(ExaminerConfigurationType.ProvisionMachine);
builder.
- SetSourceServer("localhost\\SQLEXPRESS", source_db).
- SetTargetServer("localhost\\SQLEXPRESS", target_db).
+ SetSource(GetSource(source_db)).
+ SetTarget(GetTarget(target_db)).
SetMachineSerialNumber(machine_serial_number).
Synchronize().
SetReportFile(report_file);
@@ -308,8 +330,8 @@ namespace Tango.UnitTesting
builder = new ExaminerConfigurationBuilder(ExaminerConfigurationType.UpdateTwineDB);
builder.
- SetSourceServer("localhost\\SQLEXPRESS", target_db).
- SetTargetServer("localhost\\SQLEXPRESS", source_db).
+ SetSource(GetTarget(target_db)).
+ SetTarget(GetSource(source_db)).
Synchronize().
SetReportFile(report_file);
@@ -341,8 +363,8 @@ namespace Tango.UnitTesting
builder = new ExaminerConfigurationBuilder(ExaminerConfigurationType.UpdateMachine);
builder.
- SetSourceServer("localhost\\SQLEXPRESS", source_db).
- SetTargetServer("localhost\\SQLEXPRESS", target_db).
+ SetSource(GetSource(source_db)).
+ SetTarget(GetTarget(target_db)).
SetMachineSerialNumber(machine_serial_number).
Synchronize().
SetReportFile(report_file);
diff --git a/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/ObservablesGenerator.cs b/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/ObservablesGenerator.cs
index 876639b78..3a40dfd1f 100644
--- a/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/ObservablesGenerator.cs
+++ b/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/ObservablesGenerator.cs
@@ -16,6 +16,7 @@ using Tango.Core;
using System.Data;
using System.Diagnostics;
using static Tango.Core.Components.DataBaseDescriptionsHelper;
+using System.Threading;
namespace Tango.DBObservablesGenerator.CLI
{
@@ -31,6 +32,7 @@ namespace Tango.DBObservablesGenerator.CLI
public void GenerateCSharp(String targetPath)
{
List<DbDescription> dbDescriptions = new List<DbDescription>();
+ List<ForeignKeyDescription> foreign_keys = new List<ForeignKeyDescription>();
//Get column descriptions...
using (RemoteDB db = new RemoteDB(SettingsManager.Default.GetOrCreate<CoreSettings>().DataSource))
@@ -39,6 +41,7 @@ namespace Tango.DBObservablesGenerator.CLI
db.Database.Connection.Open();
dbDescriptions = Core.Components.DataBaseDescriptionsHelper.GetDescriptions(db.Database.Connection);
+ foreign_keys = Core.Components.DataBaseDescriptionsHelper.GetForeignKeys(db.Database.Connection);
}
//Generate Entities...
@@ -61,7 +64,38 @@ namespace Tango.DBObservablesGenerator.CLI
Description = table_description,
};
- List<String> foreignKeys = table.PropertyType.GenericTypeArguments.First().GetProperties().Skip(3).Where(x => x.PropertyType == typeof(String)).Where(x => x.Name.ToLower().Contains("guid")).Select(x => DalNameToStandardName(x.Name).SingularizeMVC().Replace("Guid", "")).ToList();
+ List<String> guessed_keys = table.PropertyType.GenericTypeArguments.First().GetProperties().Skip(3).Where(x => x.PropertyType == typeof(String)).Where(x => x.Name.ToLower().Contains("guid")).Select(x => DalNameToStandardName(x.Name).SingularizeMVC().Replace("Guid", "")).OrderBy(x => x).ToList();
+
+ List<String> foreignKeys = foreign_keys.Where(x => x.TableName == table.Name).Select(x => DalNameToStandardName(x.ColumnName).SingularizeMVC().Replace("Guid", "")).OrderBy(x => x).ToList();
+
+ String t_name = table.Name;
+
+ if (guessed_keys.Count != foreignKeys.Count)
+ {
+ Console.ForegroundColor = ConsoleColor.Yellow;
+
+ Console.WriteLine($"Specious entry at {table.Name}.");
+ for (int i = 0; i < Math.Max(guessed_keys.Count, foreignKeys.Count); i++)
+ {
+ if (i < guessed_keys.Count)
+ {
+ Console.Write(guessed_keys[i]);
+ }
+
+ Console.Write(" <=> ");
+
+ if (i < foreignKeys.Count)
+ {
+ Console.Write(foreignKeys[i]);
+ }
+
+ Console.WriteLine();
+ }
+
+ Console.ForegroundColor = ConsoleColor.Gray;
+
+ Thread.Sleep(2000);
+ }
foreach (var field in table.PropertyType.GenericTypeArguments.First().GetProperties().Skip(3))
{
@@ -103,11 +137,12 @@ namespace Tango.DBObservablesGenerator.CLI
codeField.Name = codeField.Type;
codeField.XmlIgnore = true;
- var fk = foreignKeys.SingleOrDefault(x => x.Contains(codeField.Name));
+ var fk = foreignKeys.FirstOrDefault(x => x.Contains(codeField.Name));
if (fk != null)
{
codeField.Name = fk;
+ foreignKeys.Remove(fk);
}
codeField.Complex = true;
@@ -116,7 +151,7 @@ namespace Tango.DBObservablesGenerator.CLI
{
codeField.Type = field.PropertyType.Name;
- if (codeField.Name.EndsWith("Guid"))
+ if (foreignKeys.Contains(codeField.Name.Replace("Guid", "")))
{
codeField.IsForeignKey = true;
codeField.ForeignKeyName = codeField.Name.Replace("Guid", "");
diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/MachineStudioController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/MachineStudioController.cs
index 245c18b9b..8485cd67d 100644
--- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/MachineStudioController.cs
+++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/MachineStudioController.cs
@@ -1,4 +1,5 @@
-using System;
+using Microsoft.IdentityModel.Clients.ActiveDirectory;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
@@ -6,10 +7,14 @@ using System.Net.Http;
using System.Security.Authentication;
using System.Web.Http;
using Tango.BL;
+using Tango.BL.Builders;
using Tango.BL.Entities;
using Tango.BL.Enumerations;
+using Tango.Core.Cryptography;
using Tango.MachineService.Helpers;
using Tango.MachineService.Models;
+using Tango.MachineStudio.Common.Authentication;
+using System.Data.Entity;
using Tango.MachineStudio.Common.Update;
namespace Tango.MachineService.Controllers
@@ -23,6 +28,8 @@ namespace Tango.MachineService.Controllers
_pendingUploads = new List<MachineStudioPendingUpload>();
}
+ #region Update
+
[HttpPost]
public CheckForUpdatesResponse CheckForUpdates(CheckForUpdatesRequest request)
{
@@ -100,7 +107,7 @@ namespace Tango.MachineService.Controllers
var user = db.Users.SingleOrDefault(x => x.Email.ToLower() == request.Email.ToLower() && x.Password == request.Password);
- if (user != null && user.HasPermission(Permissions.PublishMachineStudioVersion))
+ if (user != null && user.HasPermission(Permissions.PublishMachineStudioVersions))
{
var latestVersion = db.MachineStudioVersions.ToList().OrderByDescending(x => Version.Parse(x.Version)).FirstOrDefault();
Version currentVersion = Version.Parse(request.Version);
@@ -182,5 +189,63 @@ namespace Tango.MachineService.Controllers
return new LatestVersionResponse() { Version = version != null ? version.Version : "0.0.0.0" };
}
}
+
+ #endregion
+
+ [HttpPost]
+ public LoginResponse Login(LoginRequest request)
+ {
+ AuthenticationResult authResult = AzureDirectoryHelper.AuthenticateUser(request.Email, request.Password);
+
+ using (ObservablesContext db = ObservablesContextHelper.CreateContext())
+ {
+ db.Roles.ToList();
+ db.Permissions.ToList();
+ db.UsersRoles.ToList();
+ db.RolesPermissions.ToList();
+
+ var user = db.Users.SingleOrDefault(x => x.Email.ToLower() == request.Email.ToLower());
+
+ IHashGenerator g = new BasicHashGenerator();
+
+ if (user == null)
+ {
+ //Than add the user !!
+ User new_user = new User();
+ new_user.Email = request.Email;
+ new_user.Password = g.Encrypt(request.Password);
+ new_user.Organization = db.Organizations.Include(x => x.Address).Single(x => x.Name == "Twine");
+ new_user.Address = new_user.Organization.Address.Clone();
+ new_user.Contact = new Contact()
+ {
+ FirstName = authResult.UserInfo.GivenName,
+ LastName = authResult.UserInfo.FamilyName,
+ FullName = authResult.UserInfo.GivenName + " " + authResult.UserInfo.FamilyName,
+ Email = request.Email,
+ };
+ new_user.Roles.Add(db.Roles.Single(x => (Roles)x.Code == Roles.User));
+ }
+ else
+ {
+ user.Password = g.Encrypt(request.Password);
+ }
+
+ db.SaveChanges();
+ }
+
+ return new LoginResponse()
+ {
+ DataSource = new Core.DataSource()
+ {
+ Address = Config.DB_ADDRESS,
+ Catalog = Config.DB_CATALOG,
+ Type = Core.DataSourceType.Azure,
+ IntegratedSecurity = false,
+ UserName = request.Email,
+ Password = request.Password,
+ }
+ };
+ }
+
}
}
diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs
index 9ce22bbb0..68f597fcc 100644
--- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs
+++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs
@@ -18,6 +18,7 @@ using Tango.BL;
using Tango.BL.Builders;
using Tango.BL.Entities;
using Tango.BL.Enumerations;
+using Tango.Core;
using Tango.Core.DB;
using Tango.Core.Helpers;
using Tango.Core.IO;
@@ -101,9 +102,16 @@ namespace Tango.MachineService.Controllers
});
}
- response.DbAddress = Config.DB_ADDRESS;
- response.DbUserName = credentials.UserName;
- response.DbPassword = credentials.Password;
+ response.DataSource = new DataSource()
+ {
+ Address = Config.DB_ADDRESS,
+ Catalog = Config.DB_CATALOG,
+ UserName = credentials.UserName,
+ Password = credentials.Password,
+ IntegratedSecurity = false,
+ Type = DataSourceType.SQLServer,
+ };
+
response.OSKey = machine.OsKey;
response.SetupActivation = machine.SetupActivation;
response.SetupRemoteAssistance = machine.SetupRemoteAssistance;
@@ -160,9 +168,15 @@ namespace Tango.MachineService.Controllers
});
}
- response.DbAddress = Config.DB_ADDRESS;
- response.DbUserName = credentials.UserName;
- response.DbPassword = credentials.Password;
+ response.DataSource = new DataSource()
+ {
+ Address = Config.DB_ADDRESS,
+ Catalog = Config.DB_CATALOG,
+ UserName = credentials.UserName,
+ Password = credentials.Password,
+ IntegratedSecurity = false,
+ Type = DataSourceType.SQLServer,
+ };
}
return response;
@@ -231,9 +245,15 @@ namespace Tango.MachineService.Controllers
});
}
- response.DbAddress = Config.DB_ADDRESS;
- response.DbUserName = credentials.UserName;
- response.DbPassword = credentials.Password;
+ response.DataSource = new DataSource()
+ {
+ Address = Config.DB_ADDRESS,
+ Catalog = Config.DB_CATALOG,
+ UserName = credentials.UserName,
+ Password = credentials.Password,
+ IntegratedSecurity = false,
+ Type = DataSourceType.SQLServer,
+ };
}
return response;
@@ -290,7 +310,7 @@ namespace Tango.MachineService.Controllers
var user = db.Users.SingleOrDefault(x => x.Email.ToLower() == request.Email.ToLower() && x.Password == request.Password);
- if (user != null && user.HasPermission(Permissions.PublishMachineStudioVersion))
+ if (user != null && user.HasPermission(Permissions.PublishPPCVersions))
{
var versions = db.TangoVersions.ToList().Where(x => x.MachineVersionGuid == request.MachineVersionGuid).OrderByDescending(x => Version.Parse(x.Version)).ToList();
diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Helpers/AzureDirectoryHelper.cs b/Software/Visual_Studio/Web/Tango.MachineService/Helpers/AzureDirectoryHelper.cs
new file mode 100644
index 000000000..fe7733323
--- /dev/null
+++ b/Software/Visual_Studio/Web/Tango.MachineService/Helpers/AzureDirectoryHelper.cs
@@ -0,0 +1,19 @@
+using Microsoft.IdentityModel.Clients.ActiveDirectory;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace Tango.MachineService.Helpers
+{
+ public static class AzureDirectoryHelper
+ {
+ public static AuthenticationResult AuthenticateUser(String email, String password)
+ {
+ var authContext = new AuthenticationContext("https://login.microsoftonline.com/2ebd63a5-bc2f-41dc-9066-4409ed5e5dd4");
+ UserCredential userCredential = new UserCredential(email, password);
+ AuthenticationResult authResult = authContext.AcquireToken("https://graph.windows.net/", "ec612854-7abc-457b-808a-5d0c5ba80c57", userCredential);
+ return authResult;
+ }
+ }
+} \ No newline at end of file
diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Tango.MachineService.csproj b/Software/Visual_Studio/Web/Tango.MachineService/Tango.MachineService.csproj
index c6245e18e..c05cb5fe7 100644
--- a/Software/Visual_Studio/Web/Tango.MachineService/Tango.MachineService.csproj
+++ b/Software/Visual_Studio/Web/Tango.MachineService/Tango.MachineService.csproj
@@ -64,6 +64,12 @@
<HintPath>..\..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.3\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
+ <Reference Include="Microsoft.IdentityModel.Clients.ActiveDirectory, Version=2.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.7.10707.1513-rc\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms, Version=2.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.7.10707.1513-rc\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll</HintPath>
+ </Reference>
<Reference Include="Microsoft.SqlServer.AzureStorageEnum, Version=14.100.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.SqlServer.SqlManagementObjects.140.17283.0\lib\net40\Microsoft.SqlServer.AzureStorageEnum.dll</HintPath>
</Reference>
@@ -271,6 +277,7 @@
<Compile Include="App_Start\FilterConfig.cs" />
<Compile Include="Config.cs" />
<Compile Include="Controllers\MachineStudioController.cs" />
+ <Compile Include="Helpers\AzureDirectoryHelper.cs" />
<Compile Include="Helpers\ObservablesContextHelper.cs" />
<Compile Include="Helpers\StorageHelper.cs" />
<Compile Include="JsonController.cs" />
@@ -373,7 +380,7 @@
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
- <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" />
+ <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" />
</VisualStudio>
</ProjectExtensions>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Web.config b/Software/Visual_Studio/Web/Tango.MachineService/Web.config
index 3590b89d8..ef2420349 100644
--- a/Software/Visual_Studio/Web/Tango.MachineService/Web.config
+++ b/Software/Visual_Studio/Web/Tango.MachineService/Web.config
@@ -125,6 +125,10 @@
<assemblyIdentity name="System.Diagnostics.StackTrace" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="Microsoft.IdentityModel.Clients.ActiveDirectory" publicKeyToken="31bf3856ad364e35" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-2.7.0.0" newVersion="2.7.0.0" />
+ </dependentAssembly>
</assemblyBinding>
</runtime>
<system.codedom>
diff --git a/Software/Visual_Studio/Web/Tango.MachineService/packages.config b/Software/Visual_Studio/Web/Tango.MachineService/packages.config
index ede4fa80d..080382800 100644
--- a/Software/Visual_Studio/Web/Tango.MachineService/packages.config
+++ b/Software/Visual_Studio/Web/Tango.MachineService/packages.config
@@ -20,6 +20,7 @@
<package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.3" targetFramework="net45" />
<package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net45" />
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="1.0.3" targetFramework="net45" />
+ <package id="Microsoft.IdentityModel.Clients.ActiveDirectory" version="2.7.10707.1513-rc" targetFramework="net461" />
<package id="Microsoft.Net.Compilers" version="2.4.0" targetFramework="net46" developmentDependency="true" />
<package id="Microsoft.SqlServer.SqlManagementObjects" version="140.17283.0" targetFramework="net461" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />