C2026-043-Tech-Debt_v1 - Stash 1

This commit is contained in:
2026-07-21 06:49:28 -04:00
parent 0fed1acfd8
commit 9486b37300
70 changed files with 4222 additions and 10191 deletions
+59 -142
View File
@@ -1,9 +1,5 @@
using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Drawing;
using VEPROMS.CSLA.Library;
using JR.Utils.GUI.Forms;
@@ -12,29 +8,21 @@ namespace Volian.Controls.Library
public partial class DisplayTabItem : DevComponents.DotNetBar.DockContainerItem
{
#region Private Fields
private DisplayTabControl _MyDisplayTabControl;
private ItemInfo _MyItemInfo;
private StepTabPanel _MyStepTabPanel;
private string _MyKey;
private DSOTabPanel _MyDSOTabPanel;
private DocumentInfo _MyDocumentInfo;
private readonly DisplayTabControl _MyDisplayTabControl;
private readonly ItemInfo _MyItemInfo;
private readonly string _MyKey;
private readonly DocumentInfo _MyDocumentInfo;
#endregion
#region Properties
/// <summary>
/// ItemInfo associated with this DisplayTabItem
/// </summary>
private int _OwnerID;
public int OwnerID
{
get { return _OwnerID; }
set { _OwnerID = value; }
}
public ItemInfo MyItemInfo
#endregion
#region Properties
/// <summary>
/// ItemInfo associated with this DisplayTabItem
/// </summary>
public int OwnerID { get; set; }
public ItemInfo MyItemInfo
{
get { return _MyItemInfo; }
//set { _MyItemInfo = value; }
}
/// <summary>
/// get Key Either:
@@ -45,48 +33,29 @@ namespace Volian.Controls.Library
{
get { return _MyKey; }
}
/// <summary>
/// Related StepTabPanel for a Step page
/// </summary>
public StepTabPanel MyStepTabPanel
{
get { return _MyStepTabPanel; }
set { _MyStepTabPanel = value; }
}
/// <summary>
/// Related DSOTabPanle for a Word page
/// </summary>
public DSOTabPanel MyDSOTabPanel
{
get { return _MyDSOTabPanel; }
set { _MyDSOTabPanel = value; }
}
private string _MyUserRole;
public string MyUserRole
{
get { return _MyUserRole; }
set { _MyUserRole = value; }
}
private bool _Closed = false;
public bool Closed
{
get { return _Closed; }
set { _Closed = value; }
}
/// <summary>
/// Current SelectedItemInfo for this page
/// </summary>
public ItemInfo SelectedItemInfo
/// <summary>
/// Related StepTabPanel for a Step page
/// </summary>
public StepTabPanel MyStepTabPanel { get; set; }
/// <summary>
/// Related DSOTabPanle for a Word page
/// </summary>
public DSOTabPanel MyDSOTabPanel { get; set; }
public string MyUserRole { get; set; }
/// <summary>
/// Current SelectedItemInfo for this page
/// </summary>
public ItemInfo SelectedItemInfo
{
get
{
if (_MyStepTabPanel == null) return null;
return _MyStepTabPanel.SelectedItemInfo;
if (MyStepTabPanel == null) return null;
return MyStepTabPanel.SelectedItemInfo;
}
set
{// B2018-074 Don't crash if opening MSWord section from Tools window in Debug Mode
if (_MyStepTabPanel != null)
_MyStepTabPanel.SelectedItemInfo = value;
if (MyStepTabPanel != null)
MyStepTabPanel.SelectedItemInfo = value;
}
}
/// <summary>
@@ -121,14 +90,6 @@ namespace Volian.Controls.Library
else
SetupDSOTabPanel();
SetupSecurity(myItemInfo);
// B2022-055 assigning the Name caused a duplicate name error
// we found that the procedure tab control remained in the Control list after the procedure was closed
// later on we need to find out why it isn't removed when the procedure is closed
//if (MyDSOTabPanel == null || MyDSOTabPanel.MyEdWord != null) // B2017-219 check needed if we could not open a word attachment
//{
// //Name = string.Format("DisplayTabItem {0}", myItemInfo.ItemID);
//}
}
private bool MesssageShown = false;
public void SetupSecurity(ItemInfo myItem)
@@ -172,43 +133,37 @@ namespace Volian.Controls.Library
FlexibleMessageBox.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();
MyStepTabPanel.MyStepTabRibbon.SetupReviewerMode();
}
else if (ui.IsAdministrator())
{
if (_MyStepTabPanel != null)
_MyStepTabPanel.MyStepTabRibbon.SetupAdminMode();
MyStepTabPanel?.MyStepTabRibbon.SetupAdminMode();
MyUserRole = Volian.Base.Library.VlnSettings.UserID + " - Administrator";
}
else if (ui.IsSetAdministrator(myItem.MyDocVersion))
{
if (_MyStepTabPanel != null)
_MyStepTabPanel.MyStepTabRibbon.SetupSetAdminMode();
MyStepTabPanel?.MyStepTabRibbon.SetupSetAdminMode();
MyUserRole = Volian.Base.Library.VlnSettings.UserID + " - Set Administrator";
}
else if (ui.IsROEditor(myItem.MyDocVersion) && !ui.IsWriter(myItem.MyDocVersion))
{
if (_MyStepTabPanel != null)
_MyStepTabPanel.MyStepTabRibbon.SetupROEditorMode();
MyStepTabPanel?.MyStepTabRibbon.SetupROEditorMode();
MyUserRole = Volian.Base.Library.VlnSettings.UserID + " - RO Editor";
}
else if (ui.IsWriter(myItem.MyDocVersion))
{
if (_MyStepTabPanel != null)
_MyStepTabPanel.MyStepTabRibbon.SetupWriterMode();
MyStepTabPanel?.MyStepTabRibbon.SetupWriterMode();
MyUserRole = Volian.Base.Library.VlnSettings.UserID + " - Writer";
}
else if (ui.IsReviewer(myItem.MyDocVersion))
{
if (_MyStepTabPanel != null)
_MyStepTabPanel.MyStepTabRibbon.SetupReviewerMode();
MyStepTabPanel?.MyStepTabRibbon.SetupReviewerMode();
MyUserRole = Volian.Base.Library.VlnSettings.UserID + " - Reviewer";
}
else
{
if (_MyStepTabPanel != null)
_MyStepTabPanel.MyStepTabRibbon.SetupReviewerMode();
MyStepTabPanel?.MyStepTabRibbon.SetupReviewerMode();
MyUserRole = Volian.Base.Library.VlnSettings.UserID + " - Reviewer";
}
}
@@ -222,42 +177,19 @@ namespace Volian.Controls.Library
InitializeComponent();
this.Click += new EventHandler(DisplayTabItem_Click);
SetupLibraryDocumentDSOTabPanel();
// B2022-055 assigning the Name caused a duplicate name error
// we found that the procedure tab control remained in the Control list after the procedure was closed
// later on we need to find out why it isn't removed when the procedure is closed
//Name = string.Format("DisplayTabLibraryDocument {0}", myDocumentInfo.DocID);
}
protected override void OnDisplayedChanged()
{
//Console.WriteLine("=>=>=>=> OnDisplayedChanged");
if (_MyStepTabPanel != null)
_MyStepTabPanel.MyStepPanel.DisplayItemChanging = true;
if (MyStepTabPanel != null)
MyStepTabPanel.MyStepPanel.DisplayItemChanging = true;
base.OnDisplayedChanged();
if (_MyStepTabPanel != null)
_MyStepTabPanel.MyStepPanel.DisplayItemChanging = false;
if (MyStepTabPanel != null)
MyStepTabPanel.MyStepPanel.DisplayItemChanging = false;
//Console.WriteLine("<=<=<=<= OnDisplayedChanged");
}
//void DisplayTabItem_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
//{
// Console.WriteLine("DisplayTabItem_MouseUp");
//}
//void DisplayTabItem_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
//{
// Console.WriteLine("DisplayTabItem_MouseDown");
//}
//void DisplayTabItem_LostFocus(object sender, EventArgs e)
//{
// Console.WriteLine("DisplayTabItem_LostFocus");
//}
//void DisplayTabItem_GotFocus(object sender, EventArgs e)
//{
// Console.WriteLine("DisplayTabItem_GotFocus");
//}
#endregion
#region Event Handlers
/// <summary>
@@ -267,12 +199,10 @@ namespace Volian.Controls.Library
/// <param name="e"></param>
private void DisplayTabItem_Click(object sender, EventArgs e)
{
// Tell the TabControl that the ItemSelected has changed
DisplayTabItem myTabItem = sender as DisplayTabItem;
if (myTabItem == null) return;
StepTabPanel myTabPanel = myTabItem.MyStepTabPanel as StepTabPanel;
if (myTabPanel == null) return;
if (MyStepTabPanel.SelectedEditItem == null) return;
// Tell the TabControl that the ItemSelected has changed
if (!(sender is DisplayTabItem myTabItem)) return;
if (!(myTabItem.MyStepTabPanel is StepTabPanel)) return;
if (MyStepTabPanel.SelectedEditItem == null) return;
MyStepTabPanel.MyDisplayTabControl.HandleChangeId(MyStepTabPanel.SelectedEditItem.MyItemInfo, myTabItem);
_MyDisplayTabControl.OnItemSelectedChanged(this, new ItemSelectedChangedEventArgs(MyStepTabPanel.SelectedEditItem));
}
@@ -285,33 +215,28 @@ namespace Volian.Controls.Library
{
((System.ComponentModel.ISupportInitialize)(_MyDisplayTabControl.MyBar)).BeginInit();
_MyDisplayTabControl.MyBar.SuspendLayout();
_MyStepTabPanel = new StepTabPanel(_MyDisplayTabControl);
MyStepTabPanel = new StepTabPanel(_MyDisplayTabControl);
//
// tabItem
//
Control = _MyStepTabPanel;
// B2022-055 assigning the Name caused a duplicate name error
// we found that the procedure tab control remained in the Control list after the procedure was closed
// later on we need to find out why it isn't removed when the procedure is closed
//Name = "tabItem Item " + _MyItemInfo.ItemID;
Control = MyStepTabPanel;
Text = _MyItemInfo.TabTitle;
_MyItemInfo.Changed += new ItemInfoEvent(_MyItemInfo_Changed);
Tooltip = _Tooltip = _MyItemInfo.TabToolTip.Replace("\u2011", "-").Replace(@"\u9586?", @"\");
MouseMove += new System.Windows.Forms.MouseEventHandler(DisplayTabItem_MouseMove);
LostFocus += new EventHandler(DisplayTabItem_LostFocus);
//
_MyDisplayTabControl.Controls.Add(_MyStepTabPanel);
_MyDisplayTabControl.Controls.Add(MyStepTabPanel);
_MyDisplayTabControl.MyBar.Items.Add(this);
_MyDisplayTabControl.MyBar.Width = 300; // This triggers the bar to resize itself
//
// tabPanel
//
_MyStepTabPanel.MyDisplayTabItem = this;
MyStepTabPanel.MyDisplayTabItem = this;
((System.ComponentModel.ISupportInitialize)(_MyDisplayTabControl.MyBar)).EndInit();
_MyDisplayTabControl.MyBar.ResumeLayout(false);
DocVersionInfo dvi = _MyItemInfo.MyProcedure.ActiveParent as DocVersionInfo; //MyRTBItem.MyItemInfo.MyProcedure.ActiveParent as DocVersionInfo;
if (dvi == null) return;
if (dvi.VersionType > 127 || viewonlymode)
if (!(_MyItemInfo.MyProcedure.ActiveParent is DocVersionInfo dvi)) return;
if (dvi.VersionType > 127 || viewonlymode)
MyStepTabPanel.MyStepPanel.VwMode = E_ViewMode.View;
// C2021 - 027: Procedure level PC/PC - add _MyIteminfo to argument list
if (dvi.MultiUnitCount > 1)
@@ -345,21 +270,17 @@ namespace Volian.Controls.Library
{
EntryInfo myEntry = _MyItemInfo.MyContent.MyEntry;
UserInfo ui = UserInfo.GetByUserID(OwnerInfo.Get(OwnerID).SessionUserID);
_MyDSOTabPanel = new DSOTabPanel(myEntry.MyDocument, _MyDisplayTabControl, _MyItemInfo, UserInfo.CanEdit(ui, MyItemInfo.MyDocVersion));
if (_MyDSOTabPanel.MyEdWord == null) return; // B2017-219 if we could not open the word attachment just return
MyDSOTabPanel = new DSOTabPanel(myEntry.MyDocument, _MyDisplayTabControl, _MyItemInfo, UserInfo.CanEdit(ui, MyItemInfo.MyDocVersion));
if (MyDSOTabPanel.MyEdWord == null) return; // B2017-219 if we could not open the word attachment just return
//
// tabItem
//
Control = _MyDSOTabPanel;
// B2022-055 assigning the Name caused a duplicate name error
// we found that the procedure tab control remained in the Control list after the procedure was closed
// later on we need to find out why it isn't removed when the procedure is closed
//Name = "tabItem Item " + _MyItemInfo.ItemID;
Control = MyDSOTabPanel;
Text = _MyItemInfo.TabTitle;
Tooltip = _Tooltip = _MyItemInfo.TabToolTip.Replace("\u2011", "-").Replace(@"\u9586?", @"\");
MouseMove += new System.Windows.Forms.MouseEventHandler(DisplayTabItem_MouseMove);
LostFocus += new EventHandler(DisplayTabItem_LostFocus);
_MyDisplayTabControl.Controls.Add(_MyDSOTabPanel);
_MyDisplayTabControl.Controls.Add(MyDSOTabPanel);
DSOTabPanel.IgnoreEnter = true;
//Console.WriteLine("AddRange {0}", Name);
_MyDisplayTabControl.MyBar.Items.AddRange(new DevComponents.DotNetBar.BaseItem[] {
@@ -368,7 +289,7 @@ namespace Volian.Controls.Library
// tabPanel
//
_MyDisplayTabControl.SelectDisplayTabItem(this);
_MyDSOTabPanel.MyDisplayTabItem = this;
MyDSOTabPanel.MyDisplayTabItem = this;
DSOTabPanel.IgnoreEnter = false;
}
private void SetupLibraryDocumentDSOTabPanel()
@@ -377,21 +298,17 @@ namespace Volian.Controls.Library
// B2016-131 if myiteminfo is null, then the lib doc is not referenced.
// - Allow editting only if you are an Administrator
// - Cannot check if you are a Writer or Set Aministrator because we don't have a Doc Verion
_MyDSOTabPanel = new DSOTabPanel(_MyDocumentInfo, _MyDisplayTabControl, _MyItemInfo, (MyItemInfo != null) ? UserInfo.CanEdit(ui, MyItemInfo.MyDocVersion) : ui.IsAdministrator());
MyDSOTabPanel = new DSOTabPanel(_MyDocumentInfo, _MyDisplayTabControl, _MyItemInfo, (MyItemInfo != null) ? UserInfo.CanEdit(ui, MyItemInfo.MyDocVersion) : ui.IsAdministrator());
//
// tabItem
//
Control = _MyDSOTabPanel;
// B2022-055 assigning the Name caused a duplicate name error
// we found that the procedure tab control remained in the Control list after the procedure was closed
// later on we need to find out why it isn't removed when the procedure is closed
//Name = "tabLibraryDocument " + _MyDocumentInfo.DocID;
Control = MyDSOTabPanel;
Text = _MyDocumentInfo.LibTitle;
DocumentConfig dc = new DocumentConfig(_MyDocumentInfo);
Tooltip = _Tooltip = dc.LibDoc_Comment;
MouseMove += new System.Windows.Forms.MouseEventHandler(DisplayTabItem_MouseMove);
LostFocus += new EventHandler(DisplayTabItem_LostFocus);
_MyDisplayTabControl.Controls.Add(_MyDSOTabPanel);
_MyDisplayTabControl.Controls.Add(MyDSOTabPanel);
DSOTabPanel.IgnoreEnter = true;
_MyDisplayTabControl.MyBar.Items.AddRange(new DevComponents.DotNetBar.BaseItem[] {
this});
@@ -399,7 +316,7 @@ namespace Volian.Controls.Library
// tabPanel
//
_MyDisplayTabControl.SelectDisplayTabItem(this);
_MyDSOTabPanel.MyDisplayTabItem = this;
MyDSOTabPanel.MyDisplayTabItem = this;
DSOTabPanel.IgnoreEnter = false;
}
#endregion