This commit is contained in:
2012-04-09 13:33:40 +00:00
parent 8cb0c78730
commit 204db5b92c
3 changed files with 31 additions and 8 deletions

View File

@@ -12,6 +12,12 @@ namespace VEPROMS
{
public partial class frmRODbProperties : Form
{
private Point _ParentLocation;
public Point ParentLocation
{
get { return _ParentLocation; }
set { _ParentLocation = value; }
}
private RODbInfo _roDbInfo;
private string _origROName;
private string _origFolderPath;
@@ -41,6 +47,16 @@ namespace VEPROMS
// Then close & return.
if (_origROName !=null && _origFolderPath !=null && (_origROName != ppRTxtName.Text || _origFolderPath != ppTxtPath.Text))
{
if (!File.Exists(ppTxtPath.Text))
{
MessageBox.Show(ppTxtPath.Text, "Invalid Directory for RO Database");
return;
}
if (!File.Exists(ppTxtPath.Text + @"\ro.fst"))
{
MessageBox.Show(ppTxtPath.Text, "Ro.Fst Doesn't Exist");
return;
}
RODb roDb = RODb.Get(_roDbInfo.RODbID);
if (_origROName != ppRTxtName.Text) roDb.ROName = ppRTxtName.Text;
if (_origFolderPath != ppTxtPath.Text)
@@ -89,15 +105,20 @@ namespace VEPROMS
RODbInfoList allrodbinfo = RODbInfoList.Get();
foreach (RODbInfo rdi in allrodbinfo)
{
if (ppRTxtName.Text == rdi.ROName || ppTxtPath.Text.ToUpper() == rdi.FolderPath.ToUpper())
if (ppRTxtName.Text == rdi.ROName)
{
MessageBox.Show("Name and/or folder path are not unique, create unique names.");
MessageBox.Show("Create unique Description.", "Description is not unique");
return;
}
if (ppTxtPath.Text.ToUpper() == rdi.FolderPath.ToUpper())
{
MessageBox.Show("Specify unique Folder Path or cancel and select an existing RO Database from drop-down.", "Folder Path is not unique" );
return;
}
}
if (ppRTxtName.Text == null || ppRTxtName.Text == "")
{
MessageBox.Show("You must enter a Name.");
MessageBox.Show("You must enter a Description.");
return;
}
if (ppTxtPath.Text == null || ppTxtPath.Text == "")
@@ -118,10 +139,12 @@ namespace VEPROMS
RODbInfo newrdi = RODbInfo.Get(newroDb.RODbID);
newroDb.Save().Dispose();
ROFst rofst = ROFstInfo.AddRoFst(newrdi, _docVersion);
DialogResult = DialogResult.OK;
Close();
}
private void frmRODbProperties_Load(object sender, EventArgs e)
{
Location = ParentLocation;
ppRTxtName.Text = (_roDbInfo == null) ? null : _roDbInfo.ROName;
ppTxtPath.Text = (_roDbInfo == null) ? null : _roDbInfo.FolderPath;
RODbConfig cfg = (_roDbInfo == null) ? new RODbConfig() : new RODbConfig(_roDbInfo);