B2016-122: from Document Version Properties form: click OK crashes if remove enhanced links done first.

B2016-122: Added a DocVersion.GetFromDB to get data directly from db (not from cache)
Support subsections when setting context menu items for enhanced links
This commit is contained in:
Kathy Ruffing 2016-05-17 11:29:30 +00:00
parent cd523e12a6
commit f4b05839fa
4 changed files with 107 additions and 80 deletions

View File

@ -103,8 +103,6 @@ namespace VEPROMS
this.ppLblDefSettingsInfo = new System.Windows.Forms.Label();
this.dlgROFolder = new System.Windows.Forms.FolderBrowserDialog();
this.tcVersions = new DevComponents.DotNetBar.TabControl();
this.tcpGeneral = new DevComponents.DotNetBar.TabControlPanel();
this.tiGeneral = new DevComponents.DotNetBar.TabItem(this.components);
this.tabControlPanel1 = new DevComponents.DotNetBar.TabControlPanel();
this.btnUnlinkDocVersion = new System.Windows.Forms.Button();
this.btnNewEnh = new System.Windows.Forms.Button();
@ -123,6 +121,8 @@ namespace VEPROMS
this.lbEnhanced = new System.Windows.Forms.ListBox();
this.bsEnhanced = new System.Windows.Forms.BindingSource(this.components);
this.tiEnhanced = new DevComponents.DotNetBar.TabItem(this.components);
this.tcpGeneral = new DevComponents.DotNetBar.TabControlPanel();
this.tiGeneral = new DevComponents.DotNetBar.TabItem(this.components);
this.tcpApplicability = new DevComponents.DotNetBar.TabControlPanel();
this.label28 = new System.Windows.Forms.Label();
this.label27 = new System.Windows.Forms.Label();
@ -199,10 +199,10 @@ namespace VEPROMS
this.ppGpbxUserSpecTxt.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.tcVersions)).BeginInit();
this.tcVersions.SuspendLayout();
this.tcpGeneral.SuspendLayout();
this.tabControlPanel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.bsMiniEnhanced)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.bsEnhanced)).BeginInit();
this.tcpGeneral.SuspendLayout();
this.tcpApplicability.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.bsMiniApple)).BeginInit();
this.panel1.SuspendLayout();
@ -225,7 +225,7 @@ namespace VEPROMS
//
this.ppBtnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.ppBtnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.ppBtnCancel.Location = new System.Drawing.Point(811, 432);
this.ppBtnCancel.Location = new System.Drawing.Point(829, 446);
this.ppBtnCancel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.ppBtnCancel.Name = "ppBtnCancel";
this.ppBtnCancel.Size = new System.Drawing.Size(75, 26);
@ -237,7 +237,7 @@ namespace VEPROMS
// ppBtnOK
//
this.ppBtnOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.ppBtnOK.Location = new System.Drawing.Point(722, 432);
this.ppBtnOK.Location = new System.Drawing.Point(732, 446);
this.ppBtnOK.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.ppBtnOK.Name = "ppBtnOK";
this.ppBtnOK.Size = new System.Drawing.Size(75, 26);
@ -1139,12 +1139,12 @@ namespace VEPROMS
this.tcVersions.Controls.Add(this.tcpOutputSettings);
this.tcVersions.Controls.Add(this.tabControlPanel5);
this.tcVersions.Controls.Add(this.tcpRefereceObjects);
this.tcVersions.Location = new System.Drawing.Point(208, 2);
this.tcVersions.Location = new System.Drawing.Point(217, 10);
this.tcVersions.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.tcVersions.Name = "tcVersions";
this.tcVersions.SelectedTabFont = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold);
this.tcVersions.SelectedTabIndex = 0;
this.tcVersions.Size = new System.Drawing.Size(700, 414);
this.tcVersions.Size = new System.Drawing.Size(685, 414);
this.tcVersions.Style = DevComponents.DotNetBar.eTabStripStyle.Office2007Dock;
this.tcVersions.TabIndex = 28;
this.tcVersions.TabLayoutType = DevComponents.DotNetBar.eTabLayoutType.FixedWithNavigationBox;
@ -1158,44 +1158,6 @@ namespace VEPROMS
this.tcVersions.TabsVisible = false;
this.tcVersions.Text = "tabControl1";
//
// tcpGeneral
//
this.tcpGeneral.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
this.tcpGeneral.Controls.Add(this.ppCmbxProcSetType);
this.tcpGeneral.Controls.Add(this.ppRTxtName);
this.tcpGeneral.Controls.Add(this.label9);
this.tcpGeneral.Controls.Add(this.ppRTxtProcSetRev);
this.tcpGeneral.Controls.Add(this.lblProcSetRev);
this.tcpGeneral.Controls.Add(this.label4);
this.tcpGeneral.Controls.Add(this.label3);
this.tcpGeneral.Controls.Add(this.ppRTxtTitle);
this.tcpGeneral.Controls.Add(this.ppTxtBxUserID);
this.tcpGeneral.Controls.Add(this.ppDTPicker);
this.tcpGeneral.Controls.Add(this.label2);
this.tcpGeneral.Controls.Add(this.label1);
this.tcpGeneral.DisabledBackColor = System.Drawing.Color.Empty;
this.tcpGeneral.Dock = System.Windows.Forms.DockStyle.Fill;
this.tcpGeneral.Location = new System.Drawing.Point(0, 24);
this.tcpGeneral.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.tcpGeneral.Name = "tcpGeneral";
this.tcpGeneral.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.tcpGeneral.Size = new System.Drawing.Size(700, 390);
this.tcpGeneral.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(253)))), ((int)(((byte)(253)))), ((int)(((byte)(254)))));
this.tcpGeneral.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(157)))), ((int)(((byte)(188)))), ((int)(((byte)(227)))));
this.tcpGeneral.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine;
this.tcpGeneral.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(146)))), ((int)(((byte)(165)))), ((int)(((byte)(199)))));
this.tcpGeneral.Style.BorderSide = ((DevComponents.DotNetBar.eBorderSide)(((DevComponents.DotNetBar.eBorderSide.Left | DevComponents.DotNetBar.eBorderSide.Right)
| DevComponents.DotNetBar.eBorderSide.Bottom)));
this.tcpGeneral.Style.GradientAngle = 90;
this.tcpGeneral.TabIndex = 1;
this.tcpGeneral.TabItem = this.tiGeneral;
//
// tiGeneral
//
this.tiGeneral.AttachedControl = this.tcpGeneral;
this.tiGeneral.Name = "tiGeneral";
this.tiGeneral.Text = "General";
//
// tabControlPanel1
//
this.tabControlPanel1.Controls.Add(this.btnUnlinkDocVersion);
@ -1218,7 +1180,7 @@ namespace VEPROMS
this.tabControlPanel1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.tabControlPanel1.Name = "tabControlPanel1";
this.tabControlPanel1.Padding = new System.Windows.Forms.Padding(1);
this.tabControlPanel1.Size = new System.Drawing.Size(700, 390);
this.tabControlPanel1.Size = new System.Drawing.Size(685, 390);
this.tabControlPanel1.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(253)))), ((int)(((byte)(253)))), ((int)(((byte)(254)))));
this.tabControlPanel1.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(157)))), ((int)(((byte)(188)))), ((int)(((byte)(227)))));
this.tabControlPanel1.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine;
@ -1381,6 +1343,44 @@ namespace VEPROMS
this.tiEnhanced.Name = "tiEnhanced";
this.tiEnhanced.Text = "Enhanced";
//
// tcpGeneral
//
this.tcpGeneral.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
this.tcpGeneral.Controls.Add(this.ppCmbxProcSetType);
this.tcpGeneral.Controls.Add(this.ppRTxtName);
this.tcpGeneral.Controls.Add(this.label9);
this.tcpGeneral.Controls.Add(this.ppRTxtProcSetRev);
this.tcpGeneral.Controls.Add(this.lblProcSetRev);
this.tcpGeneral.Controls.Add(this.label4);
this.tcpGeneral.Controls.Add(this.label3);
this.tcpGeneral.Controls.Add(this.ppRTxtTitle);
this.tcpGeneral.Controls.Add(this.ppTxtBxUserID);
this.tcpGeneral.Controls.Add(this.ppDTPicker);
this.tcpGeneral.Controls.Add(this.label2);
this.tcpGeneral.Controls.Add(this.label1);
this.tcpGeneral.DisabledBackColor = System.Drawing.Color.Empty;
this.tcpGeneral.Dock = System.Windows.Forms.DockStyle.Fill;
this.tcpGeneral.Location = new System.Drawing.Point(0, 24);
this.tcpGeneral.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.tcpGeneral.Name = "tcpGeneral";
this.tcpGeneral.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.tcpGeneral.Size = new System.Drawing.Size(685, 390);
this.tcpGeneral.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(253)))), ((int)(((byte)(253)))), ((int)(((byte)(254)))));
this.tcpGeneral.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(157)))), ((int)(((byte)(188)))), ((int)(((byte)(227)))));
this.tcpGeneral.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine;
this.tcpGeneral.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(146)))), ((int)(((byte)(165)))), ((int)(((byte)(199)))));
this.tcpGeneral.Style.BorderSide = ((DevComponents.DotNetBar.eBorderSide)(((DevComponents.DotNetBar.eBorderSide.Left | DevComponents.DotNetBar.eBorderSide.Right)
| DevComponents.DotNetBar.eBorderSide.Bottom)));
this.tcpGeneral.Style.GradientAngle = 90;
this.tcpGeneral.TabIndex = 1;
this.tcpGeneral.TabItem = this.tiGeneral;
//
// tiGeneral
//
this.tiGeneral.AttachedControl = this.tcpGeneral;
this.tiGeneral.Name = "tiGeneral";
this.tiGeneral.Text = "General";
//
// tcpApplicability
//
this.tcpApplicability.Controls.Add(this.label28);
@ -1410,7 +1410,7 @@ namespace VEPROMS
this.tcpApplicability.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.tcpApplicability.Name = "tcpApplicability";
this.tcpApplicability.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.tcpApplicability.Size = new System.Drawing.Size(700, 390);
this.tcpApplicability.Size = new System.Drawing.Size(685, 390);
this.tcpApplicability.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(253)))), ((int)(((byte)(253)))), ((int)(((byte)(254)))));
this.tcpApplicability.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(157)))), ((int)(((byte)(188)))), ((int)(((byte)(227)))));
this.tcpApplicability.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine;
@ -1716,7 +1716,7 @@ namespace VEPROMS
this.tcpFormatSettings.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.tcpFormatSettings.Name = "tcpFormatSettings";
this.tcpFormatSettings.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.tcpFormatSettings.Size = new System.Drawing.Size(700, 390);
this.tcpFormatSettings.Size = new System.Drawing.Size(685, 390);
this.tcpFormatSettings.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(253)))), ((int)(((byte)(253)))), ((int)(((byte)(254)))));
this.tcpFormatSettings.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(157)))), ((int)(((byte)(188)))), ((int)(((byte)(227)))));
this.tcpFormatSettings.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine;
@ -1783,7 +1783,7 @@ namespace VEPROMS
this.tcpOutputSettings.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.tcpOutputSettings.Name = "tcpOutputSettings";
this.tcpOutputSettings.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.tcpOutputSettings.Size = new System.Drawing.Size(700, 390);
this.tcpOutputSettings.Size = new System.Drawing.Size(685, 390);
this.tcpOutputSettings.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(253)))), ((int)(((byte)(253)))), ((int)(((byte)(254)))));
this.tcpOutputSettings.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(157)))), ((int)(((byte)(188)))), ((int)(((byte)(227)))));
this.tcpOutputSettings.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine;
@ -1922,7 +1922,7 @@ namespace VEPROMS
this.tabControlPanel5.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.tabControlPanel5.Name = "tabControlPanel5";
this.tabControlPanel5.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.tabControlPanel5.Size = new System.Drawing.Size(700, 390);
this.tabControlPanel5.Size = new System.Drawing.Size(685, 390);
this.tabControlPanel5.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(253)))), ((int)(((byte)(253)))), ((int)(((byte)(254)))));
this.tabControlPanel5.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(157)))), ((int)(((byte)(188)))), ((int)(((byte)(227)))));
this.tabControlPanel5.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine;
@ -1961,7 +1961,7 @@ namespace VEPROMS
this.ppGrdLibDocList.RowTemplate.Height = 24;
this.ppGrdLibDocList.SelectAllSignVisible = false;
this.ppGrdLibDocList.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.ppGrdLibDocList.Size = new System.Drawing.Size(694, 386);
this.ppGrdLibDocList.Size = new System.Drawing.Size(679, 386);
this.ppGrdLibDocList.TabIndex = 1;
//
// documentEntryCountDataGridViewTextBoxColumn
@ -2006,7 +2006,7 @@ namespace VEPROMS
this.tcpRefereceObjects.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.tcpRefereceObjects.Name = "tcpRefereceObjects";
this.tcpRefereceObjects.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.tcpRefereceObjects.Size = new System.Drawing.Size(700, 390);
this.tcpRefereceObjects.Size = new System.Drawing.Size(685, 390);
this.tcpRefereceObjects.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(253)))), ((int)(((byte)(253)))), ((int)(((byte)(254)))));
this.tcpRefereceObjects.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(157)))), ((int)(((byte)(188)))), ((int)(((byte)(227)))));
this.tcpRefereceObjects.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine;
@ -2227,7 +2227,7 @@ namespace VEPROMS
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.CancelButton = this.ppBtnCancel;
this.CaptionFont = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.ClientSize = new System.Drawing.Size(889, 467);
this.ClientSize = new System.Drawing.Size(924, 483);
this.ControlBox = false;
this.Controls.Add(this.panVerBtns);
this.Controls.Add(this.tcVersions);
@ -2258,12 +2258,12 @@ namespace VEPROMS
this.ppGpbxUserSpecTxt.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.tcVersions)).EndInit();
this.tcVersions.ResumeLayout(false);
this.tcpGeneral.ResumeLayout(false);
this.tcpGeneral.PerformLayout();
this.tabControlPanel1.ResumeLayout(false);
this.tabControlPanel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.bsMiniEnhanced)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.bsEnhanced)).EndInit();
this.tcpGeneral.ResumeLayout(false);
this.tcpGeneral.PerformLayout();
this.tcpApplicability.ResumeLayout(false);
this.tcpApplicability.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.bsMiniApple)).EndInit();

View File

@ -213,6 +213,12 @@ namespace VEPROMS
DialogResult = DialogResult.OK;
_DocVersionConfig.MyDocVersion.Config = _DocVersionConfig.ToString();
_DocVersionConfig.MyDocVersion.Save().Dispose();
if (_EnhNeedToUnlink)
{
this.Cursor = Cursors.WaitCursor;
_DocVersionConfig.MyDocVersion.MyDocVersionInfo.DoUnlinkEnhancedDocVersion();
this.Cursor = Cursors.Default;
}
this.Close();
}
@ -441,7 +447,7 @@ namespace VEPROMS
// the phone list button is only visible if the format has the print/phonelist format flag.
btnPhoneList.Visible = _DocVersionConfig.MyDocVersion.MyDocVersionInfo.ActiveFormat.PlantFormat.FormatData.SectData.PrintPhoneList;
btnUnlinkDocVersion.Visible = false;
InitEnhanced();
_Initializing = false;
}
@ -1422,17 +1428,12 @@ namespace VEPROMS
btnNewEnh.Enabled = false; // for now, only do 1 at a time.
_Initializing = false;
}
private bool _EnhNeedToUnlink = false;
private void btnUnlinkDocVersion_Click(object sender, EventArgs e)
{
if (MessageBox.Show(this, "Are you sure you want to Unlink? Your documents will no longer link to Enhanced.", "Unlink", MessageBoxButtons.YesNoCancel) == DialogResult.Yes)
if (MessageBox.Show(this, "Are you sure you want to Unlink? Your documents will no longer link to Enhanced. NOTE that this processing occurs when 'OK' button is selected!", "Unlink", MessageBoxButtons.YesNoCancel) == DialogResult.Yes)
{
this.Cursor = Cursors.WaitCursor;
_DocVersionConfig.MyDocVersion.MyDocVersionInfo.DoUnlinkEnhancedDocVersion();
ProcessButtonClick(tiGeneral, btnGeneral);
tiEnhanced.Visible = false;
btnEnhanced.Visible = false;
this.Cursor = Cursors.Default;
_EnhNeedToUnlink = true; // do the unlink when 'OK' button is selected
}
}
}

View File

@ -22,6 +22,25 @@ namespace VEPROMS.CSLA.Library
{
public partial class DocVersion : IVEDrillDown
{
public static DocVersion GetFromDB(int versionID) // get data from database (don't look in cache first)
{
if (!CanGetObject())
throw new System.Security.SecurityException("User not authorized to view a DocVersion");
try
{
DocVersion tmp = DataPortal.Fetch<DocVersion>(new PKCriteria(versionID));
if (tmp.ErrorMessage == "No Record Found")
{
tmp.Dispose(); // Clean-up DocVersion
tmp = null;
}
return tmp;
}
catch (Exception ex)
{
throw new DbCslaException("Error on DocVersion.Get", ex);
}
}
public bool NewerRoFst
{
get
@ -267,16 +286,17 @@ namespace VEPROMS.CSLA.Library
}
}
}
// Refresh for this docversion
Refresh(DocVersion.Get(this.VersionID));
DocVersionConfigRefresh();
// Refresh the source document's cache
// Refresh this docversioninfo. Note that this and below refresh use a docversion retrieved from the
// database, i.e. 'GetFromDB'. This was necessary since this dialog is working with docversion writable
// objects.
DocVersionInfo.Refresh(DocVersion.GetFromDB(this.VersionID));
// Refresh the source document's docversioninfo
if (sdvid > -1)
{
using (DocVersion dv = DocVersion.Get(sdvid))
using (DocVersion dv = DocVersion.GetFromDB(sdvid))
{
Refresh(dv);
dv.MyDocVersionInfo.DocVersionConfigRefresh();
DocVersionInfo.Refresh(dv);
}
}
}

View File

@ -235,21 +235,27 @@ namespace Volian.Controls.Library
}
else if (MyItemInfo.IsHigh || MyItemInfo.IsCaution || MyItemInfo.IsNote)
{
EnhancedDocuments seds = MyItemInfo.ActiveSection.GetMyEnhancedDocuments();
// for HLS there could be multiple level of sections, so need to walk up tree until a procedure to see if one exists on section/subsections.
ItemInfo sect = MyItemInfo.ActiveSection;
bool didMenuItem = false;
foreach (EnhancedDocument sed in seds)
while (!didMenuItem && sect.IsSection)
{
if (sed.Type == edtypebtn)
EnhancedDocuments seds = sect.GetMyEnhancedDocuments();
foreach (EnhancedDocument sed in seds)
{
if (MyItemInfo.IsHigh || ((MyItemInfo.IsCaution || MyItemInfo.IsNote) && MyItemInfo.MyHLS.GetMyEnhancedDocuments().Count > 0))
if (sed.Type == edtypebtn)
{
biEnhanced.Visible = true;
biEnhanced.Text = string.Format("Create Missing Enhanced {0} Document Step", dveds.GetByType(edtypebtn).Name);
biEnhanced.Tag = MyItemInfo.ItemID;
didMenuItem = true;
break;
if (MyItemInfo.IsHigh || ((MyItemInfo.IsCaution || MyItemInfo.IsNote) && MyItemInfo.MyHLS.GetMyEnhancedDocuments().Count > 0))
{
biEnhanced.Visible = true;
biEnhanced.Text = string.Format("Create Missing Enhanced {0} Document Step", dveds.GetByType(edtypebtn).Name);
biEnhanced.Tag = MyItemInfo.ItemID;
didMenuItem = true;
break;
}
}
}
sect = sect.MyParent;
}
if (!didMenuItem) biEnhanced.Visible = false;
}