Added Error Log code to record errors when import fails

Added Error handling to Import so that Change Manager is turned-on after Import whether it is successful or not.
Don't allow import if the Referenced Objects have not been selected.
Turn On Change Manager if there are no active sessions
Don't crash if the Referenced Objects are not set when you right-click on a Working Draft.
This commit is contained in:
Rich
2017-02-10 16:23:31 +00:00
parent 0deea55d7e
commit 69b7de9fc5
3 changed files with 213 additions and 165 deletions

View File

@@ -538,6 +538,13 @@ namespace VEPROMS
}
else
{
dvi.RefreshDocVersionAssociations(); // Refresh Associations Count
//Only allow Import if the Referenced Object Database is set
if ( dvi.DocVersionAssociationCount == 0)
{
MessageBox.Show("Prior to Importing Procedures you must set the Referenced Object Database", "No RO Database set", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return;
}
int ownerid = MySessionInfo.CheckOutItem(dvi.VersionID, CheckOutType.DocVersion);
dlgExportImport dlg = new dlgExportImport("Import", dvi);
dlg.MyNewProcedure = null;
@@ -1494,6 +1501,7 @@ namespace VEPROMS
private void CloseSessionsNoLongerActive()
{
SessionInfoList sil = SessionInfoList.Get();
int i = 0;
foreach(SessionInfo si in sil)
{
if (si.DTSEnd == null && si.MachineName == Environment.MachineName && si.UserID == Volian.Base.Library.VlnSettings.UserID)
@@ -1502,12 +1510,16 @@ namespace VEPROMS
{
System.Diagnostics.Process p = System.Diagnostics.Process.GetProcessById(si.ProcessID);
}
catch(Exception ex)// Process not found
catch (Exception ex)// Process not found
{
Session.Delete(si.SessionID);// Remove Session record associated with a closed process
}
}
else if (si.DTSEnd == null)
i = i + 1;
}
if (i == 0)// Turn-on Change Manger if there are no active Sessions
TurnChangeManagerOn.Execute();
}
//public bool IsEnhancedDocumentOpen(ItemInfo ii)
//{