diff options
Diffstat (limited to 'Software/Visual_Studio/Web/Tango.MachineService/Controllers')
| -rw-r--r-- | Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs index b132a4c48..71e540dbf 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs @@ -24,6 +24,7 @@ using Tango.Web.ActiveDirectory; using Tango.Core.Cryptography; using Tango.MachineService.Filters; using Tango.BL.DTO; +using Z.EntityFramework.Plus; namespace Tango.MachineService.Controllers { @@ -170,6 +171,27 @@ namespace Tango.MachineService.Controllers Token = response.NotifyCompletedToken, TangoUpdateGuid = tangoUpdate.Guid, }); + + Task.Factory.StartNew(() => + { + using (ObservablesContext b = ObservablesContextHelper.CreateContext()) + { + //Reset Job Runs. + try + { + b.JobRuns.Where(x => x.MachineGuid == machine.Guid && x.IsSynchronized).Update(x => new JobRun() { IsSynchronized = false }); + } + catch (Exception ex) + { + LogManager.Log(ex, $"Error resetting synchronized job runs for machine '{machine.SerialNumber}'."); + } + + //Reset Events. + //b.MachinesEvents.Where(x => x.MachineGuid == machine.Guid).Update(x => new MachinesEvent() { IsSynchronized = false }); + //Reset Jobs. + //b.Jobs.Where(x => x.MachineGuid == machine.Guid).Update(x => new Job() { IsSynchronized = false }); + } + }); } return response; |
