diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2019-12-18 09:02:04 +0200 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2019-12-18 09:02:04 +0200 |
| commit | a61a911d1ebde107ba7bf210af7e753e692d93e2 (patch) | |
| tree | 95355ea06f74b4a6a685e7fd2b1510b9d72c3d51 /Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs | |
| parent | 1b92f30f6dfa27392ffd8460ebeb17c17550db7b (diff) | |
| parent | 615bc666c8d0618d93bc4401a74928535c2cc7f6 (diff) | |
| download | Tango-a61a911d1ebde107ba7bf210af7e753e692d93e2.tar.gz Tango-a61a911d1ebde107ba7bf210af7e753e692d93e2.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs')
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs | 24 |
1 files changed, 24 insertions, 0 deletions
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 dfa9b833b..29daedb4c 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs @@ -11,6 +11,8 @@ using System.Net.Http.Headers; using System.Text; using System.Threading; using System.Threading.Tasks; +using Tango.BL; +using Tango.BL.Entities; using Tango.Core; using Tango.Core.DB; using Tango.Core.ExtensionMethods; @@ -29,6 +31,7 @@ using Tango.Settings; using Tango.SharedUI.Helpers; using Tango.SQLExaminer; using Tango.Transport.Web; +using System.Data.Entity; namespace Tango.PPC.Common.MachineSetup { @@ -45,6 +48,7 @@ namespace Tango.PPC.Common.MachineSetup private PPCWebClient _client; private List<LogItemBase> _logs; private bool _isUpdating; + private DateTime _setupStartDate; #region Events @@ -162,6 +166,25 @@ namespace Tango.PPC.Common.MachineSetup { LogManager.Log(xx, "Error notifying setup completed."); } + + try + { + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + TangoUpdate update = new TangoUpdate(); + update.ApplicationVersion = response.Version; + update.FirmwareVersion = response.FirmwareVersion; + update.MachineGuid = (await db.Machines.FirstAsync()).Guid; + update.UpdateStatus = BL.Enumerations.TangoUpdateStatuses.SetupCompleted; + update.StartDate = _setupStartDate; + update.EndDate = DateTime.UtcNow; + await db.SaveChangesAsync(); + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error saving tango setup information to database."); + } } _isUpdating = false; @@ -191,6 +214,7 @@ namespace Tango.PPC.Common.MachineSetup TaskCompletionSource<MachineSetupResult> result = new TaskCompletionSource<MachineSetupResult>(); MachineSetupResponse setup_response = null; + _setupStartDate = DateTime.UtcNow; try { |
