B2024-024 - Fixes issue when creating an Approved procedure import file (from Versions context menu) from a non-Parent/Child procedure set. #306
@ -1322,7 +1322,7 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
MenuItem miri = mir.MenuItems.Add("Create Procedure to Import");
|
MenuItem miri = mir.MenuItems.Add("Create Procedure to Import");
|
||||||
miri.Tag = ri.RevisionID;
|
miri.Tag = ri.RevisionID;
|
||||||
miri.Click += new EventHandler(ImportProcedure_Click);
|
miri.Click += new EventHandler(MultiUnitImportProcedure_Click); //B2024-024 Parent Child Create Approved Import file
|
||||||
}
|
}
|
||||||
|
|
||||||
//end added jcb 20111031
|
//end added jcb 20111031
|
||||||
@ -1419,6 +1419,29 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ImportProcedure_Click(object sender, EventArgs e)
|
void ImportProcedure_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
//B2024-024 restored the line below from prior change - didn't work for non parent/childs sets - created a new click event method (below) for parent/child sets.
|
||||||
|
RevisionInfo ri = (sender as MenuItem).Tag as RevisionInfo;
|
||||||
|
RevisionConfig rc = ri.MyConfig as RevisionConfig;
|
||||||
|
// bug fix: B2016-183 - add the child's name (ex Unit 1) to the export file name for Parent/Child procedures.
|
||||||
|
int applIdx = rc.Applicability_Index;
|
||||||
|
string str = (applIdx > 0)?_currentPri.MyDocVersion.UnitNames[applIdx-1] +"_":""; // if parent/child get the defined child name to inlcude the export filename
|
||||||
|
System.Xml.XmlDocument xd = new System.Xml.XmlDocument();
|
||||||
|
xd.LoadXml(ri.LatestVersion.ApprovedXML);
|
||||||
|
string PEIPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\VEPROMS\PEI_" + Database.VEPROMS_SqlConnection.Database;
|
||||||
|
DirectoryInfo di = new DirectoryInfo(PEIPath);
|
||||||
|
if (!di.Exists) di.Create();
|
||||||
|
// B2022-048: Crash when creating Procedure to Import from versions. Couldn't handle '/' in proc number.
|
||||||
|
string fNametmp = xd.SelectSingleNode("procedure/content/@number").InnerText.Replace(" ", "_").Replace(@"\u8209?", "-").Replace(@"\u9586?", "_").Replace("/", "-") + ".pxml";
|
||||||
|
// B2022-112: If applicability, need to resolve the '<' and '>' characters. Just use the UnitNames, i.e. str, from above.
|
||||||
|
if (applIdx > 0) fNametmp = Regex.Replace(fNametmp, @"\<U-ID\>", str, RegexOptions.IgnoreCase);
|
||||||
|
string fileName = PEIPath + "\\" + str + "Approved_Rev_" + ri.RevisionNumber.Replace(" ", "_").Replace("\\", "-").Replace("/", "-") + "_" + fNametmp;
|
||||||
|
xd.Save(fileName);
|
||||||
|
FlexibleMessageBox.Show("Approved procedure saved to import file " + fileName, "Creating Export of Approved Procedure", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
|
||||||
|
//B2024-024 create import file for parent/child procedure set
|
||||||
|
void MultiUnitImportProcedure_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
//RevisionInfo ri = (sender as MenuItem).Tag as RevisionInfo;
|
//RevisionInfo ri = (sender as MenuItem).Tag as RevisionInfo;
|
||||||
RevisionInfo ri = RevisionInfo.Get(int.Parse((sender as MenuItem).Tag.ToString()));
|
RevisionInfo ri = RevisionInfo.Get(int.Parse((sender as MenuItem).Tag.ToString()));
|
||||||
@ -1440,6 +1463,7 @@ namespace Volian.Controls.Library
|
|||||||
FlexibleMessageBox.Show("Approved procedure saved to import file " + fileName, "Creating Export of Approved Procedure", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
FlexibleMessageBox.Show("Approved procedure saved to import file " + fileName, "Creating Export of Approved Procedure", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ApprovedRevision_Click(object sender, EventArgs e)
|
void ApprovedRevision_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
bool superceded = false;
|
bool superceded = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user