From 0231bdc4cac253a9fb81ef914abf80706f640c29 Mon Sep 17 00:00:00 2001 From: Rich Date: Sat, 15 Mar 2014 10:02:55 +0000 Subject: [PATCH] Pass the frmLoader to the ROFixer object so that status can be displayed as steps are processed. Pass the frmLoader to the ROFixer object so that status can be displayed as steps are processed Fixed MyValue so that unchanged values will not be displayed as if they had changed. Added Status outut as changed RO Values are found. Display a MessageBox when processing is complete. --- PROMS/DataLoader/ROFixer.cs | 19 ++++++++++++++++--- PROMS/DataLoader/frmLoader.cs | 2 +- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/PROMS/DataLoader/ROFixer.cs b/PROMS/DataLoader/ROFixer.cs index 0cc8506a..f234d4cf 100644 --- a/PROMS/DataLoader/ROFixer.cs +++ b/PROMS/DataLoader/ROFixer.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Text; using VEPROMS.CSLA.Library; +using System.Windows.Forms; namespace DataLoader { @@ -48,9 +49,11 @@ namespace DataLoader set { _ErrorCount = value; } } private string _LogPath; - public ROFixer(string logpath) + private frmLoader frmMain; + public ROFixer(string logpath, frmLoader myfrmMain) { _LogPath = logpath; + frmMain = myfrmMain; } public TimeSpan Process() { @@ -60,6 +63,7 @@ namespace DataLoader } private void ProcessROs() { + int changeCount = 0; Status = "Getting List..."; // get list of content records List myContentList = new List(); @@ -97,8 +101,15 @@ namespace DataLoader int myType = rocc.type; string myValue = myLookup.GetTranslatedRoValue(ru.ROID, ii.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta); - ctmp.FixContentText(ru, myValue, myType, null); - if (ctmp.IsDirty) Console.WriteLine("{0}, {1}", myValue, ru.ROID); + myValue = myValue.Replace(@"\up2 \u8209?", @"\up2\u8209?");// Remove space between superscript command and non-breaking hyphen + myValue = myValue.Replace("\n", "");// Remove newlines in Figure data + string oldval = ctmp.FixContentText(ru, myValue, myType, null); + if (ctmp.IsDirty) + { + changeCount++; + //Console.WriteLine("'{0}', '{1}', '{2}', '{3}'", replace(oldval, @"\u8209?", "-"), replace(myValue, @"\u8209?", "-"), ru.ROID, rocc.appid); + frmMain.AddInfo("'{0}','{1}','R{2}'", (oldval??"").Replace(@"\u8209?", "-"), myValue.Replace(@"\u8209?", "-"), ru.ROID); + } } if (ctmp.IsDirty) { @@ -108,6 +119,8 @@ namespace DataLoader } } } + frmMain.AddInfo("{0} RO Values Updated", changeCount); + MessageBox.Show(String.Format("{0} RO Values Updated", changeCount), "RO Value Update Complete", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } diff --git a/PROMS/DataLoader/frmLoader.cs b/PROMS/DataLoader/frmLoader.cs index fd0ee50f..7ef6a037 100644 --- a/PROMS/DataLoader/frmLoader.cs +++ b/PROMS/DataLoader/frmLoader.cs @@ -1148,7 +1148,7 @@ namespace DataLoader private void fixROValuesToolStripMenuItem_Click(object sender, EventArgs e) { Database.VEPROMS_Connection = MySettings.ConnectionString.Replace("{DBName}", MySettings.DBName); - ROFixer myRoFixer = new ROFixer(MySettings.LogFilePath); + ROFixer myRoFixer = new ROFixer(MySettings.LogFilePath,this); myRoFixer.StatusChanged += new ROFixerEvent(myRoFixer_StatusChanged); TimeSpan howlong = myRoFixer.Process(); string RoFixTime = string.Format("Fix RO Values completion time: {0:D2}:{1:D2}:{2:D2}.{3}", howlong.Hours, howlong.Minutes, howlong.Seconds, howlong.Milliseconds);