Added code to support converting to text transitions to external destinations with internal style transition

Added wait cursor for log running processes so application shows it is busy
Added stubs for adding Update RO Values to batch process.  Not functional yet
This commit is contained in:
Rich 2015-02-11 20:30:08 +00:00
parent 313cb28327
commit 481589c028
3 changed files with 305 additions and 142 deletions

View File

@ -2255,7 +2255,7 @@ namespace VEPROMS
else else
replacewith = string.Format("#Link:TransitionRange:{0} {1} {2} {3}", trantype, transitionid, toid, rangeid); replacewith = string.Format("#Link:TransitionRange:{0} {1} {2} {3}", trantype, transitionid, toid, rangeid);
cc.Text = cc.Text.Replace(lookfor, replacewith); cc.Text = cc.Text.Replace(lookfor, replacewith);
bool forceConvertToText; bool forceConvertToText = false;
SectionConfig sc = TransitionInfo.Get(tt.TransitionID).MyItemToID.ActiveSection.MyConfig as SectionConfig; SectionConfig sc = TransitionInfo.Get(tt.TransitionID).MyItemToID.ActiveSection.MyConfig as SectionConfig;
forceConvertToText = (sc.SubSection_Edit == "N"); forceConvertToText = (sc.SubSection_Edit == "N");
cc.FixTransitionText(TransitionInfo.Get(tt.TransitionID), forceConvertToText); cc.FixTransitionText(TransitionInfo.Get(tt.TransitionID), forceConvertToText);
@ -2284,9 +2284,22 @@ namespace VEPROMS
else else
replacewith = string.Format("#Link:TransitionRange:{0} {1} {2} {3}", trantype, transitionid, toid, rangeid); replacewith = string.Format("#Link:TransitionRange:{0} {1} {2} {3}", trantype, transitionid, toid, rangeid);
cc.Text = cc.Text.Replace(lookfor, replacewith); cc.Text = cc.Text.Replace(lookfor, replacewith);
bool forceConvertToText; bool forceConvertToText = false;
SectionConfig sc = TransitionInfo.Get(tt.TransitionID).MyItemToID.ActiveSection.MyConfig as SectionConfig; SectionConfig sc = TransitionInfo.Get(tt.TransitionID).MyItemToID.ActiveSection.MyConfig as SectionConfig;
forceConvertToText = (sc.SubSection_Edit == "N"); forceConvertToText = (sc.SubSection_Edit == "N");
if (!forceConvertToText) //check to see if external with internal format
{
TransitionInfo tran = TransitionInfo.Get(transitionid);
if (tran.MyContent.ContentItems[0].MyProcedure.ItemID != tran.MyItemToID.MyProcedure.ItemID)
if (!tran.MyContent.ContentItems[0].ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[tran.TranType].TransMenu.Contains("Proc"))
forceConvertToText = true;
}
if (!forceConvertToText) //check to see if external to different doc version
{
TransitionInfo tran = TransitionInfo.Get(transitionid);
if (tran.MyContent.ContentItems[0].MyDocVersion.VersionID != tran.MyItemToID.MyDocVersion.VersionID)
forceConvertToText = true;
}
cc.FixTransitionText(TransitionInfo.Get(tt.TransitionID), forceConvertToText); cc.FixTransitionText(TransitionInfo.Get(tt.TransitionID), forceConvertToText);
cc.Save(); cc.Save();
nd.InnerText = "done"; nd.InnerText = "done";

View File

@ -34,6 +34,7 @@ namespace VEPROMS
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.rbRefObj = new System.Windows.Forms.RadioButton(); this.rbRefObj = new System.Windows.Forms.RadioButton();
this.rbTransition = new System.Windows.Forms.RadioButton(); this.rbTransition = new System.Windows.Forms.RadioButton();
this.rbUpdate = new System.Windows.Forms.RadioButton();
this.myTV = new System.Windows.Forms.TreeView(); this.myTV = new System.Windows.Forms.TreeView();
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.splitContainer1 = new System.Windows.Forms.SplitContainer();
@ -103,13 +104,14 @@ namespace VEPROMS
this.splitContainer2.Panel1.Controls.Add(this.label1); this.splitContainer2.Panel1.Controls.Add(this.label1);
this.splitContainer2.Panel1.Controls.Add(this.rbRefObj); this.splitContainer2.Panel1.Controls.Add(this.rbRefObj);
this.splitContainer2.Panel1.Controls.Add(this.rbTransition); this.splitContainer2.Panel1.Controls.Add(this.rbTransition);
this.splitContainer2.Panel1.Controls.Add(this.rbUpdate);
// //
// splitContainer2.Panel2 // splitContainer2.Panel2
// //
this.splitContainer2.Panel2.Controls.Add(this.myTV); this.splitContainer2.Panel2.Controls.Add(this.myTV);
this.splitContainer2.Panel2.Controls.Add(this.label2); this.splitContainer2.Panel2.Controls.Add(this.label2);
this.splitContainer2.Size = new System.Drawing.Size(300, 472); this.splitContainer2.Size = new System.Drawing.Size(300, 472);
this.splitContainer2.SplitterDistance = 107; this.splitContainer2.SplitterDistance = 120;
this.splitContainer2.TabIndex = 0; this.splitContainer2.TabIndex = 0;
// //
// rbBoth // rbBoth
@ -119,7 +121,7 @@ namespace VEPROMS
this.rbBoth.Name = "rbBoth"; this.rbBoth.Name = "rbBoth";
this.rbBoth.Size = new System.Drawing.Size(195, 17); this.rbBoth.Size = new System.Drawing.Size(195, 17);
this.rbBoth.TabIndex = 2; this.rbBoth.TabIndex = 2;
this.rbBoth.Text = "Transitions and Referenced Objects"; this.rbBoth.Text = "Refresh Transitions and Referenced Objects";
this.rbBoth.UseVisualStyleBackColor = true; this.rbBoth.UseVisualStyleBackColor = true;
this.rbBoth.Click += new System.EventHandler(this.Options_Changed); this.rbBoth.Click += new System.EventHandler(this.Options_Changed);
// //
@ -142,23 +144,32 @@ namespace VEPROMS
this.rbRefObj.Name = "rbRefObj"; this.rbRefObj.Name = "rbRefObj";
this.rbRefObj.Size = new System.Drawing.Size(144, 17); this.rbRefObj.Size = new System.Drawing.Size(144, 17);
this.rbRefObj.TabIndex = 1; this.rbRefObj.TabIndex = 1;
this.rbRefObj.Text = "Referenced Objects Only"; this.rbRefObj.Text = "Refresh Referenced Objects Only";
this.rbRefObj.UseVisualStyleBackColor = true; this.rbRefObj.UseVisualStyleBackColor = true;
this.rbRefObj.Click += new System.EventHandler(this.Options_Changed); this.rbRefObj.Click += new System.EventHandler(this.Options_Changed);
// //
// rbTransition // rbTransition
// //
this.rbTransition.AutoSize = true; this.rbTransition.AutoSize = true;
this.rbTransition.Checked = true;
this.rbTransition.Location = new System.Drawing.Point(12, 26); this.rbTransition.Location = new System.Drawing.Point(12, 26);
this.rbTransition.Name = "rbTransition"; this.rbTransition.Name = "rbTransition";
this.rbTransition.Size = new System.Drawing.Size(100, 17); this.rbTransition.Size = new System.Drawing.Size(100, 17);
this.rbTransition.TabIndex = 0; this.rbTransition.TabIndex = 0;
this.rbTransition.TabStop = true; this.rbTransition.Text = "Refresh Transitions Only";
this.rbTransition.Text = "Transitions Only";
this.rbTransition.UseVisualStyleBackColor = true; this.rbTransition.UseVisualStyleBackColor = true;
this.rbTransition.Click += new System.EventHandler(this.Options_Changed); this.rbTransition.Click += new System.EventHandler(this.Options_Changed);
// //
// rbUpdate
//
this.rbUpdate.AutoSize = true;
this.rbUpdate.Location = new System.Drawing.Point(12, 94);
this.rbUpdate.Name = "rbUpdate";
this.rbUpdate.Size = new System.Drawing.Size(100, 17);
this.rbUpdate.TabIndex = 0;
this.rbUpdate.Text = "Update RO Values";
this.rbUpdate.UseVisualStyleBackColor = true;
this.rbUpdate.Click += new System.EventHandler(this.Options_Changed);
//
// myTV // myTV
// //
this.myTV.CheckBoxes = true; this.myTV.CheckBoxes = true;
@ -307,7 +318,7 @@ namespace VEPROMS
this.btnRefresh.Name = "btnRefresh"; this.btnRefresh.Name = "btnRefresh";
this.btnRefresh.Size = new System.Drawing.Size(286, 28); this.btnRefresh.Size = new System.Drawing.Size(286, 28);
this.btnRefresh.TabIndex = 1; this.btnRefresh.TabIndex = 1;
this.btnRefresh.Text = "Refresh selected option"; this.btnRefresh.Text = "NO OPTION SELECTED";
this.btnRefresh.UseVisualStyleBackColor = true; this.btnRefresh.UseVisualStyleBackColor = true;
this.btnRefresh.Click += new System.EventHandler(this.btnRefresh_Click); this.btnRefresh.Click += new System.EventHandler(this.btnRefresh_Click);
// //
@ -448,6 +459,7 @@ namespace VEPROMS
private System.Windows.Forms.RadioButton rbBoth; private System.Windows.Forms.RadioButton rbBoth;
private System.Windows.Forms.RadioButton rbRefObj; private System.Windows.Forms.RadioButton rbRefObj;
private System.Windows.Forms.RadioButton rbTransition; private System.Windows.Forms.RadioButton rbTransition;
private System.Windows.Forms.RadioButton rbUpdate;
private System.Windows.Forms.SplitContainer splitContainer1; private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.Button btnSave; private System.Windows.Forms.Button btnSave;
private System.Windows.Forms.Button btnClear; private System.Windows.Forms.Button btnClear;

View File

@ -6,6 +6,8 @@ using System.Drawing;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using VEPROMS.CSLA.Library; using VEPROMS.CSLA.Library;
using System.IO;
using Volian.Controls.Library;
namespace VEPROMS namespace VEPROMS
{ {
@ -38,42 +40,53 @@ namespace VEPROMS
} }
//private DocVersionInfoList myDVIL; //private DocVersionInfoList myDVIL;
private Dictionary<TreeNode, ProcedureInfo> myProcedures = new Dictionary<TreeNode, ProcedureInfo>(); private Dictionary<TreeNode, ProcedureInfo> myProcedures = new Dictionary<TreeNode, ProcedureInfo>();
private Dictionary<TreeNode, DocVersionInfo> myDocVersions = new Dictionary<TreeNode, DocVersionInfo>();
private void frmBatchRefresh_Load(object sender, EventArgs e) private void frmBatchRefresh_Load(object sender, EventArgs e)
{ {
Options_Changed(rbTransition, e); rbUpdate.Visible = false;
ResetTV(); //Options_Changed(rbTransition, e);
//ResetTV();
} }
private void ResetTV() private void ResetTV()
{ {
ResetTV(false);
}
private void ResetTV(bool noProcs)
{
this.Cursor = Cursors.WaitCursor;
myTV.Nodes.Clear(); myTV.Nodes.Clear();
FolderInfo fi = FolderInfo.GetTop(); FolderInfo fi = FolderInfo.GetTop();
TreeNode tn = myTV.Nodes.Add(fi.Name); TreeNode tn = myTV.Nodes.Add(fi.Name);
tn.Tag = fi; tn.Tag = fi;
if (fi.ChildFolderCount > 0) if (fi.ChildFolderCount > 0)
LoadChildFolders(fi, tn); LoadChildFolders(fi, tn, noProcs);
if (myTV.SelectedNode != null) if (myTV.SelectedNode != null)
myTV.SelectedNode.Expand(); myTV.SelectedNode.Expand();
this.Cursor = Cursors.Default;
} }
private void LoadChildFolders(FolderInfo fi, TreeNode tn) private void LoadChildFolders(FolderInfo fi, TreeNode tn, bool noProcs)
{ {
foreach (FolderInfo fic in fi.ChildFolders) foreach (FolderInfo fic in fi.ChildFolders)
{ {
TreeNode tnc = tn.Nodes.Add(fic.Name); TreeNode tnc = tn.Nodes.Add(fic.Name);
tnc.Tag = fic; tnc.Tag = fic;
if (fic.ChildFolderCount > 0) if (fic.ChildFolderCount > 0)
LoadChildFolders(fic, tnc); LoadChildFolders(fic, tnc, noProcs);
if (fic.FolderDocVersionCount > 0) if (fic.FolderDocVersionCount > 0)
LoadDocVersions(fic, tnc); LoadDocVersions(fic, tnc, noProcs);
} }
} }
private void LoadDocVersions(FolderInfo fic, TreeNode tnc) private void LoadDocVersions(FolderInfo fic, TreeNode tnc, bool noProcs)
{ {
foreach (DocVersionInfo dvi in fic.FolderDocVersions) foreach (DocVersionInfo dvi in fic.FolderDocVersions)
{ {
tnc.Tag = dvi; tnc.Tag = dvi;
myDocVersions.Add(tnc, dvi);
if (dvi.Procedures.Count > 0) if (!noProcs)
LoadProcedures(dvi, tnc); {
if (dvi.Procedures.Count > 0)
LoadProcedures(dvi, tnc);
}
} }
} }
private void LoadProcedures(DocVersionInfo dvi, TreeNode tnc) private void LoadProcedures(DocVersionInfo dvi, TreeNode tnc)
@ -95,82 +108,191 @@ namespace VEPROMS
} }
private void btnRefresh_Click(object sender, EventArgs e) private void btnRefresh_Click(object sender, EventArgs e)
{ {
if (btnRefresh.Text == "NO OPTION SELECTED")
{
MessageBox.Show("You must select an option under the Option panel", btnRefresh.Text);
return;
}
this.Cursor = Cursors.WaitCursor; this.Cursor = Cursors.WaitCursor;
if (rbNow.Checked) if (rbNow.Checked)
{ {
#region now #region now
List<ProcedureInfo> pil = new List<ProcedureInfo>(); if (rbUpdate.Checked)
foreach (TreeNode tn in myProcedures.Keys)
if (tn.Checked)
pil.Add(myProcedures[tn]);
PopulateTransitionInfoLists(pil);
DateTime pStart = DateTime.Now;
txtProcess.AppendText(pStart.ToString("MM/dd/yyyy @ HH:mm"));
txtProcess.AppendText(Environment.NewLine);
txtProcess.AppendText(Environment.NewLine);
Application.DoEvents();
pbProcess.Minimum = 0;
pbProcess.Maximum = pil.Count;
pbProcess.Step = 1;
while (pil.Count > 0)
{ {
ContentInfo.StaticContentInfoChange += new StaticContentInfoEvent(ContentInfo_StaticContentInfoChange); List<DocVersionInfo> dvil = new List<DocVersionInfo>();
StringBuilder sbProcs = new StringBuilder(); foreach(TreeNode tn in myDocVersions.Keys)
Queue<ProcedureInfo> piq = new Queue<ProcedureInfo>(); if (tn.Checked)
foreach (ProcedureInfo pi in pil) dvil.Add(myDocVersions[tn]);
piq.Enqueue(pi); DateTime pStart = DateTime.Now;
pil.Clear(); txtProcess.AppendText(pStart.ToString("MM/dd/yyyy @ HH:mm"));
while (piq.Count > 0) txtProcess.AppendText(Environment.NewLine);
txtProcess.AppendText(Environment.NewLine);
Application.DoEvents();
pbProcess.Minimum = 0;
pbProcess.Maximum = dvil.Count;
pbProcess.Step = 1;
while (dvil.Count > 0)
{ {
string msg = string.Empty; StringBuilder sbDocVersions = new StringBuilder();
ProcedureInfo pq = piq.Dequeue(); Queue<DocVersionInfo> dviq = new Queue<DocVersionInfo>();
if (!MySessionInfo.CanCheckOutItem(pq.ItemID, CheckOutType.Procedure, ref msg)) foreach (DocVersionInfo dvi in dvil)
dviq.Enqueue(dvi);
dvil.Clear();
while (dviq.Count > 0)
{ {
pil.Add(pq); string msg = string.Empty;
sbProcs.AppendLine(msg); DocVersionInfo dq = dviq.Dequeue();
} if (!MySessionInfo.CanCheckOutItem(dq.VersionID, CheckOutType.DocVersion, ref msg))
else
{
if (rbTransition.Checked)
{ {
RefreshProcedureTransitions(pq); dvil.Add(dq);
} sbDocVersions.AppendLine(msg);
else if (rbRefObj.Checked)
{
RefreshProcedureReferencedObjects(pq);
} }
else else
{ {
RefreshProcedureTransitions(pq); //InitialProgressBarMessage = "Updating ROs";
RefreshProcedureReferencedObjects(pq); if (dq.DocVersionAssociationCount < 1)
{
//FinalProgressBarMessage = "No ROs associated";
MessageBox.Show("Error Updating ro.fst. No associated ro.fst");
return;
}
ROFstInfo roFstInfo = dq.DocVersionAssociations[0].MyROFst;
string rofstPath = roFstInfo.MyRODb.FolderPath + @"\ro.fst";
if (!File.Exists(rofstPath))
{
//FinalProgressBarMessage = "No existing RO.FST";
MessageBox.Show("No existing ro.fst in path " + roFstInfo.MyRODb.FolderPath + ". Check for invalid path");
return;
}
FileInfo fiRofst = new FileInfo(rofstPath);
if (roFstInfo.DTS == fiRofst.LastWriteTimeUtc)
{
//FinalProgressBarMessage = "RO.FST up to date";
MessageBox.Show("ro.fst files are same for path " + roFstInfo.MyRODb.FolderPath + ", import of that ro.fst will not be done");
return;
}
if (roFstInfo.DTS > fiRofst.LastWriteTimeUtc)
{
//FinalProgressBarMessage = "RO.FST is older";
MessageBox.Show("Cannot copy older ro.fst from " + roFstInfo.MyRODb.FolderPath + ", import of that ro.fst will not be done");
return;
}
Cursor = Cursors.WaitCursor;
using (DocVersion dv = DocVersion.Get(dq.VersionID))
{
roFstInfo.ROTableUpdate += new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate);
ROFst newrofst = ROFstInfo.UpdateRoFst(roFstInfo.MyRODb, dv.DocVersionAssociations[0], dv, roFstInfo, null);// DoProgressBarRefresh);
roFstInfo.ROTableUpdate -= new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate);
//StepPanelTabDisplayEventArgs args = new StepPanelTabDisplayEventArgs("DisplayROUpdateROFST");
//MyEditItem.MyStepPanel.OnTabDisplay(sender, args);
//btnUpdROVal.Enabled = false;
}
Cursor = Cursors.Default;
//FinalProgressBarMessage = "ROs values updated";
pbProcess.PerformStep();
Application.DoEvents();
} }
pbProcess.PerformStep(); }
Application.DoEvents(); DateTime pEnd = DateTime.Now;
txtProcess.AppendText(pEnd.ToString("mm/dd/yyyy @ HH:mm"));
Application.DoEvents();
if (dvil.Count > 0)
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("The batch update process was not usccessful for all working drafts selected.");
sb.AppendLine("The following working drafts were not able to be refreshed...");
sb.AppendLine();
sb.AppendLine(sbDocVersions.ToString());
sb.AppendLine();
sb.AppendLine("If you want to update these working drafts, please contact the respective users and have them close any procedures in the working draft.");
sb.AppendLine("Once this is complete you can continue the process otherwise you may terminate the process immediately.");
sb.AppendLine();
sb.AppendLine("Have you requested the users to close the procedures and do you want to continue the process?");
frmBatchRefreshCheckedOut frmCO = new frmBatchRefreshCheckedOut();
frmCO.MySessionInfo = MySessionInfo;
//frmCO.CheckedOutProcedures = dvil;
frmCO.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - frmCO.Width, Screen.PrimaryScreen.WorkingArea.Height - frmCO.Height);
frmCO.Show(this);
while (!this.Visible)
Application.DoEvents();
} }
} }
ContentInfo.StaticContentInfoChange -= new StaticContentInfoEvent(ContentInfo_StaticContentInfoChange); }
DateTime pEnd = DateTime.Now; else
txtProcess.AppendText(pEnd.ToString("mm/dd/yyyy @ HH:mm")); {
List<ProcedureInfo> pil = new List<ProcedureInfo>();
foreach (TreeNode tn in myProcedures.Keys)
if (tn.Checked)
pil.Add(myProcedures[tn]);
PopulateTransitionInfoLists(pil);
DateTime pStart = DateTime.Now;
txtProcess.AppendText(pStart.ToString("MM/dd/yyyy @ HH:mm"));
txtProcess.AppendText(Environment.NewLine);
txtProcess.AppendText(Environment.NewLine);
Application.DoEvents(); Application.DoEvents();
if (pil.Count > 0) pbProcess.Minimum = 0;
pbProcess.Maximum = pil.Count;
pbProcess.Step = 1;
while (pil.Count > 0)
{ {
StringBuilder sb = new StringBuilder(); ContentInfo.StaticContentInfoChange += new StaticContentInfoEvent(ContentInfo_StaticContentInfoChange);
sb.AppendLine("The batch refresh process was not usccessful for all procedures selected."); StringBuilder sbProcs = new StringBuilder();
sb.AppendLine("The following procedures were not able to be refreshed..."); Queue<ProcedureInfo> piq = new Queue<ProcedureInfo>();
sb.AppendLine(); foreach (ProcedureInfo pi in pil)
sb.AppendLine(sbProcs.ToString()); piq.Enqueue(pi);
sb.AppendLine(); pil.Clear();
sb.AppendLine("If you want to refresh these prcoedures, please contact the respective users and have them close the procedures."); while (piq.Count > 0)
sb.AppendLine("Once this is complete you can continue the process otherwise you may terminate the process immediately."); {
sb.AppendLine(); string msg = string.Empty;
sb.AppendLine("Have you requested the users to close the procedures and do you want to continue the process?"); ProcedureInfo pq = piq.Dequeue();
frmBatchRefreshCheckedOut frmCO = new frmBatchRefreshCheckedOut(); if (!MySessionInfo.CanCheckOutItem(pq.ItemID, CheckOutType.Procedure, ref msg))
frmCO.MySessionInfo = MySessionInfo; {
frmCO.CheckedOutProcedures = pil; pil.Add(pq);
frmCO.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - frmCO.Width, Screen.PrimaryScreen.WorkingArea.Height - frmCO.Height); sbProcs.AppendLine(msg);
frmCO.Show(this); }
while (!this.Visible) else
Application.DoEvents(); {
if (rbTransition.Checked)
{
RefreshProcedureTransitions(pq);
}
else if (rbRefObj.Checked)
{
RefreshProcedureReferencedObjects(pq);
}
else
{
RefreshProcedureTransitions(pq);
RefreshProcedureReferencedObjects(pq);
}
pbProcess.PerformStep();
Application.DoEvents();
}
}
ContentInfo.StaticContentInfoChange -= new StaticContentInfoEvent(ContentInfo_StaticContentInfoChange);
DateTime pEnd = DateTime.Now;
txtProcess.AppendText(pEnd.ToString("mm/dd/yyyy @ HH:mm"));
Application.DoEvents();
if (pil.Count > 0)
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("The batch refresh process was not usccessful for all procedures selected.");
sb.AppendLine("The following procedures were not able to be refreshed...");
sb.AppendLine();
sb.AppendLine(sbProcs.ToString());
sb.AppendLine();
sb.AppendLine("If you want to refresh these prcoedures, please contact the respective users and have them close the procedures.");
sb.AppendLine("Once this is complete you can continue the process otherwise you may terminate the process immediately.");
sb.AppendLine();
sb.AppendLine("Have you requested the users to close the procedures and do you want to continue the process?");
frmBatchRefreshCheckedOut frmCO = new frmBatchRefreshCheckedOut();
frmCO.MySessionInfo = MySessionInfo;
frmCO.CheckedOutProcedures = pil;
frmCO.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - frmCO.Width, Screen.PrimaryScreen.WorkingArea.Height - frmCO.Height);
frmCO.Show(this);
while (!this.Visible)
Application.DoEvents();
}
} }
} }
#endregion #endregion
@ -187,77 +309,83 @@ namespace VEPROMS
System.Threading.Thread.Sleep(60000); System.Threading.Thread.Sleep(60000);
now = long.Parse(DateTime.Now.ToString("yyyyMMddHHmm")); now = long.Parse(DateTime.Now.ToString("yyyyMMddHHmm"));
} }
List<ProcedureInfo> pil = new List<ProcedureInfo>(); if (rbUpdate.Checked)
foreach (TreeNode tn in myProcedures.Keys)
if (tn.Checked)
pil.Add(myProcedures[tn]);
DateTime pStart = DateTime.Now;
txtProcess.AppendText(Environment.NewLine);
txtProcess.AppendText(pStart.ToString("mm/dd/yyyy @ HH:mm"));
txtProcess.AppendText(Environment.NewLine);
txtProcess.AppendText(Environment.NewLine);
Application.DoEvents();
pbProcess.Minimum = 0;
pbProcess.Maximum = pil.Count;
pbProcess.Step = 1;
while (pil.Count > 0)
{ {
ContentInfo.StaticContentInfoChange += new StaticContentInfoEvent(ContentInfo_StaticContentInfoChange); }
StringBuilder sbProcs = new StringBuilder(); else
Queue<ProcedureInfo> piq = new Queue<ProcedureInfo>(); {
foreach (ProcedureInfo pi in pil) List<ProcedureInfo> pil = new List<ProcedureInfo>();
piq.Enqueue(pi); foreach (TreeNode tn in myProcedures.Keys)
pil.Clear(); if (tn.Checked)
while (piq.Count > 0) pil.Add(myProcedures[tn]);
DateTime pStart = DateTime.Now;
txtProcess.AppendText(Environment.NewLine);
txtProcess.AppendText(pStart.ToString("MM/dd/yyyy @ HH:mm"));
txtProcess.AppendText(Environment.NewLine);
txtProcess.AppendText(Environment.NewLine);
Application.DoEvents();
pbProcess.Minimum = 0;
pbProcess.Maximum = pil.Count;
pbProcess.Step = 1;
while (pil.Count > 0)
{ {
string msg = string.Empty; ContentInfo.StaticContentInfoChange += new StaticContentInfoEvent(ContentInfo_StaticContentInfoChange);
ProcedureInfo pq = piq.Dequeue(); StringBuilder sbProcs = new StringBuilder();
if (!MySessionInfo.CanCheckOutItem(pq.ItemID, CheckOutType.Procedure, ref msg)) Queue<ProcedureInfo> piq = new Queue<ProcedureInfo>();
foreach (ProcedureInfo pi in pil)
piq.Enqueue(pi);
pil.Clear();
while (piq.Count > 0)
{ {
pil.Add(pq); string msg = string.Empty;
sbProcs.AppendLine(msg); ProcedureInfo pq = piq.Dequeue();
} if (!MySessionInfo.CanCheckOutItem(pq.ItemID, CheckOutType.Procedure, ref msg))
else
{
if (rbTransition.Checked)
{ {
RefreshProcedureTransitions(pq); pil.Add(pq);
} sbProcs.AppendLine(msg);
else if (rbRefObj.Checked)
{
RefreshProcedureReferencedObjects(pq);
} }
else else
{ {
RefreshProcedureTransitions(pq); if (rbTransition.Checked)
RefreshProcedureReferencedObjects(pq); {
RefreshProcedureTransitions(pq);
}
else if (rbRefObj.Checked)
{
RefreshProcedureReferencedObjects(pq);
}
else
{
RefreshProcedureTransitions(pq);
RefreshProcedureReferencedObjects(pq);
}
pbProcess.PerformStep();
Application.DoEvents();
} }
pbProcess.PerformStep(); }
ContentInfo.StaticContentInfoChange -= new StaticContentInfoEvent(ContentInfo_StaticContentInfoChange);
DateTime pEnd = DateTime.Now;
txtProcess.AppendText(pEnd.ToString("mm/dd/yyyy @ HH:mm"));
Application.DoEvents();
if (pil.Count > 0)
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("The batch refresh process was not usccessful for all procedures selected.");
sb.AppendLine("The following procedures were not able to be refreshed...");
sb.AppendLine();
sb.AppendLine(sbProcs.ToString());
sb.AppendLine();
sb.AppendLine("These procedures were forced checked in and the process was allowed to complete.");
foreach (ProcedureInfo pi in pil)
{
OwnerInfo oi = OwnerInfo.GetByItemID(pi.ItemID, CheckOutType.Procedure);
MySessionInfo.CheckInItem(oi.OwnerID);
}
txtProcess.AppendText(sb.ToString());
txtProcess.AppendText(Environment.NewLine);
Application.DoEvents(); Application.DoEvents();
} }
} }
ContentInfo.StaticContentInfoChange -= new StaticContentInfoEvent(ContentInfo_StaticContentInfoChange);
DateTime pEnd = DateTime.Now;
txtProcess.AppendText(pEnd.ToString("mm/dd/yyyy @ HH:mm"));
Application.DoEvents();
if (pil.Count > 0)
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("The batch refresh process was not usccessful for all procedures selected.");
sb.AppendLine("The following procedures were not able to be refreshed...");
sb.AppendLine();
sb.AppendLine(sbProcs.ToString());
sb.AppendLine();
sb.AppendLine("These procedures were forced checked in and the process was allowed to complete.");
foreach (ProcedureInfo pi in pil)
{
OwnerInfo oi = OwnerInfo.GetByItemID(pi.ItemID, CheckOutType.Procedure);
MySessionInfo.CheckInItem(oi.OwnerID);
}
txtProcess.AppendText(sb.ToString());
txtProcess.AppendText(Environment.NewLine);
Application.DoEvents();
}
} }
#endregion #endregion
} }
@ -291,7 +419,10 @@ namespace VEPROMS
txtResults.AppendText(myFixes.ToString()); txtResults.AppendText(myFixes.ToString());
txtResults.AppendText(Environment.NewLine); txtResults.AppendText(Environment.NewLine);
} }
public List<string> roFstInfo_ROTableUpdate(object sender, ROFstInfoROTableUpdateEventArgs args)
{
return VlnFlexGrid.ROTableUpdate(sender, args);
}
private void PopulateTransitionInfoLists(List<ProcedureInfo> pil) private void PopulateTransitionInfoLists(List<ProcedureInfo> pil)
{ {
Dictionary<int, int> dic = new Dictionary<int, int>(); Dictionary<int, int> dic = new Dictionary<int, int>();
@ -355,8 +486,15 @@ namespace VEPROMS
} }
private void Options_Changed(object sender, EventArgs e) private void Options_Changed(object sender, EventArgs e)
{ {
if ((sender as RadioButton).Checked) RadioButton rb = sender as RadioButton;
btnRefresh.Text = string.Format("Refresh {0}", (sender as RadioButton).Text); if (rb.Checked)
{
btnRefresh.Text = (sender as RadioButton).Text;
if (rb == rbUpdate)
ResetTV(true);
else
ResetTV();
}
} }
private void myTV_AfterCheck(object sender, TreeViewEventArgs e) private void myTV_AfterCheck(object sender, TreeViewEventArgs e)
{ {