aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2020-12-17 16:22:49 +0200
committerShlomo Hecht <shlomo@twine-s.com>2020-12-17 16:22:49 +0200
commit50433ea885a3ebdc6a55f733c9083b6e07c2cb3e (patch)
tree878e54f684fa24aae504b9dda006f4068bb86353 /Software/Visual_Studio/MachineStudio/Modules
parent39cf804612a97dfb848ac308a1b40bafc3780783 (diff)
parentf0f46e7e560cf5e9999e5ba9904634f01176f27e (diff)
downloadTango-50433ea885a3ebdc6a55f733c9083b6e07c2cb3e.tar.gz
Tango-50433ea885a3ebdc6a55f733c9083b6e07c2cb3e.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Sites/ViewModels/SiteDetailsViewVM.cs6
1 files changed, 6 insertions, 0 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Sites/ViewModels/SiteDetailsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Sites/ViewModels/SiteDetailsViewVM.cs
index 92dd8273d..cacda1e8d 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Sites/ViewModels/SiteDetailsViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Sites/ViewModels/SiteDetailsViewVM.cs
@@ -125,6 +125,12 @@ namespace Tango.MachineStudio.Sites.ViewModels
using (_notification.PushTaskItem("Saving site details..."))
{
+ //Check if site organization has changed and there are no machines that belongs to this site but different organization.
+ if (_db.Machines.Any(x => x.SiteGuid == Site.Guid && x.OrganizationGuid != Site.OrganizationGuid))
+ {
+ throw new InvalidOperationException($"One or more machines belongs to this site but not to '{Site.Organization.Name}' organization.");
+ }
+
//Remove site rmls.
Site.SitesRmls.ToList().Where(x => !Rmls.SynchedSource.ToList().Exists(y => y.Guid == x.RmlGuid)).ToList().ForEach(x => _db.SitesRmls.Remove(x));
Site.SitesCatalogs.ToList().Where(x => !Catalogs.SynchedSource.ToList().Exists(y => y.Guid == x.ColorCatalogGuid)).ToList().ForEach(x => _db.SitesCatalogs.Remove(x));