Development #342
@@ -99,6 +99,10 @@ namespace VEPROMS
 | 
				
			|||||||
			MyProcedure = procedureInfo;
 | 
								MyProcedure = procedureInfo;
 | 
				
			||||||
			InitializeComponent();
 | 
								InitializeComponent();
 | 
				
			||||||
			this.Text = mode + " Dialog for " + procedureInfo.DisplayNumber;
 | 
								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)
 | 
							private void dlgExportImport_Load(object sender, EventArgs e)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
@@ -172,6 +176,7 @@ namespace VEPROMS
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
			else if (MyProcedure != null)
 | 
								else if (MyProcedure != null)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
 | 
									txtExport.Enabled = true;
 | 
				
			||||||
				txtExport.Text = string.Format(@"{0}\{1}.pxml", PEIPath, MyProcedure.DisplayNumber.Replace("/", "_").Replace("\\", "_"));
 | 
									txtExport.Text = string.Format(@"{0}\{1}.pxml", PEIPath, MyProcedure.DisplayNumber.Replace("/", "_").Replace("\\", "_"));
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -190,6 +195,8 @@ namespace VEPROMS
 | 
				
			|||||||
		private bool successfullExport = true;
 | 
							private bool successfullExport = true;
 | 
				
			||||||
		private void btnDoExport_Click(object sender, EventArgs e)
 | 
							private void btnDoExport_Click(object sender, EventArgs e)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			btnExport.Enabled = false;
 | 
								btnExport.Enabled = false;
 | 
				
			||||||
			string msg = "Finished Exporting:\n\n";
 | 
								string msg = "Finished Exporting:\n\n";
 | 
				
			||||||
			if (_MyMode.ToUpper().Contains("FORMAT"))
 | 
								if (_MyMode.ToUpper().Contains("FORMAT"))
 | 
				
			||||||
@@ -220,6 +227,27 @@ namespace VEPROMS
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
			else if (MyProcedure != null)
 | 
								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;
 | 
									this.Cursor = Cursors.WaitCursor;
 | 
				
			||||||
				MyStart = DateTime.Now;
 | 
									MyStart = DateTime.Now;
 | 
				
			||||||
				btnDoExport.Enabled = false;
 | 
									btnDoExport.Enabled = false;
 | 
				
			||||||
@@ -230,7 +258,7 @@ namespace VEPROMS
 | 
				
			|||||||
				XmlElement xe = xd.CreateElement("formats");
 | 
									XmlElement xe = xd.CreateElement("formats");
 | 
				
			||||||
				xd.DocumentElement.AppendChild(xe);
 | 
									xd.DocumentElement.AppendChild(xe);
 | 
				
			||||||
				ExportFormats(FormatInfoList.GetFormatInfoListUsed(), xe, "formats", false);
 | 
									ExportFormats(FormatInfoList.GetFormatInfoListUsed(), xe, "formats", false);
 | 
				
			||||||
				xd.Save(txtExport.Text);
 | 
									xd.Save(fileLocation);
 | 
				
			||||||
				TimeSpan elapsed = DateTime.Now.Subtract(MyStart);
 | 
									TimeSpan elapsed = DateTime.Now.Subtract(MyStart);
 | 
				
			||||||
				lblExportStatus.Text = "Export Completed in " + elapsed.ToString();
 | 
									lblExportStatus.Text = "Export Completed in " + elapsed.ToString();
 | 
				
			||||||
				this.Cursor = Cursors.Default;
 | 
									this.Cursor = Cursors.Default;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -400,6 +400,7 @@ namespace VEPROMS
 | 
				
			|||||||
			this.pnlImport.PerformLayout();
 | 
								this.pnlImport.PerformLayout();
 | 
				
			||||||
			this.ResumeLayout(false);
 | 
								this.ResumeLayout(false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		#endregion
 | 
							#endregion
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user