Added code to handle Table ROs.

Used generic (static) VlnFlexGrid.ROTableUpdate to determine if the table contents are updated.
Added Error Handling around the code that shuts down PROMs
Added function to ROFSTLookup to retrieve the Accessory Page ID.
Corrected code to handle value changes for Table ROs
Created generic (static) VlnFlexGrid.ROTableUpdate to determine if the table contents are updated.
This commit is contained in:
Rich
2014-03-19 15:30:26 +00:00
parent cf79d6a313
commit 0376212e09
9 changed files with 200 additions and 109 deletions

View File

@@ -83,9 +83,9 @@ namespace DataLoader
ContentInfo myContentInfo = ContentInfo.Get(cid);
DocVersionInfo dvi = myContentInfo.ContentItems[0].MyProcedure.MyDocVersion;
int versionId = dvi.VersionID;
ROFstInfo myRoFst = dvi.DocVersionAssociations[0].MyROFst;
if (!roFstLookups.ContainsKey(versionId))
{
ROFstInfo myRoFst = dvi.DocVersionAssociations[0].MyROFst;
roFstLookups.Add(versionId, myRoFst.GetROFSTLookup(dvi));
}
ROFSTLookup myLookup = roFstLookups[versionId];
@@ -94,26 +94,28 @@ namespace DataLoader
ItemInfo ii = myContentInfo.ContentItems[0];
foreach (RoUsageInfo ru in myContentInfo.ContentRoUsages)
{
//ROFSTLookup.rochild rocc = myLookup.GetRoChild12(ru.ROID);
//if (rocc.value == null)
ROFSTLookup.rochild rocc = myLookup.GetRoChild(ru.ROID);
//string myValue = rocc.value;
ROFSTLookup.rochild rocc = myLookup.GetRoChild12(ru.ROID);
if (rocc.value == null)
rocc = myLookup.GetRoChild(ru.ROID);
int myType = rocc.type;
string myValue = myLookup.GetTranslatedRoValue(ru.ROID, ii.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta);
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 (myType == 8 && myValue.Contains("\n"))
myValue = myValue.Replace("\n", "");// Remove newlines in Figure data
myRoFst.ROTableUpdate += new ROFstInfoROTableUpdateEvent(myRoFst_ROTableUpdate);
string oldval = ctmp.FixContentText(ru, myValue, myType, myRoFst);
myRoFst.ROTableUpdate -= new ROFstInfoROTableUpdateEvent(myRoFst_ROTableUpdate);
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);
changeCount++;
//Console.WriteLine("'{0}', '{1}', '{2}', '{3}'", replace(oldval, @"\u8209?", "-"), replace(myValue, @"\u8209?", "-"), ru.ROID, rocc.appid);
frmMain.AddInfo("'{0}','{1}','{2}','{3}','R{4}','{5}'", ii.MyDocVersion.MyFolder.Name, ii.ShortPath,
(oldval ?? "").Replace(@"\u8209?", "-"), myValue.Replace(@"\u8209?", "-"), ru.ROID, myLookup.GetAccPageID(ru.ROID));
}
}
if (ctmp.IsDirty)
{
ctmp.DTS = DateTime.Now;
//ctmp.DTS = DateTime.Now;
ctmp.Save();
ContentInfo.Refresh(ctmp);
}
@@ -122,5 +124,9 @@ 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);
}
private List<string> myRoFst_ROTableUpdate(object sender, ROFstInfoROTableUpdateEventArgs args)
{
return Volian.Controls.Library.VlnFlexGrid.ROTableUpdate(sender,args);
}
}
}