aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2020-02-24 16:51:04 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2020-02-24 16:51:04 +0200
commitefde98a69746f41c1055858142b1935955d82fb0 (patch)
tree6b317f70d8f0f89acd71529e3ca82c502b47475f /Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs
parentddf4a6b20db496a512d4fe8ccd56c1ec7fed104a (diff)
downloadTango-efde98a69746f41c1055858142b1935955d82fb0.tar.gz
Tango-efde98a69746f41c1055858142b1935955d82fb0.zip
Implemented job runs reset on factory restore.
Diffstat (limited to 'Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs')
-rw-r--r--Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs22
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;