aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2020-09-24 22:28:15 +0300
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2020-09-24 22:28:15 +0300
commit09b1dd03e5d67453e673789fe0826e7a25d881ab (patch)
treece45826edbdb28a370a0a2b4e96a530a4e557ffb /Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs
parentfddc07eece13c6676078e17b7e925ef70c6e70cb (diff)
downloadTango-09b1dd03e5d67453e673789fe0826e7a25d881ab.tar.gz
Tango-09b1dd03e5d67453e673789fe0826e7a25d881ab.zip
Allow null user on jobs.
Dropped use of any user on PPC.
Diffstat (limited to 'Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs')
-rw-r--r--Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs28
1 files changed, 3 insertions, 25 deletions
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)