B2017-076 Added checks to see if we processed any transitions or ROs and added a status message at the end of importing explaining the procedure that was imported did not have transitions or ROs.
B2017-076 Added a Boolean return value to FixTransitionText so that we know if any transition was processed.
This commit is contained in:
parent
5ce26f2350
commit
52b40b0f5e
@ -223,6 +223,8 @@ namespace VEPROMS
|
|||||||
lblImportStatus.Text = "Performing Import";
|
lblImportStatus.Text = "Performing Import";
|
||||||
_DidConvertTransitionsToText = false;
|
_DidConvertTransitionsToText = false;
|
||||||
_DidConvertROsToText = false;
|
_DidConvertROsToText = false;
|
||||||
|
_DidProcessTransitions = false; // B2017-076 to know if we processed any transition (used in status message at the end of importing)
|
||||||
|
_DidProcessROs = false; // B2017-076 to know if we processed any transition (used in status message at the end of importing)
|
||||||
//LoadImportDataReader();
|
//LoadImportDataReader();
|
||||||
if (MyFolder != null) // import a folder - a .expx file
|
if (MyFolder != null) // import a folder - a .expx file
|
||||||
{
|
{
|
||||||
@ -271,6 +273,10 @@ namespace VEPROMS
|
|||||||
string msg1 = (_DidConvertTransitionsToText && _DidConvertROsToText)?"Transitions and Referenced Objects":(_DidConvertTransitionsToText)?"Transitions":"Referenced Objects";
|
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);
|
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);
|
||||||
}
|
}
|
||||||
|
else if (!_DidProcessTransitions && !_DidProcessROs) // B2017-076 Approved import file does not have ROs nor Transitions
|
||||||
|
{
|
||||||
|
msg += "\n\nAll Transition and Referenced Object values are text.\n\nThere either were none or you had imported an Approved procedure.";
|
||||||
|
}
|
||||||
// B2016-225 added more information to the finish import message to tell the user when ROs or Transitions are converted to text.
|
// 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(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);
|
//MessageBox.Show(string.Format("Finished Importing:\n\n{0}", txtImport.Text.Substring(txtImport.Text.LastIndexOf("\\") + 1)), "Import", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
@ -2640,6 +2646,8 @@ namespace VEPROMS
|
|||||||
// cc.Save();
|
// cc.Save();
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
private bool _DidProcessTransitions = false; // B2017-076 keep track whether we procrocessed Transitions
|
||||||
|
|
||||||
private void AddTransitions(Content content, XmlNode xn)
|
private void AddTransitions(Content content, XmlNode xn)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -2690,7 +2698,7 @@ namespace VEPROMS
|
|||||||
content.Text = content.Text.Replace(lookfor, replacewith);
|
content.Text = content.Text.Replace(lookfor, replacewith);
|
||||||
if (content.MyGrid != null && content.MyGrid.Data != "")
|
if (content.MyGrid != null && content.MyGrid.Data != "")
|
||||||
content.MyGrid.Data = content.MyGrid.Data.Replace(lookfor, replacewith);
|
content.MyGrid.Data = content.MyGrid.Data.Replace(lookfor, replacewith);
|
||||||
content.FixTransitionText(TransitionInfo.Get(tt.TransitionID));
|
_DidProcessTransitions |= content.FixTransitionText(TransitionInfo.Get(tt.TransitionID)); // B2017-076 FixTransitionText will tell us if transitions were processed/changed
|
||||||
// B2017=003 make sure any grid changes are saved.
|
// B2017=003 make sure any grid changes are saved.
|
||||||
// done here because FixTransitionText() could update the transitions in the grid
|
// done here because FixTransitionText() could update the transitions in the grid
|
||||||
if (content.MyGrid != null && content.MyGrid.Data != "")
|
if (content.MyGrid != null && content.MyGrid.Data != "")
|
||||||
@ -2708,6 +2716,7 @@ namespace VEPROMS
|
|||||||
{
|
{
|
||||||
AddTransitions(PendingTransitions);
|
AddTransitions(PendingTransitions);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddTransitions(XmlDocument xd)
|
private void AddTransitions(XmlDocument xd)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -2769,7 +2778,7 @@ 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");
|
||||||
}
|
}
|
||||||
cc.FixTransitionText(TransitionInfo.Get(tt.TransitionID), forceConvertToText);
|
_DidProcessTransitions |= cc.FixTransitionText(TransitionInfo.Get(tt.TransitionID), forceConvertToText); // B2017-076 FixTransitionText will tell us if transitions were processed/changed
|
||||||
// B2017=003 make sure any grid changes are saved.
|
// B2017=003 make sure any grid changes are saved.
|
||||||
// done here because FixTransitionText() could update the transitions in the grid
|
// done here because FixTransitionText() could update the transitions in the grid
|
||||||
if (cc.MyGrid != null && cc.MyGrid.Data != "")
|
if (cc.MyGrid != null && cc.MyGrid.Data != "")
|
||||||
@ -2796,7 +2805,7 @@ namespace VEPROMS
|
|||||||
if (tt.TransitionID < 0)
|
if (tt.TransitionID < 0)
|
||||||
{
|
{
|
||||||
forceConvertToText = true;
|
forceConvertToText = true;
|
||||||
cc.FixTransitionText(TransitionInfo.Get(tt.TransitionID), forceConvertToText);
|
_DidProcessTransitions |= cc.FixTransitionText(TransitionInfo.Get(tt.TransitionID), forceConvertToText); // B2017-076 FixTransitionText will tell us if transitions were processed/changed
|
||||||
cc.Save();
|
cc.Save();
|
||||||
nd.InnerText = "done";
|
nd.InnerText = "done";
|
||||||
}
|
}
|
||||||
@ -2831,14 +2840,14 @@ namespace VEPROMS
|
|||||||
// if (tran.MyContent.ContentItems[0].MyDocVersion.VersionID != tran.MyItemToID.MyDocVersion.VersionID)
|
// if (tran.MyContent.ContentItems[0].MyDocVersion.VersionID != tran.MyItemToID.MyDocVersion.VersionID)
|
||||||
// forceConvertToText = true;
|
// forceConvertToText = true;
|
||||||
//}
|
//}
|
||||||
cc.FixTransitionText(TransitionInfo.Get(tt.TransitionID), forceConvertToText);
|
_DidProcessTransitions |= cc.FixTransitionText(TransitionInfo.Get(tt.TransitionID), forceConvertToText); // B2017-076 FixTransitionText will tell us if transitions were processed/changed
|
||||||
// B2017=003 make sure any grid changes are saved.
|
// B2017=003 make sure any grid changes are saved.
|
||||||
// done here because FixTransitionText() could update the transitions in the grid
|
// done here because FixTransitionText() could update the transitions in the grid
|
||||||
if (cc.MyGrid != null && cc.MyGrid.Data != "")
|
if (cc.MyGrid != null && cc.MyGrid.Data != "")
|
||||||
cc.MyGrid.Save();
|
cc.MyGrid.Save();
|
||||||
cc.Save();
|
cc.Save();
|
||||||
nd.InnerText = "done";
|
nd.InnerText = "done";
|
||||||
_DidConvertTransitionsToText |= forceConvertToText; // B2016-225 - notify user when transitions are converted to text
|
_DidConvertTransitionsToText |= (forceConvertToText && _DidProcessTransitions); // B2016-225 - notify user when transitions are converted to text
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3286,6 +3295,7 @@ namespace VEPROMS
|
|||||||
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;
|
||||||
ROToTextAnnotation(content, part2); // B2016-225 (follow through) add annotation when RO is converted to text
|
ROToTextAnnotation(content, part2); // B2016-225 (follow through) add annotation when RO is converted to text
|
||||||
|
_DidProcessROs = true; // B2017-076 flag that ROs where processed
|
||||||
}
|
}
|
||||||
lastIndex = mm.Index + mm.Length;
|
lastIndex = mm.Index + mm.Length;
|
||||||
}
|
}
|
||||||
@ -3332,6 +3342,7 @@ namespace VEPROMS
|
|||||||
//}
|
//}
|
||||||
_DidConvertROsToText |= true;
|
_DidConvertROsToText |= true;
|
||||||
}
|
}
|
||||||
|
private bool _DidProcessROs = false; // B2017-076 flag that ROs where processed
|
||||||
private void AddROUsages(Content content, XmlNode xn)
|
private void AddROUsages(Content content, XmlNode xn)
|
||||||
{
|
{
|
||||||
AddROUsages(content, xn, false);
|
AddROUsages(content, xn, false);
|
||||||
@ -3339,6 +3350,7 @@ namespace VEPROMS
|
|||||||
// part of bug fix B2017-060 added the isGrid parameter
|
// part of bug fix B2017-060 added the isGrid parameter
|
||||||
private void AddROUsages(Content content, XmlNode xn, bool isGrid)
|
private void AddROUsages(Content content, XmlNode xn, bool isGrid)
|
||||||
{
|
{
|
||||||
|
_DidProcessROs = false;
|
||||||
if (_ConvertROsToTextDuringImport)
|
if (_ConvertROsToTextDuringImport)
|
||||||
ConvertImportProcedureROsToText(content, xn);
|
ConvertImportProcedureROsToText(content, xn);
|
||||||
else
|
else
|
||||||
@ -3359,6 +3371,7 @@ namespace VEPROMS
|
|||||||
RoUsageInfo roui = RoUsageInfo.Get(int.Parse(rousageid));
|
RoUsageInfo roui = RoUsageInfo.Get(int.Parse(rousageid));
|
||||||
content.FixContentText(roui, roval, 0, MyDocVersion.DocVersionAssociations[0].MyROFst, null, rousageid); // + " " + roid);
|
content.FixContentText(roui, roval, 0, MyDocVersion.DocVersionAssociations[0].MyROFst, null, rousageid); // + " " + roid);
|
||||||
_DidConvertROsToText |= true; // B2016-225 (follow through) add annotation when RO is converted to text
|
_DidConvertROsToText |= true; // B2016-225 (follow through) add annotation when RO is converted to text
|
||||||
|
_DidProcessROs = true; // B2017-076 flag that ROs where processed
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -3367,6 +3380,7 @@ namespace VEPROMS
|
|||||||
RoUsageInfo roui = RoUsageInfo.Get(rou.ROUsageID);
|
RoUsageInfo roui = RoUsageInfo.Get(rou.ROUsageID);
|
||||||
string lookFor = string.Format("#Link:ReferencedObject:{0} {1} {2}[END>", rousageid, roid, oldRODbID.ToString());
|
string lookFor = string.Format("#Link:ReferencedObject:{0} {1} {2}[END>", rousageid, roid, oldRODbID.ToString());
|
||||||
string replaceWith = string.Format("#Link:ReferencedObject:{0} {1} {2}[END>", rou.ROUsageID.ToString(), roid, newRODbID.ToString());
|
string replaceWith = string.Format("#Link:ReferencedObject:{0} {1} {2}[END>", rou.ROUsageID.ToString(), roid, newRODbID.ToString());
|
||||||
|
_DidProcessROs = content.Text.Contains(lookFor); // B2017-076 RO link in the text so we will be processing it
|
||||||
if (lookFor != replaceWith)
|
if (lookFor != replaceWith)
|
||||||
{
|
{
|
||||||
content.Text = content.Text.Replace(lookFor, replaceWith);
|
content.Text = content.Text.Replace(lookFor, replaceWith);
|
||||||
|
@ -20,12 +20,13 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
return string.Format("{0} {1}", Number, Text);
|
return string.Format("{0} {1}", Number, Text);
|
||||||
}
|
}
|
||||||
public void FixTransitionText(TransitionInfo tran)
|
public bool FixTransitionText(TransitionInfo tran) // B2017-076 return whether Transitions were processed (used when importing a procedure)
|
||||||
{
|
{
|
||||||
FixTransitionText(tran, false);
|
return FixTransitionText(tran, false);
|
||||||
}
|
}
|
||||||
public void FixTransitionText(TransitionInfo tran, bool forceConvertToText)
|
public bool FixTransitionText(TransitionInfo tran, bool forceConvertToText)
|
||||||
{
|
{
|
||||||
|
bool didFixATransition = false; // B2017-076 return whether Transitions were processed (used when importing a procedure)
|
||||||
//string transText = tran.ResolvePathTo();
|
//string transText = tran.ResolvePathTo();
|
||||||
//string lookFor = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v \\]+)* ([^#]*?)(\\[^v'? \\]+)*\\v(\\[^v \\]+)* #Link:Transition[^:]*?:{0} {1}( [0-9]*){{1,2}}\[END>", tran.TranType, tran.TransitionID);
|
//string lookFor = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v \\]+)* ([^#]*?)(\\[^v'? \\]+)*\\v(\\[^v \\]+)* #Link:Transition[^:]*?:{0} {1}( [0-9]*){{1,2}}\[END>", tran.TranType, tran.TransitionID);
|
||||||
////string lookFor = string.Format(@"<START\]\\v0 ([^#]*?)\\v #Link:Transition[^:]*?:{0} {1} [0-9]*\[END>", tran.TranType, tran.TransitionID);
|
////string lookFor = string.Format(@"<START\]\\v0 ([^#]*?)\\v #Link:Transition[^:]*?:{0} {1} [0-9]*\[END>", tran.TranType, tran.TransitionID);
|
||||||
@ -81,12 +82,14 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
if(tran != null)
|
if(tran != null)
|
||||||
Transition.Delete(tran.TransitionID);
|
Transition.Delete(tran.TransitionID);
|
||||||
|
didFixATransition = true; // B2017-076 return Transitions were processed (used when importing a procedure)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//else if ((gg.Contains("\\u8209?") ? gg.Replace("\\u8209?", "-") : gg) != (newvalue.Contains("\\u8209?") ? newvalue.Replace("\\u8209?", "-") : newvalue))
|
//else if ((gg.Contains("\\u8209?") ? gg.Replace("\\u8209?", "-") : gg) != (newvalue.Contains("\\u8209?") ? newvalue.Replace("\\u8209?", "-") : newvalue))
|
||||||
else if ((gg.Replace(@"\u8209?", "-").Replace(@"\u9568?", @"\\")) != (newvalue.Replace(@"\u8209?", "-").Replace(@"\u9568?", @"\\")))
|
else if ((gg.Replace(@"\u8209?", "-").Replace(@"\u9568?", @"\\")) != (newvalue.Replace(@"\u8209?", "-").Replace(@"\u9568?", @"\\")))
|
||||||
{
|
{
|
||||||
Text = Text.Substring(0, myIndex) + newvalue + Text.Substring(myIndex + myLength);
|
Text = Text.Substring(0, myIndex) + newvalue + Text.Substring(myIndex + myLength);
|
||||||
|
didFixATransition = true; // B2017-076 return Transitions were processed (used when importing a procedure)
|
||||||
break; // Text has been processed
|
break; // Text has been processed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -131,10 +134,12 @@ namespace VEPROMS.CSLA.Library
|
|||||||
ConvertTransitionToTextInGrid(tran, newvalue);
|
ConvertTransitionToTextInGrid(tran, newvalue);
|
||||||
else
|
else
|
||||||
MyGrid.Data = MyGrid.Data.Substring(0, myIndex) + newvalue + MyGrid.Data.Substring(myIndex + myLength);
|
MyGrid.Data = MyGrid.Data.Substring(0, myIndex) + newvalue + MyGrid.Data.Substring(myIndex + myLength);
|
||||||
|
didFixATransition = true; // B2017-076 return Transitions were processed (used when importing a procedure)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return didFixATransition;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string ProcessSpecChar(string orgText, string newValue, string specChar, string kbChar)
|
private string ProcessSpecChar(string orgText, string newValue, string specChar, string kbChar)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user