This commit is contained in:
Kathy Ruffing 2012-02-24 16:30:29 +00:00
parent 65b1e90e0f
commit 784fd55a21

View File

@ -36,15 +36,52 @@ namespace VEPROMS
private void ppBtnOk_Click(object sender, EventArgs e)
{
// check for modify - if modify, just save current data, close & return.
// check for modify. If the path to this rodb already exists, we've got to use that
// as the assocation. if it's a new path, i.e. a modify of the rodb record, just save current data.
// Then close & return.
if (_origROName !=null && _origFolderPath !=null && (_origROName != ppRTxtName.Text || _origFolderPath != ppTxtPath.Text))
{
RODb roDb = RODb.Get(_roDbInfo.RODbID);
if (_origROName != ppRTxtName.Text) roDb.ROName = ppRTxtName.Text;
if (_origFolderPath != ppTxtPath.Text) roDb.FolderPath = ppTxtPath.Text;
roDb.Save().Dispose();
Close();
return;
if (_origFolderPath != ppTxtPath.Text)
{
// see if an rodb already exists with this pathname.
RODbInfoList roDbList = RODbInfoList.Get();
foreach (RODbInfo rdi in roDbList)
{
if (ppTxtPath.Text.ToUpper() == rdi.FolderPath.ToUpper())
{
// get the most recent rofst data for this rodb:
ROFstInfoList roFstList = ROFstInfoList.GetByRODbID(rdi.RODbID);
DateTime dts = new DateTime(1900, 1, 1);
int rofstinfoid = -1;
foreach (ROFstInfo rfi in roFstList)
{
if (rfi.DTS > dts)
{
dts = rfi.DTS;
rofstinfoid = rfi.ROFstID;
}
}
_docVersion.DocVersionAssociations[0].MyROFst = ROFst.Get(rofstinfoid);
_docVersion.Save().Dispose();
Close();
return;
}
}
roDb.FolderPath = ppTxtPath.Text;
}
try
{
roDb.Save().Dispose();
Close();
return;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
return;
}
}
// this is creating a new rodb. A new rofst record will be created as well & the association set
@ -82,7 +119,7 @@ namespace VEPROMS
newroDb.Save().Dispose();
ROFst rofst = ROFstInfo.AddRoFst(newrdi, _docVersion);
Close();
}
}
private void frmRODbProperties_Load(object sender, EventArgs e)
{
ppRTxtName.Text = (_roDbInfo == null) ? null : _roDbInfo.ROName;