This commit is contained in:
2009-09-01 14:30:02 +00:00
parent 17575c0f69
commit dbd75e5ae2
4 changed files with 180 additions and 119 deletions

View File

@@ -7,6 +7,7 @@ using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using VEPROMS.CSLA.Library;
//using Csla;
using DevComponents;
@@ -845,6 +846,7 @@ namespace VEPROMS
// When infotabTags is set to InVisible, the matching panel also needs to be set to invisible
infotabControlPanelTags.Visible = false;
SelectedStepTabPanel = null;
btnGetRoVals.Enabled = false;
}
else
{
@@ -859,6 +861,7 @@ namespace VEPROMS
displayRO.MyRTB = null;
infotabTags.Visible = true;
displayBookMarks.MyRTB = null;
btnGetRoVals.Enabled = false;
//vlnStackTrace.ShowStack("enter tc_ItemSelectedChanged {0}", _CurrentItem);
}
else
@@ -883,6 +886,7 @@ namespace VEPROMS
displayBookMarks.MyRTB = args.MyStepItem.MyStepRTB;
displayRO.ProgressBar = bottomProgBar;
lblEditView.Text = args.MyStepItem.MyStepRTB.ViewRTB ? "View" : "Edit";
btnGetRoVals.Enabled = true;
}
if(tc.SelectedDisplayTabItem != null)
SelectedStepTabPanel = ((DisplayTabItem)tc.SelectedDisplayTabItem).MyStepTabPanel;
@@ -1180,5 +1184,64 @@ namespace VEPROMS
frmPropGrid pg = new frmPropGrid(tc.SelectedDisplayTabItem.SelectedItemInfo, tc.SelectedDisplayTabItem.SelectedItemInfo.Path);
pg.Show();
}
private void btnGetRoVals_Click(object sender, EventArgs e)
{
if (_CurrentItem == null)
{
MessageBox.Show("A step item is not selected, cannot update the RO Values.");
return;
}
ItemInfo pi = _CurrentItem.MyProcedure as ItemInfo;
if (pi == null)
{
MessageBox.Show("Cannot find the procedure that this step item is assocaited with, cannot update the RO Values.");
return;
}
DocVersionInfo mydocversion = pi.ActiveParent as DocVersionInfo;
if (mydocversion == null)
{
MessageBox.Show("Cannot find document version for this selection, cannot update the RO Values.");
return;
}
// use rodb directory path of the first rofst for the this document version. Bring up a file
// selection dialog starting with this path. The user can select another path.
// RHM question - we talked about just using the current path, but what is the current path when
// a docversion can have more than one rofst (for now, just use first?) - should I bring up a dialog?
if (mydocversion.DocVersionAssociations.Count < 1)
{
MessageBox.Show("Error Updating ro.fst. No associated ro.fst");
return;
}
using (DocVersion dv = DocVersion.Get(mydocversion.VersionID))
{
foreach (DocVersionAssociation dva in dv.DocVersionAssociations)
{
RODbInfo rdi = RODbInfo.Get(dva.ROFst_RODbID);
string rofstPath = rdi.FolderPath + @"\ro.fst";
if (!File.Exists(rofstPath))
{
MessageBox.Show("No existing ro.fst in path " + rdi.FolderPath + ". Check for invalid path");
break;
}
FileInfo fiRofst = new FileInfo(rofstPath);
if (SelectedROFst.DTS == fiRofst.LastWriteTime)
{
MessageBox.Show("ro.fst files are same for path " + rdi.FolderPath + ", import of that ro.fst will not be done");
break;
}
if (SelectedROFst.DTS > fiRofst.LastWriteTime)
{
MessageBox.Show("Cannot copy older ro.fst from " + rdi.FolderPath + ", import of that ro.fst will not be done");
break;
}
Cursor = Cursors.WaitCursor;
ROFst newrofst = ROFstInfo.UpdateRoFst(rdi, dva, dv, SelectedROFst);
Cursor = Cursors.Default;
}
}
}
}
}