Handle new error when a deleted step is attempted to be copied.

Added logic to handle an invalid transition (a transition to a disconnected step.
This commit is contained in:
Rich
2014-08-05 19:02:02 +00:00
parent 059041c546
commit b5ded05838
3 changed files with 30 additions and 5 deletions

View File

@@ -431,7 +431,8 @@ namespace VEPROMS.CSLA.Library
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show("Details were written to the Error Log.","Paste Failed", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
if (!HandleSqlExceptionOnCopy(ex))
System.Windows.Forms.MessageBox.Show("Details were written to the Error Log.","Paste Failed", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
return this;
}
}
@@ -457,10 +458,21 @@ namespace VEPROMS.CSLA.Library
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show("Details were written to the Error Log.", "Paste Failed", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
if(!HandleSqlExceptionOnCopy(ex))
System.Windows.Forms.MessageBox.Show("Details were written to the Error Log.", "Paste Failed", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
return this;
}
}
private bool HandleSqlExceptionOnCopy(Exception ex)
{
if (ex.Message.Contains("This step has been deleted"))
{
System.Windows.Forms.MessageBox.Show("The step being pasted has been deleted!", "Cannot Paste Deleted Step"
, System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Hand);
return true;
}
return false;
}
private ItemInfo CopyPasteItemInfoFetch(int copyStartID, int itemID, int? type, int? fromType, EAddpingPart addType)
{
ItemInfo tmp=null;
@@ -1225,7 +1237,10 @@ namespace VEPROMS.CSLA.Library
}
catch (Exception ex)
{
if (ex.Message.Contains("has External Transitions and has no next step") || ex.Message.Contains("has External Transitions to it's children"))
if (ex.Message.Contains("has External Transitions and has no next step")
|| ex.Message.Contains("has External Transitions to it's children")
|| ex.Message.Contains("This step has been deleted")
)
throw ex;
System.Windows.Forms.MessageBox.Show("Details were written to the Error Log.", "Paste Replace Failed", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
return itemInfo;