VEPROMS_UI / remove BouncyCastle
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
@@ -21,11 +20,7 @@ namespace VEPROMS
|
||||
public partial class dlgApproveProcedure : Form
|
||||
{
|
||||
public event DisplayConsistencyReportEvent ConsistencyPrintRequest;
|
||||
private void OnConsistencyPrintRequest(ConsistencyReportArgs args)
|
||||
{
|
||||
if (ConsistencyPrintRequest != null)
|
||||
ConsistencyPrintRequest(this, args);
|
||||
}
|
||||
private void OnConsistencyPrintRequest(ConsistencyReportArgs args) => ConsistencyPrintRequest?.Invoke(this, args);
|
||||
private bool CanApprove
|
||||
{
|
||||
get { return btnApprove2.Enabled; }
|
||||
@@ -37,12 +32,8 @@ namespace VEPROMS
|
||||
tsslStatus.Text = value ? "" : "Need to correct the Rev Numbers marked with Question Marks";
|
||||
}
|
||||
}
|
||||
private int _ApplicabilityIndex = 0;
|
||||
public int ApplicabilityIndex
|
||||
{
|
||||
get { return _ApplicabilityIndex; }
|
||||
set { _ApplicabilityIndex = value; }
|
||||
}
|
||||
|
||||
public int ApplicabilityIndex { get; set; } = 0;
|
||||
private SessionInfo _MySessionInfo;
|
||||
public SessionInfo MySessionInfo
|
||||
{
|
||||
@@ -53,23 +44,19 @@ namespace VEPROMS
|
||||
_MyApproval.MySessionInfo = _MySessionInfo;
|
||||
}
|
||||
}
|
||||
private ApprovalInfo _MyApproval;
|
||||
private DocVersionInfo _MyDocVersion;
|
||||
frmVEPROMS _MyFrmVEPROMS = null;
|
||||
public frmVEPROMS MyFrmVEPROMS
|
||||
{
|
||||
get { return _MyFrmVEPROMS; }
|
||||
set { _MyFrmVEPROMS = value; }
|
||||
}
|
||||
private bool _initializing = false; // C2018-008 redesign of user interface
|
||||
private readonly ApprovalInfo _MyApproval;
|
||||
private readonly DocVersionInfo _MyDocVersion;
|
||||
|
||||
public frmVEPROMS MyFrmVEPROMS { get; set; } = null;
|
||||
private readonly bool _initializing = false; // C2018-008 redesign of user interface
|
||||
public dlgApproveProcedure(DocVersionInfo myDocVersion, frmVEPROMS myFrmVEPROMS) // approve all procedures
|
||||
{
|
||||
MyFrmVEPROMS = myFrmVEPROMS;// Save frmVEPROMS for Import to shutoff SessionPing
|
||||
_MyApproval = new ApprovalInfo(myFrmVEPROMS);// Save frmVEPROMS for Import to shutoff SessionPing
|
||||
ApplicabilityIndex = myDocVersion.DocVersionConfig.SelectedSlave;
|
||||
_MyApproval.SavedSlave = ApplicabilityIndex;
|
||||
this.ConsistencyPrintRequest -= new DisplayConsistencyReportEvent(dlgApproveProcedure_ConsistencyPrintRequest);
|
||||
this.ConsistencyPrintRequest += new DisplayConsistencyReportEvent(dlgApproveProcedure_ConsistencyPrintRequest);
|
||||
ConsistencyPrintRequest -= new DisplayConsistencyReportEvent(dlgApproveProcedure_ConsistencyPrintRequest);
|
||||
ConsistencyPrintRequest += new DisplayConsistencyReportEvent(dlgApproveProcedure_ConsistencyPrintRequest);
|
||||
_MyDocVersion = myDocVersion;
|
||||
_MyDocVersion.ResetProcedures(); // B2021-035: Pasted, modified number and deleted procedures not refreshed so missing from list
|
||||
InitializeComponent();
|
||||
@@ -77,7 +64,7 @@ namespace VEPROMS
|
||||
_MyApproval.StatusUpdated -= new ApprovalStatusChangeEvent(_MyApproval_StatusUpdated);
|
||||
_MyApproval.StatusUpdated += new ApprovalStatusChangeEvent(_MyApproval_StatusUpdated);
|
||||
SetupComboBoxes();
|
||||
foreach (ProcedureInfo pi in myDocVersion.Procedures)
|
||||
foreach (ProcedureInfo pi in myDocVersion.Procedures.OfType<ProcedureInfo>())
|
||||
{
|
||||
bool includeProc = pi.ApplInclude(ApplicabilityIndex); // C2021-027: Procedure level PC/PC
|
||||
if (includeProc)
|
||||
@@ -98,31 +85,8 @@ namespace VEPROMS
|
||||
|
||||
private void FlexGridAddEvents()
|
||||
{
|
||||
//fgProcs.ChangeEdit += new EventHandler(fgProcs_ChangeEdit);
|
||||
//Console.WriteLine(fgProcs.ComboBoxEditor.GetType().Name);
|
||||
//Console.WriteLine(fgProcs.Editor.GetType().Name);
|
||||
//fgProcs.ImeModeChanged += new EventHandler(fgProcs_ImeModeChanged);
|
||||
//fgProcs.LeaveEdit += new C1.Win.C1FlexGrid.RowColEventHandler(fgProcs_LeaveEdit);
|
||||
//fgProcs.SetupEditor += new C1.Win.C1FlexGrid.RowColEventHandler(fgProcs_SetupEditor);
|
||||
//fgProcs.StartEdit += new C1.Win.C1FlexGrid.RowColEventHandler(fgProcs_StartEdit);
|
||||
//fgProcs.ValidateEdit += new C1.Win.C1FlexGrid.ValidateEditEventHandler(fgProcs_ValidateEdit);
|
||||
fgProcs.ComboCloseUp -= new C1.Win.C1FlexGrid.RowColEventHandler(fgProcs_ComboCloseUp);
|
||||
fgProcs.ComboCloseUp += new C1.Win.C1FlexGrid.RowColEventHandler(fgProcs_ComboCloseUp);
|
||||
//fgProcs.MouseDown += new MouseEventHandler(fgProcs_MouseDown);
|
||||
//fgProcs.MouseUp += new MouseEventHandler(fgProcs_MouseUp);
|
||||
}
|
||||
|
||||
void fgProcs_MouseUp(object sender, MouseEventArgs e)
|
||||
{
|
||||
C1.Win.C1FlexGrid.HitTestInfo hti = fgProcs.HitTest(e.X, e.Y);
|
||||
//Console.WriteLine("fgProcs_MouseUp X={0},Y={1},Row={2},Col={3}", e.X, e.Y, hti.Row, hti.Column);
|
||||
}
|
||||
|
||||
void fgProcs_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
C1.Win.C1FlexGrid.HitTestInfo hti = fgProcs.HitTest(e.X, e.Y);
|
||||
//Console.WriteLine("fgProcs_MouseDown X={0},Y={1},Row={2},Col={3}", e.X, e.Y, hti.Row, hti.Column);
|
||||
|
||||
}
|
||||
|
||||
void fgProcs_ComboCloseUp(object sender, C1.Win.C1FlexGrid.RowColEventArgs e)
|
||||
@@ -134,46 +98,6 @@ namespace VEPROMS
|
||||
//Console.WriteLine("fgProcs_ComboCloseUp row: {0}, col: {1}, val: {2}, etostring: {3}", e.Row, e.Col, fgProcs[e.Row, e.Col], e.ToString());
|
||||
}
|
||||
|
||||
void fgProcs_ValidateEdit(object sender, C1.Win.C1FlexGrid.ValidateEditEventArgs e)
|
||||
{
|
||||
//Console.WriteLine("fgProcs_ValidateEdit");
|
||||
}
|
||||
|
||||
void fgProcs_StartEdit(object sender, C1.Win.C1FlexGrid.RowColEventArgs e)
|
||||
{
|
||||
|
||||
object val = fgProcs[e.Row, e.Col];
|
||||
DateTime dt = (DateTime)val;
|
||||
if (dt != null)
|
||||
dt = dt.AddHours(1);
|
||||
fgProcs[e.Row, e.Col] = dt;
|
||||
//Console.WriteLine("fgProcs_StartEdit val: {0}, dt: {1}", val, dt);
|
||||
}
|
||||
|
||||
void fgProcs_SetupEditor(object sender, C1.Win.C1FlexGrid.RowColEventArgs e)
|
||||
{
|
||||
//Console.WriteLine("fgProcs_SetupEditor");
|
||||
}
|
||||
|
||||
void fgProcs_LeaveEdit(object sender, C1.Win.C1FlexGrid.RowColEventArgs e)
|
||||
{
|
||||
object val = fgProcs[e.Row, e.Col];
|
||||
DateTime dt = (DateTime)val;
|
||||
if (dt != null && dt.Hour != 0)
|
||||
dt = dt.AddHours(-1);
|
||||
fgProcs[e.Row, e.Col] = dt;
|
||||
//Console.WriteLine("fgProcs_LeaveEdit val: {0}, dt: {1}, mouserow={2}, mousecol={3}", val, dt, fgProcs.MouseRow, fgProcs.MouseCol);
|
||||
}
|
||||
|
||||
void fgProcs_ImeModeChanged(object sender, EventArgs e)
|
||||
{
|
||||
//Console.WriteLine("fgProcs_ImeModeChanged");
|
||||
}
|
||||
|
||||
void fgProcs_ChangeEdit(object sender, EventArgs e)
|
||||
{
|
||||
//Console.WriteLine("fgProcs_ChangeEdit");
|
||||
}
|
||||
//C2020-036 returns a string of duplicate procedure numbers separated by newlines for use in FlexibleMessageBox
|
||||
private string dupProcList
|
||||
{
|
||||
@@ -183,12 +107,13 @@ namespace VEPROMS
|
||||
if (dpl.Count > 0)
|
||||
{
|
||||
foreach (string pn in dpl)
|
||||
rtn += pn + "\n";
|
||||
rtn += $"{pn}\n";
|
||||
rtn = rtn.TrimEnd('\n');
|
||||
}
|
||||
return rtn;
|
||||
}
|
||||
}
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
|
||||
private List<string> dpl = new List<string>(); //C2020-036 used to create list duplicate procedure numbers
|
||||
|
||||
private bool InitializePanelSelect()
|
||||
@@ -196,7 +121,7 @@ namespace VEPROMS
|
||||
if (clbMore.Items.Count == 0)
|
||||
{
|
||||
dpl.Clear();
|
||||
foreach (ProcedureInfo pi in _MyDocVersion.Procedures)
|
||||
foreach (ProcedureInfo pi in _MyDocVersion.Procedures.OfType<ProcedureInfo>())
|
||||
{
|
||||
bool includeProc = pi.ApplInclude(ApplicabilityIndex); // C2021-027: Procedure level PC/PC
|
||||
if (includeProc)
|
||||
@@ -245,22 +170,22 @@ namespace VEPROMS
|
||||
lblViewPDF.Enabled = false;
|
||||
if (_MyApproval.MyProcedures.Count == 1)
|
||||
{
|
||||
this.Text = "Approve " + _MyApproval.MyProcedures[0].ProcInfo.DisplayNumber;
|
||||
Text = "Approve " + _MyApproval.MyProcedures[0].ProcInfo.DisplayNumber;
|
||||
swtbtViewPDF.Value = false;
|
||||
swtbtViewPDF.Enabled = true;
|
||||
lblViewPDF.Enabled = true;
|
||||
}
|
||||
else if (_MyApproval.MyProcedures.Count == _MyDocVersion.Procedures.Count)
|
||||
this.Text = "Approve All Procedures";
|
||||
Text = "Approve All Procedures";
|
||||
else
|
||||
this.Text = "Approve Selected Procedures";
|
||||
Text = "Approve Selected Procedures";
|
||||
}
|
||||
private void InitializePanelApprove()
|
||||
{
|
||||
setupLablesAndSwitches(); // C2018-008 redesign of user interface
|
||||
SetupMyApproval();
|
||||
}
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
|
||||
private Dictionary<string, ProcedureInfo> tmpProcedures = new Dictionary<string, ProcedureInfo>();
|
||||
private ProcedureInfo GetProcedureInfoByKey(string key)
|
||||
{
|
||||
@@ -277,12 +202,13 @@ namespace VEPROMS
|
||||
return tmpProcedures[GetDisplayNumberOnly(key)];
|
||||
}
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "selectsome Kept for Legacy - To give Constructor a different Signature")]
|
||||
public dlgApproveProcedure(DocVersionInfo myDocVersion, bool selectSome, frmVEPROMS myFrmVEPROMS) // approve some procedures
|
||||
{
|
||||
MyFrmVEPROMS = myFrmVEPROMS;// Save frmVEPROMS for Import to shutoff SessionPing
|
||||
_MyApproval = new ApprovalInfo(myFrmVEPROMS);// Save frmVEPROMS for Import to shutoff SessionPing
|
||||
this.ConsistencyPrintRequest -= new DisplayConsistencyReportEvent(dlgApproveProcedure_ConsistencyPrintRequest);
|
||||
this.ConsistencyPrintRequest += new DisplayConsistencyReportEvent(dlgApproveProcedure_ConsistencyPrintRequest);
|
||||
ConsistencyPrintRequest -= new DisplayConsistencyReportEvent(dlgApproveProcedure_ConsistencyPrintRequest);
|
||||
ConsistencyPrintRequest += new DisplayConsistencyReportEvent(dlgApproveProcedure_ConsistencyPrintRequest);
|
||||
_MyDocVersion = myDocVersion;
|
||||
_MyDocVersion.ResetProcedures(); // B2021-035: Pasted, modified number and deleted procedures not refreshed so missing from list
|
||||
InitializeComponent();
|
||||
@@ -303,8 +229,8 @@ namespace VEPROMS
|
||||
{
|
||||
MyFrmVEPROMS = myFrmVEPROMS;// Save frmVEPROMS for Import to shutoff SessionPing
|
||||
_MyApproval = new ApprovalInfo(myFrmVEPROMS);// Save frmVEPROMS for Import to shutoff SessionPing
|
||||
this.ConsistencyPrintRequest -= new DisplayConsistencyReportEvent(dlgApproveProcedure_ConsistencyPrintRequest);
|
||||
this.ConsistencyPrintRequest += new DisplayConsistencyReportEvent(dlgApproveProcedure_ConsistencyPrintRequest);
|
||||
ConsistencyPrintRequest -= new DisplayConsistencyReportEvent(dlgApproveProcedure_ConsistencyPrintRequest);
|
||||
ConsistencyPrintRequest += new DisplayConsistencyReportEvent(dlgApproveProcedure_ConsistencyPrintRequest);
|
||||
_MyDocVersion = myProcedure.MyDocVersion;
|
||||
_MyDocVersion.ResetProcedures(); // B2021-035: Pasted, modified number and deleted procedures not refreshed so missing from list
|
||||
ApplicabilityIndex = _MyDocVersion.DocVersionConfig.SelectedSlave; // B2022-033 set the child being approved or workflow so other procedure list can populate
|
||||
@@ -328,12 +254,7 @@ namespace VEPROMS
|
||||
}
|
||||
_initializing = false;
|
||||
}
|
||||
private bool ProcedureSetHasDuplicateProcedureNumbers()
|
||||
{
|
||||
bool hasDuplicateProcNums = false;
|
||||
|
||||
return hasDuplicateProcNums;
|
||||
}
|
||||
void _MyApproval_StatusUpdated(ApprovalInfo sender, ApprovalMessageArgs e)
|
||||
{
|
||||
tsslMsg2.Text = e.MyStatus;
|
||||
@@ -342,33 +263,16 @@ namespace VEPROMS
|
||||
private void SetupMyApproval()
|
||||
{
|
||||
approvalInfoBindingSource.DataSource = _MyApproval;
|
||||
//if(_MyApproval.MyProcedures.Count == 1)
|
||||
// lblOldRevNumber.Text = _MyApproval.RevNumber;
|
||||
//else if (_MyApproval.MyProcedures.Count > 1)
|
||||
// lblMaxRevNumber1.Text = GetMaxRevNumber();
|
||||
_MyApproval.RevType = 1; // C2018-008 redesign of user interface //(revTypeBindingSource.Current as RevType).TypeID;
|
||||
_MyApproval.RevType = 1; // C2018-008 redesign of user interface
|
||||
_MyApproval.RevStage = (stageInfoBindingSource.Current == null) ? 0 : (stageInfoBindingSource.Current as StageInfo).StageID;// C2018-008 redesign of user interface
|
||||
approvalInfoBindingSource.ResetBindings(false);
|
||||
approvalProcedureBindingSource.DataSource = _MyApproval.MyProcedures;
|
||||
approvalProcedureBindingSource.ResetBindings(false);
|
||||
//this.ConsistencyPrintRequest -= new DisplayConsistencyReportEvent(dlgApproveProcedure_ConsistencyPrintRequest);
|
||||
}
|
||||
|
||||
private string GetMaxRevNumber()
|
||||
{
|
||||
string mrn = string.Empty;
|
||||
foreach (ApprovalProcedure ap in _MyApproval.MyProcedures)
|
||||
{
|
||||
int k = _MyApproval.FancyShmancyRevCompare(mrn, ap.RevNumber);
|
||||
if (k < 0)
|
||||
mrn = ap.RevNumber;
|
||||
}
|
||||
return mrn;
|
||||
}
|
||||
|
||||
void dlgApproveProcedure_ConsistencyPrintRequest(object sender, ConsistencyReportArgs args)
|
||||
{
|
||||
foreach (ProcedureInfo pi in args.MyItems)
|
||||
foreach (ProcedureInfo pi in args.MyItems.OfType<ProcedureInfo>())
|
||||
pi.IsSelected = _MyApproval.ProcedureExists(pi);
|
||||
PDFConsistencyCheckReport rpt = new PDFConsistencyCheckReport(args.ReportName, args.MyItems, args.MyDocVersion); //B2020-020 needed to pass in DocVersion to get paper size from format
|
||||
rpt.BuildReport();
|
||||
@@ -389,20 +293,12 @@ namespace VEPROMS
|
||||
|
||||
private void btnApprove_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Cursor = Cursors.WaitCursor;
|
||||
Cursor = Cursors.WaitCursor;
|
||||
if(!_MyApproval.Approve(new Point(Left,Bottom),cmbRevisionStage2.Text)) // C2021-020 pass in the revision stage name
|
||||
this.DialogResult = DialogResult.None;
|
||||
this.Cursor = Cursors.Default;
|
||||
DialogResult = DialogResult.None;
|
||||
Cursor = Cursors.Default;
|
||||
}
|
||||
|
||||
// C2018-008 redesign of user interface
|
||||
// -- Note that the Revison Type data source is still connected (revTypeBindingSource) - commented out for documentatin purposes
|
||||
//private void cmbRevisionType_SelectedIndexChanged(object sender, EventArgs e)
|
||||
//{
|
||||
// RevType rt = cmbRevisionType2.SelectedItem as RevType;
|
||||
// _MyApproval.RevType = rt.TypeID;
|
||||
//}
|
||||
|
||||
private void cmbRevisionStage_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
StageInfo si = cmbRevisionStage2.SelectedItem as StageInfo;
|
||||
@@ -431,7 +327,6 @@ namespace VEPROMS
|
||||
SetupComboBoxes();
|
||||
for (int i = 0; i < clbMore.Items.Count; i++)
|
||||
{
|
||||
string xyz = clbMore.Items[i].ToString();
|
||||
ProcedureInfo pi = GetProcedureInfoByKey(clbMore.Items[i].ToString());
|
||||
if (clbMore.GetItemChecked(i))
|
||||
{
|
||||
@@ -449,10 +344,7 @@ namespace VEPROMS
|
||||
RefreshCount(); // B2021-015: select/clear all not populating left panel & count not refreshed.
|
||||
}
|
||||
|
||||
private void btnCheck_Click(object sender, EventArgs e)
|
||||
{
|
||||
UpdateClbMore();
|
||||
}
|
||||
private void btnCheck_Click(object sender, EventArgs e) => UpdateClbMore();
|
||||
|
||||
private ItemInfoList _MyItemInfoList;
|
||||
private void UpdateClbMore()
|
||||
@@ -485,7 +377,7 @@ namespace VEPROMS
|
||||
if (info.Contains(" - ("))
|
||||
clbMore.Items[i] = info.Substring(0, info.IndexOf(" - ("));
|
||||
}
|
||||
foreach (ProcedureInfo npi in _MyItemInfoList)
|
||||
foreach (ProcedureInfo npi in _MyItemInfoList.OfType<ProcedureInfo>())
|
||||
{
|
||||
string info = string.Format("{0} - ({1})", npi.DisplayNumber, npi.MyDifferenceReasons);
|
||||
//checked list box
|
||||
@@ -506,7 +398,7 @@ namespace VEPROMS
|
||||
for (int i = 0; i < clbMore.Items.Count; i++)
|
||||
{
|
||||
if (!clbMore.Items[i].ToString().Contains(" - ("))
|
||||
clbMore.Items[i] = clbMore.Items[i].ToString() + " - (none)";
|
||||
clbMore.Items[i] = $"{clbMore.Items[i]} - (none)";
|
||||
}
|
||||
Application.DoEvents();
|
||||
clbMore.Enabled = btnAll.Enabled = btnClear.Enabled = true;
|
||||
@@ -523,10 +415,7 @@ namespace VEPROMS
|
||||
}
|
||||
}
|
||||
// B2021-015: select/clear all not populating left panel & count not refreshed.
|
||||
private void RefreshCount()
|
||||
{
|
||||
lblMore.Text = string.Format("{0} Procedures, {1} Selected", clbMore.Items.Count, clbMore.CheckedItems.Count);
|
||||
}
|
||||
private void RefreshCount() => lblMore.Text = string.Format("{0} Procedures, {1} Selected", clbMore.Items.Count, clbMore.CheckedItems.Count);
|
||||
|
||||
void ItemInfoList_ConsistencyCheckUpdated(object sender, ItemInfoListCCEventArgs args)
|
||||
{
|
||||
@@ -572,14 +461,12 @@ namespace VEPROMS
|
||||
if (clbMore.Items[itemIndex] != null)
|
||||
{
|
||||
SuperTooltipInfo stti = sttMore.GetSuperTooltip(clbMore);
|
||||
//string headerText = tmpProcedures[xyz].DisplayNumber;
|
||||
//string bodyText = tmpProcedures[xyz].MyDifferencesText;
|
||||
stti.HeaderText = GetProcedureInfoByKey(clbMore.Items[itemIndex].ToString()).DisplayNumber;
|
||||
stti.BodyText = GetProcedureInfoByKey(clbMore.Items[itemIndex].ToString()).MyDifferencesText;
|
||||
stti.FooterVisible = false;
|
||||
using (Graphics g = CreateGraphics())
|
||||
{
|
||||
SizeF sf = g.MeasureString(stti.BodyText, this.Font);
|
||||
SizeF sf = g.MeasureString(stti.BodyText, Font);
|
||||
stti.CustomSize = new Size(10 + sf.ToSize().Width, 0);
|
||||
}
|
||||
sttMore.ShowTooltip(sender);
|
||||
@@ -611,10 +498,7 @@ namespace VEPROMS
|
||||
|
||||
}
|
||||
|
||||
private void btnReportMore_Click(object sender, EventArgs e)
|
||||
{
|
||||
OnConsistencyPrintRequest(new ConsistencyReportArgs(Volian.Base.Library.VlnSettings.TemporaryFolder + @"\MyConsistency.pdf", _MyItemInfoList, _MyDocVersion)); //B2020-020 needed to pass in DocVersion to get paper size from format
|
||||
}
|
||||
private void btnReportMore_Click(object sender, EventArgs e) => OnConsistencyPrintRequest(new ConsistencyReportArgs(Volian.Base.Library.VlnSettings.TemporaryFolder + @"\MyConsistency.pdf", _MyItemInfoList, _MyDocVersion)); //B2020-020 needed to pass in DocVersion to get paper size from format
|
||||
|
||||
private void fgProcs_AfterEdit(object sender, C1.Win.C1FlexGrid.RowColEventArgs e)
|
||||
{
|
||||
@@ -724,19 +608,16 @@ namespace VEPROMS
|
||||
private void expAddProcConChk_ExpandedChanged(object sender, ExpandedChangeEventArgs e) // C2018-008 redesign of user interface
|
||||
{
|
||||
if (expAddProcConChk.Expanded)
|
||||
this.Size = new Size(this.Size.Width + (expAddProcConChk.Size.Width - expAddProcConChk.TitlePanel.Size.Height), this.Size.Height);
|
||||
Size = new Size(Size.Width + (expAddProcConChk.Size.Width - expAddProcConChk.TitlePanel.Size.Height), Size.Height);
|
||||
}
|
||||
|
||||
private void expAddProcConChk_ExpandedChanging(object sender, ExpandedChangeEventArgs e) // C2018-008 redesign of user interface
|
||||
{
|
||||
if (expAddProcConChk.Expanded)
|
||||
this.Size = new Size(this.Size.Width - (expAddProcConChk.Size.Width - expAddProcConChk.TitlePanel.Size.Height), this.Size.Height);
|
||||
Size = new Size(Size.Width - (expAddProcConChk.Size.Width - expAddProcConChk.TitlePanel.Size.Height), Size.Height);
|
||||
}
|
||||
|
||||
private void fgProcs_AfterDataRefresh(object sender, ListChangedEventArgs e)
|
||||
{
|
||||
btnApprove2.Enabled = CanApprove && tsslStatus.Text.Length == 0; // B2016-057 If did un-successful Auto Increament Rev Number, then don't enable Approve (Do Work Flow) button
|
||||
}
|
||||
private void fgProcs_AfterDataRefresh(object sender, ListChangedEventArgs e) => btnApprove2.Enabled = CanApprove && tsslStatus.Text.Length == 0; // B2016-057 If did un-successful Auto Increament Rev Number, then don't enable Approve (Do Work Flow) button
|
||||
|
||||
// C2020-040 automatically update left panel when tree item in right panel is selected or deselected
|
||||
private void clbMore_SelectedIndexChanged(object sender, EventArgs e)
|
||||
@@ -758,18 +639,11 @@ namespace VEPROMS
|
||||
}
|
||||
|
||||
private void clbMore_MouseLeave(object sender, EventArgs e) //C2020-045 - added switch to control if pop-ups are displayed in procedure list
|
||||
{
|
||||
sttMore.Enabled = true;
|
||||
}
|
||||
=> sttMore.Enabled = true;
|
||||
}
|
||||
public class ApprovalProcedure
|
||||
{
|
||||
private ProcedureInfo _ProcInfo;
|
||||
public ProcedureInfo ProcInfo
|
||||
{
|
||||
get { return _ProcInfo; }
|
||||
set { _ProcInfo = value; }
|
||||
}
|
||||
public ProcedureInfo ProcInfo { get; set; }
|
||||
private string _RevNumber;
|
||||
public string RevNumber
|
||||
{
|
||||
@@ -779,37 +653,17 @@ namespace VEPROMS
|
||||
if (value.Trim() != _RevNumber)
|
||||
{
|
||||
_RevNumber = value.Trim();
|
||||
//_RevDate = DateTime.Now; // commented out for bug fix B2013-012
|
||||
}
|
||||
}
|
||||
}
|
||||
private DateTime _RevDate;
|
||||
public DateTime RevDate
|
||||
{
|
||||
get { return _RevDate; }
|
||||
set { _RevDate = value; }
|
||||
}
|
||||
|
||||
public DateTime RevDate { get; set; }
|
||||
// added RevNumAndDate to handle the use use of the DoRevDate flag
|
||||
// this fixes bug B2013-011 where Today's date would print on the approved procedures (Westinghouse data)
|
||||
// instead of the the Revision Date assigned to the procedure.
|
||||
public string RevNumAndDate
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_ProcInfo.ActiveFormat.PlantFormat.FormatData.PrintData.DoRevDate)
|
||||
return RevNumber + "/" + RevDate.ToString("M/d/yyyy");
|
||||
else
|
||||
return RevNumber;
|
||||
}
|
||||
}
|
||||
public string DisplayNumber
|
||||
{
|
||||
get { return _ProcInfo.DisplayNumber; }
|
||||
}
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0}\t{1}\t{2:M/d/yyyy}", _ProcInfo.DisplayNumber, _RevNumber, _RevDate);
|
||||
}
|
||||
public string RevNumAndDate => ProcInfo.ActiveFormat.PlantFormat.FormatData.PrintData.DoRevDate ? $"{RevNumber}/{RevDate:M/d/yyyy}" : RevNumber;
|
||||
public string DisplayNumber => ProcInfo.DisplayNumber;
|
||||
public override string ToString() => string.Format("{0}\t{1}\t{2:M/d/yyyy}", ProcInfo.DisplayNumber, _RevNumber, RevDate);
|
||||
public ApprovalProcedure(ProcedureInfo proc)
|
||||
{
|
||||
proc.ProcedureConfig.SelectedSlave = proc.MyDocVersion.DocVersionConfig.SelectedSlave;
|
||||
@@ -818,105 +672,42 @@ namespace VEPROMS
|
||||
string sRevDate = proc.ProcedureConfig.Print_RevDate;
|
||||
if (sRevDate == string.Empty)
|
||||
sRevDate = DateTime.Now.ToString("M/d/y");
|
||||
DateTime revDate;
|
||||
if (!DateTime.TryParse(sRevDate, out revDate)) revDate = DateTime.Now;
|
||||
if (!DateTime.TryParse(sRevDate, out DateTime revDate)) revDate = DateTime.Now;
|
||||
RevDate = revDate;
|
||||
}
|
||||
}
|
||||
public class ApprovalMessageArgs : EventArgs
|
||||
{
|
||||
public ApprovalMessageArgs(string msg)
|
||||
{
|
||||
_MyStatus = msg;
|
||||
}
|
||||
private string _MyStatus;
|
||||
public string MyStatus
|
||||
{
|
||||
get { return _MyStatus; }
|
||||
set { _MyStatus = value; }
|
||||
}
|
||||
public ApprovalMessageArgs(string msg) => MyStatus = msg;
|
||||
|
||||
public string MyStatus { get; set; }
|
||||
}
|
||||
public delegate void ApprovalStatusChangeEvent(ApprovalInfo sender, ApprovalMessageArgs e);
|
||||
public class ApprovalInfo
|
||||
{
|
||||
frmVEPROMS _MyFrmVEPROMS = null;
|
||||
public frmVEPROMS MyFrmVEPROMS
|
||||
{
|
||||
get { return _MyFrmVEPROMS; }
|
||||
set { _MyFrmVEPROMS = value; }
|
||||
}
|
||||
public frmVEPROMS MyFrmVEPROMS { get; set; } = null;
|
||||
public event ApprovalStatusChangeEvent StatusUpdated;
|
||||
public void OnStatusUpdated(ApprovalInfo sender, ApprovalMessageArgs e)
|
||||
{
|
||||
if (StatusUpdated != null)
|
||||
StatusUpdated(sender, e);
|
||||
}
|
||||
private SessionInfo _MySessionInfo;
|
||||
public SessionInfo MySessionInfo
|
||||
{
|
||||
get { return _MySessionInfo; }
|
||||
set { _MySessionInfo = value; }
|
||||
}
|
||||
private int _RevType;
|
||||
public int RevType
|
||||
{
|
||||
get { return _RevType; }
|
||||
set { _RevType = value; }
|
||||
}
|
||||
private string _RevNumber;
|
||||
public string RevNumber
|
||||
{
|
||||
get { return _RevNumber; }
|
||||
set { _RevNumber = value; }
|
||||
}
|
||||
private Nullable<DateTime> _RevDate;
|
||||
public Nullable<DateTime> RevDate
|
||||
public void OnStatusUpdated(ApprovalInfo sender, ApprovalMessageArgs e) => StatusUpdated?.Invoke(sender, e);
|
||||
|
||||
public SessionInfo MySessionInfo { get; set; }
|
||||
public int RevType { get; set; }
|
||||
public string RevNumber { get; set; }
|
||||
private DateTime? _RevDate;
|
||||
public DateTime? RevDate
|
||||
{
|
||||
get { return _RevDate == null ? _RevDate : _RevDate.Value; }
|
||||
set { _RevDate = value; }
|
||||
}
|
||||
private int _RevStage;
|
||||
public int RevStage
|
||||
{
|
||||
get { return _RevStage; }
|
||||
set { _RevStage = value; }
|
||||
}
|
||||
private string _RevNote;
|
||||
public string RevNote
|
||||
{
|
||||
get { return _RevNote; }
|
||||
set { _RevNote = value; }
|
||||
}
|
||||
private bool _ViewPDF;
|
||||
public bool ViewPDF
|
||||
{
|
||||
get { return _ViewPDF; }
|
||||
set { _ViewPDF = value; }
|
||||
}
|
||||
private string _MsgNumber;
|
||||
public string MsgNumber
|
||||
{
|
||||
get { return _MsgNumber; }
|
||||
set { _MsgNumber = value; }
|
||||
}
|
||||
private string _MsgDate;
|
||||
public string MsgDate
|
||||
{
|
||||
get { return _MsgDate; }
|
||||
set { _MsgDate = value; }
|
||||
}
|
||||
private bool _CanIncrement;
|
||||
public bool CanIncrement
|
||||
{
|
||||
get { return _CanIncrement; }
|
||||
set { _CanIncrement = value; }
|
||||
}
|
||||
|
||||
public int RevStage { get; set; }
|
||||
public string RevNote { get; set; }
|
||||
public bool ViewPDF { get; set; }
|
||||
public string MsgNumber { get; set; }
|
||||
public string MsgDate { get; set; }
|
||||
public bool CanIncrement { get; set; }
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
|
||||
private List<ApprovalProcedure> _MyProcedures;
|
||||
public List<ApprovalProcedure> MyProcedures
|
||||
{
|
||||
get { return _MyProcedures; }
|
||||
//set { _MyProcedures = value; }
|
||||
}
|
||||
public List<ApprovalProcedure> MyProcedures => _MyProcedures;
|
||||
|
||||
//B2026-058 - If approving multiple procedures at the same time with a multiunit set and one of the procedures is open, PROMS sometimes loses that it is set for an individual unit.
|
||||
// this will save the SectedSlave in case a refresh causes it to get lost
|
||||
@@ -927,10 +718,6 @@ namespace VEPROMS
|
||||
MyFrmVEPROMS = myFrmVEPROMS;// Save frmVEPROMS for Import to shutoff SessionPing
|
||||
_MyProcedures = new List<ApprovalProcedure>();
|
||||
}
|
||||
private static string FormatRev(Match m)
|
||||
{
|
||||
return "".PadLeft(5 - m.Groups[1].Value.Length, '0') + m.Groups[1].Value;
|
||||
}
|
||||
public void AddProcedure(ProcedureInfo proc)
|
||||
{
|
||||
ApprovalProcedure ap = new ApprovalProcedure(proc);
|
||||
@@ -963,64 +750,11 @@ namespace VEPROMS
|
||||
public void Refresh()
|
||||
{
|
||||
bool ok = true;
|
||||
int rv = 0;
|
||||
foreach (ApprovalProcedure ap in MyProcedures)
|
||||
{
|
||||
ok = ok && int.TryParse(ap.RevNumber, out rv);
|
||||
ok = ok && int.TryParse(ap.RevNumber, out int rv);
|
||||
}
|
||||
_CanIncrement = ok;
|
||||
//if (MyProcedures.Count == 1)
|
||||
//{
|
||||
// ProcedureInfo pi = _MyProcedures[0].ProcInfo;
|
||||
// RevNumber = pi.ProcedureConfig.Print_Rev == string.Empty ? "0" : pi.ProcedureConfig.Print_Rev;
|
||||
// DateTime revdate = pi.ProcedureConfig.Print_RevDate == string.Empty ? DateTime.Now : DateTime.TryParse(pi.ProcedureConfig.Print_RevDate, out revdate) ? revdate : DateTime.Now;
|
||||
// RevDate = revdate;
|
||||
// RevNote = string.Empty;
|
||||
// ViewPDF = false;
|
||||
//}
|
||||
//else if (MyProcedures.Count > 1)
|
||||
//{
|
||||
// Regex myRegEx = new Regex("^([0-9]{1,5})");
|
||||
// SortedList<string, ProcedureInfo> printRevs = new SortedList<string, ProcedureInfo>();
|
||||
// SortedList<string, ProcedureInfo> printRevDates = new SortedList<string, ProcedureInfo>();
|
||||
// string printRev = string.Empty;
|
||||
// foreach (ApprovalProcedure pi in MyProcedures)
|
||||
// {
|
||||
// printRev = myRegEx.Replace(pi.RevNumber, new MatchEvaluator(FormatRev));
|
||||
// printRev = printRev == string.Empty ? "0" : printRev;
|
||||
// if (printRev != string.Empty)
|
||||
// if (!printRevs.ContainsKey(printRev))
|
||||
// printRevs.Add(printRev, pi.ProcInfo);
|
||||
// if (pi.RevDate != null)
|
||||
// if (!printRevDates.ContainsKey(pi.RevDate.ToString()))
|
||||
// printRevDates.Add(pi.RevDate.ToString(), pi.ProcInfo);
|
||||
// }
|
||||
// if (printRevs.Count > 1)
|
||||
// {
|
||||
// ProcedureInfo pi = printRevs[printRevs.Keys[printRevs.Count - 1]];
|
||||
// RevNumber = "*";
|
||||
// MsgNumber = "Multiple Revision Numbers found. Enter asterisk (*) to use current revision numbers or plus sign (+) to increment revision numbers";
|
||||
// }
|
||||
// else if (printRevs.Count == 1)
|
||||
// {
|
||||
// ProcedureInfo pi = printRevs[printRevs.Keys[printRevs.Count - 1]];
|
||||
// RevNumber = pi.ProcedureConfig.Print_Rev;
|
||||
// MsgNumber = string.Empty;
|
||||
// }
|
||||
// if (printRevDates.Count > 1)
|
||||
// {
|
||||
// RevDate = null;
|
||||
// MsgDate = "Multiple Revision Dates found. Use current revision dates or manually assign revision date by selecting a date";
|
||||
// }
|
||||
// else if (printRevDates.Count == 1)
|
||||
// {
|
||||
// ProcedureInfo pi = printRevDates[printRevDates.Keys[printRevDates.Count - 1]];
|
||||
// RevDate = DateTime.Parse(pi.ProcedureConfig.Print_RevDate);
|
||||
// MsgDate = string.Empty;
|
||||
// }
|
||||
// else if (printRevDates.Count == 0)
|
||||
// RevDate = DateTime.Now;
|
||||
//}
|
||||
CanIncrement = ok;
|
||||
}
|
||||
public void DeleteProcedure(ProcedureInfo pi)
|
||||
{
|
||||
@@ -1036,10 +770,7 @@ namespace VEPROMS
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
public bool CanApprove
|
||||
{
|
||||
get { return _RevType > 0 && _RevNumber != string.Empty && _RevStage > 0; }
|
||||
}
|
||||
public bool CanApprove => RevType > 0 && RevNumber != string.Empty && RevStage > 0;
|
||||
public int FancyShmancyRevCompare(string s1, string s2)
|
||||
{
|
||||
if (s1 == s2)
|
||||
@@ -1164,13 +895,13 @@ namespace VEPROMS
|
||||
if (MessageBox.Show(sb.ToString(),string.Format("Revert to {0}",nsi.Name),MessageBoxButtons.YesNo,MessageBoxIcon.Stop) == DialogResult.No)
|
||||
return false;
|
||||
}
|
||||
|
||||
DialogResult doSumChgDR = FlexibleMessageBox.Show("Do you want to save the Summary of Changes along with the Approved PDF?\r\n\r\nSelecting 'Cancel' will cancel the approval process.", "Create Summary of Changes", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);// == DialogResult.Yes;
|
||||
if (doSumChgDR == DialogResult.Cancel) return false;
|
||||
// C2018-007: When performing more than a single procedure approval (approve all or some), only prompt once whether to include
|
||||
// Summary of Changes (use the following 2 flags, code using them is below)
|
||||
// C2022-022: Moved the prompt once for Summary of changes out of loop and allow user to cancel, go back to approval dialog
|
||||
bool doSumChg = false;
|
||||
DialogResult doSumChgDR = FlexibleMessageBox.Show("Do you want to save the Summary of Changes along with the Approved PDF?\r\n\r\nSelecting 'Cancel' will cancel the approval process.", "Create Summary of Changes", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);// == DialogResult.Yes;
|
||||
if (doSumChgDR == DialogResult.Cancel) return false;
|
||||
doSumChg = doSumChgDR == DialogResult.Yes;
|
||||
bool doSumChg = doSumChgDR == DialogResult.Yes;
|
||||
List<string> procsApproved = new List<string>();
|
||||
foreach (ApprovalProcedure ap in MyProcedures)
|
||||
{
|
||||
@@ -1186,9 +917,8 @@ namespace VEPROMS
|
||||
//B2026-058 - If approving multiple procedures at the same time with a multiunit set and one of the procedures is open, PROMS sometimes loses that it is set for an individual unit.
|
||||
ap.ProcInfo.MyDocVersion.DocVersionConfig.SelectedSlave = SavedSlave;
|
||||
}
|
||||
procsApproved.Add(ap.ProcInfo.DisplayNumber + " " + ap.ProcInfo.DisplayText);
|
||||
procsApproved.Add($"{ap.ProcInfo.DisplayNumber} {ap.ProcInfo.DisplayText}");
|
||||
RevisionInfo ric = pi.MyDocVersion.DocVersionConfig.SelectedSlave > 0 ? RevisionInfo.GetCurrentByItemIDandUnitID(pi.ItemID, pi.MyDocVersion.DocVersionConfig.SelectedSlave) : RevisionInfo.GetCurrentByItemID(pi.ItemID);
|
||||
// RevisionInfo rip = RevisionInfo.GetPreviousByItemID(pi.ItemID);
|
||||
DateTime myDTS = pi.DTS; // pi.DTS is date of last approval
|
||||
string cbDTS = (pi.MyConfig as ProcedureConfig).Print_ChangeBarDate;
|
||||
// pi.DTS was the field that was used to store the approval date before master/slave code was added. Use ChangeBarDate if it is set - this is set either manually if no approval date (from treeview menu) or
|
||||
@@ -1203,7 +933,6 @@ namespace VEPROMS
|
||||
if (ap.RevNumber == ric.RevisionNumber)
|
||||
{
|
||||
myDTS = ric.MyConfig.History_StartDate;
|
||||
//UpdateProcedureDTS(pi, myDTS);
|
||||
}
|
||||
// New approval, i.e. not same revision number, use the date from the latest approved version
|
||||
else
|
||||
@@ -1211,26 +940,24 @@ namespace VEPROMS
|
||||
myDTS = ric.LatestVersion.DTS; // B2019-051: Extra info in Change Summary. Use the last 'approved' (ric.LatestVersion.MyStage.IsApproved==1)
|
||||
}
|
||||
}
|
||||
Revision revision = null;
|
||||
Revision revision;
|
||||
if (ap.ProcInfo.MyDocVersion.DocVersionConfig.SelectedSlave > 0)
|
||||
{
|
||||
revision = Revision.GetByItemIDAndRevisionNumberAndUnitID(pi.ItemID, ap.RevNumber, ap.ProcInfo.MyDocVersion.DocVersionConfig.SelectedSlave);
|
||||
if (revision == null) // no revision yet, need to set the StartDate & which slave
|
||||
{
|
||||
RevisionConfig cfg = new RevisionConfig();
|
||||
cfg.History_StartDate = myDTS; // if there is a slave, date found from above code
|
||||
cfg.Applicability_Index = ap.ProcInfo.MyDocVersion.DocVersionConfig.SelectedSlave;
|
||||
//cfg.Save();
|
||||
RevisionConfig cfg = new RevisionConfig
|
||||
{
|
||||
History_StartDate = myDTS, // if there is a slave, date found from above code
|
||||
Applicability_Index = ap.ProcInfo.MyDocVersion.DocVersionConfig.SelectedSlave
|
||||
};
|
||||
revision = Revision.MakeRevision(pi.ItemID, RevType, ap.RevNumber, ap.RevDate, RevNote, cfg.ToString(), now, Volian.Base.Library.VlnSettings.UserID);
|
||||
// revision.MyConfig.History_StartDate = pi.DTS;
|
||||
// revision.MyConfig.Save();
|
||||
// revision = revision.Save();
|
||||
}
|
||||
else if (revision.Notes != RevNote || revision.RevisionDate != ap.RevDate)
|
||||
{
|
||||
//C2016-036 - Inform the user that an existing approved version will be replaced
|
||||
//C2022-016 - Improve/clarify the dialog message
|
||||
if (MessageBox.Show("Replace Existing Revision " + ap.RevNumber + "?\r\n\r\nTo create a new revision, click Cancel then change\r\nthe Rev. Number.", "Replace Existing", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel)
|
||||
if (MessageBox.Show($"Replace Existing Revision {ap.RevNumber}?\r\n\r\nTo create a new revision, click Cancel then change\r\nthe Rev. Number.", "Replace Existing", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel)
|
||||
return false;
|
||||
revision.Notes = RevNote;
|
||||
revision.RevisionDate = ap.RevDate;
|
||||
@@ -1245,19 +972,17 @@ namespace VEPROMS
|
||||
// went wrong, the revision could be created but not the version. Added the count check below.
|
||||
if (revision == null || revision.RevisionVersionCount==0) // no revision yet, need to set the StartDate. If there is a revision, it uses the revision date as the startdate
|
||||
{
|
||||
RevisionConfig cfg = new RevisionConfig();
|
||||
cfg.History_StartDate = pi.DTS; // todo: this should probably be myDTS, found during fix of B2019-051.
|
||||
//cfg.Save();
|
||||
RevisionConfig cfg = new RevisionConfig
|
||||
{
|
||||
History_StartDate = pi.DTS // todo: this should probably be myDTS, found during fix of B2019-051.
|
||||
};
|
||||
revision = Revision.MakeRevision(pi.ItemID, RevType, ap.RevNumber, ap.RevDate, RevNote, cfg.ToString(), now, Volian.Base.Library.VlnSettings.UserID);
|
||||
// revision.MyConfig.History_StartDate = pi.DTS;
|
||||
// revision.MyConfig.Save();
|
||||
// revision = revision.Save();
|
||||
}
|
||||
else if (revision.Notes != RevNote || revision.RevisionDate != ap.RevDate)
|
||||
{
|
||||
//C2016-036 - Inform the user that an existing approved version will be replaced
|
||||
//C2022-016 - Improve/clarify the dialog message
|
||||
if (MessageBox.Show("Replace Existing Revision " + ap.RevNumber + "?\r\n\r\nTo create a new revision, click Cancel then change\r\nthe Rev. Number.", "Replace Existing", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel)
|
||||
if (MessageBox.Show($"Replace Existing Revision {ap.RevNumber}?\r\n\r\nTo create a new revision, click Cancel then change\r\nthe Rev. Number.", "Replace Existing", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel)
|
||||
return false;
|
||||
revision.Notes = RevNote;
|
||||
revision.RevisionDate = ap.RevDate;
|
||||
@@ -1268,10 +993,7 @@ namespace VEPROMS
|
||||
//B2017-149 Allow the user to choose if they want the Summary of Changes report created during the approval process
|
||||
if (doSumChg) summaryBuf = CreateSummary(ref pi, summaryPDF, myDTS);
|
||||
DateTime currentDTS = now;
|
||||
Check check = Check.MakeCheck(revision, Stage.GetJustStage(RevStage), RevisionInfo.BuildRevisionChecks(pi), currentDTS, VlnSettings.UserID);
|
||||
//make pdf with promsprinter and get byte stream
|
||||
// Moved to end so that Item and Content are saved at the same time
|
||||
//UpdateProcedureConfig(pi, ap.RevNumber, ap.RevDate, myDTS);
|
||||
_ = Check.MakeCheck(revision, Stage.GetJustStage(RevStage), RevisionInfo.BuildRevisionChecks(pi), currentDTS, VlnSettings.UserID);
|
||||
string watermarkColor = "Blue"; // this is the default watermark color
|
||||
string waterMark = Stage.GetJustStage(RevStage).IsApproved > 0 ? null : Stage.GetJustStage(RevStage).Name;
|
||||
// C2022-004 - BNPP if doing an approval stage, and the format file uses the UseUnitWatermarkOnApproved format flag (<PrintData UseUnitWatermarkOnApproved = "true"\>)
|
||||
@@ -1281,39 +1003,14 @@ namespace VEPROMS
|
||||
waterMark = "Unit Designator";
|
||||
frmPDFStatusForm.SetUnitWatermark(MyProcedures[0].ProcInfo, ref waterMark, ref watermarkColor);
|
||||
}
|
||||
//ProcedureInfo myproc = pi;
|
||||
//frmPDFStatusForm frm = new frmPDFStatusForm(myproc, ap.RevNumber, /* revdate change: ap.RevDate.ToString("MM/dd/yyyy") ,*/ waterMark, false, false, ViewPDF, true, VlnSettings.TemporaryFolder, new ChangeBarDefinition(pi.MyDocVersion.MyConfig as DocVersionConfig, pi.ActiveFormat), pdfTmp, location);
|
||||
//myproc.ChangeBarDate = myDTS;
|
||||
frmPDFStatusForm frm = new frmPDFStatusForm(pi, ap.RevNumAndDate, /* revdate change: ap.RevDate.ToString("MM/dd/yyyy") ,*/ waterMark, false, false, ViewPDF, true, VlnSettings.TemporaryFolder, new ChangeBarDefinition(pi.MyDocVersion.MyConfig as DocVersionConfig, pi.ActiveFormat), pdfTmp, location, pi.MyDocVersion.DocVersionConfig.Print_AddBlankPagesWhenUsingDuplexFoldouts, true, "", false, 0, false,
|
||||
MyProcedures.Count > (MyProcedures[0].ProcInfo.MyDocVersion.Procedures.Count / 4), pi.MyDocVersion.DocVersionConfig.Print_DuplexBlankPageText, null, watermarkColor); // C2019-004: Allow user to define duplex lank page text at the docversion level
|
||||
frm.AllowAllWatermarks = true;
|
||||
frm.CloseWhenDone = !ViewPDF;
|
||||
frm.DocReplace = new Dictionary<int, byte[]>(); // will hold the Word Attachments with resolved ROs
|
||||
MyProcedures.Count > (MyProcedures[0].ProcInfo.MyDocVersion.Procedures.Count / 4), pi.MyDocVersion.DocVersionConfig.Print_DuplexBlankPageText, null, watermarkColor)
|
||||
{
|
||||
AllowAllWatermarks = true,
|
||||
CloseWhenDone = !ViewPDF,
|
||||
DocReplace = new Dictionary<int, byte[]>() // will hold the Word Attachments with resolved ROs
|
||||
}; // C2019-004: Allow user to define duplex lank page text at the docversion level
|
||||
frm.ShowDialog();
|
||||
//if (ap.ProcInfo.MyDocVersion.DocVersionConfig.SelectedSlave > 0)
|
||||
//{
|
||||
// using (ProcedureInfo myproc = ProcedureInfo.GetItemAndChildrenByUnit(pi.ItemID, 0, ap.ProcInfo.MyDocVersion.DocVersionConfig.SelectedSlave))
|
||||
// {
|
||||
// //frmPDFStatusForm frm = new frmPDFStatusForm(myproc, ap.RevNumber, /* revdate change: ap.RevDate.ToString("MM/dd/yyyy") ,*/ waterMark, false, false, ViewPDF, true, VlnSettings.TemporaryFolder, new ChangeBarDefinition(pi.MyDocVersion.MyConfig as DocVersionConfig, pi.ActiveFormat), pdfTmp, location);
|
||||
// myproc.ChangeBarDate = myDTS;
|
||||
// frmPDFStatusForm frm = new frmPDFStatusForm(myproc, ap.RevNumAndDate, /* revdate change: ap.RevDate.ToString("MM/dd/yyyy") ,*/ waterMark, false, false, ViewPDF, true, VlnSettings.TemporaryFolder, new ChangeBarDefinition(pi.MyDocVersion.MyConfig as DocVersionConfig, pi.ActiveFormat), pdfTmp, location);
|
||||
// frm.AllowAllWatermarks = true;
|
||||
// frm.CloseWhenDone = !ViewPDF;
|
||||
// frm.ShowDialog();
|
||||
// }
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// using (ProcedureInfo myproc = ProcedureInfo.GetItemAndChildren(pi.ItemID))
|
||||
// {
|
||||
// //frmPDFStatusForm frm = new frmPDFStatusForm(myproc, ap.RevNumber, /* revdate change: ap.RevDate.ToString("MM/dd/yyyy") ,*/ waterMark, false, false, ViewPDF, true, VlnSettings.TemporaryFolder, new ChangeBarDefinition(pi.MyDocVersion.MyConfig as DocVersionConfig, pi.ActiveFormat), pdfTmp, location);
|
||||
// myproc.ChangeBarDate = myDTS;
|
||||
// frmPDFStatusForm frm = new frmPDFStatusForm(myproc, ap.RevNumAndDate, /* revdate change: ap.RevDate.ToString("MM/dd/yyyy") ,*/ waterMark, false, false, ViewPDF, true, VlnSettings.TemporaryFolder, new ChangeBarDefinition(pi.MyDocVersion.MyConfig as DocVersionConfig, pi.ActiveFormat), pdfTmp, location);
|
||||
// frm.AllowAllWatermarks = true;
|
||||
// frm.CloseWhenDone = !ViewPDF;
|
||||
// frm.ShowDialog();
|
||||
// }
|
||||
//}
|
||||
FileInfo pdfFile = new FileInfo(pdfPath);
|
||||
FileStream fs = pdfFile.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
|
||||
byte[] buf = new byte[pdfFile.Length];
|
||||
@@ -1333,8 +1030,10 @@ namespace VEPROMS
|
||||
return false;
|
||||
}
|
||||
|
||||
dlgExportImport dlg = new dlgExportImport("Export", pi, MyFrmVEPROMS, (selectedSlave)); // "true tell export to convert ROs and Transitions to text
|
||||
dlg.DocReplace = frm.DocReplace; // this tells approval to prepare an export file with resolved transitions and ROs, word sections are saved with resolved ROs during approval PDF creation and saved in DocReplace
|
||||
dlgExportImport dlg = new dlgExportImport("Export", pi, MyFrmVEPROMS, (selectedSlave))
|
||||
{
|
||||
DocReplace = frm.DocReplace // this tells approval to prepare an export file with resolved transitions and ROs, word sections are saved with resolved ROs during approval PDF creation and saved in DocReplace
|
||||
}; // "true tell export to convert ROs and Transitions to text
|
||||
System.Xml.XmlDocument xd = new System.Xml.XmlDocument();
|
||||
dlg.ExportItem(xd, pi, "procedure");
|
||||
frm.DocReplace = dlg.DocReplace = null;
|
||||
@@ -1376,21 +1075,20 @@ namespace VEPROMS
|
||||
}
|
||||
else
|
||||
UpdateProcedureConfig(pi, ap.RevNumber, ap.RevDate, myDTS, selectedSlave);
|
||||
//UpdateProcedureDTS(pi, DateTime.Now);
|
||||
pi.MyDocVersion.DocVersionConfig.SelectedSlave = selectedSlave;
|
||||
}
|
||||
// C2019-019: Put out a complete message when approval is done.
|
||||
// C2020-024 Display a more descriptive end message
|
||||
if (procsApproved.Count > 0)
|
||||
{
|
||||
string msg = "";
|
||||
string msg;
|
||||
if (procsApproved.Count == (MyProcedures[0]).ProcInfo.MyDocVersion.Procedures.Count)
|
||||
msg = "All Procedures were Approved.";
|
||||
else
|
||||
{
|
||||
msg = "The following procedures were approved:\n";
|
||||
foreach (string prc in procsApproved)
|
||||
msg += "\n" + prc;
|
||||
msg += $"\n{prc}";
|
||||
}
|
||||
FlexibleMessageBox.Show( msg, "Approve Procedure(s)", MessageBoxButtons.OK);
|
||||
}
|
||||
@@ -1434,7 +1132,7 @@ namespace VEPROMS
|
||||
{
|
||||
while (!(ex is System.Data.SqlClient.SqlException) && ex.InnerException != null)
|
||||
ex = ex.InnerException;
|
||||
MessageBox.Show(ex.Message +"\r\n\r\nApproval will continue without the Summary of Change Report", ex.GetType().Name + " while trying to create Summary of Changes." , MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
MessageBox.Show(ex.Message +"\r\n\r\nApproval will continue without the Summary of Change Report", $"{ex.GetType().Name} while trying to create Summary of Changes.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1456,7 +1154,7 @@ namespace VEPROMS
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.AppendLine("Could not create");
|
||||
sb.AppendLine();
|
||||
sb.AppendLine(pdfFile + ".");
|
||||
sb.AppendLine($"{pdfFile}.");
|
||||
sb.AppendLine();
|
||||
sb.AppendLine("If it is open, close it then press the OK button.");
|
||||
if (cntr >= 3) // after two tries offer additional troubleshooting information
|
||||
@@ -1471,18 +1169,9 @@ namespace VEPROMS
|
||||
return true;
|
||||
}
|
||||
|
||||
private void UpdateProcedureDTS(ProcedureInfo pi, DateTime dts)
|
||||
{
|
||||
using (Item itm = Item.Get(pi.ItemID))
|
||||
{
|
||||
itm.DTS = dts;
|
||||
itm.Save();
|
||||
}
|
||||
}
|
||||
private void UpdateProcedureConfig(ProcedureInfo procedureInfo, string revNumber, DateTime revDate, DateTime dts, int selectedSlave)
|
||||
{
|
||||
ProcedureConfig pc = procedureInfo.MyConfig as ProcedureConfig;
|
||||
if (pc == null) return;
|
||||
if (!(procedureInfo.MyConfig is ProcedureConfig pc)) return;
|
||||
|
||||
pc.SelectedSlave = selectedSlave;
|
||||
pc.Print_Rev = revNumber;
|
||||
@@ -1492,7 +1181,6 @@ namespace VEPROMS
|
||||
using (Item itm = Item.Get(procedureInfo.ItemID))
|
||||
{
|
||||
itm.MyContent.Config = pc.ToString();
|
||||
//itm.DTS = dts;
|
||||
itm.UserID = Volian.Base.Library.VlnSettings.UserID;
|
||||
itm.Save();
|
||||
|
||||
@@ -1515,22 +1203,12 @@ namespace VEPROMS
|
||||
}
|
||||
public class RevType
|
||||
{
|
||||
private int _TypeID;
|
||||
public int TypeID
|
||||
{
|
||||
get { return _TypeID; }
|
||||
set { _TypeID = value; }
|
||||
}
|
||||
private string _TypeName;
|
||||
public string TypeName
|
||||
{
|
||||
get { return _TypeName; }
|
||||
set { _TypeName = value; }
|
||||
}
|
||||
public int TypeID { get; set; }
|
||||
public string TypeName { get; set; }
|
||||
public RevType(int i, string s)
|
||||
{
|
||||
_TypeID = i;
|
||||
_TypeName = s;
|
||||
TypeID = i;
|
||||
TypeName = s;
|
||||
}
|
||||
}
|
||||
public class RevTypes : List<RevType>
|
||||
@@ -1539,29 +1217,14 @@ namespace VEPROMS
|
||||
public delegate void DisplayConsistencyReportEvent(object sender, ConsistencyReportArgs args);
|
||||
public class ConsistencyReportArgs : EventArgs
|
||||
{
|
||||
private string _ReportName;
|
||||
public string ReportName
|
||||
{
|
||||
get { return _ReportName; }
|
||||
set { _ReportName = value; }
|
||||
}
|
||||
private ItemInfoList _MyItems;
|
||||
public ItemInfoList MyItems
|
||||
{
|
||||
get { return _MyItems; }
|
||||
set { _MyItems = value; }
|
||||
}
|
||||
private DocVersionInfo _MyDocVersion;
|
||||
public DocVersionInfo MyDocVersion
|
||||
{
|
||||
get { return _MyDocVersion; }
|
||||
set { _MyDocVersion = value; }
|
||||
}
|
||||
public string ReportName { get; set; }
|
||||
public ItemInfoList MyItems { get; set; }
|
||||
public DocVersionInfo MyDocVersion { get; set; }
|
||||
public ConsistencyReportArgs(string reportName, ItemInfoList myItems, DocVersionInfo myDocVerion)
|
||||
{
|
||||
_ReportName = reportName;
|
||||
_MyItems = myItems;
|
||||
_MyDocVersion = myDocVerion; //B2020-020 needed to pass in DocVersion to get paper size from format
|
||||
ReportName = reportName;
|
||||
MyItems = myItems;
|
||||
MyDocVersion = myDocVerion; //B2020-020 needed to pass in DocVersion to get paper size from format
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user