diff --git a/PROMS/Volian.Controls.Library/AnnotationDetails.cs b/PROMS/Volian.Controls.Library/AnnotationDetails.cs
index 178e49af..cad0f999 100644
--- a/PROMS/Volian.Controls.Library/AnnotationDetails.cs
+++ b/PROMS/Volian.Controls.Library/AnnotationDetails.cs
@@ -85,7 +85,12 @@ namespace Volian.Controls.Library
rtxbComment.SelectionStart = rtxbComment.TextLength; // position cursor to end of text
}
}
-
+ private UserInfo _MyUserInfo;
+ public UserInfo MyUserInfo
+ {
+ get { return _MyUserInfo; }
+ set { _MyUserInfo = value; }
+ }
#endregion
#region Constructors
@@ -204,8 +209,20 @@ namespace Volian.Controls.Library
}
_LoadingAnnotation = false;
AnnotationDirty = false;
- if (!_LoadingGrid)
- rtxbComment.Focus(); // Set the focus to the comment text
+ if (!_LoadingGrid)
+ rtxbComment.Focus(); // Set the focus to the comment text
+ if (MyUserInfo.IsReviewer(_CurrentItem.MyDocVersion) && CurrentAnnotation != null && CurrentAnnotation.UserID != MyUserInfo.UserID)
+ {
+ btnRemoveAnnotation.Enabled = false;
+ cbGridAnnoType.Enabled = false;
+ rtxbComment.Enabled = false;
+ }
+ else
+ {
+ btnRemoveAnnotation.Enabled = true;
+ cbGridAnnoType.Enabled = true;
+ rtxbComment.Enabled = true;
+ }
}
#endregion
diff --git a/PROMS/Volian.Controls.Library/DSOTabPanel.cs b/PROMS/Volian.Controls.Library/DSOTabPanel.cs
index 554a5cfd..81fa4f68 100644
--- a/PROMS/Volian.Controls.Library/DSOTabPanel.cs
+++ b/PROMS/Volian.Controls.Library/DSOTabPanel.cs
@@ -85,6 +85,12 @@ namespace Volian.Controls.Library
return !doc.Saved;
}
}
+ private bool _OverrideClose = false;
+ public bool OverrideClose
+ {
+ get { return _OverrideClose; }
+ set { _OverrideClose = value; }
+ }
public E_ViewMode PanelViewEditMode = E_ViewMode.Edit;
#endregion
//private frmPG _frm = null;
@@ -187,7 +193,7 @@ namespace Volian.Controls.Library
this._MyDSOFramer.Open(MyDSOFile.MyFile.FullName);
}
LBDocumentClass doc = new LBDocumentClass(_MyDSOFramer.ActiveDocument);
- //Console.WriteLine("Version {0}", doc.Application.Version);
+ Console.WriteLine("Version {0}", doc.Application.Version);
float ver;
if (!float.TryParse(doc.Application.Version, out ver))
ver = 12.0F;
@@ -528,6 +534,8 @@ namespace Volian.Controls.Library
///
public bool SaveDirty()
{
+ if (OverrideClose)
+ return false;
if (IsDirty)
{
// Unfortunately, the only way to handle view mode for DSO Framer is to not save.
@@ -537,7 +545,7 @@ namespace Volian.Controls.Library
return false;
}
//if (MessageBox.Show("Save changes to " + _MyDisplayTabItem.MyItemInfo.TabTitle + "\r\n" + _MyDisplayTabItem.MyItemInfo.TabToolTip, "Document has Changed", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
- if (MessageBox.Show("Save changes to " + _MyDisplayTabItem.Text + "\r\n" + _MyDisplayTabItem.Tooltip, "Document has Changed", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
+ if (MessageBox.Show("Save changes to " + _MyDisplayTabItem.Text + "\r\n" + _MyDisplayTabItem.Tooltip, "Document has Changed", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
return SaveDSO();
return false;
}
diff --git a/PROMS/Volian.Controls.Library/DisplayTabControl.cs b/PROMS/Volian.Controls.Library/DisplayTabControl.cs
index 84dd23d3..c54cbffa 100644
--- a/PROMS/Volian.Controls.Library/DisplayTabControl.cs
+++ b/PROMS/Volian.Controls.Library/DisplayTabControl.cs
@@ -327,6 +327,7 @@ namespace Volian.Controls.Library
e.RemoveDockTab = true;
_RemovedDisplayTabItems.Add((DisplayTabItem)e.DockContainerItem);
DisplayTabItem dti = e.DockContainerItem as DisplayTabItem;
+ MySessionInfo.CheckInItem(dti.OwnerID);
if (dti != null && dti.MyStepTabPanel != null)
dti.MyStepTabPanel.MyStepPanel.Dispose();
DisplayTabItem myTabItem = e.DockContainerItem as DisplayTabItem;
@@ -363,6 +364,23 @@ namespace Volian.Controls.Library
public DisplayTabItem OpenItem(ItemInfo myItemInfo2)
{
ItemInfo myItemInfo = myItemInfo2;
+ string message = string.Empty;
+ if (myItemInfo.MyContent.MyEntry == null) //not a document
+ {
+ if (!MySessionInfo.CanCheckOutItem(myItemInfo.MyProcedure.ItemID, CheckOutType.Procedure, ref message))
+ {
+ MessageBox.Show(this, message, "Procedure Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ return null;
+ }
+ }
+ else
+ {
+ if (!MySessionInfo.CanCheckOutItem(myItemInfo.MyContent.MyEntry.DocID, CheckOutType.Document, ref message))
+ {
+ MessageBox.Show(this, message, "Document Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ return null;
+ }
+ }
//if (myItemInfo.IsProcedure)
//{
// DateTime start = DateTime.Now;
@@ -511,9 +529,12 @@ namespace Volian.Controls.Library
public void CloseTabItem(DisplayTabItem myTabItem)
{
Bar b = myTabItem.ContainerControl as Bar;
- b.CloseDockTab(myTabItem);
- //b.Items.Remove(myTabItem);
- RemoveItem(myTabItem);
+ if (b != null)
+ {
+ b.CloseDockTab(myTabItem);
+ //b.Items.Remove(myTabItem);
+ RemoveItem(myTabItem);
+ }
}
///
/// Look for a tab and set it to active.
@@ -553,6 +574,12 @@ namespace Volian.Controls.Library
}
#endregion
#region Public Properties
+ private SessionInfo _MySessionInfo;
+ public SessionInfo MySessionInfo
+ {
+ get { return _MySessionInfo; }
+ set { _MySessionInfo = value; }
+ }
public DevComponents.DotNetBar.Bar MyBar
{
get { return _MyBar; }
@@ -834,7 +861,7 @@ namespace Volian.Controls.Library
//if ((myItemInfo.MyContent.MyEntry.MyDocument.LibTitle ?? "") != "")
// MessageBox.Show("WARNING: All edits made to this Library Document will be applied to all uses of the Document");
pg = new DisplayTabItem(this.components, this, myItemInfo, key); // Open a new document page
- _MyDisplayTabItems.Add(key, pg);
+ _MyDisplayTabItems.Add(key, pg);
}
SelectDisplayTabItem(pg);
pg.MyDSOTabPanel.EnterPanel();
diff --git a/PROMS/Volian.Controls.Library/DisplayTabItem.cs b/PROMS/Volian.Controls.Library/DisplayTabItem.cs
index f06cb97e..91e2558e 100644
--- a/PROMS/Volian.Controls.Library/DisplayTabItem.cs
+++ b/PROMS/Volian.Controls.Library/DisplayTabItem.cs
@@ -24,6 +24,12 @@ namespace Volian.Controls.Library
///
/// ItemInfo associated with this DisplayTabItem
///
+ private int _OwnerID;
+ public int OwnerID
+ {
+ get { return _OwnerID; }
+ set { _OwnerID = value; }
+ }
public ItemInfo MyItemInfo
{
get { return _MyItemInfo; }
@@ -54,6 +60,12 @@ namespace Volian.Controls.Library
get { return _MyDSOTabPanel; }
set { _MyDSOTabPanel = value; }
}
+ private string _MyUserRole;
+ public string MyUserRole
+ {
+ get { return _MyUserRole; }
+ set { _MyUserRole = value; }
+ }
///
/// Current SelectedItemInfo for this page
///
@@ -77,9 +89,14 @@ namespace Volian.Controls.Library
#region Constructors
public DisplayTabItem(IContainer container, DisplayTabControl myDisplayTabControl, ItemInfo myItemInfo, string myKey)
{
+ _MyItemInfo = myItemInfo;
+ if(MyItemInfo.MyContent.MyEntry == null)
+ OwnerID = myDisplayTabControl.MySessionInfo.CheckOutItem(myItemInfo.MyProcedure.ItemID, CheckOutType.Procedure);
+ else
+ OwnerID = myDisplayTabControl.MySessionInfo.CheckOutItem(myItemInfo.MyContent.MyEntry.DocID, CheckOutType.Document);
+ Console.WriteLine("DisplayTabItem");
_MyKey = myKey;
_MyDisplayTabControl = myDisplayTabControl;
- _MyItemInfo = myItemInfo;
container.Add(this);
InitializeComponent();
this.Click += new EventHandler(DisplayTabItem_Click);
@@ -87,8 +104,59 @@ namespace Volian.Controls.Library
SetupStepTabPanel();
else
SetupDSOTabPanel();
+ SetupSecurity(myItemInfo);
Name = string.Format("DisplayTabItem {0}", myItemInfo.ItemID);
}
+ private bool MesssageShown = false;
+ public void SetupSecurity(ItemInfo myItem)
+ {
+ UserInfo ui = UserInfo.GetByUserID(OwnerInfo.Get(OwnerID).SessionUserID);
+ if (ui == null)
+ {
+ if (!MesssageShown)
+ {
+ System.Windows.Forms.MessageBox.Show("Security has not been defined for PROMS. All functionality has been defaulted to the lowest level for all users until security is defined.", "no security defined", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Warning);
+ MesssageShown = true;
+ }
+ _MyStepTabPanel.MyStepTabRibbon.SetupReviewerMode();
+ }
+ else if (ui.IsAdministrator())
+ {
+ if(_MyStepTabPanel != null)
+ _MyStepTabPanel.MyStepTabRibbon.SetupAdminMode();
+ MyUserRole = Volian.Base.Library.VlnSettings.UserID + " - Administrator";
+ }
+ else if (ui.IsSetAdministrator(myItem.MyDocVersion))
+ {
+ if (_MyStepTabPanel != null)
+ _MyStepTabPanel.MyStepTabRibbon.SetupSetAdminMode();
+ MyUserRole = Volian.Base.Library.VlnSettings.UserID + " - Set Administrator";
+ }
+ else if (ui.IsROEditor(myItem.MyDocVersion))
+ {
+ if (_MyStepTabPanel != null)
+ _MyStepTabPanel.MyStepTabRibbon.SetupROEditorMode();
+ MyUserRole = Volian.Base.Library.VlnSettings.UserID + " - RO Editor";
+ }
+ else if (ui.IsWriter(myItem.MyDocVersion))
+ {
+ if (_MyStepTabPanel != null)
+ _MyStepTabPanel.MyStepTabRibbon.SetupWriterMode();
+ MyUserRole = Volian.Base.Library.VlnSettings.UserID + " - Writer";
+ }
+ else if (ui.IsReviewer(myItem.MyDocVersion))
+ {
+ if (_MyStepTabPanel != null)
+ _MyStepTabPanel.MyStepTabRibbon.SetupReviewerMode();
+ MyUserRole = Volian.Base.Library.VlnSettings.UserID + " - Reviewer";
+ }
+ else
+ {
+ if (_MyStepTabPanel != null)
+ _MyStepTabPanel.MyStepTabRibbon.SetupReviewerMode();
+ MyUserRole = Volian.Base.Library.VlnSettings.UserID + " - Reviewer";
+ }
+ }
public DisplayTabItem(IContainer container, DisplayTabControl myDisplayTabControl, DocumentInfo myDocumentInfo, string myKey)
{
_MyKey = myKey;
diff --git a/PROMS/Volian.Controls.Library/EditItem.cs b/PROMS/Volian.Controls.Library/EditItem.cs
index 2d9dd928..3ae24ee7 100644
--- a/PROMS/Volian.Controls.Library/EditItem.cs
+++ b/PROMS/Volian.Controls.Library/EditItem.cs
@@ -2282,8 +2282,6 @@ namespace Volian.Controls.Library
}
protected void SetupEditItem(ItemInfo itemInfo, StepPanel myStepPanel, EditItem myParentEditItem, ChildRelation myChildRelation, bool expand, EditItem nextEditItem, bool addFirstChld)
{
- if (itemInfo.ItemID == 1359)
- Console.WriteLine("jcb");
if (myStepPanel.TopMostEditItem == null) myStepPanel.TopMostEditItem = this;
//if (itemInfo.ItemID == 10366) Console.WriteLine("Here");
//if (itemInfo.ItemID == 225) _MyStepRTB.Resize += new EventHandler(_MyStepRTB_Resize);
diff --git a/PROMS/Volian.Controls.Library/StepTabRibbon.cs b/PROMS/Volian.Controls.Library/StepTabRibbon.cs
index 07f3c395..b437a0be 100644
--- a/PROMS/Volian.Controls.Library/StepTabRibbon.cs
+++ b/PROMS/Volian.Controls.Library/StepTabRibbon.cs
@@ -29,6 +29,7 @@ namespace Volian.Controls.Library
}
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#region Properties
+ private bool EnableROEdit;
private VlnFlexGrid MyFlexGrid
{
get
@@ -47,6 +48,7 @@ namespace Volian.Controls.Library
_MyEditItem = value;
if (value != null)
{
+ (this.Parent as StepTabPanel).MyDisplayTabItem.SetupSecurity(MyItemInfo);
MyStepRTB = value.MyStepRTB;
if (value is GridItem)
{
@@ -427,7 +429,7 @@ namespace Volian.Controls.Library
if (_MyStepRTB == null) return;
// if we are in view mode or the edit window is empty, then don't allow inserting steps/substeps,
// page breaks, copy step, nor creating a pdf
- bool allow = (_MyStepRTB.TextLength > 0);
+ bool allow = (_MyStepRTB.TextLength > 0 && (MyEditItem == null || MyEditItem.MyStepPanel.VwMode == E_ViewMode.Edit));
// turn ribbon items on/off base on whether there is text in the edit window
rbnSiblings.Enabled = rbnBreaks.Enabled = rbnStepParts.Enabled = allow;
@@ -590,6 +592,7 @@ namespace Volian.Controls.Library
public StepTabRibbon()
{
InitializeComponent();
+ EnableROEdit = true;
_RibbonControl.AutoSize = true;
_RibbonControl.SizeChanged += new EventHandler(_RibbonControl_SizeChanged);
// When AutoExpand is set to true, [CTRL][F1] and double click will hide/expand the ribbon bar
@@ -1631,9 +1634,37 @@ namespace Volian.Controls.Library
//#endif
#endregion
-
+ public void SetupReviewerMode()
+ {
+ if (MyEditItem != null && MyEditItem.MyStepPanel.VwMode == E_ViewMode.Edit)
+ {
+ btnToggleEditView_Click(null, new EventArgs());
+ rtabView.Visible = false;
+ rtabHome.Visible = false;
+ rtabInsert.Visible = false;
+ rtabAdmin.Visible = false;
+ rtabReview.Select();
+ }
+ }
+ public void SetupROEditorMode()
+ {
+ btnToggleEditView_Click(null, new EventArgs());
+ rtabView.Visible = false;
+ }
+ public void SetupWriterMode()
+ {
+ EnableROEdit = false;
+ rtabAdmin.Visible = false;
+ }
+ public void SetupSetAdminMode()
+ {
+ }
+ public void SetupAdminMode()
+ {
+ }
private void btnToggleEditView_Click(object sender, EventArgs e)
{
+ if (MyEditItem == null) return;
MyEditItem.MyStepPanel.VwMode = MyEditItem.MyStepPanel.VwMode == E_ViewMode.Edit ? E_ViewMode.View : E_ViewMode.Edit;
MyEditItem.ToggleEditView(MyEditItem.MyStepPanel.VwMode);
SetButtonAndMenuEnabling(true);
@@ -1777,7 +1808,7 @@ namespace Volian.Controls.Library
btnROEdit.Enabled = false;
return;
}
- btnROEdit.Enabled = true;
+ btnROEdit.Enabled = EnableROEdit;
if (!NewerRoFst()) return;
btnUpdROVal.Enabled = true;
}
@@ -2513,7 +2544,8 @@ namespace Volian.Controls.Library
IDataObject iData = Clipboard.GetDataObject();
// set to true if editing cell, otherwise false for grids
//bool enable = (MyFlexGrid != null && MyFlexGrid.Editor != null);
- bool enable = (MyFlexGrid != null);
+
+ bool enable = (MyFlexGrid != null && MyEditItem.MyStepPanel.VwMode == E_ViewMode.Edit);
//btnPasteText.Enabled = btnPasteStepText.Enabled = btnPaste.Enabled = enable;
btnPaste.Enabled = (iData.GetDataPresent(DataFormats.Text) || iData.GetDataPresent(DataFormats.Rtf)) && enable;
btnCMPasteText.Enabled = btnPasteText.Enabled = iData.GetDataPresent(DataFormats.Text) && enable;
diff --git a/PROMS/Volian.Controls.Library/vlnTreeView.cs b/PROMS/Volian.Controls.Library/vlnTreeView.cs
index 095a4422..9114f9b5 100644
--- a/PROMS/Volian.Controls.Library/vlnTreeView.cs
+++ b/PROMS/Volian.Controls.Library/vlnTreeView.cs
@@ -317,6 +317,12 @@ namespace Volian.Controls.Library
#endregion
public partial class vlnTreeView : TreeView
{
+ private SessionInfo _MySessionInfo;
+ public SessionInfo MySessionInfo
+ {
+ get { return _MySessionInfo; }
+ set { _MySessionInfo = value; }
+ }
#region Local Vars
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
@@ -409,6 +415,16 @@ namespace Volian.Controls.Library
{
if (ReportAllProceduresInconsistencies != null) ReportAllProceduresInconsistencies(sender, args);
}
+ public event vlnTreeViewEvent RefreshCheckedOutProcedures;
+ private void OnRefreshCheckedOutProcedures(object sender, vlnTreeEventArgs args)
+ {
+ if (RefreshCheckedOutProcedures != null) RefreshCheckedOutProcedures(sender, args);
+ }
+ public event vlnTreeViewEvent ProcedureCheckedOutTo;
+ private void OnProcedureCheckedOutTo(object sender, vlnTreeEventArgs args)
+ {
+ if (ProcedureCheckedOutTo != null) ProcedureCheckedOutTo(sender, args);
+ }
public event vlnTreeViewEvent NodeNew;
private void OnNodeNew(object sender, vlnTreeEventArgs args)
{
@@ -476,6 +492,8 @@ namespace Volian.Controls.Library
{
if (e.Button == MouseButtons.Right)
{
+ OwnerInfoList oil = null;
+ OwnerInfo oi = null;
VETreeNode tn = this.GetNodeAt(new Point(e.X, e.Y)) as VETreeNode;
if (tn != null)
{
@@ -484,7 +502,12 @@ namespace Volian.Controls.Library
// Display Menu
ToolStripMenuItem mi = new ToolStripMenuItem();
ContextMenu cm = new ContextMenu();
-
+ UserInfo ui = UserInfo.GetByUserID(VlnSettings.UserID);
+ if (ui == null)
+ {
+ MessageBox.Show("Security has not been defined for PROMS. All functionality has been defaulted to the lowest level for all users until security is defined.", "no security defined", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ return;
+ }
#region Menu_New
if (tn.VEObject as FolderInfo != null)
{
@@ -492,81 +515,161 @@ namespace Volian.Controls.Library
// folders then can only add another folder, and if children are docversions can only
// add docversion.
FolderInfo fi = tn.VEObject as FolderInfo;
- if (fi.MyParent != null) // don't allow insert before/after if at top node
+ if (ui.IsAdministrator())
{
- cm.MenuItems.Add("Insert Folder Before", new EventHandler(mi_Click));
- cm.MenuItems.Add("Insert Folder After", new EventHandler(mi_Click));
+ if (fi.MyParent != null) // don't allow insert before/after if at top node
+ {
+ cm.MenuItems.Add("Insert Folder Before", new EventHandler(mi_Click));
+ cm.MenuItems.Add("Insert Folder After", new EventHandler(mi_Click));
+ }
+ if (fi.FolderDocVersionCount == 0) cm.MenuItems.Add("New Folder", new EventHandler(mi_Click));
+ if (fi.ChildFolderCount == 0 && !fi.HasWorkingDraft) cm.MenuItems.Add("Create Working Draft", new EventHandler(mi_Click));
}
- if (fi.FolderDocVersionCount == 0) cm.MenuItems.Add("New Folder", new EventHandler(mi_Click));
- if (fi.ChildFolderCount == 0 && !fi.HasWorkingDraft) cm.MenuItems.Add("Create Working Draft", new EventHandler(mi_Click));
}
else if (tn.VEObject as DocVersionInfo != null) // DocVersions can only contain procs
{
- cm.MenuItems.Add("New Procedure", new EventHandler(mi_Click));
DocVersionInfo dvi = tn.VEObject as DocVersionInfo;
- if (dvi.MultiUnitCount > 1)
+ if (ui.IsAdministrator() || ui.IsSetAdministrator(dvi) || ui.IsWriter(dvi))
{
- MenuItem mip = new MenuItem("Print All Procedures for");
- MenuItem mia= new MenuItem("Approve All Procedures for");
- MenuItem mis = new MenuItem("Approve Some Procedures for");
- int k = 0;
- foreach (string s in dvi.UnitNames)
+ OwnerInfoList.Reset();
+ oil = OwnerInfoList.Get();
+ cm.MenuItems.Add("Refresh Checked Out Procedures", new EventHandler(mi_Click));
+ cm.MenuItems.Add("New Procedure", new EventHandler(mi_Click));
+ if (dvi.MultiUnitCount > 1)
{
- k++;
- MenuItem mp = mip.MenuItems.Add(s, new EventHandler(miMultiUnit_Click));
- mp.Tag = k;
- MenuItem ma = mia.MenuItems.Add(s, new EventHandler(miMultiUnit_Click));
- ma.Tag = k;
- MenuItem ms = mis.MenuItems.Add(s, new EventHandler(miMultiUnit_Click));
- ms.Tag = k;
+ MenuItem mip = new MenuItem("Print All Procedures for");
+ MenuItem mia = new MenuItem("Approve All Procedures for");
+ MenuItem mis = new MenuItem("Approve Some Procedures for");
+ int k = 0;
+ foreach (string s in dvi.UnitNames)
+ {
+ k++;
+ MenuItem mp = mip.MenuItems.Add(s, new EventHandler(miMultiUnit_Click));
+ mp.Tag = k;
+ MenuItem ma = mia.MenuItems.Add(s, new EventHandler(miMultiUnit_Click));
+ ma.Tag = k;
+ MenuItem ms = mis.MenuItems.Add(s, new EventHandler(miMultiUnit_Click));
+ ms.Tag = k;
+ }
+ //MenuItem mmp = mip.MenuItems.Add("All Units", new EventHandler(miMultiUnit_Click));
+ //mmp.Tag = 0;
+ //MenuItem mma = mia.MenuItems.Add("All Units", new EventHandler(miMultiUnit_Click));
+ //mma.Tag = 0;
+ //MenuItem mms = mis.MenuItems.Add("All Units", new EventHandler(miMultiUnit_Click));
+ //mms.Tag = 0;
+ cm.MenuItems.Add(mip);
+ cm.MenuItems.Add(mia);
+ cm.MenuItems.Add(mis);
}
- //MenuItem mmp = mip.MenuItems.Add("All Units", new EventHandler(miMultiUnit_Click));
- //mmp.Tag = 0;
- //MenuItem mma = mia.MenuItems.Add("All Units", new EventHandler(miMultiUnit_Click));
- //mma.Tag = 0;
- //MenuItem mms = mis.MenuItems.Add("All Units", new EventHandler(miMultiUnit_Click));
- //mms.Tag = 0;
- cm.MenuItems.Add(mip);
- cm.MenuItems.Add(mia);
- cm.MenuItems.Add(mis);
+ else
+ {
+ cm.MenuItems.Add("Print All Procedures", new EventHandler(mi_Click));
+ cm.MenuItems.Add("Approve All Procedures", new EventHandler(mi_Click));
+ cm.MenuItems.Add("Approve Some Procedures", new EventHandler(mi_Click));
+ }
+ cm.MenuItems.Add("Report All Procedures Inconsistencies", new EventHandler(mi_Click));
}
else
{
- cm.MenuItems.Add("Print All Procedures", new EventHandler(mi_Click));
- cm.MenuItems.Add("Approve All Procedures", new EventHandler(mi_Click));
- cm.MenuItems.Add("Approve Some Procedures", new EventHandler(mi_Click));
+ OwnerInfoList.Reset();
+ oil = OwnerInfoList.Get();
+ cm.MenuItems.Add("Refresh Checked Out Procedures", new EventHandler(mi_Click));
+ if (dvi.MultiUnitCount > 1)
+ {
+ MenuItem mip = new MenuItem("Print All Procedures for");
+ int k = 0;
+ foreach (string s in dvi.UnitNames)
+ {
+ k++;
+ MenuItem mp = mip.MenuItems.Add(s, new EventHandler(miMultiUnit_Click));
+ mp.Tag = k;
+ }
+ //MenuItem mmp = mip.MenuItems.Add("All Units", new EventHandler(miMultiUnit_Click));
+ //mmp.Tag = 0;
+ //MenuItem mma = mia.MenuItems.Add("All Units", new EventHandler(miMultiUnit_Click));
+ //mma.Tag = 0;
+ //MenuItem mms = mis.MenuItems.Add("All Units", new EventHandler(miMultiUnit_Click));
+ //mms.Tag = 0;
+ cm.MenuItems.Add(mip);
+ }
+ else
+ {
+ cm.MenuItems.Add("Print All Procedures", new EventHandler(mi_Click));
+ }
+ }
+ //if (ui.IsAdministrator() || ui.IsSetAdministrator(dvi))
+ //{
+ // cm.MenuItems.Add("Check Out Procedure Set", new EventHandler(mi_Click));
+ // cm.MenuItems.Add("Check In Procedure Set", new EventHandler(mi_Click));
+ //}
+ if (ui.IsAdministrator() || ui.IsSetAdministrator(dvi) || ui.IsROEditor(dvi))
+ {
+ cm.MenuItems.Add("Run RO Editor", new EventHandler(mi_Click));
+ }
+ if (ui.IsAdministrator() || ui.IsSetAdministrator(dvi))
+ {
+ MenuItem urv = cm.MenuItems.Add("Update RO Values", new EventHandler(mi_Click));
+ urv.Enabled = dvi.NewerRoFst;
}
- cm.MenuItems.Add("Report All Procedures Inconsistencies", new EventHandler(mi_Click));
}
else if (tn.VEObject as ProcedureInfo != null) // Procs can only contain sections
{
ProcedureInfo pri = tn.VEObject as ProcedureInfo;
- if (pri.ActiveFormat.PlantFormat.FormatData.ProcData.PSI.Caption != null) cm.MenuItems.Add("Procedure Specific Information", new EventHandler(mi_Click));
- cm.MenuItems.Add("Insert Procedure Before", new EventHandler(mi_Click));
- cm.MenuItems.Add("Insert Procedure After", new EventHandler(mi_Click));
- cm.MenuItems.Add("New Section", new EventHandler(mi_Click));
- if (pri.MyDocVersion.MultiUnitCount > 1)
+ oi = OwnerInfo.GetByItemID(pri.ItemID, CheckOutType.Procedure);
+ if (ui.IsAdministrator() || ui.IsSetAdministrator(pri.MyDocVersion) || ui.IsWriter(pri.MyDocVersion))
{
- MenuItem mip = new MenuItem("Print");
- MenuItem mia = new MenuItem("Approve");
- int k = 0;
- foreach (string s in pri.MyDocVersion.UnitNames)
+ if (oi != null && oi.SessionID != MySessionInfo.SessionID)
+ cm.MenuItems.Add(string.Format("Procedure Checked Out to {0}", oi.SessionUserID), new EventHandler(mi_Click));
+ if (pri.ActiveFormat.PlantFormat.FormatData.ProcData.PSI.Caption != null) cm.MenuItems.Add("Procedure Specific Information", new EventHandler(mi_Click));
+ cm.MenuItems.Add("Insert Procedure Before", new EventHandler(mi_Click));
+ cm.MenuItems.Add("Insert Procedure After", new EventHandler(mi_Click));
+ cm.MenuItems.Add("New Section", new EventHandler(mi_Click));
+ if (pri.MyDocVersion.MultiUnitCount > 1)
{
- k++;
- MenuItem mp = mip.MenuItems.Add(s, new EventHandler(miMultiUnit_Click));
- mp.Tag = k;
- MenuItem ma = mia.MenuItems.Add(s, new EventHandler(miMultiUnit_Click));
- ma.Tag = k;
+ MenuItem mip = new MenuItem("Print");
+ MenuItem mia = new MenuItem("Approve");
+ int k = 0;
+ foreach (string s in pri.MyDocVersion.UnitNames)
+ {
+ k++;
+ MenuItem mp = mip.MenuItems.Add(s, new EventHandler(miMultiUnit_Click));
+ mp.Tag = k;
+ MenuItem ma = mia.MenuItems.Add(s, new EventHandler(miMultiUnit_Click));
+ ma.Tag = k;
+ }
+ cm.MenuItems.Add(mip);
+ cm.MenuItems.Add(mia);
+ AddApprovedRevisionsMultiUnit(cm.MenuItems, pri);
+ }
+ else
+ {
+ cm.MenuItems.Add("Print", new EventHandler(mi_Click));
+ cm.MenuItems.Add("Approve", new EventHandler(mi_Click));
+ AddApprovedRevisions(cm.MenuItems, pri);
}
- cm.MenuItems.Add(mip);
- cm.MenuItems.Add(mia);
- AddApprovedRevisionsMultiUnit(cm.MenuItems, pri);
}
else
{
- cm.MenuItems.Add("Print", new EventHandler(mi_Click));
- cm.MenuItems.Add("Approve", new EventHandler(mi_Click));
- AddApprovedRevisions(cm.MenuItems, pri);
+ if (oi != null && oi.SessionID != MySessionInfo.SessionID)
+ cm.MenuItems.Add(string.Format("Procedure Checked Out to {0}", oi.SessionUserID), new EventHandler(mi_Click));
+ if (pri.MyDocVersion.MultiUnitCount > 1)
+ {
+ MenuItem mip = new MenuItem("Print");
+ int k = 0;
+ foreach (string s in pri.MyDocVersion.UnitNames)
+ {
+ k++;
+ MenuItem mp = mip.MenuItems.Add(s, new EventHandler(miMultiUnit_Click));
+ mp.Tag = k;
+ }
+ cm.MenuItems.Add(mip);
+ AddApprovedRevisionsMultiUnit(cm.MenuItems, pri);
+ }
+ else
+ {
+ cm.MenuItems.Add("Print", new EventHandler(mi_Click));
+ AddApprovedRevisions(cm.MenuItems, pri);
+ }
}
}
else if (tn.VEObject as SectionInfo != null)
@@ -576,22 +679,31 @@ namespace Volian.Controls.Library
// A word doc section can contain another subsection (either step section or word doc section),
// but cannot contain steps.
SectionInfo si = tn.VEObject as SectionInfo;
- si.MyConfig = null;
- // Do not need step versus Word doc options, user enters this in property page during
- // insert process.
- cm.MenuItems.Add("Insert Section Before", new EventHandler(mi_Click));
- cm.MenuItems.Add("Insert Section After", new EventHandler(mi_Click));
- if (!si.IsAutoTOCSection)
+ if (ui.IsAdministrator() || ui.IsSetAdministrator(si.MyProcedure.MyDocVersion) || ui.IsWriter(si.MyProcedure.MyDocVersion))
{
- bool meta = si.ActiveFormat.PlantFormat.FormatData.SectData.UseMetaSections;
- if (meta) cm.MenuItems.Add("New Subsection", new EventHandler(mi_Click));
- // if this section has subsections, then be sure that the 'editable' data config
- // is set to allow new step creation.
- if (si.IsStepSection)
+ if (si.HasWordContent)
{
- SectionConfig sc = si.MyConfig as SectionConfig;
- if (si.Sections==null || si.Sections.Count==0 || (meta && sc != null && si.Sections != null && si.Sections.Count > 0 && sc.SubSection_Edit == "Y"))
- cm.MenuItems.Add("New Step", new EventHandler(mi_Click));
+ oi = OwnerInfo.GetByItemID(si.MyContent.MyEntry.DocID, CheckOutType.Document);
+ }
+ si.MyConfig = null;
+ // Do not need step versus Word doc options, user enters this in property page during
+ // insert process.
+ if (oi != null && oi.SessionID != MySessionInfo.SessionID)
+ cm.MenuItems.Add(string.Format("Document Checked Out to {0}", oi.SessionUserID), new EventHandler(mi_Click));
+ cm.MenuItems.Add("Insert Section Before", new EventHandler(mi_Click));
+ cm.MenuItems.Add("Insert Section After", new EventHandler(mi_Click));
+ if (!si.IsAutoTOCSection)
+ {
+ bool meta = si.ActiveFormat.PlantFormat.FormatData.SectData.UseMetaSections;
+ if (meta) cm.MenuItems.Add("New Subsection", new EventHandler(mi_Click));
+ // if this section has subsections, then be sure that the 'editable' data config
+ // is set to allow new step creation.
+ if (si.IsStepSection)
+ {
+ SectionConfig sc = si.MyConfig as SectionConfig;
+ if (si.Sections == null || si.Sections.Count == 0 || (meta && sc != null && si.Sections != null && si.Sections.Count > 0 && sc.SubSection_Edit == "Y"))
+ cm.MenuItems.Add("New Step", new EventHandler(mi_Click));
+ }
}
}
}
@@ -599,8 +711,12 @@ namespace Volian.Controls.Library
{
// check the format for allowable inserts, and also,
ItemInfo i = tn.VEObject as ItemInfo;
- if (AddToInsertMenu(i, 0)) cm.MenuItems.Add("Insert Step Before", new EventHandler(mi_Click));
- if (AddToInsertMenu(i, 1)) cm.MenuItems.Add("Insert Step After", new EventHandler(mi_Click));
+ if (ui.IsAdministrator() || ui.IsSetAdministrator(i.MyProcedure.MyDocVersion) || ui.IsWriter(i.MyProcedure.MyDocVersion))
+ {
+ //oi = OwnerInfo.GetByItemID(i.MyProcedure.ItemID);
+ if (AddToInsertMenu(i, 0)) cm.MenuItems.Add("Insert Step Before", new EventHandler(mi_Click));
+ if (AddToInsertMenu(i, 1)) cm.MenuItems.Add("Insert Step After", new EventHandler(mi_Click));
+ }
}
#endregion
#region Menu_Open
@@ -621,32 +737,102 @@ namespace Volian.Controls.Library
// For initial release, copy is not available for folders or docversions
if (tn.VEObject as ItemInfo != null)
{
- cm.MenuItems.Add("Copy", new EventHandler(mi_Click));
+ ItemInfo i = tn.VEObject as ItemInfo;
+ if (ui.IsAdministrator() || ui.IsSetAdministrator(i.MyProcedure.MyDocVersion) || ui.IsWriter(i.MyProcedure.MyDocVersion))
+ cm.MenuItems.Add("Copy", new EventHandler(mi_Click));
}
#endregion
- Menu_Paste(tn, cm);
+ bool ok = tn.VEObject as FolderInfo != null ? false : tn.VEObject as DocVersionInfo != null ? (ui.IsAdministrator() || ui.IsSetAdministrator(tn.VEObject as DocVersionInfo) || ui.IsWriter(tn.VEObject as DocVersionInfo)) : (ui.IsAdministrator() || ui.IsSetAdministrator((tn.VEObject as ItemInfo).MyProcedure.MyDocVersion) || ui.IsWriter((tn.VEObject as ItemInfo).MyProcedure.MyDocVersion));
+ if(ok)
+ Menu_Paste(tn, cm);
#region Menu_Delete
- // Add delete to the menu unless at the very 'top' node, on a grouping (partinfo)
- // node (RNOs, Steps, Cautions, Notes) or Folder/DocVersion that contains any items.
- PartInfo pi = tn.VEObject as PartInfo;
- if (pi == null && tn.Parent != null) // it's not a part and it's not the top....
- {
- FolderInfo fi = tn.VEObject as FolderInfo;
- if (fi == null || tn.Nodes.Count == 0) // it's not a folder or it has no children
+ if (ok)
{
- DocVersionInfo di = tn.VEObject as DocVersionInfo;
- if (di == null || tn.Nodes.Count == 0) // it's not a docversion or it has no children
- cm.MenuItems.Add("Delete", new EventHandler(mi_Click));
+ // Add delete to the menu unless at the very 'top' node, on a grouping (partinfo)
+ // node (RNOs, Steps, Cautions, Notes) or Folder/DocVersion that contains any items.
+ PartInfo pi = tn.VEObject as PartInfo;
+ if (pi == null && tn.Parent != null) // it's not a part and it's not the top....
+ {
+ FolderInfo fi = tn.VEObject as FolderInfo;
+ if (fi == null || tn.Nodes.Count == 0) // it's not a folder or it has no children
+ {
+ DocVersionInfo di = tn.VEObject as DocVersionInfo;
+ if (di == null || tn.Nodes.Count == 0) // it's not a docversion or it has no children
+ cm.MenuItems.Add("Delete", new EventHandler(mi_Click));
+ }
+ }
}
- }
#endregion
#region Menu_Properties
// Add Properties to the menu unless at the very 'top' node or on a grouping (partinfo)
// node (RNOs, Steps, Cautions, Notes) or at the step level.
+ ok = tn.VEObject as FolderInfo != null ? ui.IsAdministrator() : tn.VEObject as DocVersionInfo != null ? (ui.IsAdministrator() || ui.IsSetAdministrator(tn.VEObject as DocVersionInfo)) : (ui.IsAdministrator() || ui.IsSetAdministrator((tn.VEObject as ItemInfo).MyProcedure.MyDocVersion) || ui.IsWriter((tn.VEObject as ItemInfo).MyProcedure.MyDocVersion));
PartInfo pia = tn.VEObject as PartInfo;
ItemInfo ii = tn.VEObject as ItemInfo;
- if (pia == null && tn.VEObject as StepInfo == null) cm.MenuItems.Add("Properties...", new EventHandler(mi_Click));
+ if (ok)
+ if (pia == null && tn.VEObject as StepInfo == null) cm.MenuItems.Add("Properties...", new EventHandler(mi_Click));
#endregion
+ if (oil != null && oil.Count > 0 && tn.VEObject as DocVersionInfo != null)
+ {
+ /*
+ --docversion level
+ Approve All Procedures
+ Report All Procedures Inconsistencies
+ */
+ bool greyOut = false;
+ foreach (OwnerInfo own in oil)
+ {
+ if (own.SessionID != MySessionInfo.SessionID)
+ {
+ greyOut = true;
+ break;
+ }
+ }
+ if (greyOut)
+ {
+ foreach (MenuItem itm in cm.MenuItems)
+ {
+ if (itm.Text == "Approve All Procedures" || itm.Text == "Report All Procedures Inconsistencies")
+ itm.Enabled = false;
+ }
+ }
+ }
+ if (oi != null && oi.SessionID != MySessionInfo.SessionID)
+ {
+ /*
+ --procedure level
+ Procedure Specific Information
+ New Section
+ Approve
+ Open
+ Copy
+ Delete
+ Properties...
+
+ --section level
+ all of them
+
+ --step level
+ all of them
+ */
+ if (tn.VEObject as ProcedureInfo != null)
+ {
+ foreach (MenuItem itm in cm.MenuItems)
+ {
+ if(itm.Text == "Procedure Specific Information" || itm.Text == "New Section" || itm.Text == "Approve" || itm.Text == "Open" ||
+ itm.Text == "Copy" || itm.Text == "Delete" || itm.Text == "Properties..." || itm.Text == "Replace Existing Procedure")
+ itm.Enabled = false;
+ }
+ }
+ if (tn.VEObject as SectionInfo != null || tn.VEObject as StepInfo != null)
+ {
+ foreach (MenuItem itm in cm.MenuItems)
+ {
+ if(!itm.Text.StartsWith("Document Checked Out"))
+ itm.Enabled = false;
+ }
+ }
+ }
cm.Show(this, new Point(e.X, e.Y));
}
}
@@ -907,6 +1093,11 @@ namespace Volian.Controls.Library
MenuItem mi = sender as MenuItem;
if (mi == null)
return;
+ if (mi.Text.StartsWith("Procedure Checked Out to") || mi.Text.StartsWith("Document Checked Out to"))
+ {
+ OnProcedureCheckedOutTo(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0));
+ return;
+ }
switch (mi.Text)
{
case "Open":
@@ -1017,11 +1208,169 @@ namespace Volian.Controls.Library
case "Report All Procedures Inconsistencies":
OnReportAllProceduresInconsistencies(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0));
break;
+ case "Refresh Checked Out Procedures":
+ OnRefreshCheckedOutProcedures(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0));
+ break;
+ case "Run RO Editor":
+ RunROEditor(SelectedNode as VETreeNode);
+ break;
+ case "Update RO Values":
+ UpdateROValues(SelectedNode as VETreeNode);
+ break;
+ //case "Check Out Procedure Set":
+ // CheckOutDocVersion(SelectedNode as VETreeNode);
+ // break;
+ //case "Check In Procedure Set":
+ // CheckInDocVersion(SelectedNode as VETreeNode);
+ // break;
default:
MessageBox.Show(string.Format("Unrecognized Menu Item '{0}'", mi.Text));
break;
}
}
+ private Dictionary MyCheckedOutDocVersions;
+ private void CheckOutDocVersion(VETreeNode tn)
+ {
+ if (MyCheckedOutDocVersions == null)
+ MyCheckedOutDocVersions = new Dictionary();
+ DocVersionInfo MyDVI = tn.VEObject as DocVersionInfo;
+ string message = string.Empty;
+ if (MySessionInfo.CanCheckOutItem(MyDVI.VersionID, CheckOutType.DocVersion, ref message))
+ MyCheckedOutDocVersions.Add(MyDVI.VersionID,MySessionInfo.CheckOutItem(MyDVI.VersionID, CheckOutType.DocVersion));
+ else
+ MessageBox.Show(this, message, "Working Draft Has Items Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ }
+ private void CheckInDocVersion(VETreeNode tn)
+ {
+ DocVersionInfo MyDVI = tn.VEObject as DocVersionInfo;
+ MySessionInfo.CheckInItem(MyCheckedOutDocVersions[MyDVI.VersionID]);
+ MyCheckedOutDocVersions.Remove(MyDVI.VersionID);
+ }
+
+ private void UpdateROValues(VETreeNode tn)
+ {
+ DocVersionInfo MyDVI = tn.VEObject as DocVersionInfo;
+ // use rodb directory path of the first rofst for the this document version. Later, will need
+ // to modify code to get which one (when there is more than one)
+ if (MyDVI.DocVersionAssociations.Count < 1)
+ {
+ MessageBox.Show("Error Updating ro.fst. No associated ro.fst");
+ return;
+ }
+ ROFstInfo roFstInfo = MyDVI.DocVersionAssociations[0].MyROFst;
+
+ string rofstPath = roFstInfo.MyRODb.FolderPath + @"\ro.fst";
+ if (!File.Exists(rofstPath))
+ {
+ MessageBox.Show("No existing ro.fst in path " + roFstInfo.MyRODb.FolderPath + ". Check for invalid path");
+ return;
+ }
+ FileInfo fiRofst = new FileInfo(rofstPath);
+ if (roFstInfo.DTS == fiRofst.LastWriteTimeUtc)
+ {
+ MessageBox.Show("ro.fst files are same for path " + roFstInfo.MyRODb.FolderPath + ", import of that ro.fst will not be done");
+ return;
+ }
+ if (roFstInfo.DTS > fiRofst.LastWriteTimeUtc)
+ {
+ MessageBox.Show("Cannot copy older ro.fst from " + roFstInfo.MyRODb.FolderPath + ", import of that ro.fst will not be done");
+ return;
+ }
+ Cursor = Cursors.WaitCursor;
+ string message = string.Empty;
+ if (!MySessionInfo.CanCheckOutItem(MyDVI.VersionID, CheckOutType.DocVersion, ref message))
+ {
+ MessageBox.Show(this, message, "Working Draft Has Items Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ return;
+ }
+ int ownerid = MySessionInfo.CheckOutItem(MyDVI.VersionID, CheckOutType.DocVersion);
+ using (DocVersion dv = DocVersion.Get(MyDVI.VersionID))
+ {
+ roFstInfo.ROTableUpdate += new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate);
+ ROFst newrofst = ROFstInfo.UpdateRoFst(roFstInfo.MyRODb, dv.DocVersionAssociations[0], dv, roFstInfo);
+ roFstInfo.ROTableUpdate -= new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate);
+ StepPanelTabDisplayEventArgs args = new StepPanelTabDisplayEventArgs("DisplayROUpdateROFST");
+ }
+ MySessionInfo.CheckInItem(ownerid);
+ Cursor = Cursors.Default;
+ }
+ public List roFstInfo_ROTableUpdate(object sender, ROFstInfoROTableUpdateEventArgs args)
+ {
+ string xml = null;
+ string srchtxt = null;
+ using (VlnFlexGrid myGrid = new VlnFlexGrid())
+ {
+ using (StringReader sr = new StringReader(args.OldGridXml))
+ {
+ myGrid.ReadXml(sr);
+ myGrid.KeyActionTab = C1.Win.C1FlexGrid.KeyActionEnum.MoveAcross;
+ sr.Close();
+ }
+ string roid = myGrid.ROID;
+ int rodbid = myGrid.RODbId;
+ Font GridFont = myGrid.Font;
+ myGrid.Clear();
+ myGrid.ParseTableFromText(args.ROText, GridLinePattern.Single);
+ myGrid.AutoSizeCols();
+ myGrid.AutoSizeRows();
+ myGrid.MakeRTFcells();
+ myGrid.RODbId = rodbid;
+ myGrid.ROID = roid;
+ myGrid.IsRoTable = true;
+ using (StringWriter sw = new StringWriter())
+ {
+ myGrid.WriteXml(sw);
+ xml = sw.GetStringBuilder().ToString();
+ sw.Close();
+ }
+ srchtxt = myGrid.GetSearchableText();
+ }
+ List retlist = new List();
+ retlist.Add(srchtxt);
+ retlist.Add(xml);
+ return retlist;
+ }
+
+ private void RunROEditor(VETreeNode tn)
+ {
+ DocVersionInfo MyDVI = tn.VEObject as DocVersionInfo;
+ if (VlnSettings.ReleaseMode.Equals("DEMO"))
+ {
+ MessageBox.Show("Referenced Object Editor not available in the Demo version.", "PROMS Demo Version");
+ return;
+ }
+ //string roapp = Environment.GetEnvironmentVariable("roapp");
+ string roapp = Volian.Base.Library.ExeInfo.GetROEditorPath(); // get the path to the RO Editor Executable
+ if (roapp == null || roapp == string.Empty)
+ {
+ MessageBox.Show("The 'roapp' environment variable needs to be set to the path of the RO Editor\n\n Ex: C:\\VE-PROMS.NET\\Bin\\roeditor.exe", "Environment Variable Error");
+ return;
+ }
+ if (!File.Exists(roapp))
+ {
+ string errtxt = string.Format("Could not find path to Referenced Objects Editor:\n\n roapp = {0}\n\n Verify the path assigned to the 'roapp' environment variable", roapp);
+ MessageBox.Show(errtxt, "Environment Variable Error");
+ //MessageBox.Show("Could not find path to Ro Editor, check 'roapp' environment variable","Environment Variable Error");
+ return;
+ }
+ //if (roapp == null)
+ //{
+ // MessageBox.Show("Could not find path to Ro Editor, check 'roapp' environment variable");
+ // return;
+ //}
+ if (MyDVI == null || MyDVI.DocVersionAssociationCount < 1)
+ {
+ MessageBox.Show("Could not find associated path for ro data.", "No RO Data", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ return;
+ }
+ string roloc = "\"" + MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath + "\"";
+ if (!Directory.Exists(MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath))
+ {
+ MessageBox.Show(string.Format("RO Database directory does not exist: {0}", MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath));
+ return;
+ }
+ System.Diagnostics.Process.Start(roapp, roloc);
+ }
[Serializable]
public struct PromsClipboard
@@ -1040,6 +1389,23 @@ namespace Volian.Controls.Library
PromsClipboard iClip = (PromsClipboard) oClip;
ItemInfo iiClipboard = ItemInfo.Get(iClip.itemId);
+ string message = string.Empty;
+ if (iiClipboard.MyContent.MyEntry == null)
+ {
+ if (!MySessionInfo.CanCheckOutItem(iiClipboard.MyProcedure.ItemID, CheckOutType.Procedure, ref message))
+ {
+ MessageBox.Show(this, message, "Copied Procedure Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ return;
+ }
+ }
+ else
+ {
+ if (!MySessionInfo.CanCheckOutItem(iiClipboard.MyContent.MyEntry.DocID, CheckOutType.Document, ref message))
+ {
+ MessageBox.Show(this, message, "Copied Document Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ return;
+ }
+ }
VETreeNode tn = SelectedNode as VETreeNode;
DocVersionInfo dvi = tn.VEObject as DocVersionInfo;
if (dvi != null)
@@ -1318,6 +1684,12 @@ namespace Volian.Controls.Library
#region InsertSection
else if (newtype == MenuSelections.Section) // Insert subsection at end of parents section list
{
+ string message = string.Empty;
+ if (!MySessionInfo.CanCheckOutItem(_LastProcedureInfo.ItemID, CheckOutType.Procedure, ref message))
+ {
+ MessageBox.Show(this, message, "Item Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ return;
+ }
int s1 = -1;
if (!(_LastProcedureInfo == null) || !(_LastSectionInfo == null))
{
@@ -1405,6 +1777,12 @@ namespace Volian.Controls.Library
}
else if (newtype == MenuSelections.SectionAfter || newtype == MenuSelections.SectionBefore)
{
+ string message = string.Empty;
+ if (!MySessionInfo.CanCheckOutItem(_LastSectionInfo.MyProcedure.ItemID, CheckOutType.Procedure, ref message))
+ {
+ MessageBox.Show(this, message, "Item Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ return;
+ }
int tvindex = SelectedNode.Index;
// if inserting before, the parent is set in case previous is null, i.e. beginning of the list.
int s2 = -1;
@@ -1428,10 +1806,22 @@ namespace Volian.Controls.Library
#region InsertStep
else if (newtype == MenuSelections.Step) // insert step from section - no substeps from tree.
{
+ string message = string.Empty;
+ if (!MySessionInfo.CanCheckOutItem(_LastSectionInfo.MyProcedure.ItemID, CheckOutType.Procedure, ref message))
+ {
+ MessageBox.Show(this, message, "Item Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ return;
+ }
tn = InsertChildStep((VETreeNode)SelectedNode);
}
else if (newtype == MenuSelections.StepAfter || newtype == MenuSelections.StepBefore && _LastStepInfo != null)
{
+ string message = string.Empty;
+ if (!MySessionInfo.CanCheckOutItem(_LastStepInfo.MyProcedure.ItemID, CheckOutType.Procedure, ref message))
+ {
+ MessageBox.Show(this, message, "Item Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ return;
+ }
tn = InsertBeforeOrAfter(newtype, (VETreeNode)SelectedNode);
}
#endregion
@@ -1508,6 +1898,58 @@ namespace Volian.Controls.Library
private bool tv_NodeDelete()
{
SetLastValues((VETreeNode)SelectedNode);
+ string message = string.Empty;
+ if(_LastStepInfo != null)
+ if (!MySessionInfo.CanCheckOutItem(_LastStepInfo.MyProcedure.ItemID, CheckOutType.Procedure, ref message))
+ {
+ MessageBox.Show(this, message, "Item Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ return false;
+ }
+ if (_LastSectionInfo != null)
+ if (!MySessionInfo.CanCheckOutItem(_LastSectionInfo.MyProcedure.ItemID, CheckOutType.Procedure, ref message))
+ {
+ MessageBox.Show(this, message, "Item Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ return false;
+ }
+ if (_LastProcedureInfo != null)
+ if (!MySessionInfo.CanCheckOutItem(_LastProcedureInfo.ItemID, CheckOutType.Procedure, ref message))
+ {
+ MessageBox.Show(this, message, "Item Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ return false;
+ }
+ if (_LastDocVersionInfo != null)
+ {
+ StringBuilder sb = new StringBuilder();
+ foreach (ProcedureInfo pi in _LastDocVersionInfo.Procedures)
+ {
+ if (!MySessionInfo.CanCheckOutItem(pi.ItemID, CheckOutType.Procedure, ref message))
+ sb.AppendLine(message);
+ message = string.Empty;
+ }
+ if (sb.Length > 0)
+ {
+ MessageBox.Show(this, sb.ToString(), "Items Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ return false;
+ }
+ }
+ if (_LastFolderInfo != null)
+ {
+ StringBuilder sb = new StringBuilder();
+ foreach (DocVersionInfo dvi in _LastFolderInfo.FolderDocVersions)
+ {
+ foreach (ProcedureInfo pi in dvi.Procedures)
+ {
+ if (!MySessionInfo.CanCheckOutItem(pi.ItemID, CheckOutType.Procedure, ref message))
+ sb.AppendLine(message);
+ message = string.Empty;
+ }
+ }
+ if (sb.Length > 0)
+ {
+ MessageBox.Show(this, sb.ToString(), "Items Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ return false;
+ }
+ }
DialogResult result = MessageBox.Show("Are you sure you want to delete " + SelectedNode.Text, "Verify Delete",
MessageBoxButtons.YesNo, MessageBoxIcon.Question);
@@ -1682,11 +2124,6 @@ namespace Volian.Controls.Library
MessageBox.Show("Cannot drag/drop a grouping node.");
return;
}
- if (iidrag != null && !iidrag.IsProcedure && !iidrag.IsSection)
- {
- MessageBox.Show("Cannot drag/drop steps (for now).","Under Construction", MessageBoxButtons.OK, MessageBoxIcon.Hand);
- return;
- }
// don't put up message, message kept coming up on any selection of node (to copy, properties, etc)
//if (iidrag != null && iidrag.IsStep) return;
if (SetupDragCursor(_dragImageList, dragNode))
@@ -2023,12 +2460,6 @@ namespace Volian.Controls.Library
{
return (veTreeNode.VEObject.GetType() == typeof(FolderInfo));
}
- private Exception RootException(Exception ex)
- {
- while (ex.InnerException != null)
- ex = ex.InnerException;
- return ex;
- }
private void tv_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
{
try
@@ -2038,7 +2469,13 @@ namespace Volian.Controls.Library
int index = _LastDropLocation.Index + (_LastDropLocation.Position == DropPosition.After ? 1 : 0);
int myIndex = index;
if (dragNode.Parent == _LastDropLocation.DropNode && dragNode.Index <= _LastDropLocation.Index) index--;
- FolderInfo fdragi = ((VETreeNode)dragNode).VEObject as FolderInfo;
+ if (e.Effect == DragDropEffects.Move)// If Move Remove drag node from parent
+ dragNode.Remove();
+ else
+ dragNode = Clone(dragNode);
+ _LastDropLocation.DropNode.Nodes.Insert(index, dragNode);
+ this.SelectedNode = dragNode;
+ FolderInfo fdragi = ((VETreeNode)dragNode).VEObject as FolderInfo;
FolderInfo fdropi = ((VETreeNode)_LastDropLocation.DropNode).VEObject as FolderInfo;
if (fdragi != null && fdropi != null && fdropi.FolderDocVersionCount==0)
{
@@ -2046,22 +2483,9 @@ namespace Volian.Controls.Library
{
using (Folder fdrop = fdropi.Get())
{
- try
- {
- fdrag.ManualOrder = fdropi.NewManualOrder(myIndex);
- fdrag.MyParent = fdrop;
- fdrag.Save();
- MoveNode(e, dragNode, index);
- }
- catch (Exception ex)
- {
- ex = RootException(ex);
- if (ex.Message.Contains("Cannot insert duplicate key row in object 'dbo.Folders' with unique index 'IX_UniqueChildFolders'"))
- MessageBox.Show("You cannot have two folders with the same name here!",
- "Duplicate Folder Name", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
- else
- _MyLog.WarnFormat("{0} - {1}", ex.GetType().Name, ex.Message);
- }
+ fdrag.ManualOrder = fdropi.NewManualOrder(myIndex);
+ fdrag.MyParent = fdrop;
+ fdrag.Save();
}
}
return;
@@ -2078,7 +2502,6 @@ namespace Volian.Controls.Library
if (pdropi != null && pdragi.ActiveParent == pdropi.ActiveParent)
{
pdragi.MoveProcedure(pdragi.ActiveParent, myIndex);
- MoveNode(e, dragNode, index);
return;
}
DocVersionInfo dvdropi = ((VETreeNode)_LastDropLocation.DropNode).VEObject as DocVersionInfo;
@@ -2086,7 +2509,6 @@ namespace Volian.Controls.Library
if (dvdropi != null && dvdragpar.VersionID == dvdropi.VersionID)
{
pdragi.MoveProcedure(dvdropi, myIndex);
- MoveNode(e, dragNode, index);
return;
}
}
@@ -2100,7 +2522,6 @@ namespace Volian.Controls.Library
if (sdropi != null && sdragi.ActiveParent == sdropi.ActiveParent)
{
sdragi.MoveSection(sdragi, myIndex);
- MoveNode(e, dragNode, index);
return;
}
pdropi = ((VETreeNode)_LastDropLocation.DropNode).VEObject as ProcedureInfo;
@@ -2108,7 +2529,6 @@ namespace Volian.Controls.Library
{
sdragi.MoveSection(pdropi, myIndex);
sdragi.Moving = true;
- MoveNode(e, dragNode, index);
OnNodeSelect(dragNode, new vlnTreeEventArgs(dragNode));
return;
}
@@ -2123,21 +2543,18 @@ namespace Volian.Controls.Library
if (stdropi != null && stdragi.ActiveParent == stdropi.ActiveParent)
{
stdragi.MoveStep(stdragi.ActiveParent, myIndex);
- MoveNode(e, dragNode, index);
return;
}
sdropi = ((VETreeNode)_LastDropLocation.DropNode).VEObject as SectionInfo;
if (sdropi != null && stdragi.MyParent.ItemID == sdropi.ItemID)
{
stdragi.MoveStep(stdragi.ActiveParent, myIndex);
- MoveNode(e, dragNode, index);
return;
}
// the following handles items under the app nodes of 'steps', 'notes', 'cautions', etc.
if (sdropi == null && dragNode.Parent == _LastDropLocation.DropNode)
{
stdragi.MoveStep(stdragi.ActiveParent, myIndex);
- MoveNode(e, dragNode, index);
return;
}
}
@@ -2147,17 +2564,6 @@ namespace Volian.Controls.Library
if(_MyLog.IsErrorEnabled)_MyLog.Error("tv_DragDrop", ex);
}
}
-
- private void MoveNode(System.Windows.Forms.DragEventArgs e, TreeNode dragNode, int index)
- {
- if (e.Effect == DragDropEffects.Move)// If Move Remove drag node from parent
- dragNode.Remove();
- // Copy method has been removed
- //else
- // dragNode = Clone(dragNode);
- _LastDropLocation.DropNode.Nodes.Insert(index, dragNode);
- this.SelectedNode = dragNode;
- }
// private void DumpMembers(object o)
// {
// Type t = o.GetType();
@@ -2187,17 +2593,17 @@ namespace Volian.Controls.Library
ExpandMatch(tmp,tn);
return tmp;
}
- //private void tv_DragDropOld(object sender, System.Windows.Forms.DragEventArgs e)
- //{
- // TreeNode dragNode = (TreeNode)e.Data.GetData("System.Windows.Forms.TreeNode");// Get the drag node
- // DragHelper.ImageList_DragLeave(this.Handle);
- // TreeNode cloneNode = (TreeNode)dragNode.Clone();// copy the source node
- // ExpandMatch(cloneNode, dragNode);
- // _LastDropLocation.DropNode.Nodes.Insert(_LastDropLocation.Index + (_LastDropLocation.Position == DropPosition.After ? 1 : 0), cloneNode);
- // if (e.Effect == DragDropEffects.Move)// If Move Remove drag node from parent
- // dragNode.Remove();
- // this.SelectedNode = cloneNode;
- //}
+ private void tv_DragDropOld(object sender, System.Windows.Forms.DragEventArgs e)
+ {
+ TreeNode dragNode = (TreeNode)e.Data.GetData("System.Windows.Forms.TreeNode");// Get the drag node
+ DragHelper.ImageList_DragLeave(this.Handle);
+ TreeNode cloneNode = (TreeNode)dragNode.Clone();// copy the source node
+ ExpandMatch(cloneNode, dragNode);
+ _LastDropLocation.DropNode.Nodes.Insert(_LastDropLocation.Index + (_LastDropLocation.Position == DropPosition.After ? 1 : 0), cloneNode);
+ if (e.Effect == DragDropEffects.Move)// If Move Remove drag node from parent
+ dragNode.Remove();
+ this.SelectedNode = cloneNode;
+ }
private void tv_DragEnter(object sender, System.Windows.Forms.DragEventArgs e)
{
DragHelper.ImageList_DragEnter(this.Handle, e.X - this.Left, e.Y - this.Top);