diff options
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Sites/ViewModels')
| -rw-r--r-- | Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Sites/ViewModels/SiteDetailsViewVM.cs | 6 |
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)); |
