From 09b1dd03e5d67453e673789fe0826e7a25d881ab Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Thu, 24 Sep 2020 22:28:15 +0300 Subject: Allow null user on jobs. Dropped use of any user on PPC. --- .../Controllers/PPCController.cs | 28 +++------------------- 1 file changed, 3 insertions(+), 25 deletions(-) (limited to 'Software/Visual_Studio/Web/Tango.MachineService/Controllers') diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs index 22feb29c1..4215cd175 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs @@ -507,8 +507,6 @@ namespace Tango.MachineService.Controllers }); } - User machineUser = null; - try { using (ObservablesContext db = ObservablesContextHelper.CreateContext()) @@ -519,26 +517,6 @@ namespace Tango.MachineService.Controllers { throw new AuthenticationException("The specified machine could not be found."); } - - machineUser = db.Users.Include(x => x.Contact).SingleOrDefault(x => x.Contact.FirstName == machine.Name); - - if (machineUser == null) - { - //No machine user then create one. - machineUser = new User(); - machineUser.Email = machine.SerialNumber + "@twine-s.com"; - machineUser.Password = machine.SerialNumber; - machineUser.OrganizationGuid = machine.OrganizationGuid; - machineUser.Contact = new Contact(); - machineUser.Contact.Email = machineUser.Email; - machineUser.Contact.FirstName = machine.Name; - machineUser.Contact.LastName = machine.Name; - machineUser.Contact.FullName = machine.Name; - machineUser.Address = new Address(); - - db.Users.Add(machineUser); - db.SaveChanges(); - } } //Insert/Replace Jobs. @@ -551,7 +529,7 @@ namespace Tango.MachineService.Controllers var job = dto.ToObservable(); job.ID = 0; - job.UserGuid = machineUser.Guid; + job.UserGuid = dto.UserGuid; job.CustomerGuid = null; job.IsSynchronized = true; @@ -589,7 +567,7 @@ namespace Tango.MachineService.Controllers { var run = dto.ToObservable(); run.ID = 0; - run.UserGuid = machineUser.Guid; + run.UserGuid = dto.UserGuid; run.IsSynchronized = true; if (db.JobRuns.SingleOrDefault(x => x.Guid == run.Guid) == null) @@ -618,7 +596,7 @@ namespace Tango.MachineService.Controllers { var ev = dto.ToObservable(); ev.ID = 0; - ev.UserGuid = machineUser.Guid; + ev.UserGuid = dto.UserGuid; ev.IsSynchronized = true; if (db.MachinesEvents.SingleOrDefault(x => x.Guid == ev.Guid) == null) -- cgit v1.3.1 From 17a624c8ddacc1dac4904793645d6c893f7ced77 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Thu, 24 Sep 2020 23:20:25 +0300 Subject: Changed all PPC updated to based on GUID ! --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 22675456 -> 22675456 bytes .../MachineSetup/MachineSetupManager.cs | 1 - .../MachineUpdate/IMachineUpdateManager.cs | 13 +++--- .../MachineUpdate/MachineUpdateManager.cs | 47 +++++++++------------ .../DefaultMachineDataSynchronizer.cs | 2 +- .../Tango.PPC.Common/Web/CheckForUpdateRequest.cs | 1 - .../Tango.PPC.Common/Web/DownloadUpdateRequest.cs | 2 +- .../PPC/Tango.PPC.Common/Web/LoginRequest.cs | 1 + .../Tango.PPC.Common/Web/MachineSetupRequest.cs | 1 - .../PPC/Tango.PPC.Common/Web/UpdateDBRequest.cs | 1 - .../Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs | 6 +-- .../Configurations/ProvisionMachine.xml | Bin 88354 -> 76348 bytes .../SQLExaminer/Configurations/UpdateMachine.xml | Bin 55424 -> 72920 bytes .../Controllers/PPCController.cs | 10 +++-- 15 files changed, 39 insertions(+), 46 deletions(-) (limited to 'Software/Visual_Studio/Web/Tango.MachineService/Controllers') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index f8c0132fb..aeb06fad3 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index 5cc378c9f..52724650c 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ 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 a2a750805..15902f629 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs @@ -247,7 +247,6 @@ namespace Tango.PPC.Common.MachineSetup } MachineSetupRequest request = new MachineSetupRequest(); - request.SerialNumber = serialNumber; request.DeviceID = await _windows_manager.GetDeviceId(); request.DeviceName = deviceName; diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/IMachineUpdateManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/IMachineUpdateManager.cs index 3e3fbcc27..77646da40 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/IMachineUpdateManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/IMachineUpdateManager.cs @@ -38,9 +38,8 @@ namespace Tango.PPC.Common.MachineUpdate event EventHandler Progress; /// - /// Performs a machine update using the specified serial number and machine service address. + /// Performs a machine update. /// - /// The serial number. /// if set to true updates the embedded device firmware. /// if set to true updates the embedded device FPGA version and other parameters. /// @@ -61,24 +60,22 @@ namespace Tango.PPC.Common.MachineUpdate Task UpdateFromTFP(String fileName); /// - /// Checks if any update are available for the specified machine serial number. + /// Checks if any update are available. /// - /// The serial number. /// - Task CheckForUpdate(String serialNumber); + Task CheckForUpdate(); /// /// Checks whether it is necessary to updates all the "overwrite-able" database tables. /// - /// The serial number. /// - Task UpdateDBCheck(String serialNumber); + Task UpdateDBCheck(); /// /// Updates all the "overwrite-able" database tables. /// /// - Task UpdateDB(DbCompareResult dbCompareResult, String serialNumber); + Task UpdateDB(DbCompareResult dbCompareResult); /// /// Gets the update package file information. 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 4f8be0a6e..9b4462a70 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs @@ -148,12 +148,12 @@ namespace Tango.PPC.Common.MachineUpdate #region Private Methods - private Task Login(String serialNumber) + private Task Login(String machineGuid) { return _client.Login(new LoginRequest() { Mode = LoginMode.Machine, - SerialNumber = serialNumber, + MachineGuid = machineGuid, }); } @@ -609,9 +609,8 @@ namespace Tango.PPC.Common.MachineUpdate #region Public Methods /// - /// Performs a machine update using the specified serial number and machine service address. + /// Performs a machine update. /// - /// The serial number. /// if set to true updates the embedded device firmware. /// if set to true updates the embedded device FPGA version and other parameters. /// @@ -638,7 +637,7 @@ namespace Tango.PPC.Common.MachineUpdate var _newPackageTempFolder = TemporaryManager.CreateFolder(); _newPackageTempFolder.Persist = true; - String serialNumber = _machineProvider.Machine.SerialNumber; + String machineGuid = _machineProvider.Machine.Guid; try { @@ -646,7 +645,7 @@ namespace Tango.PPC.Common.MachineUpdate var machineServiceAddress = _settings.GetMachineServiceAddress(); - LogManager.Log($"Starting machine update for serial number {serialNumber}..."); + LogManager.Log($"Starting machine update..."); //Connecting to machine... LogManager.Log("Verifying machine connection and state..."); @@ -677,10 +676,9 @@ namespace Tango.PPC.Common.MachineUpdate LogManager.Log($"Connecting to machine service on {machineServiceAddress}..."); - await Login(serialNumber); + await Login(machineGuid); DownloadUpdateRequest request = new DownloadUpdateRequest(); - request.SerialNumber = serialNumber; update_response = await _client.MachineUpdate(request); @@ -804,7 +802,7 @@ namespace Tango.PPC.Common.MachineUpdate Path.Combine(_newPackageTempFolder, "Update Scripts"), update_response.DataSource, localDataSource, - serialNumber); + machineGuid); runner.Log += (x, msg) => { @@ -894,12 +892,11 @@ namespace Tango.PPC.Common.MachineUpdate } /// - /// Checks if any update are available for the specified machine serial number. + /// Checks if any update are available for the specified machine. /// - /// The serial number. /// The machine service address. /// - public Task CheckForUpdate(string serialNumber) + public Task CheckForUpdate() { return Task.Factory.StartNew(() => { @@ -909,12 +906,13 @@ namespace Tango.PPC.Common.MachineUpdate LogManager.Log($"Connecting to machine service on {machineServiceAddress}..."); - Login(serialNumber).GetAwaiter().GetResult(); + String machineGuid = _machineProvider.Machine.Guid; + + Login(machineGuid).GetAwaiter().GetResult(); LogManager.Log($"Checking if updates available..."); CheckForUpdateRequest request = new CheckForUpdateRequest(); - request.SerialNumber = serialNumber; request.Version = _app_manager.Version.ToString(); request.FirmwareVersion = _app_manager.FirmwareVersion?.ToString(); @@ -950,10 +948,9 @@ namespace Tango.PPC.Common.MachineUpdate /// /// Updates all the "overwrite-able" database tables. /// - /// The serial number. /// The machine service address. /// - public Task UpdateDB(DbCompareResult dbCompareResult, String serialNumber) + public Task UpdateDB(DbCompareResult dbCompareResult) { _updateStartDate = DateTime.UtcNow; _logs.Clear(); @@ -1034,7 +1031,7 @@ namespace Tango.PPC.Common.MachineUpdate if (item.RequiresSerialNumber) { - builder.SetMachineSerialNumber(serialNumber); + builder.SetMachineSerialNumber(_machineProvider.Machine.Guid); } builder.Synchronize(); @@ -1081,16 +1078,15 @@ namespace Tango.PPC.Common.MachineUpdate /// /// Checks whether it is necessary to updates all the "overwrite-able" database tables. /// - /// The serial number. /// The machine service address. /// - public Task UpdateDBCheck(string serialNumber) + public Task UpdateDBCheck() { return Task.Factory.StartNew(() => { var machineServiceAddress = _settings.GetMachineServiceAddress(); - LogManager.Log($"Checking if database update is required for serial number {serialNumber}..."); + LogManager.Log($"Checking if database update is required..."); LogManager.Log("Looking for update scripts configuration on application path..."); @@ -1103,10 +1099,9 @@ namespace Tango.PPC.Common.MachineUpdate LogManager.Log($"Connecting to machine service on {machineServiceAddress}..."); - Login(serialNumber).Wait(); + Login(_machineProvider.Machine.Guid).Wait(); UpdateDBRequest request = new UpdateDBRequest(); - request.SerialNumber = serialNumber; request.ApplicationVersion = _app_manager.Version.ToString(); request.FirmwareVersion = _app_manager.FirmwareVersion.ToString(); @@ -1137,7 +1132,7 @@ namespace Tango.PPC.Common.MachineUpdate if (item.RequiresSerialNumber) { - builder.SetMachineSerialNumber(serialNumber); + builder.SetMachineSerialNumber(_machineProvider.Machine.Guid); } var config = builder.Build(); @@ -1227,7 +1222,7 @@ namespace Tango.PPC.Common.MachineUpdate { _isUpdating = true; - LogManager.Log($"Starting machine update for serial number {serialNumber}..."); + LogManager.Log($"Starting machine update (TUP) for serial number {serialNumber}..."); //Connecting to machine... LogManager.Log("Verifying machine connection and state..."); @@ -1368,7 +1363,7 @@ namespace Tango.PPC.Common.MachineUpdate Path.Combine(_newPackageTempFolder, "Update Scripts"), tempDbDataSource, localDataSource, - serialNumber); + _machineProvider.Machine.Guid); runner.Log += (x, msg) => { @@ -1661,7 +1656,7 @@ namespace Tango.PPC.Common.MachineUpdate try { - var response = await CheckForUpdate(_machineProvider.Machine.SerialNumber); + var response = await CheckForUpdate(); if (response.IsUpdateAvailable || response.IsDatabaseUpdateAvailable) { LogManager.Log($"New {(response.IsDatabaseUpdateAvailable ? "database updates" : "application version")} detected ({response.Version}). Raising event..."); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Synchronization/DefaultMachineDataSynchronizer.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Synchronization/DefaultMachineDataSynchronizer.cs index ab1f8e890..645ddbdf5 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Synchronization/DefaultMachineDataSynchronizer.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Synchronization/DefaultMachineDataSynchronizer.cs @@ -452,7 +452,7 @@ namespace Tango.PPC.Common.Synchronization await this.client.Login(new LoginRequest() { Mode = LoginMode.Machine, - SerialNumber = _machineProvider.Machine.SerialNumber, + MachineGuid = _machineProvider.Machine.Guid, }); } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/CheckForUpdateRequest.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/CheckForUpdateRequest.cs index a93b30a59..8e13ea7c4 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/CheckForUpdateRequest.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/CheckForUpdateRequest.cs @@ -9,7 +9,6 @@ namespace Tango.PPC.Common.Web { public class CheckForUpdateRequest : WebRequestMessage { - public String SerialNumber { get; set; } public String Version { get; set; } public String FirmwareVersion { get; set; } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/DownloadUpdateRequest.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/DownloadUpdateRequest.cs index a32d3d497..db4080dff 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/DownloadUpdateRequest.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/DownloadUpdateRequest.cs @@ -9,6 +9,6 @@ namespace Tango.PPC.Common.Web { public class DownloadUpdateRequest : WebRequestMessage { - public String SerialNumber { get; set; } + } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/LoginRequest.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/LoginRequest.cs index f8588f6b0..9ae0d65ae 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/LoginRequest.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/LoginRequest.cs @@ -11,6 +11,7 @@ namespace Tango.PPC.Common.Web { public LoginMode Mode { get; set; } public String SerialNumber { get; set; } + public String MachineGuid { get; set; } public String Email { get; set; } public String Password { get; set; } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/MachineSetupRequest.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/MachineSetupRequest.cs index 821828a48..a9e68df36 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/MachineSetupRequest.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/MachineSetupRequest.cs @@ -9,7 +9,6 @@ namespace Tango.PPC.Common.Web { public class MachineSetupRequest : WebRequestMessage { - public String SerialNumber { get; set; } public String DeviceID { get; set; } public String DeviceName { get; set; } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/UpdateDBRequest.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/UpdateDBRequest.cs index c78f6199e..4d8433a56 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/UpdateDBRequest.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/UpdateDBRequest.cs @@ -9,7 +9,6 @@ namespace Tango.PPC.Common.Web { public class UpdateDBRequest : WebRequestMessage { - public String SerialNumber { get; set; } public String ApplicationVersion { get; set; } public String FirmwareVersion { get; set; } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs index d4d78dac6..23ec956a0 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs @@ -167,7 +167,7 @@ namespace Tango.PPC.UI.ViewModels return; } - var response = await MachineUpdateManager.CheckForUpdate(MachineProvider.Machine.SerialNumber); + var response = await MachineUpdateManager.CheckForUpdate(); try { @@ -208,7 +208,7 @@ namespace Tango.PPC.UI.ViewModels } else { - _db_compare_result = await MachineUpdateManager.UpdateDBCheck(MachineProvider.Machine.SerialNumber); + _db_compare_result = await MachineUpdateManager.UpdateDBCheck(); if (_db_compare_result.RequiresUpdate) { @@ -261,7 +261,7 @@ namespace Tango.PPC.UI.ViewModels try { - await MachineUpdateManager.UpdateDB(_db_compare_result, MachineProvider.Machine.SerialNumber); + await MachineUpdateManager.UpdateDB(_db_compare_result); LogManager.Log("Database update completed."); await NavigateTo(MachineUpdateView.UpdateCompletedView); } diff --git a/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/ProvisionMachine.xml b/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/ProvisionMachine.xml index 8f60372b0..f3b845010 100644 Binary files a/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/ProvisionMachine.xml and b/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/ProvisionMachine.xml differ diff --git a/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/UpdateMachine.xml b/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/UpdateMachine.xml index 540b4cad9..260448394 100644 Binary files a/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/UpdateMachine.xml and b/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/UpdateMachine.xml differ diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs index 4215cd175..601438d67 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs @@ -390,7 +390,11 @@ namespace Tango.MachineService.Controllers if (hasDatabaseUpdates) { response.IsDatabaseUpdateAvailable = true; - response.UpdateDBResponse = UpdateDB(new UpdateDBRequest() { SerialNumber = request.SerialNumber }); + response.UpdateDBResponse = UpdateDB(new UpdateDBRequest() + { + ApplicationVersion = request.Version, + FirmwareVersion = request.FirmwareVersion + }); } //Compare database @@ -937,11 +941,11 @@ namespace Tango.MachineService.Controllers } else if (request.Mode == LoginMode.Machine) { - var machine = db.Machines.SingleOrDefault(x => x.SerialNumber == request.SerialNumber); + var machine = db.Machines.SingleOrDefault(x => x.SerialNumber == request.SerialNumber || x.Guid == request.MachineGuid); if (machine == null) { - throw new AuthenticationException("Invalid serial number."); + throw new AuthenticationException("Invalid machine serial number or id."); } response.AccessToken = WebToken.CreateNew(MachineServiceConfig.JWT_TOKEN_SECRET, new TokenObject() -- cgit v1.3.1 From 73d68112321587add7e22d89175fd1f12c34c6d1 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Fri, 25 Sep 2020 04:04:52 +0300 Subject: Improved Auth2 package and tested. Dropped "Stack trace not provided" message from TangoController. Retained job user round-trip from MS. --- .../PPC Installer-cache/cacheIndex.txt | Bin 52 -> 52 bytes .../Advanced Installer Projects/PPC Installer.aip | 125 +++++++++++++-------- .../Views/MachineJobSelectionView.xaml | 2 +- .../PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs | 2 +- .../Visual_Studio/PPC/Tango.PPC.UI/app.manifest | 2 +- .../Tango.PPC.Packages.Auth2/Auth2.cs | 37 +++++- .../Tango.PPC.Packages.Auth2.csproj | 4 + .../SQLExaminer/Configurations/UpdateMachine.xml | Bin 72920 -> 77930 bytes .../Tango.Web/Controllers/TangoController.cs | 2 +- .../Controllers/PPCController.cs | 4 +- .../Properties/AssemblyInfo.cs | 2 +- 11 files changed, 119 insertions(+), 61 deletions(-) (limited to 'Software/Visual_Studio/Web/Tango.MachineService/Controllers') diff --git a/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache/cacheIndex.txt b/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache/cacheIndex.txt index a603ff06b..5fe5afe5a 100644 Binary files a/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache/cacheIndex.txt and b/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache/cacheIndex.txt differ diff --git a/Software/Visual_Studio/Advanced Installer Projects/PPC Installer.aip b/Software/Visual_Studio/Advanced Installer Projects/PPC Installer.aip index d1e783e61..7cd6c02b1 100644 --- a/Software/Visual_Studio/Advanced Installer Projects/PPC Installer.aip +++ b/Software/Visual_Studio/Advanced Installer Projects/PPC Installer.aip @@ -18,10 +18,10 @@ - + - + @@ -73,7 +73,9 @@ + + @@ -156,7 +158,6 @@ - @@ -164,6 +165,7 @@ + @@ -194,12 +196,14 @@ + + @@ -221,26 +225,28 @@ - - - - - - + + + + + + + + + + + + - - - - + + + + - - - - @@ -312,7 +318,6 @@ - @@ -502,6 +507,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -511,7 +548,7 @@ - + @@ -579,20 +616,6 @@ - - - - - - - - - - - - - - @@ -707,7 +730,6 @@ - @@ -791,20 +813,27 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml index c7e1d4130..a3d2dbd68 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml @@ -193,7 +193,7 @@ - + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs index de58aa679..b95219ad0 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs @@ -8,4 +8,4 @@ using System.Windows; // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Tango PPC Application")] -[assembly: AssemblyVersion("1.1.28.0")] +[assembly: AssemblyVersion("1.2.3.0")] diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest index efc5f8179..d72e75011 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest @@ -16,7 +16,7 @@ Remove this element if your application requires this virtualization for backwards compatibility. --> - + diff --git a/Software/Visual_Studio/PPC/UpdatePackages/Tango.PPC.Packages.Auth2/Auth2.cs b/Software/Visual_Studio/PPC/UpdatePackages/Tango.PPC.Packages.Auth2/Auth2.cs index c27391d90..6ba278511 100644 --- a/Software/Visual_Studio/PPC/UpdatePackages/Tango.PPC.Packages.Auth2/Auth2.cs +++ b/Software/Visual_Studio/PPC/UpdatePackages/Tango.PPC.Packages.Auth2/Auth2.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using System.Threading; using System.Threading.Tasks; using Tango.BL; using Tango.Core; @@ -10,7 +11,7 @@ using Tango.PPC.Shared.Updates; namespace Tango.PPC.Packages.Auth2 { - [PPCPackage(PackageType.Pre, "Auth 2", false)] + [PPCPackage(PackageType.Pre, "Applying Auth2 Patch", false)] public class Auth2 : ExtendedObject, IPPCPackage { public Task Run(PackageContext context) @@ -23,23 +24,49 @@ namespace Tango.PPC.Packages.Auth2 { using (var transaction = db.Database.BeginTransaction()) { - LogManager.Log("Removing all users..."); - context.ReportProgress("Modifying users..."); - db.Database.ExecuteSqlCommand("DELETE FROM USERS"); - LogManager.Log("Setting all jobs users to null..."); context.ReportProgress("Modifying jobs..."); db.Database.ExecuteSqlCommand("ALTER TABLE JOBS ALTER COLUMN USER_GUID VARCHAR(36) NULL"); db.Database.ExecuteSqlCommand("UPDATE JOBS SET USER_GUID = NULL"); + Thread.Sleep(1000); + LogManager.Log("Setting all job runs users to null..."); context.ReportProgress("Modifying job runs..."); db.Database.ExecuteSqlCommand("UPDATE JOB_RUNS SET USER_GUID = NULL"); + Thread.Sleep(1000); + LogManager.Log("Setting all events users to null..."); context.ReportProgress("Modifying events..."); db.Database.ExecuteSqlCommand("UPDATE MACHINES_EVENTS SET USER_GUID = NULL"); + Thread.Sleep(1000); + + LogManager.Log("Removing all users..."); + context.ReportProgress("Modifying users..."); + db.Database.ExecuteSqlCommand("DELETE FROM USERS"); + + Thread.Sleep(1000); + + LogManager.Log("Removing redundant addresses..."); + context.ReportProgress("Modifying addresses..."); + db.Database.ExecuteSqlCommand(@" +DELETE ADDRESSES FROM ADDRESSES +FULL JOIN ORGANIZATIONS ON ORGANIZATIONS.ADDRESS_GUID = ADDRESSES.GUID +WHERE ORGANIZATIONS.ADDRESS_GUID IS NULL"); + + Thread.Sleep(1000); + + LogManager.Log("Removing redundant contacts..."); + context.ReportProgress("Modifying contacts..."); + db.Database.ExecuteSqlCommand(@" +DELETE CONTACTS FROM CONTACTS +FULL JOIN ORGANIZATIONS ON ORGANIZATIONS.CONTACT_GUID = CONTACTS.GUID +WHERE ORGANIZATIONS.CONTACT_GUID IS NULL"); + + Thread.Sleep(1000); + LogManager.Log("Committing transaction..."); context.ReportProgress("Committing transaction..."); transaction.Commit(); diff --git a/Software/Visual_Studio/PPC/UpdatePackages/Tango.PPC.Packages.Auth2/Tango.PPC.Packages.Auth2.csproj b/Software/Visual_Studio/PPC/UpdatePackages/Tango.PPC.Packages.Auth2/Tango.PPC.Packages.Auth2.csproj index 721c61654..bd91c2b60 100644 --- a/Software/Visual_Studio/PPC/UpdatePackages/Tango.PPC.Packages.Auth2/Tango.PPC.Packages.Auth2.csproj +++ b/Software/Visual_Studio/PPC/UpdatePackages/Tango.PPC.Packages.Auth2/Tango.PPC.Packages.Auth2.csproj @@ -33,9 +33,11 @@ ..\..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll + False ..\..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll + False @@ -55,6 +57,7 @@ {F441FEEE-322A-4943-B566-110E12FD3B72} Tango.BL + False {A34EE0F0-649D-41C8-8489-B6F1CC6924EE} @@ -74,6 +77,7 @@ {208c8bd8-72c6-4e3c-acaa-351091a2acc7} Tango.PPC.Shared + False diff --git a/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/UpdateMachine.xml b/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/UpdateMachine.xml index 260448394..b70bc1ff4 100644 Binary files a/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/UpdateMachine.xml and b/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/UpdateMachine.xml differ diff --git a/Software/Visual_Studio/Tango.Web/Controllers/TangoController.cs b/Software/Visual_Studio/Tango.Web/Controllers/TangoController.cs index 3fd3d469e..b3df0373e 100644 --- a/Software/Visual_Studio/Tango.Web/Controllers/TangoController.cs +++ b/Software/Visual_Studio/Tango.Web/Controllers/TangoController.cs @@ -84,7 +84,7 @@ namespace Tango.Web.Controllers if (expandedExceptionValues != null) { - expandedExceptionValues["StackTrace"] = "StackTrace not provided."; + expandedExceptionValues["StackTrace"] = ""; } } #endif diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs index 601438d67..2c1c27f52 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs @@ -533,7 +533,6 @@ namespace Tango.MachineService.Controllers var job = dto.ToObservable(); job.ID = 0; - job.UserGuid = dto.UserGuid; job.CustomerGuid = null; job.IsSynchronized = true; @@ -546,6 +545,7 @@ namespace Tango.MachineService.Controllers } else if (job.LastUpdated > existingJob.LastUpdated) { + job.UserGuid = existingJob.UserGuid; existingJob.Delete(db); db.Jobs.Add(job); db.SaveChanges(); @@ -571,7 +571,6 @@ namespace Tango.MachineService.Controllers { var run = dto.ToObservable(); run.ID = 0; - run.UserGuid = dto.UserGuid; run.IsSynchronized = true; if (db.JobRuns.SingleOrDefault(x => x.Guid == run.Guid) == null) @@ -600,7 +599,6 @@ namespace Tango.MachineService.Controllers { var ev = dto.ToObservable(); ev.ID = 0; - ev.UserGuid = dto.UserGuid; ev.IsSynchronized = true; if (db.MachinesEvents.SingleOrDefault(x => x.Guid == ev.Guid) == null) diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Web/Tango.MachineService/Properties/AssemblyInfo.cs index efa53fcdd..11c9ee72a 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Properties/AssemblyInfo.cs @@ -24,4 +24,4 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("3.0.4.0")] +[assembly: AssemblyVersion("3.0.5.0")] -- cgit v1.3.1