Fixed issues with Transitions and ROs when importing procedures and sets. Notifies user when Transitions and/or ROs are converted to text. Added message box for when an export is complete as well as when an import is complete

When a Transition or RO is converted to text, a “Link Convert To Text” annotation type is created instead of a “Verification Required” annotation
When a RO is converted to text, a “Link Convert To Text” annotation type is created instead of a “Verification Required” annotation
Fixed an invalid index issue
This commit is contained in:
John Jenko 2017-01-04 16:50:00 +00:00
parent eec322b4b0
commit afe6c695d9
4 changed files with 152 additions and 49 deletions

View File

@ -18,6 +18,11 @@ namespace VEPROMS
{ {
private bool _ConvertROsToTextDuringImport = false; private bool _ConvertROsToTextDuringImport = false;
private bool _ConvertROsAndTransitionsToText = false; // set to true when Approval creates an Export file private bool _ConvertROsAndTransitionsToText = false; // set to true when Approval creates an Export file
// B2016-225 notify user when Transitions and/or ROs are converted to text
private bool _DidConvertTransitionsToText = false;
private bool _DidConvertROsToText = false;
private ItemInfo _ExternalTransitionItem = null; private ItemInfo _ExternalTransitionItem = null;
public ItemInfo ExternalTransitionItem public ItemInfo ExternalTransitionItem
{ {
@ -139,6 +144,7 @@ namespace VEPROMS
private void btnDoExport_Click(object sender, EventArgs e) private void btnDoExport_Click(object sender, EventArgs e)
{ {
btnExport.Enabled = false; btnExport.Enabled = false;
string msg = "Finished Exporting:\n\n";
if (MyFolder != null) if (MyFolder != null)
{ {
this.Cursor = Cursors.WaitCursor; this.Cursor = Cursors.WaitCursor;
@ -151,6 +157,7 @@ namespace VEPROMS
TimeSpan elapsed = DateTime.Now.Subtract(MyStart); TimeSpan elapsed = DateTime.Now.Subtract(MyStart);
lblExportStatus.Text = "Export Completed in " + elapsed.ToString(); lblExportStatus.Text = "Export Completed in " + elapsed.ToString();
this.Cursor = Cursors.Default; this.Cursor = Cursors.Default;
msg += MyFolder.Name;
} }
else if (MyProcedure != null) else if (MyProcedure != null)
{ {
@ -166,6 +173,9 @@ namespace VEPROMS
lblExportStatus.Text = "Export Completed in " + elapsed.ToString(); lblExportStatus.Text = "Export Completed in " + elapsed.ToString();
this.Cursor = Cursors.Default; this.Cursor = Cursors.Default;
} }
// added message to user when export of a procedure or procedure set has completed
msg += MyProcedure;
MessageBox.Show(msg, "Export", MessageBoxButtons.OK, MessageBoxIcon.Information);
btnCloseExport.Enabled = true; btnCloseExport.Enabled = true;
} }
private void SaveExportData() private void SaveExportData()
@ -195,6 +205,8 @@ namespace VEPROMS
MyStart = DateTime.Now; MyStart = DateTime.Now;
btnDoImport.Enabled = false; btnDoImport.Enabled = false;
lblImportStatus.Text = "Performing Import"; lblImportStatus.Text = "Performing Import";
_DidConvertTransitionsToText = false;
_DidConvertROsToText = false;
//LoadImportDataReader(); //LoadImportDataReader();
if (MyFolder != null) // import a folder - a .expx file if (MyFolder != null) // import a folder - a .expx file
{ {
@ -390,7 +402,17 @@ namespace VEPROMS
this.Cursor = Cursors.Default; this.Cursor = Cursors.Default;
btnCloseImport.Enabled = true; btnCloseImport.Enabled = true;
if (isImported) if (isImported)
MessageBox.Show(string.Format("Finished Importing:\n\n{0}",txtImport.Text.Substring(txtImport.Text.LastIndexOf("\\")+1)),"Import",MessageBoxButtons.OK,MessageBoxIcon.Information); {
string msg = string.Format("Finished Importing:\n\n{0}", txtImport.Text.Substring(txtImport.Text.LastIndexOf("\\") + 1));
if (_DidConvertTransitionsToText || _DidConvertROsToText)
{
string msg1 = (_DidConvertTransitionsToText && _DidConvertROsToText)?"Transitions and Referenced Objects":(_DidConvertTransitionsToText)?"Transitions":"Referenced Objects";
msg += string.Format("\n\n{0} converted to text.\n\nThe locations can be found by doing a Global Search for the \"Link Converted To Text\" annotation type",msg1);
}
// B2016-225 added more information to the finish import message to tell the user when ROs or Transitions are converted to text.
MessageBox.Show(msg, "Import", MessageBoxButtons.OK, MessageBoxIcon.Information);
//MessageBox.Show(string.Format("Finished Importing:\n\n{0}", txtImport.Text.Substring(txtImport.Text.LastIndexOf("\\") + 1)), "Import", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
if (canceledPressed) if (canceledPressed)
{ {
MessageBox.Show(string.Format("Canceling the import of:\n\n{0}",txtImport.Text.Substring(txtImport.Text.LastIndexOf("\\")+1)),"Import",MessageBoxButtons.OK,MessageBoxIcon.Information); MessageBox.Show(string.Format("Canceling the import of:\n\n{0}",txtImport.Text.Substring(txtImport.Text.LastIndexOf("\\")+1)),"Import",MessageBoxButtons.OK,MessageBoxIcon.Information);
@ -542,6 +564,7 @@ namespace VEPROMS
xd = new XmlDocument(); xd = new XmlDocument();
xd.Load(fn); xd.Load(fn);
pi = AddProcedure(xd.DocumentElement, dvi, pi); pi = AddProcedure(xd.DocumentElement, dvi, pi);
GC.Collect(); // need to cleanup memory after importing each procedure due to use of Regular Expressions in processing RO and Transition links
} }
DirectoryInfo di = new DirectoryInfo(PEIPath); DirectoryInfo di = new DirectoryInfo(PEIPath);
DirectoryInfo[] dis = di.GetDirectories(); DirectoryInfo[] dis = di.GetDirectories();
@ -977,35 +1000,38 @@ namespace VEPROMS
string fn = PEIPath + @"\items.xml"; string fn = PEIPath + @"\items.xml";
XmlDocument xd = new XmlDocument(); XmlDocument xd = new XmlDocument();
xd.Load(fn); xd.Load(fn);
XmlNodeList nl = xd.SelectNodes("//item"); // B2016-176, B2016-197 Transitions were no always properly resolved - don't load in the old item ids
foreach (XmlNode nd in nl) //XmlNodeList nl = xd.SelectNodes("//item");
{ //foreach (XmlNode nd in nl)
int oldid = int.Parse(nd.Attributes.GetNamedItem("old").InnerText); //{
int newid = int.Parse(nd.Attributes.GetNamedItem("new").InnerText); // int oldid = int.Parse(nd.Attributes.GetNamedItem("old").InnerText);
//if (!Old2NewItem.ContainsKey(oldid)) // int newid = int.Parse(nd.Attributes.GetNamedItem("new").InnerText);
Old2NewItem.Add(oldid, newid); // //if (!Old2NewItem.ContainsKey(oldid))
} // Old2NewItem.Add(oldid, newid);
//}
File.Delete(fn); File.Delete(fn);
ze = MyImpxZipFile["contents.xml"]; ze = MyImpxZipFile["contents.xml"];
ze.Extract(PEIPath, ExtractExistingFileAction.OverwriteSilently); ze.Extract(PEIPath, ExtractExistingFileAction.OverwriteSilently);
fn = PEIPath + @"\contents.xml"; fn = PEIPath + @"\contents.xml";
xd = new XmlDocument(); xd = new XmlDocument();
xd.Load(fn); xd.Load(fn);
nl = xd.SelectNodes("//content"); // B2016-176, B2016-197 Transitions were no always properly resolved - don't load in the old content ids
foreach (XmlNode nd in nl) //nl = xd.SelectNodes("//content");
{ //foreach (XmlNode nd in nl)
int oldid = int.Parse(nd.Attributes.GetNamedItem("old").InnerText); //{
int newid = int.Parse(nd.Attributes.GetNamedItem("new").InnerText); // int oldid = int.Parse(nd.Attributes.GetNamedItem("old").InnerText);
//if (!Old2NewContent.ContainsKey(oldid)) // int newid = int.Parse(nd.Attributes.GetNamedItem("new").InnerText);
Old2NewContent.Add(oldid, newid); // //if (!Old2NewContent.ContainsKey(oldid))
} // Old2NewContent.Add(oldid, newid);
//}
File.Delete(fn); File.Delete(fn);
ze = MyImpxZipFile["libdocs.xml"]; ze = MyImpxZipFile["libdocs.xml"];
ze.Extract(PEIPath, ExtractExistingFileAction.OverwriteSilently); ze.Extract(PEIPath, ExtractExistingFileAction.OverwriteSilently);
fn = PEIPath + @"\libdocs.xml"; fn = PEIPath + @"\libdocs.xml";
xd = new XmlDocument(); xd = new XmlDocument();
xd.Load(fn); xd.Load(fn);
nl = xd.SelectNodes("//libdoc"); XmlNodeList nl = xd.SelectNodes("//libdoc");
//nl = xd.SelectNodes("//libdoc");
foreach (XmlNode nd in nl) foreach (XmlNode nd in nl)
{ {
int oldid = int.Parse(nd.Attributes.GetNamedItem("old").InnerText); int oldid = int.Parse(nd.Attributes.GetNamedItem("old").InnerText);
@ -2715,22 +2741,25 @@ namespace VEPROMS
SectionConfig sc = TransitionInfo.Get(tt.TransitionID).MyItemToID.ActiveSection.MyConfig as SectionConfig; SectionConfig sc = TransitionInfo.Get(tt.TransitionID).MyItemToID.ActiveSection.MyConfig as SectionConfig;
forceConvertToText = (sc.SubSection_Edit == "N"); forceConvertToText = (sc.SubSection_Edit == "N");
} }
if (!forceConvertToText) //check to see if external with internal format // B2016-176, B2016197 - external transitions should be convert to text
{
TransitionInfo tran = TransitionInfo.Get(transitionid);
if (tran.MyContent.ContentItems[0].MyProcedure.ItemID != tran.MyItemToID.MyProcedure.ItemID)
if (!tran.MyContent.ContentItems[0].ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[tran.TranType].TransMenu.Contains("Proc"))
forceConvertToText = true; forceConvertToText = true;
} //if (!forceConvertToText) //check to see if external with internal format
if (!forceConvertToText) //check to see if external to different doc version //{
{ // TransitionInfo tran = TransitionInfo.Get(transitionid);
TransitionInfo tran = TransitionInfo.Get(transitionid); // if (tran.MyContent.ContentItems[0].MyProcedure.ItemID != tran.MyItemToID.MyProcedure.ItemID)
if (tran.MyContent.ContentItems[0].MyDocVersion.VersionID != tran.MyItemToID.MyDocVersion.VersionID) // if (!tran.MyContent.ContentItems[0].ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[tran.TranType].TransMenu.Contains("Proc"))
forceConvertToText = true; // forceConvertToText = true;
} //}
//if (!forceConvertToText) //check to see if external to different doc version
//{
// TransitionInfo tran = TransitionInfo.Get(transitionid);
// if (tran.MyContent.ContentItems[0].MyDocVersion.VersionID != tran.MyItemToID.MyDocVersion.VersionID)
// forceConvertToText = true;
//}
cc.FixTransitionText(TransitionInfo.Get(tt.TransitionID), forceConvertToText); cc.FixTransitionText(TransitionInfo.Get(tt.TransitionID), forceConvertToText);
cc.Save(); cc.Save();
nd.InnerText = "done"; nd.InnerText = "done";
_DidConvertTransitionsToText |= forceConvertToText; // B2016-225 - notify user when transitions are converted to text
} }
} }
} }
@ -3054,8 +3083,12 @@ namespace VEPROMS
p.Save(); p.Save();
if (!Old2NewItem.ContainsKey(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText))) if (!Old2NewItem.ContainsKey(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText)))
Old2NewItem.Add(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText), p.ItemID); Old2NewItem.Add(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText), p.ItemID);
else
Old2NewItem[int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText)] = p.ItemID; // B2016-176, B2016-197 refresh saved ItemId with current ItemID
if (!Old2NewContent.ContainsKey(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText))) if (!Old2NewContent.ContainsKey(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText)))
Old2NewContent.Add(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText), p.MyContent.ContentID); Old2NewContent.Add(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText), p.MyContent.ContentID);
else
Old2NewContent[int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText)] = p.MyContent.ContentID; // B2016-176, B2016-197 refresh saved ContentID with current ContentID
if (xn.SelectNodes("annotation").Count > 0) if (xn.SelectNodes("annotation").Count > 0)
AddAnnotations(p.ItemID, xn); AddAnnotations(p.ItemID, xn);
if (xc.SelectNodes("rousage").Count > 0) if (xc.SelectNodes("rousage").Count > 0)
@ -3118,7 +3151,6 @@ namespace VEPROMS
} }
private void ConvertImportProcedureROsToText(Content content, XmlNode xn) private void ConvertImportProcedureROsToText(Content content, XmlNode xn)
{ {
string newvalue = "";
foreach (XmlNode nd in xn.SelectNodes("rousage")) foreach (XmlNode nd in xn.SelectNodes("rousage"))
{ {
string rousageid = nd.Attributes.GetNamedItem("rousageid").InnerText; string rousageid = nd.Attributes.GetNamedItem("rousageid").InnerText;
@ -3160,13 +3192,53 @@ namespace VEPROMS
else else
part3 = suffix.Replace(@"\v0", "") + part3.Substring(suffix.Length); part3 = suffix.Replace(@"\v0", "") + part3.Substring(suffix.Length);
content.Text = part1 + part2 + part3; content.Text = part1 + part2 + part3;
break; // Text has been processed ROToTextAnnotation(content, part2); // B2016-225 (follow through) add annotation when RO is converted to text
} }
lastIndex = mm.Index + mm.Length; lastIndex = mm.Index + mm.Length;
} }
} }
content.Save(); content.Save();
} }
// B2016-225 (follow through) add annotation when RO is converted to text
private void ROToTextAnnotation(Content content, string txtRO)
{
// replace unicode symbols to DOS code symbols
txtRO = txtRO.Replace(@"\u8209?", "-"); // dash
txtRO = txtRO.Replace(@"\u9586?", @"\\"); // backslash
txtRO = txtRO.Replace(@"\'b0", "\xb0"); //degree
txtRO = txtRO.Replace(@"\u160?"," "); //hard space
txtRO = txtRO.Replace(@"\u916?", "\x7F"); // delta
txtRO = txtRO.Replace(@"\u8805?", "\xF2"); //greater than or equal
txtRO = txtRO.Replace(@"\u8804?", "\xF3"); // less than or equal
txtRO = txtRO.Replace(@"\u931?", "\xE4"); // sigma
txtRO = txtRO.Replace(@"\u947?", "\xE7"); // gamma
txtRO = txtRO.Replace(@"\u9604?", "\xFE"); // accum 2584
txtRO = txtRO.Replace(@"\u9679?", "\x7"); // bullet 25CF
txtRO = txtRO.Replace(@"\u8776?", "\xF7"); // approx eq
txtRO = txtRO.Replace(@"\u8773?", "\xF0"); // similar eq 2245
txtRO = txtRO.Replace(@"\u8730?", "\xFB"); // square root
txtRO = txtRO.Replace(@"\u961?", "\xE2"); // rho 3C1
txtRO = txtRO.Replace(@"\u960?", "\xE3"); // pi
txtRO = txtRO.Replace(@"\u956?", "\xE6"); // micro
txtRO = txtRO.Replace(@"\u948?", "\xEB"); // lower case delta
txtRO = txtRO.Replace(@"\u963?", "\xE5"); // lower case sigma
txtRO = txtRO.Replace(@"\u274?", "\x90"); // energy, 112
txtRO = txtRO.Replace(@"\u949?", "\xEE"); // epsilon
txtRO = txtRO.Replace(@"\u952?", "\xE9"); // theta, 3B8
txtRO = txtRO.Replace(@"\u8857?", "\xEC"); // dot in oval, 2299
txtRO = txtRO.Replace(@"\u964?", "\xA8"); // tau, 3C4
txtRO = txtRO.Replace(@"\u9830?", "\xA9"); // diamond, 2666
txtRO = txtRO.Replace(@"\u8593?", "\x18"); // Up Arrow - changes to \xff
txtRO = txtRO.Replace(@"\u8595?", "\x19"); // Down Arrow - changes to \xd6
Item myitem = content.ContentItems[0].MyItem; // The Using statement caused the content.text to disappear
//using (Item myitem = content.ContentItems[0].MyItem) // so that myitem does not stay in cache
//{
Annotation.MakeAnnotation(myitem, AnnotationType.GetByNameOrCreate("Link Converted To Text"), "", string.Format("RO value ({0}) converted to text", txtRO), null);
//}
_DidConvertROsToText |= true;
}
private void AddROUsages(Content content, XmlNode xn) private void AddROUsages(Content content, XmlNode xn)
{ {
if (_ConvertROsToTextDuringImport) if (_ConvertROsToTextDuringImport)
@ -3187,6 +3259,8 @@ namespace VEPROMS
if (roval == "?") if (roval == "?")
{ {
RoUsageInfo roui = RoUsageInfo.Get(int.Parse(rousageid)); RoUsageInfo roui = RoUsageInfo.Get(int.Parse(rousageid));
content.FixContentText(roui, roval, 0, MyDocVersion.DocVersionAssociations[0].MyROFst);
_DidConvertROsToText |= true; // B2016-225 (follow through) add annotation when RO is converted to text
} }
else else
{ {
@ -3355,8 +3429,12 @@ namespace VEPROMS
step.Save(); step.Save();
if (!Old2NewItem.ContainsKey(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText))) if (!Old2NewItem.ContainsKey(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText)))
Old2NewItem.Add(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText), step.ItemID); Old2NewItem.Add(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText), step.ItemID);
else
Old2NewItem[int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText)] = step.ItemID; // B2016-176, B2016-197 refresh saved ItemId with current ItemID
if (!Old2NewContent.ContainsKey(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText))) if (!Old2NewContent.ContainsKey(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText)))
Old2NewContent.Add(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText), step.MyContent.ContentID); Old2NewContent.Add(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText), step.MyContent.ContentID);
else
Old2NewContent[int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText)] = step.MyContent.ContentID; // B2016-176, B2016-197 refresh saved ContentID with current ContentID
if (xc.SelectNodes("grid").Count > 0) if (xc.SelectNodes("grid").Count > 0)
AddGrid(step.MyContent, xc); AddGrid(step.MyContent, xc);
if (xc.SelectNodes("image").Count > 0) if (xc.SelectNodes("image").Count > 0)
@ -3448,8 +3526,12 @@ namespace VEPROMS
step.Save(); step.Save();
if (!Old2NewItem.ContainsKey(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText))) if (!Old2NewItem.ContainsKey(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText)))
Old2NewItem.Add(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText), step.ItemID); Old2NewItem.Add(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText), step.ItemID);
else
Old2NewItem[int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText)] = step.ItemID; // B2016-176, B2016-197 refresh saved ItemId with current ItemID
if (!Old2NewContent.ContainsKey(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText))) if (!Old2NewContent.ContainsKey(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText)))
Old2NewContent.Add(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText), step.MyContent.ContentID); Old2NewContent.Add(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText), step.MyContent.ContentID);
else
Old2NewContent[int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText)] = step.MyContent.ContentID; // B2016-176, B2016-197 refresh saved ContentID with current ContentID
if (xn.SelectNodes("annotation").Count > 0) if (xn.SelectNodes("annotation").Count > 0)
AddAnnotations(step.ItemID, xn); AddAnnotations(step.ItemID, xn);
if (xc.SelectNodes("rousage").Count > 0) if (xc.SelectNodes("rousage").Count > 0)
@ -3538,8 +3620,12 @@ namespace VEPROMS
step.Save(); step.Save();
if (!Old2NewItem.ContainsKey(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText))) if (!Old2NewItem.ContainsKey(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText)))
Old2NewItem.Add(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText), step.ItemID); Old2NewItem.Add(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText), step.ItemID);
else
Old2NewItem[int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText)] = step.ItemID; // B2016-176, B2016-197 refresh saved ItemId with current ItemID
if (!Old2NewContent.ContainsKey(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText))) if (!Old2NewContent.ContainsKey(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText)))
Old2NewContent.Add(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText), step.MyContent.ContentID); Old2NewContent.Add(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText), step.MyContent.ContentID);
else
Old2NewContent[int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText)] = step.MyContent.ContentID; // B2016-176, B2016-197 refresh saved ContentID with current ContentID
if (xn.SelectNodes("annotation").Count > 0) if (xn.SelectNodes("annotation").Count > 0)
AddAnnotations(step.ItemID, xn); AddAnnotations(step.ItemID, xn);
if (xc.SelectNodes("rousage").Count > 0) if (xc.SelectNodes("rousage").Count > 0)
@ -3628,8 +3714,12 @@ namespace VEPROMS
step.Save(); step.Save();
if (!Old2NewItem.ContainsKey(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText))) if (!Old2NewItem.ContainsKey(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText)))
Old2NewItem.Add(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText), step.ItemID); Old2NewItem.Add(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText), step.ItemID);
else
Old2NewItem[int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText)] = step.ItemID; // B2016-176, B2016-197 refresh saved ItemId with current ItemID
if (!Old2NewContent.ContainsKey(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText))) if (!Old2NewContent.ContainsKey(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText)))
Old2NewContent.Add(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText), step.MyContent.ContentID); Old2NewContent.Add(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText), step.MyContent.ContentID);
else
Old2NewContent[int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText)] = step.MyContent.ContentID; // B2016-176, B2016-197 refresh saved ContentID with current ContentID
if (xn.SelectNodes("annotation").Count > 0) if (xn.SelectNodes("annotation").Count > 0)
AddAnnotations(step.ItemID, xn); AddAnnotations(step.ItemID, xn);
if (xc.SelectNodes("rousage").Count > 0) if (xc.SelectNodes("rousage").Count > 0)
@ -3718,8 +3808,12 @@ namespace VEPROMS
step.Save(); step.Save();
if (!Old2NewItem.ContainsKey(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText))) if (!Old2NewItem.ContainsKey(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText)))
Old2NewItem.Add(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText), step.ItemID); Old2NewItem.Add(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText), step.ItemID);
else
Old2NewItem[int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText)] = step.ItemID; // B2016-176, B2016-197 refresh saved ItemId with current ItemID
if (!Old2NewContent.ContainsKey(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText))) if (!Old2NewContent.ContainsKey(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText)))
Old2NewContent.Add(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText), step.MyContent.ContentID); Old2NewContent.Add(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText), step.MyContent.ContentID);
else
Old2NewContent[int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText)] = step.MyContent.ContentID; // B2016-176, B2016-197 refresh saved ContentID with current ContentID
if (xn.SelectNodes("annotation").Count > 0) if (xn.SelectNodes("annotation").Count > 0)
AddAnnotations(step.ItemID, xn); AddAnnotations(step.ItemID, xn);
if (xc.SelectNodes("rousage").Count > 0) if (xc.SelectNodes("rousage").Count > 0)
@ -3813,8 +3907,12 @@ namespace VEPROMS
sect.Save(); sect.Save();
if (!Old2NewContent.ContainsKey(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText))) if (!Old2NewContent.ContainsKey(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText)))
Old2NewContent.Add(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText), sect.MyContent.ContentID); Old2NewContent.Add(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText), sect.MyContent.ContentID);
else
Old2NewContent[int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText)] = sect.MyContent.ContentID; // B2016-176, B2016-197 refresh saved ContentID with current ContentID
if (!Old2NewItem.ContainsKey(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText))) if (!Old2NewItem.ContainsKey(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText)))
Old2NewItem.Add(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText), sect.ItemID); Old2NewItem.Add(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText), sect.ItemID);
else
Old2NewItem[int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText)] = sect.ItemID; // B2016-176, B2016-197 refresh saved ItemId with current ItemID
if (xn.SelectNodes("annotation").Count > 0) if (xn.SelectNodes("annotation").Count > 0)
AddAnnotations(sect.ItemID, xn); AddAnnotations(sect.ItemID, xn);
if (xc.SelectNodes("entry").Count > 0) if (xc.SelectNodes("entry").Count > 0)
@ -3878,6 +3976,7 @@ namespace VEPROMS
if (_ConvertROsToTextDuringImport) if (_ConvertROsToTextDuringImport)
{ {
gn.InnerText = "False"; gn.InnerText = "False";
ROToTextAnnotation(content, "RO Table"); // B2016-225 (follow through) add annotation when RO is converted to text
} }
else else
{ {

View File

@ -75,7 +75,8 @@ namespace VEPROMS.CSLA.Library
//Text = Text.Substring(0, myIndex - 14) + gg + Text.Substring(myIndex + myLength); //Text = Text.Substring(0, myIndex - 14) + gg + Text.Substring(myIndex + myLength);
using (Item myitem = this.ContentItems[0].MyItem) // so that myitem does not stay in cache B2016-153 using (Item myitem = this.ContentItems[0].MyItem) // so that myitem does not stay in cache B2016-153
{ {
Annotation.MakeAnnotation(myitem, AnnotationType.GetByName("Verification Required"), "", string.Format("Transition ({0}) converted to text", ItemInfo.ConvertToDisplayText(gg)), null); // B2016-225 (follow through) added more descriptive Annotation Type when transition is converted to text
Annotation.MakeAnnotation(myitem, AnnotationType.GetByNameOrCreate("Link Converted To Text"), "", string.Format("Transition ({0}) converted to text", ItemInfo.ConvertToDisplayText(gg)), null);
} }
if(tran != null) if(tran != null)
Transition.Delete(tran.TransitionID); Transition.Delete(tran.TransitionID);
@ -539,7 +540,8 @@ namespace VEPROMS.CSLA.Library
retval = this.ConvertROToText(rousg, value, rotype, origROFstInfo); retval = this.ConvertROToText(rousg, value, rotype, origROFstInfo);
using (Item myitem = this.ContentItems[0].MyItem) // so that myitem does not stay in cache B2016-153 using (Item myitem = this.ContentItems[0].MyItem) // so that myitem does not stay in cache B2016-153
{ {
Annotation.MakeAnnotation(myitem, AnnotationType.GetByName("Verification Required"), "", string.Format("RO value ({0}) converted to text", ItemInfo.ConvertToDisplayText(retval)), null); // B2016-225 (follow through) added more descriptive Annotation Type when RO is converted to text
Annotation.MakeAnnotation(myitem, AnnotationType.GetByNameOrCreate("Link Converted To Text"), "", string.Format("RO value ({0}) converted to text", ItemInfo.ConvertToDisplayText(retval)), null);
} }
RoUsage.Delete(rousg.ROUsageID); RoUsage.Delete(rousg.ROUsageID);
return retval; return retval;

View File

@ -753,7 +753,8 @@ namespace VEPROMS.CSLA.Library
oldText = content.ConvertROToText(rousage, roval, roch.type, rofstinfo); oldText = content.ConvertROToText(rousage, roval, roch.type, rofstinfo);
using (Item myitem = content.ContentItems[0].MyItem) // so that myitem does not stay in cache B2016-153 using (Item myitem = content.ContentItems[0].MyItem) // so that myitem does not stay in cache B2016-153
{ {
Annotation.MakeAnnotation(myitem, AnnotationType.GetByName("Verification Required"), "", string.Format("RO value ({0}) converted to text", ItemInfo.ConvertToDisplayText(oldText)), null); // B2016-225 (follow through) added more descriptive Annotation Type when RO is converted to text
Annotation.MakeAnnotation(myitem, AnnotationType.GetByNameOrCreate("Link Converted To Text"), "", string.Format("RO value ({0}) converted to text", ItemInfo.ConvertToDisplayText(oldText)), null);
} }
} }
else else
@ -794,7 +795,8 @@ namespace VEPROMS.CSLA.Library
oldText = content.ConvertROToText(rousage, roval, roch.type, rofstinfo); oldText = content.ConvertROToText(rousage, roval, roch.type, rofstinfo);
using (Item myitem = content.ContentItems[0].MyItem) // so that myitem does not stay in cache B2016-153 using (Item myitem = content.ContentItems[0].MyItem) // so that myitem does not stay in cache B2016-153
{ {
Annotation.MakeAnnotation(myitem, AnnotationType.GetByName("Verification Required"), "", string.Format("RO value ({0}) converted to text", ItemInfo.ConvertToDisplayText(oldText)), null); // B2016-225 (follow through) added more descriptive Annotation Type when RO is converted to text
Annotation.MakeAnnotation(myitem, AnnotationType.GetByNameOrCreate("Link Converted To Text"), "", string.Format("RO value ({0}) converted to text", ItemInfo.ConvertToDisplayText(oldText)), null);
} }
} }
else else

View File

@ -837,7 +837,7 @@ namespace VEPROMS.CSLA.Library
tb._FormatData = formatInfo.PlantFormat.FormatData; tb._FormatData = formatInfo.PlantFormat.FormatData;
// get the format of the transition string based on this transition's index into the TransData part of // get the format of the transition string based on this transition's index into the TransData part of
// format.... // format....
if (tranType > tb._FormatData.TransData.TransTypeList.MaxIndex) if (tranType >= tb._FormatData.TransData.TransTypeList.MaxIndex) // found during fixing of B2016-176 B2016-197 fixes invalid index error during import of procedure
tranType = 0; tranType = 0;
// Replace 3 tokens ", {.}, {.}, {.}" with a single token "{.}" // Replace 3 tokens ", {.}, {.}, {.}" with a single token "{.}"
tb._TransFormat = tb._FormatData.TransData.TransTypeList[tranType].TransFormat.Replace(", {.}, {.}, {.}", "{.}"); tb._TransFormat = tb._FormatData.TransData.TransTypeList[tranType].TransFormat.Replace(", {.}, {.}, {.}", "{.}");