B2025-024-Document-Unit-Print

This commit is contained in:
Paul Larsen 2025-05-28 18:19:24 -04:00
parent 612e7955cf
commit e0b628dce9

View File

@ -57,7 +57,7 @@ namespace Volian.Controls.Library
{ {
_MySectionInfo = mySectionInfo; _MySectionInfo = mySectionInfo;
} }
public vlnTreeSectionInfoEventArgs(SectionInfo mySectionInfo,bool isDeleting) public vlnTreeSectionInfoEventArgs(SectionInfo mySectionInfo, bool isDeleting)
{ {
_MySectionInfo = mySectionInfo; _MySectionInfo = mySectionInfo;
_IsDeleting = isDeleting; _IsDeleting = isDeleting;
@ -140,7 +140,7 @@ namespace Volian.Controls.Library
get { return _Node; } get { return _Node; }
set { _Node = value; } set { _Node = value; }
} }
private TreeNode _Destination=null; private TreeNode _Destination = null;
public TreeNode Destination public TreeNode Destination
{ {
get { return _Destination; } get { return _Destination; }
@ -168,7 +168,7 @@ namespace Volian.Controls.Library
//end jcb multiunit //end jcb multiunit
#endregion #endregion
#region Factory Methods #region Factory Methods
private vlnTreeEventArgs() { ;} private vlnTreeEventArgs() {; }
public vlnTreeEventArgs(TreeNode node) public vlnTreeEventArgs(TreeNode node)
{ {
_Node = node; _Node = node;
@ -192,7 +192,7 @@ namespace Volian.Controls.Library
#endregion #endregion
public override string ToString() public override string ToString()
{ {
return string.Format("Node={0},Destination={1},Index={2},Unit={3},UnitIndex={4}",NodePath(this.Node),this.Destination, this.Index,this.Unit, this.UnitIndex); return string.Format("Node={0},Destination={1},Index={2},Unit={3},UnitIndex={4}", NodePath(this.Node), this.Destination, this.Index, this.Unit, this.UnitIndex);
} }
private string NodePath(TreeNode node) private string NodePath(TreeNode node)
@ -215,7 +215,7 @@ namespace Volian.Controls.Library
} }
#endregion #endregion
#region Factory Methods #region Factory Methods
private vlnTreeItemInfoEventArgs() { ;} private vlnTreeItemInfoEventArgs() {; }
public vlnTreeItemInfoEventArgs(ItemInfo myItemInfo) public vlnTreeItemInfoEventArgs(ItemInfo myItemInfo)
{ {
_MyItemInfo = myItemInfo; _MyItemInfo = myItemInfo;
@ -231,7 +231,7 @@ namespace Volian.Controls.Library
FolderId = folderId; FolderId = folderId;
} }
} }
public enum E_InsertType {Before, After, Child}; public enum E_InsertType { Before, After, Child };
public partial class vlnTreeItemInfoInsertEventArgs public partial class vlnTreeItemInfoInsertEventArgs
{ {
#region Business Methods #region Business Methods
@ -267,7 +267,7 @@ namespace Volian.Controls.Library
} }
#endregion #endregion
#region Factory Methods #region Factory Methods
private vlnTreeItemInfoInsertEventArgs() { ;} private vlnTreeItemInfoInsertEventArgs() {; }
public vlnTreeItemInfoInsertEventArgs(ItemInfo myItemInfo, E_InsertType insertType, string stepText) public vlnTreeItemInfoInsertEventArgs(ItemInfo myItemInfo, E_InsertType insertType, string stepText)
{ {
_MyItemInfo = myItemInfo; _MyItemInfo = myItemInfo;
@ -314,7 +314,7 @@ namespace Volian.Controls.Library
} }
#endregion #endregion
#region Factory Methods #region Factory Methods
private vlnTreeItemInfoPasteEventArgs() { ;} private vlnTreeItemInfoPasteEventArgs() {; }
public vlnTreeItemInfoPasteEventArgs(ItemInfo myItemInfo, int copyStartId, ItemInfo.EAddpingPart pasteType, int? type) public vlnTreeItemInfoPasteEventArgs(ItemInfo myItemInfo, int copyStartId, ItemInfo.EAddpingPart pasteType, int? type)
{ {
_MyItemInfo = myItemInfo; _MyItemInfo = myItemInfo;
@ -364,7 +364,7 @@ namespace Volian.Controls.Library
get { return _SectionConfig; } get { return _SectionConfig; }
set { _ConfigObject = _SectionConfig = value; } set { _ConfigObject = _SectionConfig = value; }
} }
private vlnTreePropertyEventArgs() { ;} private vlnTreePropertyEventArgs() {; }
public vlnTreePropertyEventArgs(string title, FolderConfig folderConfig) public vlnTreePropertyEventArgs(string title, FolderConfig folderConfig)
{ {
_Title = title; _Title = title;
@ -724,7 +724,7 @@ namespace Volian.Controls.Library
{ {
if (!ui.IsAdministrator() && DoSpecificInfo) cm.MenuItems.Add("Procedure Set Specific Information", new EventHandler(mi_Click)); if (!ui.IsAdministrator() && DoSpecificInfo) cm.MenuItems.Add("Procedure Set Specific Information", new EventHandler(mi_Click));
// B2020-111 only allow Set Administrator to add new folders inside folders they admininstrate // B2020-111 only allow Set Administrator to add new folders inside folders they admininstrate
if (ui.IsAdministrator()||ui.IsSetAdministrator(fi.MyParent)) if (ui.IsAdministrator() || ui.IsSetAdministrator(fi.MyParent))
{ {
cm.MenuItems.Add("Insert Folder Before", new EventHandler(mi_Click)); cm.MenuItems.Add("Insert Folder Before", new EventHandler(mi_Click));
cm.MenuItems.Add("Insert Folder After", new EventHandler(mi_Click)); cm.MenuItems.Add("Insert Folder After", new EventHandler(mi_Click));
@ -1081,12 +1081,39 @@ namespace Volian.Controls.Library
// require clearing of all enhanced config data or mapping it to existing data (quite complicated) // require clearing of all enhanced config data or mapping it to existing data (quite complicated)
if ((ui.IsAdministrator() || ui.IsSetAdministrator(i.MyProcedure.MyDocVersion) || ui.IsWriter(i.MyProcedure.MyDocVersion)) && (!i.IsEnhancedStep && !i.IsEnhancedProcedure && !i.IsEnhancedSection && !i.IsRtfRaw && !i.IsFigure)) if ((ui.IsAdministrator() || ui.IsSetAdministrator(i.MyProcedure.MyDocVersion) || ui.IsWriter(i.MyProcedure.MyDocVersion)) && (!i.IsEnhancedStep && !i.IsEnhancedProcedure && !i.IsEnhancedSection && !i.IsRtfRaw && !i.IsFigure))
cm.MenuItems.Add("Copy", new EventHandler(mi_Click)); cm.MenuItems.Add("Copy", new EventHandler(mi_Click));
//if (i.HasWordContent)
//{
// cm.MenuItems.Add("Print Section", new EventHandler(mi_Click));
// cm.MenuItems.Add("Quick Print Section", new EventHandler(mi_Click));
//}
if (i.HasWordContent) if (i.HasWordContent)
{
if (i.MyDocVersion.MultiUnitCount > 1)
{
if (!i.IsSubsection)
{
MenuItem mps = new MenuItem("Print Section");
MenuItem mqps = new MenuItem("Quick Print Section");
int k = 0;
foreach (string s in i.MyDocVersion.UnitNames)
{
k++;
MenuItem mp = mps.MenuItems.Add(s, new EventHandler(miMultiUnit_Click));
mp.Tag = k;
MenuItem mqp = mqps.MenuItems.Add(s, new EventHandler(miMultiUnit_Click));
mqp.Tag = k;
}
cm.MenuItems.Add(mps);
cm.MenuItems.Add(mqps);
}
}
else
{ {
cm.MenuItems.Add("Print Section", new EventHandler(mi_Click)); cm.MenuItems.Add("Print Section", new EventHandler(mi_Click));
cm.MenuItems.Add("Quick Print Section", new EventHandler(mi_Click)); cm.MenuItems.Add("Quick Print Section", new EventHandler(mi_Click));
} }
} }
}
#endregion #endregion
//_MyLog.WarnFormat("Context Menu 4 - {0}", GC.GetTotalMemory(true)); //_MyLog.WarnFormat("Context Menu 4 - {0}", GC.GetTotalMemory(true));
@ -1098,7 +1125,7 @@ namespace Volian.Controls.Library
ok = true; ok = true;
else if (tn.VEObject is ItemInfo && (ui.IsAdministrator() || ui.IsSetAdministrator((tn.VEObject as ItemInfo).MyProcedure.MyDocVersion) || ui.IsWriter((tn.VEObject as ItemInfo).MyProcedure.MyDocVersion))) else if (tn.VEObject is ItemInfo && (ui.IsAdministrator() || ui.IsSetAdministrator((tn.VEObject as ItemInfo).MyProcedure.MyDocVersion) || ui.IsWriter((tn.VEObject as ItemInfo).MyProcedure.MyDocVersion)))
ok = true; ok = true;
if(ok) if (ok)
Menu_Paste(tn, cm); Menu_Paste(tn, cm);
#endregion #endregion
//_MyLog.WarnFormat("Context Menu 5 - {0}", GC.GetTotalMemory(true)); //_MyLog.WarnFormat("Context Menu 5 - {0}", GC.GetTotalMemory(true));
@ -1196,7 +1223,7 @@ namespace Volian.Controls.Library
// Add Properties to the menu unless at the very 'top' node or on a grouping (partinfo) // 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. // node (RNOs, Steps, Cautions, Notes) or at the step level.
// B2020-105 Allow Set Administrators to rename folder's (sets of procedures) to which they have been given access. // B2020-105 Allow Set Administrators to rename folder's (sets of procedures) to which they have been given access.
if ( tn.VEObject is FolderInfo) ok = (ui.IsAdministrator() || ui.IsSetAdministrator(tn.VEObject as FolderInfo)); if (tn.VEObject is FolderInfo) ok = (ui.IsAdministrator() || ui.IsSetAdministrator(tn.VEObject as FolderInfo));
else ok = (tn.VEObject is DocVersionInfo) ? (ui.IsAdministrator() || ui.IsSetAdministrator(tn.VEObject as DocVersionInfo)) else ok = (tn.VEObject is DocVersionInfo) ? (ui.IsAdministrator() || ui.IsSetAdministrator(tn.VEObject as DocVersionInfo))
: (ui.IsAdministrator() || (tn.VEObject is ItemInfo) && (ui.IsSetAdministrator((tn.VEObject as ItemInfo).MyProcedure.MyDocVersion) : (ui.IsAdministrator() || (tn.VEObject is ItemInfo) && (ui.IsSetAdministrator((tn.VEObject as ItemInfo).MyProcedure.MyDocVersion)
|| ui.IsWriter((tn.VEObject as ItemInfo).MyProcedure.MyDocVersion))); || ui.IsWriter((tn.VEObject as ItemInfo).MyProcedure.MyDocVersion)));
@ -1308,7 +1335,7 @@ namespace Volian.Controls.Library
// F2022-024 added Time Critical Action Summary option // F2022-024 added Time Critical Action Summary option
foreach (MenuItem itm in cm.MenuItems) foreach (MenuItem itm in cm.MenuItems)
{ {
if(itm.Text == "Procedure Specific Information" || itm.Text == "New Section" || itm.Text == "Approve" || itm.Text == "Open" || 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.Text == "Copy" || itm.Text == "Delete" || itm.Text == "Properties..." || itm.Text == "Replace Existing Procedure" ||
itm.Text.StartsWith("Showing Change Bars Starting") || itm.Text == "Create Continuous Action Summary" || itm.Text.StartsWith("Showing Change Bars Starting") || itm.Text == "Create Continuous Action Summary" ||
itm.Text == "Create Time Critical Action Summary" || itm.Text == "Export Procedure") itm.Text == "Create Time Critical Action Summary" || itm.Text == "Export Procedure")
@ -1319,7 +1346,7 @@ namespace Volian.Controls.Library
{ {
foreach (MenuItem itm in cm.MenuItems) foreach (MenuItem itm in cm.MenuItems)
{ {
if(!itm.Text.StartsWith("Document Checked Out")) if (!itm.Text.StartsWith("Document Checked Out"))
itm.Enabled = false; itm.Enabled = false;
} }
} }
@ -1477,7 +1504,7 @@ namespace Volian.Controls.Library
RevisionConfig rc = ri.MyConfig as RevisionConfig; RevisionConfig rc = ri.MyConfig as RevisionConfig;
// bug fix: B2016-183 - add the child's name (ex Unit 1) to the export file name for Parent/Child procedures. // bug fix: B2016-183 - add the child's name (ex Unit 1) to the export file name for Parent/Child procedures.
int applIdx = rc.Applicability_Index; int applIdx = rc.Applicability_Index;
string str = (applIdx > 0)?_currentPri.MyDocVersion.UnitNames[applIdx-1] +"_":""; // if parent/child get the defined child name to inlcude the export filename string str = (applIdx > 0) ? _currentPri.MyDocVersion.UnitNames[applIdx - 1] + "_" : ""; // if parent/child get the defined child name to inlcude the export filename
System.Xml.XmlDocument xd = new System.Xml.XmlDocument(); System.Xml.XmlDocument xd = new System.Xml.XmlDocument();
xd.LoadXml(ri.LatestVersion.ApprovedXML); xd.LoadXml(ri.LatestVersion.ApprovedXML);
string PEIPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\VEPROMS\PEI_" + Database.VEPROMS_SqlConnection.Database; string PEIPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\VEPROMS\PEI_" + Database.VEPROMS_SqlConnection.Database;
@ -1525,12 +1552,12 @@ namespace Volian.Controls.Library
{ {
MenuItem mip = mi.Parent as MenuItem; MenuItem mip = mi.Parent as MenuItem;
//B2021-086 Added the check for the last revision stage is an Approved stage //B2021-086 Added the check for the last revision stage is an Approved stage
if ((ri.RevisionID < int.Parse(mip.Parent.Tag.ToString())) && ri.LatestVersion.MyStage.IsApproved!=0) if ((ri.RevisionID < int.Parse(mip.Parent.Tag.ToString())) && ri.LatestVersion.MyStage.IsApproved != 0)
superceded = true; superceded = true;
} }
vlnTreeViewPdfArgs args = new vlnTreeViewPdfArgs(Volian.Base.Library.TmpFile.CreateFileName(ProcedureInfo.Get(ri.ItemID).PDFNumber), ri.LatestVersion.PDF, superceded ? "Superceded" : ""); vlnTreeViewPdfArgs args = new vlnTreeViewPdfArgs(Volian.Base.Library.TmpFile.CreateFileName(ProcedureInfo.Get(ri.ItemID).PDFNumber), ri.LatestVersion.PDF, superceded ? "Superceded" : "");
OnViewPDF(sender, args); OnViewPDF(sender, args);
// System.Diagnostics.Process pp = System.Diagnostics.Process.Start(GetDocPdf(ri, superceded)); // System.Diagnostics.Process pp = System.Diagnostics.Process.Start(GetDocPdf(ri, superceded));
} }
void MultiUnitApprovedRevision_Click(object sender, EventArgs e) void MultiUnitApprovedRevision_Click(object sender, EventArgs e)
{ {
@ -1892,7 +1919,7 @@ namespace Volian.Controls.Library
OnQPrintSection(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0, mi.Text, (int)mi.Tag)); OnQPrintSection(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0, mi.Text, (int)mi.Tag));
break; break;
case "Print All Procedures for": case "Print All Procedures for":
OnPrintAllProcedures(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0,mi.Text,(int)mi.Tag)); OnPrintAllProcedures(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0, mi.Text, (int)mi.Tag));
break; break;
case "Approve": case "Approve":
OnApproveProcedure(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0, mi.Text, (int)mi.Tag)); OnApproveProcedure(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0, mi.Text, (int)mi.Tag));
@ -1904,10 +1931,10 @@ namespace Volian.Controls.Library
OnApproveSomeProcedures(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0, mi.Text, (int)mi.Tag)); OnApproveSomeProcedures(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0, mi.Text, (int)mi.Tag));
break; break;
case "Create Continuous Action Summary": case "Create Continuous Action Summary":
OnCreateContinuousActionSummary(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null,0,mi.Text,(int)mi.Tag)); OnCreateContinuousActionSummary(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0, mi.Text, (int)mi.Tag));
break; break;
case "Create Time Critical Action Summary": case "Create Time Critical Action Summary":
OnCreateTimeCriticalActionSummary(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null,0,mi.Text,(int)mi.Tag)); OnCreateTimeCriticalActionSummary(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0, mi.Text, (int)mi.Tag));
break; break;
default: default:
if (mip.Text.StartsWith("Showing Change Bars Starting")) if (mip.Text.StartsWith("Showing Change Bars Starting"))
@ -2197,11 +2224,11 @@ namespace Volian.Controls.Library
UpdateROValues(SelectedNode as VETreeNode); UpdateROValues(SelectedNode as VETreeNode);
break; break;
case "Create Continuous Action Summary": case "Create Continuous Action Summary":
OnCreateContinuousActionSummary(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null,0)); OnCreateContinuousActionSummary(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0));
break; break;
// F2022-024 Time Critical Action Summary // F2022-024 Time Critical Action Summary
case "Create Time Critical Action Summary": case "Create Time Critical Action Summary":
OnCreateTimeCriticalActionSummary(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null,0)); OnCreateTimeCriticalActionSummary(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0));
break; break;
// B2017-243 added the following two Cannot Paste items when dealing with enhanced documents // B2017-243 added the following two Cannot Paste items when dealing with enhanced documents
// when then user selects these menu items a message box will appear giving more information as to why it cannot be pasted // when then user selects these menu items a message box will appear giving more information as to why it cannot be pasted
@ -2334,7 +2361,7 @@ namespace Volian.Controls.Library
swROUpdate.Write(string.Format("Fixed Referenced Object for {1}({4}){0}Old Text: {2}{0}New Text: {3}{0}{0}", Environment.NewLine, (sender as ItemInfo).ShortPath, args.OldValue, args.NewValue, (sender as ItemInfo).ItemID)); swROUpdate.Write(string.Format("Fixed Referenced Object for {1}({4}){0}Old Text: {2}{0}New Text: {3}{0}{0}", Environment.NewLine, (sender as ItemInfo).ShortPath, args.OldValue, args.NewValue, (sender as ItemInfo).ItemID));
} }
private ProgressBarItem _ProgressBar=null; private ProgressBarItem _ProgressBar = null;
public ProgressBarItem ProgressBar public ProgressBarItem ProgressBar
{ {
get { return _ProgressBar; } get { return _ProgressBar; }
@ -2512,7 +2539,7 @@ namespace Volian.Controls.Library
// assume that item to paste is a procedure, otherwise the menuing would not have // assume that item to paste is a procedure, otherwise the menuing would not have
// included the paste options // included the paste options
tn = (VETreeNode) tn.Nodes[tn.Nodes.Count - 1]; tn = (VETreeNode)tn.Nodes[tn.Nodes.Count - 1];
p = "After"; p = "After";
} }
else // this is an empty docversion: else // this is an empty docversion:
@ -2649,8 +2676,8 @@ namespace Volian.Controls.Library
} }
private ItemInfo PasteReplace(VETreeNode tn, int copyStartID) private ItemInfo PasteReplace(VETreeNode tn, int copyStartID)
{ {
VETreeNode prevtn = (VETreeNode) tn.PrevNode; VETreeNode prevtn = (VETreeNode)tn.PrevNode;
VETreeNode partn = (VETreeNode) tn.Parent; VETreeNode partn = (VETreeNode)tn.Parent;
ItemInfo ii = tn.VEObject as ItemInfo; ItemInfo ii = tn.VEObject as ItemInfo;
// F2021-009 display a message if pasting step will results in more sub-step levels than are defined in the format // F2021-009 display a message if pasting step will results in more sub-step levels than are defined in the format
ItemInfo.PasteStepIsWithinDefinedSubStepLevels(copyStartID, ii, true); ItemInfo.PasteStepIsWithinDefinedSubStepLevels(copyStartID, ii, true);
@ -2701,7 +2728,7 @@ namespace Volian.Controls.Library
private void SetupNodeProperties() private void SetupNodeProperties()
{ {
VETreeNode tn = SelectedNode as VETreeNode; VETreeNode tn = SelectedNode as VETreeNode;
if (tn==null)return; if (tn == null) return;
if ((tn.VEObject as FolderInfo) != null) if ((tn.VEObject as FolderInfo) != null)
OpenProperties(tn.VEObject as FolderInfo); OpenProperties(tn.VEObject as FolderInfo);
@ -2713,7 +2740,7 @@ namespace Volian.Controls.Library
if (dvi != null && dvi.DocVersionAssociations != null && dvi.DocVersionAssociations.Count > 0) rofstid = dvi.DocVersionAssociations[0].MyROFst.ROFstID; if (dvi != null && dvi.DocVersionAssociations != null && dvi.DocVersionAssociations.Count > 0) rofstid = dvi.DocVersionAssociations[0].MyROFst.ROFstID;
OpenProperties(tn.VEObject as DocVersionInfo); OpenProperties(tn.VEObject as DocVersionInfo);
if (dvi != null && dvi.DocVersionAssociations != null && dvi.DocVersionAssociations.Count > 0 && rofstid != dvi.DocVersionAssociations[0].MyROFst.ROFstID) if (dvi != null && dvi.DocVersionAssociations != null && dvi.DocVersionAssociations.Count > 0 && rofstid != dvi.DocVersionAssociations[0].MyROFst.ROFstID)
OnTabDisplay(this,new StepPanelTabDisplayEventArgs("DisplayROUpdateROFST")); OnTabDisplay(this, new StepPanelTabDisplayEventArgs("DisplayROUpdateROFST"));
} }
else if ((tn.VEObject as ProcedureInfo) != null) else if ((tn.VEObject as ProcedureInfo) != null)
OpenProperties(tn.VEObject as ProcedureInfo); OpenProperties(tn.VEObject as ProcedureInfo);
@ -2847,7 +2874,7 @@ namespace Volian.Controls.Library
} }
if (f1 != -1) Folder.Delete(f1); if (f1 != -1) Folder.Delete(f1);
} }
else if (newtype == MenuSelections.FolderAfter||newtype == MenuSelections.FolderBefore) else if (newtype == MenuSelections.FolderAfter || newtype == MenuSelections.FolderBefore)
{ {
int f2 = -1; int f2 = -1;
string uniquename = _LastFolderInfo.MyParent.UniqueChildName("New Folder"); string uniquename = _LastFolderInfo.MyParent.UniqueChildName("New Folder");
@ -2856,7 +2883,8 @@ namespace Volian.Controls.Library
//since before/after folder is at same level as current folder //since before/after folder is at same level as current folder
//so need to use the parents order to determine where to place it //so need to use the parents order to determine where to place it
using (FolderInfo parfolderinfo = FolderInfo.Get(parentfolder.MyParent.FolderID)) using (FolderInfo parfolderinfo = FolderInfo.Get(parentfolder.MyParent.FolderID))
{ double? myorder = parfolderinfo.NewManualOrder(myindex); {
double? myorder = parfolderinfo.NewManualOrder(myindex);
using (Folder folder = Folder.MakeFolder(parentfolder.MyParent, parentfolder.MyConnection, uniquename, string.Empty, "Short Name", null, myorder, string.Empty, DateTime.Now, VlnSettings.UserID)) using (Folder folder = Folder.MakeFolder(parentfolder.MyParent, parentfolder.MyConnection, uniquename, string.Empty, "Short Name", null, myorder, string.Empty, DateTime.Now, VlnSettings.UserID))
{ {
ShowBrokenRules(folder.BrokenRulesCollection); ShowBrokenRules(folder.BrokenRulesCollection);
@ -2881,7 +2909,7 @@ namespace Volian.Controls.Library
else if (newtype == MenuSelections.Procedure) else if (newtype == MenuSelections.Procedure)
{ {
int p1 = -1; int p1 = -1;
using (Procedure procedure = Procedure.MakeProcedure(_LastDocVersionInfo, _LastDocVersionInfo.Procedures.Count!=0?_LastDocVersionInfo.Procedures[_LastDocVersionInfo.Procedures.Count-1]:null, null, "New Procedure", 0)) using (Procedure procedure = Procedure.MakeProcedure(_LastDocVersionInfo, _LastDocVersionInfo.Procedures.Count != 0 ? _LastDocVersionInfo.Procedures[_LastDocVersionInfo.Procedures.Count - 1] : null, null, "New Procedure", 0))
{ {
ShowBrokenRules(procedure.BrokenRulesCollection); ShowBrokenRules(procedure.BrokenRulesCollection);
SetLastValues(ProcedureInfo.Get(procedure.ItemID)); SetLastValues(ProcedureInfo.Get(procedure.ItemID));
@ -2977,7 +3005,7 @@ namespace Volian.Controls.Library
"If you would like to view or copy these hidden steps you will need to go\n" + "If you would like to view or copy these hidden steps you will need to go\n" +
"into the properties of this section and check the Editable Data checkbox.\n" + "into the properties of this section and check the Editable Data checkbox.\n" +
"You will then be able to view and copy those steps. When finished, open\n" + "You will then be able to view and copy those steps. When finished, open\n" +
"the properties page again and uncheck the Editable Data checkbox.\n\n"+ "the properties page again and uncheck the Editable Data checkbox.\n\n" +
"Do you want to continue creating the subsection?"; "Do you want to continue creating the subsection?";
if (FlexibleMessageBox.Show(this, msgstr, "Subsection Insert", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) if (FlexibleMessageBox.Show(this, msgstr, "Subsection Insert", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
{ {
@ -2989,7 +3017,7 @@ namespace Volian.Controls.Library
if (!hasMetaSubs) doPseudo = true; if (!hasMetaSubs) doPseudo = true;
} }
} }
using(Section section = CreateNewSection()) using (Section section = CreateNewSection())
{ {
ShowBrokenRules(section.BrokenRulesCollection); ShowBrokenRules(section.BrokenRulesCollection);
SectionInfo savLastSectionInfo = _LastSectionInfo; SectionInfo savLastSectionInfo = _LastSectionInfo;
@ -3013,7 +3041,7 @@ namespace Volian.Controls.Library
// may have to add a 'steps' node if a step(s) already exist... // may have to add a 'steps' node if a step(s) already exist...
ItemInfo ii = (SelectedNode as VETreeNode).VEObject as ItemInfo; ItemInfo ii = (SelectedNode as VETreeNode).VEObject as ItemInfo;
int cpindx = 0; int cpindx = 0;
if (SelectedNode.Nodes.Count>0) if (SelectedNode.Nodes.Count > 0)
{ {
VETreeNode vtn = SelectedNode.Nodes[0] as VETreeNode; VETreeNode vtn = SelectedNode.Nodes[0] as VETreeNode;
// B2017-014: removed code that was adding a 2nd section part node. and also select node to // B2017-014: removed code that was adding a 2nd section part node. and also select node to
@ -3057,8 +3085,8 @@ namespace Volian.Controls.Library
if (OnNodeOpenProperty(this, new vlnTreePropertyEventArgs("New Section", section.SectionConfig)) == DialogResult.OK) if (OnNodeOpenProperty(this, new vlnTreePropertyEventArgs("New Section", section.SectionConfig)) == DialogResult.OK)
{ {
int indx = tvindex + ((newtype == MenuSelections.SectionBefore) ? 0 : 1); int indx = tvindex + ((newtype == MenuSelections.SectionBefore) ? 0 : 1);
int itemido = (indx >= par.Nodes.Count)?-1:(((par.Nodes[indx] as VETreeNode).VEObject) as ItemInfo).ItemID; int itemido = (indx >= par.Nodes.Count) ? -1 : (((par.Nodes[indx] as VETreeNode).VEObject) as ItemInfo).ItemID;
if (indx >= par.Nodes.Count || (par.Nodes[indx] as VETreeNode).VEObject.ToString() != _LastSectionInfo.ToString() || itemido !=section.ItemID) if (indx >= par.Nodes.Count || (par.Nodes[indx] as VETreeNode).VEObject.ToString() != _LastSectionInfo.ToString() || itemido != section.ItemID)
{ {
tn = new VETreeNode(_LastSectionInfo); tn = new VETreeNode(_LastSectionInfo);
par.Nodes.Insert(indx, tn); par.Nodes.Insert(indx, tn);
@ -3340,7 +3368,7 @@ namespace Volian.Controls.Library
// see if enhanced related steps need created: // see if enhanced related steps need created:
SectionConfig scfgE = _LastItemInfo.ActiveSection.MyConfig as SectionConfig; // C2018-003 fixed use of getting the active section SectionConfig scfgE = _LastItemInfo.ActiveSection.MyConfig as SectionConfig; // C2018-003 fixed use of getting the active section
if (scfgE != null && scfgE.Section_LnkEnh=="Y") if (scfgE != null && scfgE.Section_LnkEnh == "Y")
{ {
// set up which item to insert from based on whether editor was open (see comment from 11/17 above). // set up which item to insert from based on whether editor was open (see comment from 11/17 above).
EnhancedDocuments enhdocs = null; EnhancedDocuments enhdocs = null;
@ -3623,7 +3651,7 @@ namespace Volian.Controls.Library
// just clear enhanced links back // just clear enhanced links back
_LastSectionInfo.ClearEnhancedSectionLink(); _LastSectionInfo.ClearEnhancedSectionLink();
} }
OnSectionShouldClose(this, new vlnTreeSectionInfoEventArgs(_LastSectionInfo,true)); OnSectionShouldClose(this, new vlnTreeSectionInfoEventArgs(_LastSectionInfo, true));
// always return false because an event gets fired to delete tree nodes. // always return false because an event gets fired to delete tree nodes.
if (!DeleteItemInfoAndChildren(_LastSectionInfo)) if (!DeleteItemInfoAndChildren(_LastSectionInfo))
{ {
@ -3724,11 +3752,11 @@ namespace Volian.Controls.Library
// do delete using RTBItem - this manages windowing from the step editor. // do delete using RTBItem - this manages windowing from the step editor.
// If the procedure is open & you're deleting procedure, you want to close open // If the procedure is open & you're deleting procedure, you want to close open
// window - this is done in DisplayTabControl-DeleteStepTabItem. // window - this is done in DisplayTabControl-DeleteStepTabItem.
OnProcessing(true,"Deleting"); OnProcessing(true, "Deleting");
if (!OnDeleteItemInfo(this, new vlnTreeItemInfoEventArgs(ii))) if (!OnDeleteItemInfo(this, new vlnTreeItemInfoEventArgs(ii)))
Item.DeleteItemAndChildren(ii); Item.DeleteItemAndChildren(ii);
OnProcessing(false,"Deleted"); OnProcessing(false, "Deleted");
OnProcessingComplete(dtStart,"Deleted"); OnProcessingComplete(dtStart, "Deleted");
if (deletedSection) if (deletedSection)
{ {
// B2020-087 if we deleted the last sub section, then clear the SubSection_Edit in the parent's config // B2020-087 if we deleted the last sub section, then clear the SubSection_Edit in the parent's config
@ -3747,8 +3775,8 @@ namespace Volian.Controls.Library
} }
catch (System.Data.SqlClient.SqlException ex) catch (System.Data.SqlClient.SqlException ex)
{ {
OnProcessing(false,"Delete Failed"); OnProcessing(false, "Delete Failed");
OnProcessingComplete(dtStart,"Delete Failed"); OnProcessingComplete(dtStart, "Delete Failed");
// C2020-033: Support delete to bring up Search/Incoming Transitions panel // C2020-033: Support delete to bring up Search/Incoming Transitions panel
if (ex.Message.Contains("has External Transitions")) if (ex.Message.Contains("has External Transitions"))
{ {
@ -3768,13 +3796,13 @@ namespace Volian.Controls.Library
private void OnProcessingComplete(DateTime dtStart, string message) private void OnProcessingComplete(DateTime dtStart, string message)
{ {
if (ProcessingComplete != null) if (ProcessingComplete != null)
ProcessingComplete(this, new vlnTreeTimeEventArgs(dtStart,message)); ProcessingComplete(this, new vlnTreeTimeEventArgs(dtStart, message));
} }
public event vlnTreeViewStatusEvent Processing; public event vlnTreeViewStatusEvent Processing;
private void OnProcessing(bool status, string message) private void OnProcessing(bool status, string message)
{ {
if (Processing != null) if (Processing != null)
Processing(this, new vlnTreeStatusEventArgs(status,message)); Processing(this, new vlnTreeStatusEventArgs(status, message));
} }
#endregion #endregion
#region SetLastValuesAndSaveIfChangedStuff #region SetLastValuesAndSaveIfChangedStuff
@ -3865,7 +3893,7 @@ namespace Volian.Controls.Library
} }
catch (Exception ex) catch (Exception ex)
{ {
if(_MyLog.IsErrorEnabled)_MyLog.Error("tv_ItemDrag", ex); if (_MyLog.IsErrorEnabled) _MyLog.Error("tv_ItemDrag", ex);
} }
} }
#endregion #endregion
@ -4045,12 +4073,12 @@ namespace Volian.Controls.Library
//if (e.Effect == DragDropEffects.None) return; //if (e.Effect == DragDropEffects.None) return;
if (_dropNode != null) if (_dropNode != null)
{ {
// if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("ShowLocation1 {0} {1}", e.Effect.ToString(), DateTime.Now.Millisecond); // if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("ShowLocation1 {0} {1}", e.Effect.ToString(), DateTime.Now.Millisecond);
DragHelper.ImageList_DragShowNolock(false); DragHelper.ImageList_DragShowNolock(false);
TreeView tv = _dropNode.TreeView; TreeView tv = _dropNode.TreeView;
TreeNode tmp = tv.GetNodeAt(tv.PointToClient(new Point(e.X, e.Y))); TreeNode tmp = tv.GetNodeAt(tv.PointToClient(new Point(e.X, e.Y)));
// if (!ScrollOnly) // if (!ScrollOnly)
// { // {
if (ScrollTreeView(tmp) || !ScrollOnly) if (ScrollTreeView(tmp) || !ScrollOnly)
{ {
//if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("ShowLocation2 {0} {1}", e.Effect.ToString(), DateTime.Now.Millisecond); //if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("ShowLocation2 {0} {1}", e.Effect.ToString(), DateTime.Now.Millisecond);
@ -4060,11 +4088,11 @@ namespace Volian.Controls.Library
//tv.SelectedNode = dropNode; //tv.SelectedNode = dropNode;
Graphics g = tv.CreateGraphics(); Graphics g = tv.CreateGraphics();
TreeNodeTriangle(g); TreeNodeTriangle(g);
if (_position != DropPosition.Child)InsertPointer(tmp, g); if (_position != DropPosition.Child) InsertPointer(tmp, g);
} }
} }
// } // }
// else ScrollTreeView(tmp); // else ScrollTreeView(tmp);
DragHelper.ImageList_DragShowNolock(true); DragHelper.ImageList_DragShowNolock(true);
} }
} }
@ -4152,7 +4180,7 @@ namespace Volian.Controls.Library
} }
catch (Exception ex) catch (Exception ex)
{ {
if(_MyLog.IsErrorEnabled)_MyLog.Error("tv_DragOver", ex); if (_MyLog.IsErrorEnabled) _MyLog.Error("tv_DragOver", ex);
} }
} }
@ -4206,7 +4234,7 @@ namespace Volian.Controls.Library
} }
catch (Exception ex) catch (Exception ex)
{ {
if(_MyLog.IsErrorEnabled)_MyLog.Error("GetTreeNodeFromData", ex); if (_MyLog.IsErrorEnabled) _MyLog.Error("GetTreeNodeFromData", ex);
} }
} }
return null; return null;
@ -4232,7 +4260,7 @@ namespace Volian.Controls.Library
this.SelectedNode = dragNode; this.SelectedNode = dragNode;
FolderInfo fdragi = ((VETreeNode)dragNode).VEObject as FolderInfo; FolderInfo fdragi = ((VETreeNode)dragNode).VEObject as FolderInfo;
FolderInfo fdropi = ((VETreeNode)_LastDropLocation.DropNode).VEObject as FolderInfo; FolderInfo fdropi = ((VETreeNode)_LastDropLocation.DropNode).VEObject as FolderInfo;
if (fdragi != null && fdropi != null && fdropi.FolderDocVersionCount==0) if (fdragi != null && fdropi != null && fdropi.FolderDocVersionCount == 0)
{ {
using (Folder fdrag = fdragi.Get()) using (Folder fdrag = fdragi.Get())
{ {
@ -4316,36 +4344,36 @@ namespace Volian.Controls.Library
} }
catch (Exception ex) catch (Exception ex)
{ {
if(_MyLog.IsErrorEnabled)_MyLog.Error("tv_DragDrop", ex); if (_MyLog.IsErrorEnabled) _MyLog.Error("tv_DragDrop", ex);
} }
} }
// private void DumpMembers(object o) // private void DumpMembers(object o)
// { // {
// Type t = o.GetType(); // Type t = o.GetType();
// //if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("\r\n\r\nMembers for type {0}", t.ToString()); // //if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("\r\n\r\nMembers for type {0}", t.ToString());
// MemberInfo[] mis = t.GetMembers(); // MemberInfo[] mis = t.GetMembers();
// int i = 0; // int i = 0;
// foreach (MemberInfo mi in mis) // foreach (MemberInfo mi in mis)
// { // {
// i++; // i++;
// try // try
// { // {
// //if(mi.MemberType != MemberTypes.Method) // //if(mi.MemberType != MemberTypes.Method)
// //if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("{0} {1} {2}", i, mi.Name, mi.MemberType); // //if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("{0} {1} {2}", i, mi.Name, mi.MemberType);
//// if (fi.Name == "TreeView") //// if (fi.Name == "TreeView")
//// fi.SetValue(o, null); //// fi.SetValue(o, null);
// } // }
// catch (Exception ex) // catch (Exception ex)
// { // {
// if(_MyLog.IsErrorEnabled)_MyLog.Error("DumpMembers", ex); // if(_MyLog.IsErrorEnabled)_MyLog.Error("DumpMembers", ex);
// } // }
// } // }
// } // }
private TreeNode Clone(TreeNode tn) private TreeNode Clone(TreeNode tn)
{ {
TreeNode tmp = (TreeNode)tn.Clone(); TreeNode tmp = (TreeNode)tn.Clone();
ExpandMatch(tmp,tn); ExpandMatch(tmp, tn);
return tmp; return tmp;
} }
private void tv_DragDropOld(object sender, System.Windows.Forms.DragEventArgs e) private void tv_DragDropOld(object sender, System.Windows.Forms.DragEventArgs e)