From 265cf53f893a3622a5fe2a1ca0c5cd743bd69970 Mon Sep 17 00:00:00 2001 From: Rich Date: Thu, 29 Oct 2015 15:24:20 +0000 Subject: [PATCH] Logic to limit when the OK button is enabled. Don't enable the OK button unless the RO Path has changed. Verify that the RO Path is not previously used (for a different RO Database) This will resolve an issue that we were seeing where AEP was changing the RO Path from ROAOP to ROEOP and the result was that the association was changed. The code will now check that this will not be able to happen. Fixed Bug B2015-171 - when the Library Documents Report located Disconnected Data records. Previously, the code would crash. --- .../frmRODbProperties.cs | 20 +++++++++++++++++++ .../VEPROMS.CSLA.Library/Extension/ItemExt.cs | 7 ++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/PROMS/VEPROMS User Interface/frmRODbProperties.cs b/PROMS/VEPROMS User Interface/frmRODbProperties.cs index ed7f6b3e..0143e6f7 100644 --- a/PROMS/VEPROMS User Interface/frmRODbProperties.cs +++ b/PROMS/VEPROMS User Interface/frmRODbProperties.cs @@ -66,11 +66,15 @@ namespace VEPROMS InitializeComponent(); _origROName = (_roDbInfo == null) ? null : _roDbInfo.ROName; _origFolderPath = (_roDbInfo == null) ? null : _roDbInfo.FolderPath; + // Disable the OK button when initialized. Enable it if the user makes changes + ppBtnOk.Enabled = false; } private void ppBtnFldrDlg_Click(object sender, EventArgs e) { FolderBrowserDialog dlgROFolder = new FolderBrowserDialog(); + // Initialize the starting location in the Browser window + dlgROFolder.SelectedPath = ppTxtPath.Text; if (dlgROFolder.ShowDialog() == DialogResult.OK) { ppTxtPath.Text = dlgROFolder.SelectedPath; @@ -104,6 +108,12 @@ namespace VEPROMS { if (ppTxtPath.Text.ToUpper() == rdi.FolderPath.ToUpper()) { + // if this has a previously defined path and a different name, do not save it. + if(ppRTxtName.Text.ToUpper() != rdi.ROName.ToUpper()) + { + MessageBox.Show(string.Format("This path has been used for \"{0}\" Database",rdi.ROName), "Previously Used RO Path", MessageBoxButtons.OK, MessageBoxIcon.Warning); + return; + } // get the most recent rofst data for this rodb: ROFstInfoList roFstList = ROFstInfoList.GetByRODbID(rdi.RODbID); DateTime dts = new DateTime(1900, 1, 1); @@ -197,12 +207,22 @@ namespace VEPROMS { string newFolderPath = null; FolderBrowserDialog dlgROFolder = new FolderBrowserDialog(); + dlgROFolder.RootFolder = Environment.SpecialFolder.MyComputer; + dlgROFolder.SelectedPath = ppTxtPath.Text; if (dlgROFolder.ShowDialog() == DialogResult.OK) { newFolderPath = dlgROFolder.SelectedPath; } ppTxtPath.Text = newFolderPath; } + // Initialize the enabled status for the OK button to false. + ppBtnOk.Enabled = false; + ppTxtPath.TextChanged += ppTxtPath_TextChanged; + } + void ppTxtPath_TextChanged(object sender, EventArgs e) + { + //The OK button should only be enabled if the path has changed + ppBtnOk.Enabled = _origFolderPath != ppTxtPath.Text; } } } \ No newline at end of file diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs index bf98a6b3..8f301a41 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs @@ -2148,7 +2148,12 @@ namespace VEPROMS.CSLA.Library get { if (_SearchDVPath == null) - _SearchDVPath = ActiveParent.SearchDVPath; + { + if (ActiveParent != null) + _SearchDVPath = ActiveParent.SearchDVPath; + else // RHM 20151026 - B2015-171 This was added to handle an error in the Library Document Report + _SearchDVPath = string.Format("Disconnected Data {0}", ItemID); + } return _SearchDVPath; } }