Development #342

Merged
djankowski merged 6 commits from Development into master 2024-06-20 11:36:59 -04:00
2 changed files with 30 additions and 1 deletions
Showing only changes of commit db4f114caf - Show all commits

View File

@ -99,6 +99,10 @@ namespace VEPROMS
MyProcedure = procedureInfo;
InitializeComponent();
this.Text = mode + " Dialog for " + procedureInfo.DisplayNumber;
//Preset path for single procedures.
PEIPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\VEPROMS\PEI_" + Database.VEPROMS_SqlConnection.Database;
txtExport.Text = string.Format(@"{0}\{1}.pxml", PEIPath, MyProcedure.DisplayNumber.Replace("/", "_").Replace("\\", "_"));
}
private void dlgExportImport_Load(object sender, EventArgs e)
{
@ -172,6 +176,7 @@ namespace VEPROMS
}
else if (MyProcedure != null)
{
txtExport.Enabled = true;
txtExport.Text = string.Format(@"{0}\{1}.pxml", PEIPath, MyProcedure.DisplayNumber.Replace("/", "_").Replace("\\", "_"));
}
}
@ -190,6 +195,8 @@ namespace VEPROMS
private bool successfullExport = true;
private void btnDoExport_Click(object sender, EventArgs e)
{
btnExport.Enabled = false;
string msg = "Finished Exporting:\n\n";
if (_MyMode.ToUpper().Contains("FORMAT"))
@ -220,6 +227,27 @@ namespace VEPROMS
}
else if (MyProcedure != null)
{
var fileLocation = txtExport.Text;
if (File.Exists(fileLocation))
{ // C2022-029 if an existing export of the same name is found, provide option to overwrite it
DialogResult ovewriteEx = FlexibleMessageBox.Show("There is already another export file with the same name, would you like to overwrite it?\r\n\r\nSelecting 'Cancel' will cancel the export.", "Overwrite the export change", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);// == DialogResult.Yes;
if (ovewriteEx == DialogResult.Cancel) btnCloseExport.Enabled = true;
else
{
// Extract directory, filename, and extension
string directory = Path.GetDirectoryName(fileLocation);
string filename = Path.GetFileNameWithoutExtension(fileLocation);
string extension = Path.GetExtension(fileLocation);
// Generate the new filename with a datestamp
string datestamp = DateTime.Now.ToString("yyyyMMddHHmmss");
fileLocation = $"{directory}\\{filename}_{datestamp}{extension}";
}
}
this.Cursor = Cursors.WaitCursor;
MyStart = DateTime.Now;
btnDoExport.Enabled = false;
@ -230,7 +258,7 @@ namespace VEPROMS
XmlElement xe = xd.CreateElement("formats");
xd.DocumentElement.AppendChild(xe);
ExportFormats(FormatInfoList.GetFormatInfoListUsed(), xe, "formats", false);
xd.Save(txtExport.Text);
xd.Save(fileLocation);
TimeSpan elapsed = DateTime.Now.Subtract(MyStart);
lblExportStatus.Text = "Export Completed in " + elapsed.ToString();
this.Cursor = Cursors.Default;

View File

@ -400,6 +400,7 @@ namespace VEPROMS
this.pnlImport.PerformLayout();
this.ResumeLayout(false);
}
#endregion