B2019-014: Import of incorrect file type crashes; B2019-015: Improve message on import of UCFs.
This commit is contained in:
parent
af5ca6171f
commit
31033ae63f
@ -32,6 +32,7 @@ namespace VEPROMS
|
|||||||
// B2016-225 notify user when Transitions and/or ROs are converted to text
|
// B2016-225 notify user when Transitions and/or ROs are converted to text
|
||||||
private bool _DidConvertTransitionsToText = false;
|
private bool _DidConvertTransitionsToText = false;
|
||||||
private bool _DidConvertROsToText = false;
|
private bool _DidConvertROsToText = false;
|
||||||
|
private bool _DidUCF = false;
|
||||||
|
|
||||||
private ItemInfo _ExternalTransitionItem = null;
|
private ItemInfo _ExternalTransitionItem = null;
|
||||||
public ItemInfo ExternalTransitionItem
|
public ItemInfo ExternalTransitionItem
|
||||||
@ -363,7 +364,11 @@ namespace VEPROMS
|
|||||||
if (isImported)
|
if (isImported)
|
||||||
{
|
{
|
||||||
string msg = string.Format("Finished Importing:\n\n{0}", txtImport.Text.Substring(txtImport.Text.LastIndexOf("\\") + 1));
|
string msg = string.Format("Finished Importing:\n\n{0}", txtImport.Text.Substring(txtImport.Text.LastIndexOf("\\") + 1));
|
||||||
if (_DidConvertTransitionsToText || _DidConvertROsToText)
|
if (_DidUCF) // B2019-015: add a message to state to exit re-enter on format imports
|
||||||
|
{
|
||||||
|
msg += "\n\nRestart PROMS to have user controlled formats become available.";
|
||||||
|
}
|
||||||
|
else if (_DidConvertTransitionsToText || _DidConvertROsToText)
|
||||||
{
|
{
|
||||||
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);
|
||||||
@ -394,6 +399,13 @@ namespace VEPROMS
|
|||||||
XmlDocument xd = new XmlDocument();
|
XmlDocument xd = new XmlDocument();
|
||||||
xd.Load(txtImport.Text);
|
xd.Load(txtImport.Text);
|
||||||
XmlNodeList nl = xd.SelectNodes("ucformats/ucformat");
|
XmlNodeList nl = xd.SelectNodes("ucformats/ucformat");
|
||||||
|
if (nl == null || nl.Count == 0) // B2019-014: Check contents of import file for compatible operation
|
||||||
|
{
|
||||||
|
MessageBox.Show("A Procedure export file can only be imported from the Tree View.", "Import Failed", MessageBoxButtons.OK);
|
||||||
|
this.Close();
|
||||||
|
isImported = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
foreach (XmlNode nd in nl)
|
foreach (XmlNode nd in nl)
|
||||||
{
|
{
|
||||||
int formatid = int.Parse(nd.Attributes.GetNamedItem("formatid").InnerText);
|
int formatid = int.Parse(nd.Attributes.GetNamedItem("formatid").InnerText);
|
||||||
@ -437,6 +449,7 @@ namespace VEPROMS
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
isImported = true;
|
isImported = true;
|
||||||
|
_DidUCF = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -467,6 +480,15 @@ namespace VEPROMS
|
|||||||
XmlDocument xd = new XmlDocument();
|
XmlDocument xd = new XmlDocument();
|
||||||
xd.Load(txtImport.Text);
|
xd.Load(txtImport.Text);
|
||||||
pbImportProcedure.Maximum = 1;
|
pbImportProcedure.Maximum = 1;
|
||||||
|
XmlNode ucf = xd.SelectSingleNode("ucformats"); // B2019-014: Check contents of import file for compatible operation
|
||||||
|
if (ucf != null)
|
||||||
|
{
|
||||||
|
MessageBox.Show("A User Control of Format export file can only be imported from Administration on the V-Button.", "Import Failed", MessageBoxButtons.OK);
|
||||||
|
this.Cursor = Cursors.Default;
|
||||||
|
this.btnImport.Enabled = true; // allow user to select a different export file to import
|
||||||
|
this.btnCloseImport.Enabled = true; // allow user to close import dialog
|
||||||
|
return false;
|
||||||
|
}
|
||||||
string rofolderpath = xd.DocumentElement.Attributes.GetNamedItem("rofolderpath").InnerText;
|
string rofolderpath = xd.DocumentElement.Attributes.GetNamedItem("rofolderpath").InnerText;
|
||||||
int rodbid = int.Parse(xd.DocumentElement.Attributes.GetNamedItem("rodbid").InnerText);
|
int rodbid = int.Parse(xd.DocumentElement.Attributes.GetNamedItem("rodbid").InnerText);
|
||||||
int rofstid = int.Parse(xd.DocumentElement.Attributes.GetNamedItem("rofstid").InnerText);
|
int rofstid = int.Parse(xd.DocumentElement.Attributes.GetNamedItem("rofstid").InnerText);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user