aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2020-12-13 01:36:14 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2020-12-13 01:36:14 +0200
commit10ed2886c61b94ed0ec294e40d260d2a69ef2cc1 (patch)
treefd439c24cf0cd48350f42cbfa54aeb90d563e5da /Software/Visual_Studio/MachineStudio/Modules
parent2a73ff05b9bf95da0f9fe10aa7823bd70f01f01e (diff)
parenta793aababd2b255dda42540715792167164e1e94 (diff)
downloadTango-10ed2886c61b94ed0ec294e40d260d2a69ef2cc1.tar.gz
Tango-10ed2886c61b94ed0ec294e40d260d2a69ef2cc1.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/_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));