diff --git a/PROMS/ReferencedObjects/Exe/RefObj/ROEditor/RO_FST.cs b/PROMS/ReferencedObjects/Exe/RefObj/ROEditor/RO_FST.cs index 151ddba2..93c93986 100644 --- a/PROMS/ReferencedObjects/Exe/RefObj/ROEditor/RO_FST.cs +++ b/PROMS/ReferencedObjects/Exe/RefObj/ROEditor/RO_FST.cs @@ -101,6 +101,7 @@ using System.Runtime.InteropServices; using VlnStatus; using System.Collections.Specialized; using ROFST_FILE; +using Volian.Base.Library; //using VlnProfiler; //don't forget to add VlnProfiler to the reference list @@ -261,6 +262,14 @@ namespace ROEditor } File.Copy(FstNew,FstPath,true); // save ROFST.NEW as RO.fST File.Delete(FstNew); // remove ROFST.NEW + if (OrphanedRecords.Length > 0) + { + StreamWriter sw = new StreamWriter(VlnSettings.TemporaryFolder + @"\Orphaned RO Records.txt"); + sw.Write(OrphanedRecords.ToString()); + sw.Close(); + MessageBox.Show("The file Orphaned RO Records.txt has been created", "Warning - Orphan RO Record"); + } + MessageBox.Show("New RO.FST file created successfully.","Create RO.FST file",System.Windows.Forms.MessageBoxButtons.OK); } // MessageBox.Show(Profiler.ToString("000.00%"),"Timings"); @@ -531,7 +540,7 @@ namespace ROEditor // Profiler.End("Finish"); return RtnVal; } - + StringBuilder OrphanedRecords = new StringBuilder(); private uint SaveFstGroup(XmlNode GroupNode, uint parentID,ref ushort typ,ArrayList AvailList,string AccPageIDTplate) { uint RtnVal; @@ -568,7 +577,7 @@ namespace ROEditor { // Profiler.Start("GetChildData"); // ROdatabase.RODB_GetChildData(elem,true); - ROdatabase.RODB_GetGroupAndSubgroups(elem); + ROdatabase.RODB_GetGroupAndSubgroups(elem, OrphanedRecords); // Profiler.End("GetChildData"); } diff --git a/PROMS/ReferencedObjects/LibSource/RODBInterface/RODBInterface.cs b/PROMS/ReferencedObjects/LibSource/RODBInterface/RODBInterface.cs index 96f1ecea..c56cbdbb 100644 --- a/PROMS/ReferencedObjects/LibSource/RODBInterface/RODBInterface.cs +++ b/PROMS/ReferencedObjects/LibSource/RODBInterface/RODBInterface.cs @@ -1203,7 +1203,7 @@ namespace RODBInterface // Note that this function is designed to be call for the // root node (i.e. it gets all of group and RO data for a given // database table) - public bool RODB_GetGroupAndSubgroups(VlnXmlElement node) + public bool RODB_GetGroupAndSubgroups(VlnXmlElement node, StringBuilder sb) { VlnStatusBar StatBar = new VlnStatusBar("Reading from the Database"); string tablename = node.GetAttribute("Table"); @@ -1236,8 +1236,15 @@ namespace RODBInterface { if (!dicGroups.Contains(ParID)) { - string strMBText = "The following record is being skipped. The parent for this RO is missing:\n\n RecID: " + RecID + "\n\n Table: " + tablename +"\n"; - MessageBox.Show(strMBText, "Warning - Orphan RO Record"); + if (sb.Length == 0) + { + sb.AppendLine("The following records were skipped."); + sb.AppendLine("The parent for these RO's was missing."); + sb.AppendLine(); + } + string strMBText = "RecID: " + RecID + "\n\n Table: " + tablename +"\n"; + sb.AppendLine(strMBText); +// MessageBox.Show(strMBText, "Warning - Orphan RO Record"); continue; // skip - no parent for this node } node = (VlnXmlElement)dicGroups[ParID]; @@ -1636,7 +1643,7 @@ namespace RODBInterface { DBE.Command(readstr); DBE.Reader(); - + if (recid == null) DBE.Read(); // skip the first parentID record of 00000000