|
|
|
@@ -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<int, int> MyCheckedOutDocVersions;
|
|
|
|
|
private void CheckOutDocVersion(VETreeNode tn)
|
|
|
|
|
{
|
|
|
|
|
if (MyCheckedOutDocVersions == null)
|
|
|
|
|
MyCheckedOutDocVersions = new Dictionary<int, int>();
|
|
|
|
|
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<string> 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<string> retlist = new List<string>();
|
|
|
|
|
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);
|
|
|
|
|