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.
This commit is contained in:
Rich 2015-10-29 15:24:20 +00:00
parent 9b54691fee
commit 265cf53f89
2 changed files with 26 additions and 1 deletions

View File

@ -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;
}
}
}

View File

@ -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;
}
}