B2019-046: Improve error handling for import
This commit is contained in:
parent
b3b98dacff
commit
bbead6687d
@ -12,6 +12,7 @@ using System.Xml;
|
||||
using System.IO;
|
||||
using Ionic.Zip;
|
||||
using System.Text.RegularExpressions;
|
||||
using JR.Utils.GUI.Forms;
|
||||
|
||||
namespace VEPROMS
|
||||
{
|
||||
@ -326,9 +327,9 @@ namespace VEPROMS
|
||||
{
|
||||
TurnChangeManagerOff.Execute();
|
||||
MyFrmVEPROMS.DisablePing = true;// Turn-off SessionPing
|
||||
TryToLoadImportDataDocument();// Added Try Catch Error Handling to assure that the Change Manager is tuned-on
|
||||
// B2019-046: improved error handling (added return value)
|
||||
isImported = TryToLoadImportDataDocument();// Added Try Catch Error Handling to assure that the Change Manager is tuned-on
|
||||
MyDocVersion = null;
|
||||
isImported = true;
|
||||
MyFrmVEPROMS.DisablePing = false;// Turn-on SessionPing
|
||||
TurnChangeManagerOn.Execute();
|
||||
}
|
||||
@ -683,16 +684,20 @@ namespace VEPROMS
|
||||
}
|
||||
}
|
||||
// Added Error Handling to assure that Change Manager is turned-on regardless of success or failure of the import
|
||||
private void TryToLoadImportDataDocument()
|
||||
// B2019-046: improved error handling (added return value & error message)
|
||||
private bool TryToLoadImportDataDocument()
|
||||
{
|
||||
try
|
||||
{
|
||||
LoadImportDataDocument();
|
||||
bool retval = LoadImportDataDocument();
|
||||
return retval;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FlexibleMessageBox.Show("The import failed, check the error log for more information.", "Import Failed", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
_MyLog.Warn("Failure During Import", ex);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
private void ImportProcedureNew(XmlDocument xd)
|
||||
{
|
||||
@ -823,7 +828,7 @@ namespace VEPROMS
|
||||
FixFloatingFoldouts();
|
||||
return true;
|
||||
}
|
||||
private void LoadImportDataDocument()
|
||||
private bool LoadImportDataDocument()
|
||||
{
|
||||
floatFoldout = new Dictionary<int, int>();
|
||||
ZipEntry ze = MyExpxZipFile[0];
|
||||
@ -837,13 +842,13 @@ namespace VEPROMS
|
||||
this.Cursor = Cursors.Default;
|
||||
this.btnImport.Enabled = true; // allow user to select a different export file to import
|
||||
this.btnDoImport.Enabled = true; // allow user to change mind and perform the import
|
||||
return; // Return False to Indicate that the Import did not succeed
|
||||
return false; // Return False to Indicate that the Import did not succeed
|
||||
}
|
||||
Folder ff = AddFolder(Folder.Get(MyFolder.FolderID), xd);
|
||||
if (ff == null)
|
||||
{
|
||||
MessageBox.Show("You can not import the same procedure set more than once", "Duplicate Import Error");
|
||||
return;
|
||||
MessageBox.Show("You can not import the same procedure set more than once. You should rename the existing folder then try again.", "Duplicate Import Error");
|
||||
return false;
|
||||
}
|
||||
_MyNewFolder = FolderInfo.Get(ff.FolderID);
|
||||
AddAnnotationTypes(xd);
|
||||
@ -873,6 +878,7 @@ namespace VEPROMS
|
||||
AddTransitions();
|
||||
FixFloatingFoldouts();
|
||||
SaveTransitionAndItemContentIDs();
|
||||
return true;
|
||||
}
|
||||
private void FixSectionStart(ProcedureInfo pi)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user