C2018-020: Import of procedure when Overwriting has confusing transition list dialog and does not import
This commit is contained in:
parent
9b8dc9fe05
commit
8b431d2fe4
@ -436,7 +436,13 @@ namespace VEPROMS
|
|||||||
DialogResult dr = MessageBox.Show(this, msg, "Overwrite Existing Procedure", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Stop);
|
DialogResult dr = MessageBox.Show(this, msg, "Overwrite Existing Procedure", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Stop);
|
||||||
if (dr == DialogResult.Yes)
|
if (dr == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
ImportProcedureOverwrite(xd, pi);
|
bool success = ImportProcedureOverwrite(xd, pi); // C2018-020: check for successful Import
|
||||||
|
if (!success)
|
||||||
|
{
|
||||||
|
canceledPressed = true;
|
||||||
|
resolvedProcNum = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
isImported = true;
|
isImported = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -549,7 +555,7 @@ namespace VEPROMS
|
|||||||
FixFloatingFoldouts();
|
FixFloatingFoldouts();
|
||||||
File.Delete(fn);
|
File.Delete(fn);
|
||||||
}
|
}
|
||||||
private void ImportProcedureOverwrite(XmlDocument xd, ProcedureInfo pi)
|
private bool ImportProcedureOverwrite(XmlDocument xd, ProcedureInfo pi)
|
||||||
{
|
{
|
||||||
floatFoldout = new Dictionary<int, int>();
|
floatFoldout = new Dictionary<int, int>();
|
||||||
oldFormat = new Dictionary<int, string>();
|
oldFormat = new Dictionary<int, string>();
|
||||||
@ -581,16 +587,30 @@ namespace VEPROMS
|
|||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
ExternalTransitionItem = pi.HandleSqlExceptionOnDelete(ex);
|
// C2018-020: cannot overwrite the procedure because transitions point to this. Show dialog listing transitions and then
|
||||||
|
// return false to flag that import was not successful.
|
||||||
|
if (ex.Message.Contains("has External Transitions"))
|
||||||
|
{
|
||||||
|
using (TransitionInfoList exTrans = TransitionInfoList.GetExternalTransitionsToChildren(pi.ItemID))
|
||||||
|
{
|
||||||
|
DialogResult ans = MessageBox.Show("Transitions exist to this procedure and cannot be adjusted automatically." +
|
||||||
|
"\r\nSteps with Problem Transitions:" +
|
||||||
|
exTrans.Summarize(),
|
||||||
|
"Cannot Overwrite procedure", MessageBoxButtons.OK, MessageBoxIcon.Question);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
MessageBox.Show(ex.Message, "SQL Exception", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||||
File.Delete(fn);
|
File.Delete(fn);
|
||||||
TurnChangeManagerOff.Execute(); // Assure that the Change Manager is off
|
TurnChangeManagerOff.Execute(); // Assure that the Change Manager is off
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
//add imported procedure
|
//add imported procedure
|
||||||
_MyNewProcedure = AddProcedure(xd.DocumentElement, MyDocVersion, lastProcedure);
|
_MyNewProcedure = AddProcedure(xd.DocumentElement, MyDocVersion, lastProcedure);
|
||||||
//update transitions
|
//update transitions
|
||||||
AddTransitions(PendingTransitions);
|
AddTransitions(PendingTransitions);
|
||||||
FixFloatingFoldouts();
|
FixFloatingFoldouts();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
private void LoadImportDataDocument()
|
private void LoadImportDataDocument()
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user