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.
This commit is contained in:
Rich 2014-03-15 10:02:55 +00:00
parent ac8a99dd84
commit 0231bdc4ca
2 changed files with 17 additions and 4 deletions

View File

@ -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<int> myContentList = new List<int>();
@ -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);
}
}
}

View File

@ -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);