New form to handle Batch Refresh of Referenced Objects and Transitions

This commit is contained in:
Rich 2015-02-05 03:50:47 +00:00
parent 0303f4780d
commit d6544c0025
6 changed files with 1410 additions and 0 deletions

View File

@ -0,0 +1,476 @@
namespace VEPROMS
{
partial class frmBatchRefresh
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.scBatch = new System.Windows.Forms.SplitContainer();
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.rbBoth = new System.Windows.Forms.RadioButton();
this.label1 = new System.Windows.Forms.Label();
this.rbRefObj = new System.Windows.Forms.RadioButton();
this.rbTransition = new System.Windows.Forms.RadioButton();
this.myTV = new System.Windows.Forms.TreeView();
this.label2 = new System.Windows.Forms.Label();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.panel2 = new System.Windows.Forms.Panel();
this.txtProcess = new System.Windows.Forms.TextBox();
this.pbProcess = new System.Windows.Forms.ProgressBar();
this.label6 = new System.Windows.Forms.Label();
this.panel3 = new System.Windows.Forms.Panel();
this.pnlLater = new System.Windows.Forms.Panel();
this.label5 = new System.Windows.Forms.Label();
this.dtpTime = new System.Windows.Forms.DateTimePicker();
this.dtpDate = new System.Windows.Forms.DateTimePicker();
this.btnRefresh = new System.Windows.Forms.Button();
this.rbLater = new System.Windows.Forms.RadioButton();
this.rbNow = new System.Windows.Forms.RadioButton();
this.label4 = new System.Windows.Forms.Label();
this.txtResults = new System.Windows.Forms.TextBox();
this.panel1 = new System.Windows.Forms.Panel();
this.btnSave = new System.Windows.Forms.Button();
this.btnClear = new System.Windows.Forms.Button();
this.label3 = new System.Windows.Forms.Label();
this.btBatch = new DevComponents.DotNetBar.BalloonTip();
this.scBatch.Panel1.SuspendLayout();
this.scBatch.Panel2.SuspendLayout();
this.scBatch.SuspendLayout();
this.splitContainer2.Panel1.SuspendLayout();
this.splitContainer2.Panel2.SuspendLayout();
this.splitContainer2.SuspendLayout();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.panel2.SuspendLayout();
this.panel3.SuspendLayout();
this.pnlLater.SuspendLayout();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// scBatch
//
this.scBatch.Dock = System.Windows.Forms.DockStyle.Fill;
this.scBatch.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.scBatch.IsSplitterFixed = true;
this.scBatch.Location = new System.Drawing.Point(0, 0);
this.scBatch.Name = "scBatch";
//
// scBatch.Panel1
//
this.scBatch.Panel1.Controls.Add(this.splitContainer2);
//
// scBatch.Panel2
//
this.scBatch.Panel2.Controls.Add(this.splitContainer1);
this.scBatch.Size = new System.Drawing.Size(994, 472);
this.scBatch.SplitterDistance = 300;
this.scBatch.TabIndex = 1;
//
// splitContainer2
//
this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer2.Location = new System.Drawing.Point(0, 0);
this.splitContainer2.Name = "splitContainer2";
this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer2.Panel1
//
this.splitContainer2.Panel1.Controls.Add(this.rbBoth);
this.splitContainer2.Panel1.Controls.Add(this.label1);
this.splitContainer2.Panel1.Controls.Add(this.rbRefObj);
this.splitContainer2.Panel1.Controls.Add(this.rbTransition);
//
// splitContainer2.Panel2
//
this.splitContainer2.Panel2.Controls.Add(this.myTV);
this.splitContainer2.Panel2.Controls.Add(this.label2);
this.splitContainer2.Size = new System.Drawing.Size(300, 472);
this.splitContainer2.SplitterDistance = 107;
this.splitContainer2.TabIndex = 0;
//
// rbBoth
//
this.rbBoth.AutoSize = true;
this.rbBoth.Location = new System.Drawing.Point(12, 72);
this.rbBoth.Name = "rbBoth";
this.rbBoth.Size = new System.Drawing.Size(195, 17);
this.rbBoth.TabIndex = 2;
this.rbBoth.Text = "Transitions and Referenced Objects";
this.rbBoth.UseVisualStyleBackColor = true;
this.rbBoth.Click += new System.EventHandler(this.Options_Changed);
//
// label1
//
this.label1.BackColor = System.Drawing.SystemColors.ActiveCaption;
this.label1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.label1.Dock = System.Windows.Forms.DockStyle.Top;
this.label1.Location = new System.Drawing.Point(0, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(300, 23);
this.label1.TabIndex = 0;
this.label1.Text = "Options";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// rbRefObj
//
this.rbRefObj.AutoSize = true;
this.rbRefObj.Location = new System.Drawing.Point(12, 49);
this.rbRefObj.Name = "rbRefObj";
this.rbRefObj.Size = new System.Drawing.Size(144, 17);
this.rbRefObj.TabIndex = 1;
this.rbRefObj.Text = "Referenced Objects Only";
this.rbRefObj.UseVisualStyleBackColor = true;
this.rbRefObj.Click += new System.EventHandler(this.Options_Changed);
//
// rbTransition
//
this.rbTransition.AutoSize = true;
this.rbTransition.Checked = true;
this.rbTransition.Location = new System.Drawing.Point(12, 26);
this.rbTransition.Name = "rbTransition";
this.rbTransition.Size = new System.Drawing.Size(100, 17);
this.rbTransition.TabIndex = 0;
this.rbTransition.TabStop = true;
this.rbTransition.Text = "Transitions Only";
this.rbTransition.UseVisualStyleBackColor = true;
this.rbTransition.Click += new System.EventHandler(this.Options_Changed);
//
// myTV
//
this.myTV.CheckBoxes = true;
this.myTV.Dock = System.Windows.Forms.DockStyle.Fill;
this.myTV.Location = new System.Drawing.Point(0, 23);
this.myTV.Name = "myTV";
this.myTV.Size = new System.Drawing.Size(300, 338);
this.myTV.TabIndex = 4;
this.myTV.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.myTV_AfterCheck);
//
// label2
//
this.label2.BackColor = System.Drawing.SystemColors.ActiveCaption;
this.label2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.label2.Dock = System.Windows.Forms.DockStyle.Top;
this.label2.Location = new System.Drawing.Point(0, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(300, 23);
this.label2.TabIndex = 1;
this.label2.Text = "Selected Procedures Or Sets";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.panel2);
this.splitContainer1.Panel1.Controls.Add(this.label4);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.txtResults);
this.splitContainer1.Panel2.Controls.Add(this.panel1);
this.splitContainer1.Panel2.Controls.Add(this.label3);
this.splitContainer1.Size = new System.Drawing.Size(690, 472);
this.splitContainer1.SplitterDistance = 300;
this.splitContainer1.TabIndex = 0;
//
// panel2
//
this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel2.Controls.Add(this.txtProcess);
this.panel2.Controls.Add(this.pbProcess);
this.panel2.Controls.Add(this.label6);
this.panel2.Controls.Add(this.panel3);
this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel2.Location = new System.Drawing.Point(0, 23);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(300, 449);
this.panel2.TabIndex = 4;
//
// txtProcess
//
this.txtProcess.AcceptsReturn = true;
this.txtProcess.Dock = System.Windows.Forms.DockStyle.Fill;
this.txtProcess.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.txtProcess.Location = new System.Drawing.Point(0, 188);
this.txtProcess.Multiline = true;
this.txtProcess.Name = "txtProcess";
this.txtProcess.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.txtProcess.Size = new System.Drawing.Size(298, 259);
this.txtProcess.TabIndex = 5;
//
// pbProcess
//
this.pbProcess.Dock = System.Windows.Forms.DockStyle.Top;
this.pbProcess.Location = new System.Drawing.Point(0, 165);
this.pbProcess.Name = "pbProcess";
this.pbProcess.Size = new System.Drawing.Size(298, 23);
this.pbProcess.TabIndex = 6;
//
// label6
//
this.label6.BackColor = System.Drawing.SystemColors.ActiveCaption;
this.label6.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.label6.Dock = System.Windows.Forms.DockStyle.Top;
this.label6.Location = new System.Drawing.Point(0, 142);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(298, 23);
this.label6.TabIndex = 3;
this.label6.Text = "Process Status";
this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// panel3
//
this.panel3.Controls.Add(this.pnlLater);
this.panel3.Controls.Add(this.btnRefresh);
this.panel3.Controls.Add(this.rbLater);
this.panel3.Controls.Add(this.rbNow);
this.panel3.Dock = System.Windows.Forms.DockStyle.Top;
this.panel3.Location = new System.Drawing.Point(0, 0);
this.panel3.Name = "panel3";
this.panel3.Padding = new System.Windows.Forms.Padding(6);
this.panel3.Size = new System.Drawing.Size(298, 142);
this.panel3.TabIndex = 2;
//
// pnlLater
//
this.pnlLater.Controls.Add(this.label5);
this.pnlLater.Controls.Add(this.dtpTime);
this.pnlLater.Controls.Add(this.dtpDate);
this.pnlLater.Dock = System.Windows.Forms.DockStyle.Top;
this.pnlLater.Enabled = false;
this.pnlLater.Location = new System.Drawing.Point(6, 66);
this.pnlLater.Name = "pnlLater";
this.pnlLater.Padding = new System.Windows.Forms.Padding(6);
this.pnlLater.Size = new System.Drawing.Size(286, 37);
this.pnlLater.TabIndex = 3;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(155, 15);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(18, 13);
this.label5.TabIndex = 5;
this.label5.Text = "@";
//
// dtpTime
//
this.dtpTime.CustomFormat = "HH:mm";
this.dtpTime.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.dtpTime.Location = new System.Drawing.Point(179, 9);
this.dtpTime.Name = "dtpTime";
this.dtpTime.ShowUpDown = true;
this.dtpTime.Size = new System.Drawing.Size(98, 20);
this.dtpTime.TabIndex = 4;
//
// dtpDate
//
this.dtpDate.Format = System.Windows.Forms.DateTimePickerFormat.Short;
this.dtpDate.Location = new System.Drawing.Point(9, 9);
this.dtpDate.Name = "dtpDate";
this.dtpDate.Size = new System.Drawing.Size(140, 20);
this.dtpDate.TabIndex = 3;
//
// btnRefresh
//
this.btnRefresh.Dock = System.Windows.Forms.DockStyle.Bottom;
this.btnRefresh.Location = new System.Drawing.Point(6, 108);
this.btnRefresh.Name = "btnRefresh";
this.btnRefresh.Size = new System.Drawing.Size(286, 28);
this.btnRefresh.TabIndex = 1;
this.btnRefresh.Text = "Refresh selected option";
this.btnRefresh.UseVisualStyleBackColor = true;
this.btnRefresh.Click += new System.EventHandler(this.btnRefresh_Click);
//
// rbLater
//
this.rbLater.Dock = System.Windows.Forms.DockStyle.Top;
this.rbLater.Location = new System.Drawing.Point(6, 36);
this.rbLater.Name = "rbLater";
this.rbLater.Size = new System.Drawing.Size(286, 30);
this.rbLater.TabIndex = 2;
this.rbLater.Text = "Process Later";
this.rbLater.UseVisualStyleBackColor = true;
this.rbLater.CheckedChanged += new System.EventHandler(this.schedule_Click);
//
// rbNow
//
this.rbNow.Checked = true;
this.rbNow.Dock = System.Windows.Forms.DockStyle.Top;
this.rbNow.Location = new System.Drawing.Point(6, 6);
this.rbNow.Name = "rbNow";
this.rbNow.Size = new System.Drawing.Size(286, 30);
this.rbNow.TabIndex = 1;
this.rbNow.TabStop = true;
this.rbNow.Text = "Process Now";
this.rbNow.UseVisualStyleBackColor = true;
this.rbNow.CheckedChanged += new System.EventHandler(this.schedule_Click);
//
// label4
//
this.label4.BackColor = System.Drawing.SystemColors.ActiveCaption;
this.label4.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.label4.Dock = System.Windows.Forms.DockStyle.Top;
this.label4.Location = new System.Drawing.Point(0, 0);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(300, 23);
this.label4.TabIndex = 3;
this.label4.Text = "Process";
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// txtResults
//
this.txtResults.AcceptsReturn = true;
this.txtResults.Dock = System.Windows.Forms.DockStyle.Fill;
this.txtResults.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.txtResults.Location = new System.Drawing.Point(0, 52);
this.txtResults.Multiline = true;
this.txtResults.Name = "txtResults";
this.txtResults.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.txtResults.Size = new System.Drawing.Size(386, 420);
this.txtResults.TabIndex = 4;
//
// panel1
//
this.panel1.Controls.Add(this.btnSave);
this.panel1.Controls.Add(this.btnClear);
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
this.panel1.Location = new System.Drawing.Point(0, 23);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(386, 29);
this.panel1.TabIndex = 3;
//
// btnSave
//
this.btnSave.Dock = System.Windows.Forms.DockStyle.Left;
this.btnSave.Location = new System.Drawing.Point(95, 0);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(95, 29);
this.btnSave.TabIndex = 3;
this.btnSave.Text = "Save Results";
this.btnSave.UseVisualStyleBackColor = true;
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
//
// btnClear
//
this.btnClear.Dock = System.Windows.Forms.DockStyle.Left;
this.btnClear.Location = new System.Drawing.Point(0, 0);
this.btnClear.Name = "btnClear";
this.btnClear.Size = new System.Drawing.Size(95, 29);
this.btnClear.TabIndex = 2;
this.btnClear.Text = "Clear Results";
this.btnClear.UseVisualStyleBackColor = true;
this.btnClear.Click += new System.EventHandler(this.btnClear_Click);
//
// label3
//
this.label3.BackColor = System.Drawing.SystemColors.ActiveCaption;
this.label3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.label3.Dock = System.Windows.Forms.DockStyle.Top;
this.label3.Location = new System.Drawing.Point(0, 0);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(386, 23);
this.label3.TabIndex = 2;
this.label3.Text = "Results";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// btBatch
//
this.btBatch.AutoCloseTimeOut = 0;
this.btBatch.BalloonDisplaying += new System.EventHandler(this.btBatch_BalloonDisplaying);
//
// frmBatchRefresh
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(994, 472);
this.Controls.Add(this.scBatch);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "frmBatchRefresh";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Batch Refresh";
this.Load += new System.EventHandler(this.frmBatchRefresh_Load);
this.scBatch.Panel1.ResumeLayout(false);
this.scBatch.Panel2.ResumeLayout(false);
this.scBatch.ResumeLayout(false);
this.splitContainer2.Panel1.ResumeLayout(false);
this.splitContainer2.Panel1.PerformLayout();
this.splitContainer2.Panel2.ResumeLayout(false);
this.splitContainer2.ResumeLayout(false);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
this.splitContainer1.Panel2.PerformLayout();
this.splitContainer1.ResumeLayout(false);
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
this.panel3.ResumeLayout(false);
this.pnlLater.ResumeLayout(false);
this.pnlLater.PerformLayout();
this.panel1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer scBatch;
private System.Windows.Forms.RadioButton rbBoth;
private System.Windows.Forms.RadioButton rbRefObj;
private System.Windows.Forms.RadioButton rbTransition;
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.Button btnSave;
private System.Windows.Forms.Button btnClear;
private System.Windows.Forms.Button btnRefresh;
private System.Windows.Forms.SplitContainer splitContainer2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox txtResults;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Panel panel3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TreeView myTV;
private System.Windows.Forms.DateTimePicker dtpTime;
private System.Windows.Forms.DateTimePicker dtpDate;
private System.Windows.Forms.RadioButton rbLater;
private System.Windows.Forms.RadioButton rbNow;
private System.Windows.Forms.Panel pnlLater;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.TextBox txtProcess;
private System.Windows.Forms.ProgressBar pbProcess;
private DevComponents.DotNetBar.BalloonTip btBatch;
}
}

View File

@ -0,0 +1,404 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using VEPROMS.CSLA.Library;
namespace VEPROMS
{
public partial class frmBatchRefresh : Form
{
private SessionInfo _MySessionInfo;
public SessionInfo MySessionInfo
{
get { return _MySessionInfo; }
set { _MySessionInfo = value; }
}
public frmBatchRefresh()
{
InitializeComponent();
SetUpBalloons();
}
private void SetUpBalloons()
{
btBatch.SetBalloonCaption(rbTransition, "Transitions Only Guidance");
btBatch.SetBalloonText(rbTransition, "Occasionally, transitions do not get updated." + Environment.NewLine + Environment.NewLine + "This function will refresh transitions in all procedures selected below whether they were selected individually or as a group via a procedure set.");
btBatch.SetBalloonCaption(rbRefObj, "Referenced Objects Only Guidance");
btBatch.SetBalloonText(rbRefObj, "Occasionally, referenced objects do not get updated. One cause of this is a failure to allow the RO update to complete." + Environment.NewLine + Environment.NewLine + "This function will refresh referenced objects (based on the current ROFst) in all procedures selected below whether they were selected individually or as a group via a procedure set.");
btBatch.SetBalloonCaption(rbBoth, "Transitions and Referenced Objects Guidance");
btBatch.SetBalloonText(rbBoth, "Occasionally, transitions and referenced objects do not get updated." + Environment.NewLine + Environment.NewLine + "This function will refresh transitions and referenced objects (based on the current ROFst) in all procedures selected below whether they were selected individually or as a group via a procedure set.");
btBatch.SetBalloonCaption(rbNow, "Process Now Guidance");
btBatch.SetBalloonText(rbNow, "When the button below is pressed the process option selected (as indicated the the title of the button below) will be performed immediately. If during the process a procedure selected to be processed is checked out to a user, you will be notified." + Environment.NewLine + Environment.NewLine + "You will then be given the option of terminating the process without processing the procedures checked out or contacting the appropriate users to check in the procedures and then continue the process to completion.");
btBatch.SetBalloonCaption(rbLater, "Process Later Guidance");
btBatch.SetBalloonText(rbLater, "NOTE: It is highly recommended that this function be used on off hours" + Environment.NewLine + Environment.NewLine + "When the button below is pressed the process option selected (as indicated the the title of the button below) will be performed when the date and time set has arrived." + Environment.NewLine + Environment.NewLine + "If during the process a procedure selected to be processed is checked out to a user, the procedures will be forced checked in and the process will be allowed to complete.");
}
//private DocVersionInfoList myDVIL;
private Dictionary<TreeNode, ProcedureInfo> myProcedures = new Dictionary<TreeNode, ProcedureInfo>();
private void frmBatchRefresh_Load(object sender, EventArgs e)
{
Options_Changed(rbTransition, e);
ResetTV();
}
private void ResetTV()
{
myTV.Nodes.Clear();
FolderInfo fi = FolderInfo.GetTop();
TreeNode tn = myTV.Nodes.Add(fi.Name);
tn.Tag = fi;
if (fi.ChildFolderCount > 0)
LoadChildFolders(fi, tn);
if (myTV.SelectedNode != null)
myTV.SelectedNode.Expand();
}
private void LoadChildFolders(FolderInfo fi, TreeNode tn)
{
foreach (FolderInfo fic in fi.ChildFolders)
{
TreeNode tnc = tn.Nodes.Add(fic.Name);
tnc.Tag = fic;
if (fic.ChildFolderCount > 0)
LoadChildFolders(fic, tnc);
if (fic.FolderDocVersionCount > 0)
LoadDocVersions(fic, tnc);
}
}
private void LoadDocVersions(FolderInfo fic, TreeNode tnc)
{
foreach (DocVersionInfo dvi in fic.FolderDocVersions)
{
tnc.Tag = dvi;
if (dvi.Procedures.Count > 0)
LoadProcedures(dvi, tnc);
}
}
private void LoadProcedures(DocVersionInfo dvi, TreeNode tnc)
{
foreach (ProcedureInfo pi in dvi.Procedures)
{
TreeNode tn = tnc.Nodes.Add(string.Format("{0} {1}", pi.DisplayNumber, pi.DisplayText));
myProcedures.Add(tn, pi);
tn.Tag = pi;
}
}
private void LoadFolderInfo(FolderInfo f)
{
TreeNode tn = myTV.Nodes.Add(f.Name);
tn.Tag = f;
if (f.ChildFolderCount > 0)
foreach (FolderInfo cf in f.ChildFolders)
LoadFolderInfo(cf);
}
private void btnRefresh_Click(object sender, EventArgs e)
{
this.Cursor = Cursors.WaitCursor;
if (rbNow.Checked)
{
#region now
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();
pbProcess.Minimum = 0;
pbProcess.Maximum = pil.Count;
pbProcess.Step = 1;
while (pil.Count > 0)
{
ContentInfo.StaticContentInfoChange += new StaticContentInfoEvent(ContentInfo_StaticContentInfoChange);
StringBuilder sbProcs = new StringBuilder();
Queue<ProcedureInfo> piq = new Queue<ProcedureInfo>();
foreach (ProcedureInfo pi in pil)
piq.Enqueue(pi);
pil.Clear();
while (piq.Count > 0)
{
string msg = string.Empty;
ProcedureInfo pq = piq.Dequeue();
if (!MySessionInfo.CanCheckOutItem(pq.ItemID, CheckOutType.Procedure, ref msg))
{
pil.Add(pq);
sbProcs.AppendLine(msg);
}
else
{
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
}
else
{
#region later
long later = long.Parse(dtpDate.Value.ToString("yyyyMMdd") + dtpTime.Value.ToString("HHmm"));
long now = long.Parse(DateTime.Now.ToString("yyyyMMddHHmm"));
while (now < later)
{
txtProcess.Clear();
txtProcess.AppendText("Waiting...");
System.Threading.Thread.Sleep(60000);
now = long.Parse(DateTime.Now.ToString("yyyyMMddHHmm"));
}
List<ProcedureInfo> pil = new List<ProcedureInfo>();
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();
Queue<ProcedureInfo> piq = new Queue<ProcedureInfo>();
foreach (ProcedureInfo pi in pil)
piq.Enqueue(pi);
pil.Clear();
while (piq.Count > 0)
{
string msg = string.Empty;
ProcedureInfo pq = piq.Dequeue();
if (!MySessionInfo.CanCheckOutItem(pq.ItemID, CheckOutType.Procedure, ref msg))
{
pil.Add(pq);
sbProcs.AppendLine(msg);
}
else
{
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("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
}
this.Cursor = Cursors.Default;
MessageBox.Show("Batch Refresh Process Completed", "Batch Refresh Complete");
}
private void RefreshProcedureReferencedObjects(ProcedureInfo pq)
{
DateTime start = DateTime.Now;
myFixes = new StringBuilder();
ProcedureInfo.ResetROCounters();
ProcedureInfo.RefreshReferenceObjects(pq);
TimeSpan ts = DateTime.Now - start;
txtProcess.AppendText(string.Format("Procedure: {1}{0}, Checked {2} Referenced Objects{0}, Fixed {3} Referenced Objects{0}, Elapsed Seconds:{4}{0}", Environment.NewLine, pq.DisplayNumber, ProcedureInfo.ROCheckCount, ProcedureInfo.ROFixCount, ts.TotalSeconds));
txtProcess.AppendText(Environment.NewLine);
txtResults.AppendText(myFixes.ToString());
txtResults.AppendText(Environment.NewLine);
}
private TransitionInfoList transitionsToDisconnected;
private TransitionInfoList transitionsToNonEditable;
private void RefreshProcedureTransitions(ProcedureInfo pq)
{
DateTime start = DateTime.Now;
myFixes = new StringBuilder();
ProcedureInfo.ResetTranCounters();
ProcedureInfo.RefreshTransitions(pq, transitionsToDisconnected, transitionsToNonEditable);
TimeSpan ts = DateTime.Now - start;
txtProcess.AppendText(string.Format("Procedure: {1}{0}Checked {2} Transitions{0}Fixed {3} Transitions{0}Elapsed Seconds:{4}{0}", Environment.NewLine, pq.DisplayNumber, ProcedureInfo.TranCheckCount, ProcedureInfo.TranFixCount, ts.TotalSeconds));
txtProcess.AppendText(Environment.NewLine);
txtResults.AppendText(myFixes.ToString());
txtResults.AppendText(Environment.NewLine);
}
private void PopulateTransitionInfoLists(List<ProcedureInfo> pil)
{
Dictionary<int, int> dic = new Dictionary<int, int>();
StringBuilder sb = new StringBuilder();
foreach (ProcedureInfo pi in pil)
if (!dic.ContainsKey(pi.MyDocVersion.VersionID))
{
dic.Add(pi.MyDocVersion.VersionID, pi.MyDocVersion.VersionID);
sb.Append(sb.Length == 0 ? pi.MyDocVersion.VersionID.ToString() : "," + pi.MyDocVersion.VersionID.ToString());
}
txtProcess.AppendText("Preparing to process...");
txtProcess.AppendText(Environment.NewLine);
Application.DoEvents();
//transitionsToDisconnected = TransitionInfoList.GetTransitionsToDisconnected(sb.ToString());
transitionsToNonEditable = TransitionInfoList.GetTransitionsToNonEditable(sb.ToString());
}
private void ProgressBarShowText()
{
pbProcess.Refresh();
int percent = (int)(((double)(pbProcess.Value - pbProcess.Minimum) /
(double)(pbProcess.Maximum - pbProcess.Minimum)) * 100);
using (Graphics gr = pbProcess.CreateGraphics())
{
gr.DrawString(percent.ToString() + "%",
SystemFonts.DefaultFont,
Brushes.Black,
new PointF(pbProcess.Width / 2 - (gr.MeasureString(percent.ToString() + "%",
SystemFonts.DefaultFont).Width / 2.0F),
pbProcess.Height / 2 - (gr.MeasureString(percent.ToString() + "%",
SystemFonts.DefaultFont).Height / 2.0F)));
}
Application.DoEvents();
}
StringBuilder myFixes;
void ContentInfo_StaticContentInfoChange(object sender, StaticContentInfoEventArgs args)
{
if(args.Type == "TX")
myFixes.AppendLine(string.Format("Fixed Transition for {1}{0}Old Text: {2}{0}New Text: {3}{0}", Environment.NewLine, (sender as ItemInfo).ShortPath, args.OldValue, args.NewValue));
else if(args.Type == "RO")
myFixes.AppendLine(string.Format("Fixed Referenced Object for {1}{0}Old Text: {2}{0}New Text: {3}{0}", Environment.NewLine, (sender as ItemInfo).ShortPath, args.OldValue, args.NewValue));
}
private void btnClear_Click(object sender, EventArgs e)
{
txtResults.Clear();
}
private void btnSave_Click(object sender, EventArgs e)
{
SaveFileDialog sfd = new SaveFileDialog();
sfd.DefaultExt = "txt";
sfd.AddExtension = true;
sfd.Filter = "Text Files (*.txt)|*.txt";
sfd.FileName = string.Format("BatchRefreshResults_{0}", DateTime.Now.ToString("yyyyMMdd_HHmm"));
sfd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\VEPROMS";
DialogResult dr = sfd.ShowDialog();
if (dr == DialogResult.OK)
{
System.IO.StreamWriter sw = new System.IO.StreamWriter(sfd.FileName);
sw.Write(txtResults.Text);
sw.Close();
}
}
private void Options_Changed(object sender, EventArgs e)
{
if ((sender as RadioButton).Checked)
btnRefresh.Text = string.Format("Refresh {0}", (sender as RadioButton).Text);
}
private void myTV_AfterCheck(object sender, TreeViewEventArgs e)
{
if (e.Action != TreeViewAction.Unknown)
if(e.Node.Nodes.Count > 0)
CheckChildNodes(e.Node, e.Node.Checked);
}
private void CheckChildNodes(TreeNode treeNode, bool ischecked)
{
foreach (TreeNode tn in treeNode.Nodes)
{
tn.Checked = ischecked;
if (tn.Nodes.Count > 0)
CheckChildNodes(tn, ischecked);
}
}
private void schedule_Click(object sender, EventArgs e)
{
pnlLater.Enabled = rbLater.Checked;
}
private void btBatch_BalloonDisplaying(object sender, EventArgs e)
{
Point p = Control.MousePosition;
p.Offset(-btBatch.BalloonControl.TipOffset, btBatch.BalloonControl.TipLength + 4);
btBatch.BalloonControl.Location = p;
if (btBatch.BalloonTriggerControl == rbTransition)
{
}
else if (btBatch.BalloonTriggerControl == rbRefObj)
{
}
else if (btBatch.BalloonTriggerControl == rbBoth)
{
}
else if (btBatch.BalloonTriggerControl == rbNow)
{
}
else if (btBatch.BalloonTriggerControl == rbLater)
{
}
}
}
}

View File

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="btBatch.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>38</value>
</metadata>
</root>

View File

@ -0,0 +1,105 @@
namespace VEPROMS
{
partial class frmBatchRefreshCheckedOut
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmBatchRefreshCheckedOut));
this.label1 = new System.Windows.Forms.Label();
this.pnlList = new System.Windows.Forms.Panel();
this.tmrCheck = new System.Windows.Forms.Timer(this.components);
this.label2 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// label1
//
this.label1.BackColor = System.Drawing.SystemColors.ActiveCaption;
this.label1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.label1.Dock = System.Windows.Forms.DockStyle.Top;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(0, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(584, 34);
this.label1.TabIndex = 0;
this.label1.Text = "The following procedures could not be processed because they are checked out";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// pnlList
//
this.pnlList.AutoScroll = true;
this.pnlList.Dock = System.Windows.Forms.DockStyle.Top;
this.pnlList.Location = new System.Drawing.Point(0, 34);
this.pnlList.Name = "pnlList";
this.pnlList.Size = new System.Drawing.Size(584, 200);
this.pnlList.TabIndex = 1;
//
// tmrCheck
//
this.tmrCheck.Interval = 30000;
this.tmrCheck.Tick += new System.EventHandler(this.tmrCheck_Tick);
//
// label2
//
this.label2.BackColor = System.Drawing.SystemColors.ActiveCaption;
this.label2.Dock = System.Windows.Forms.DockStyle.Fill;
this.label2.Location = new System.Drawing.Point(0, 234);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(584, 128);
this.label2.TabIndex = 2;
this.label2.Text = resources.GetString("label2.Text");
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// frmBatchRefreshCheckedOut
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(584, 362);
this.Controls.Add(this.label2);
this.Controls.Add(this.pnlList);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "frmBatchRefreshCheckedOut";
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "Procedures Currently Checked Out";
this.TopMost = true;
this.Load += new System.EventHandler(this.frmBatchRefreshCheckedOut_Load);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmBatchRefreshCheckedOut_FormClosing);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Panel pnlList;
private System.Windows.Forms.Timer tmrCheck;
private System.Windows.Forms.Label label2;
}
}

View File

@ -0,0 +1,171 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using VEPROMS.CSLA.Library;
using LBOutlookLibrary;
using System.Reflection;
using System.Text.RegularExpressions;
using System.Net.Mail;
using System.Net;
using System.IO;
namespace VEPROMS
{
public partial class frmBatchRefreshCheckedOut : Form
{
private SessionInfo _MySessionInfo;
public SessionInfo MySessionInfo
{
get { return _MySessionInfo; }
set { _MySessionInfo = value; }
}
private List<ProcedureInfo> _CheckedOutProcedures;
public List<ProcedureInfo> CheckedOutProcedures
{
get { return _CheckedOutProcedures; }
set { _CheckedOutProcedures = value; }
}
public frmBatchRefreshCheckedOut()
{
InitializeComponent();
}
private void frmBatchRefreshCheckedOut_FormClosing(object sender, FormClosingEventArgs e)
{
Owner.Show();
}
private void frmBatchRefreshCheckedOut_Load(object sender, EventArgs e)
{
Owner.Hide();
foreach (ProcedureInfo pi in CheckedOutProcedures)
AddToDisplayList(pi);
tmrCheck.Enabled = true;
}
private void AddToDisplayList(ProcedureInfo pi)
{
Panel p = new Panel();
p.BorderStyle = BorderStyle.FixedSingle;
p.Dock = DockStyle.Top;
p.Height = 28;
Button b = new Button();
//b.FlatStyle = FlatStyle.Popup;
b.Dock = DockStyle.Right;
b.Text = "Force Check In";
b.Tag = pi;
b.Click += new EventHandler(ForceCheckIn_Click);
p.Controls.Add(b);
b = new Button();
//b.FlatStyle = FlatStyle.Popup;
b.Dock = DockStyle.Right;
b.Text = "Send Email";
b.Tag = pi;
b.Click += new EventHandler(SendEmail_Click);
p.Controls.Add(b);
Label l = new Label();
l.Dock = DockStyle.Fill;
l.TextAlign = ContentAlignment.MiddleLeft;
l.Text = string.Format("Procedure {0} is checked out to {1}", pi.DisplayNumber, UserInfo.GetByUserID(OwnerInfo.GetByItemID(pi.ItemID, CheckOutType.Procedure).SessionUserID).UserID);
p.Controls.Add(l);
pnlList.Controls.Add(p);
p.BringToFront();
pnlList.Focus();
}
void SendEmail_Click(object sender, EventArgs e)
{
ProcedureInfo pi = (sender as Button).Tag as ProcedureInfo;
OwnerInfo oi = OwnerInfo.GetByItemID(pi.ItemID, CheckOutType.Procedure);
UserInfo ui = UserInfo.GetByUserID(oi.SessionUserID);
UserConfig uc = new UserConfig(ui.Config);
string subject = "Please Check In A Procedure";
if (!SendOutlookEmail(uc.User_UserEmail, subject, BuildEmailMessageBody(pi)))
(sender as Button).Enabled = false;
}
private string BuildEmailMessageBody(ProcedureInfo pi)
{
StringBuilder body = new StringBuilder();
body.AppendLine("THIS IS A TEST MESSAGE FROM JIM BODINE");
body.AppendLine();
body.AppendLine(string.Format("I need you to check in procedure {0} so I can continue a batch refresh process", pi.DisplayNumber));
body.AppendLine();
body.AppendLine("Obviously, you do not really have this procedure checked out, so you really do not have to do anything.");
body.AppendLine();
body.AppendLine("However, I would appreciate it if you would reply to this email so I know the email worked");
body.AppendLine();
body.AppendLine("I will try NOT to overwhelm your email system :-)");
return body.ToString();
}
void ForceCheckIn_Click(object sender, EventArgs e)
{
ProcedureInfo pi = (sender as Button).Tag as ProcedureInfo;
OwnerInfo oi = OwnerInfo.GetByItemID(pi.ItemID, CheckOutType.Procedure);
UserInfo ui = UserInfo.GetByUserID(oi.SessionUserID);
UserConfig uc = new UserConfig(ui.Config);
MySessionInfo.CheckInItem(oi.OwnerID);
pnlList.Controls.Remove((sender as Button).Parent as Panel);
string subject = "A Procedure Was Forced Checked In";
SendOutlookEmail(uc.User_UserEmail, subject, BuildForcedMessageBody(pi));
}
private string BuildForcedMessageBody(ProcedureInfo pi)
{
StringBuilder body = new StringBuilder();
body.AppendLine("THIS IS A TEST MESSAGE FROM JIM BODINE");
body.AppendLine();
body.AppendLine(string.Format("I needed to force check in procedure {0} so I could continue a batch refresh process", pi.DisplayNumber));
body.AppendLine();
body.AppendLine("Obviously, you do not really have this procedure checked out, so nothing really got forced checked in.");
body.AppendLine();
body.AppendLine("However, I would appreciate it if you would reply to this email so I know the email worked");
body.AppendLine();
body.AppendLine("I will try NOT to overwhelm your email system :-)");
return body.ToString();
}
private bool SendOutlookEmail(string email, string subject, string body)
{
try
{
LBApplicationClass app = new LBApplicationClass();
LBMailItemClass msg = app.CreateMailItem();
msg.To = email;
msg.Subject = subject;
msg.BodyFormat = LBOlBodyFormat.olFormatPlain;
msg.Body = body;
msg.Send();
return true;
}
catch (Exception ex)
{
if (ex.Message.ToLower().Contains("failed due to the following error: 80080005"))
MessageBox.Show("You cannot send email via a running instance of Outlook from VE PROMS running from within Visual Studio.");
else
MessageBox.Show(string.Format("{0} - {1}", ex.GetType().Name, ex.Message));
return false;
}
}
private void tmrCheck_Tick(object sender, EventArgs e)
{
tmrCheck.Enabled = false;
string msg = string.Empty;
pnlList.Controls.Clear();
List<ProcedureInfo> tmp = new List<ProcedureInfo>();
foreach(ProcedureInfo pi in CheckedOutProcedures)
if (!MySessionInfo.CanCheckOutItem(pi.ItemID, CheckOutType.Procedure, ref msg))
tmp.Add(pi);
CheckedOutProcedures = tmp;
if (CheckedOutProcedures.Count == 0)
{
this.Close();
return;
}
foreach (ProcedureInfo pi in CheckedOutProcedures)
AddToDisplayList(pi);
tmrCheck.Enabled = true;
}
}
}

View File

@ -0,0 +1,128 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="tmrCheck.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<data name="label2.Text" xml:space="preserve">
<value>While this form is visible, there is a timer running that checks every 30 seconds to see if any of the above procedures have been checked in. You have the option of sending an email to the user asking them to close the procedure so you can finish the batch refresh process or you can force check in the procedure.
The recommended practice would be to send an email and wait to see if the user closes the procedure. If after an acceptable period of time, the procedure is still checked out, the forced check in step can be taken. When you select forced check in, an email will be sent to the user stating that the procedure was forced checked in.</value>
</data>
</root>