Index: Ringtoets/Common/src/Ringtoets.Common.IO/ReferenceLineMetaImporter.cs =================================================================== diff -u -re3f0e0861e4d1f5faa32280e837777e8755b67d6 -r7d38bc43c1be859f9a410ed99c6dacb2a6f58126 --- Ringtoets/Common/src/Ringtoets.Common.IO/ReferenceLineMetaImporter.cs (.../ReferenceLineMetaImporter.cs) (revision e3f0e0861e4d1f5faa32280e837777e8755b67d6) +++ Ringtoets/Common/src/Ringtoets.Common.IO/ReferenceLineMetaImporter.cs (.../ReferenceLineMetaImporter.cs) (revision 7d38bc43c1be859f9a410ed99c6dacb2a6f58126) @@ -24,6 +24,7 @@ using System.IO; using System.Linq; using System.Security; +using System.Windows.Forms; using Core.Common.IO.Exceptions; using Core.Common.Utils.Builders; using Core.Common.Utils.Properties; @@ -78,6 +79,8 @@ targetItem.WrappedData.Id = assessmentSectionId; targetItem.WrappedData.ReferenceLine = selectedReferenceLineMeta; + targetItem.WrappedData.NotifyObservers(); + return true; } @@ -163,6 +166,33 @@ } } while (referenceLinesMeta != null); } + + ValidateReferenceLineMetas(); } + + private void ValidateReferenceLineMetas() + { + var referenceLineMetasCount = referenceLineMetas.Select(rlm => rlm.AssessmentSectionId).Count(); + var referenceLineMetasDistinctCount = referenceLineMetas.Select(rlm => rlm.AssessmentSectionId).Distinct().Count(); + + if (referenceLineMetasCount != referenceLineMetasDistinctCount) + { + var message = new FileReaderErrorMessageBuilder(shapeFilePath) + .Build("De trajectid's niet uniek."); + log.Warn(message); + + MessageBox.Show(message, "Fout", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + + if (referenceLineMetas.Any(rlm => String.IsNullOrEmpty(rlm.AssessmentSectionId))) + { + var message = new FileReaderErrorMessageBuilder(shapeFilePath) + .Build("De trajectid's zijn niet allemaal ingevuld."); + log.Warn(message); + + MessageBox.Show(message, "Fout", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } } } \ No newline at end of file