Changed administrative tools drop down to DevComponents control
Added administrative tools of Identifying Disconnected Items and NonEditable Items Removed administrative tools CSLA methods since they were moved to AdminToolsExt. Added new module to handle administrative tools CSLA methods Added methods for administrative tools of Identifying Disconnected Items and NonEditable Items
This commit is contained in:
parent
8a2224a95b
commit
f8b9d03669
@ -33,7 +33,7 @@ namespace VEPROMS
|
||||
this.lblWarning = new System.Windows.Forms.Label();
|
||||
this.lblDescription = new System.Windows.Forms.Label();
|
||||
this.lblCaption = new System.Windows.Forms.Label();
|
||||
this.cbxAdminTools = new System.Windows.Forms.ComboBox();
|
||||
this.cbxAdminTools = new DevComponents.DotNetBar.Controls.ComboBoxEx();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.myTV = new System.Windows.Forms.TreeView();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
@ -140,12 +140,15 @@ namespace VEPROMS
|
||||
//
|
||||
// cbxAdminTools
|
||||
//
|
||||
this.cbxAdminTools.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cbxAdminTools.FlatStyle = System.Windows.Forms.FlatStyle.Standard;
|
||||
this.cbxAdminTools.FormattingEnabled = true;
|
||||
this.cbxAdminTools.Location = new System.Drawing.Point(5, 27);
|
||||
this.cbxAdminTools.Name = "cbxAdminTools";
|
||||
this.cbxAdminTools.Size = new System.Drawing.Size(290, 21);
|
||||
this.cbxAdminTools.TabIndex = 1;
|
||||
this.cbxAdminTools.WatermarkBehavior = DevComponents.DotNetBar.eWatermarkBehavior.HideNonEmpty;
|
||||
this.cbxAdminTools.WatermarkFont = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.cbxAdminTools.WatermarkText = "Select Adminstrative Tool";
|
||||
this.cbxAdminTools.SelectedIndexChanged += new System.EventHandler(this.cbxAdminTools_SelectedIndexChanged);
|
||||
//
|
||||
// label1
|
||||
@ -449,7 +452,7 @@ namespace VEPROMS
|
||||
private System.Windows.Forms.Label label6;
|
||||
private System.Windows.Forms.TextBox txtProcess;
|
||||
private System.Windows.Forms.ProgressBar pbProcess;
|
||||
private System.Windows.Forms.ComboBox cbxAdminTools;
|
||||
private DevComponents.DotNetBar.Controls.ComboBoxEx cbxAdminTools;
|
||||
private System.Windows.Forms.Label lblCaption;
|
||||
private System.Windows.Forms.Label lblDescription;
|
||||
private System.Windows.Forms.Label lblWarning;
|
||||
|
@ -28,15 +28,14 @@ namespace VEPROMS
|
||||
private AdminTool selectedAdminTool;
|
||||
private void SetUpAdminTools()
|
||||
{
|
||||
DevComponents.DotNetBar.BalloonTip bt = new BalloonTip();
|
||||
bt.SetBalloonCaption(cbxAdminTools, "Select Administrative Tool");
|
||||
bt.SetBalloonText(cbxAdminTools, "Use this combo box to select an Administrative Tool to execute");
|
||||
adminToolsList = new AdminTools();
|
||||
adminToolsList.Add("Update RO Values", "Update RO Values Guidance", "This allows the user to update referenced objects values for multiple working drafts in a batch mode.", "It is recommended that this be done during off hours.", "WARNING:", true, false, UpdateROValues);
|
||||
adminToolsList.Add("Refresh Referenced Objects", "Refresh Referenced Objects Guidance", "Occasionally, referenced objects do not get updated. One cause of this is a failure to allow the RO update to complete.\r\n\r\nThis 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.", "If more than one procedure is selected, it is recommened that this be performed during off hours.", "WARNING:", false, false, RefreshReferencedObjects);
|
||||
adminToolsList.Add("Refresh Transitions", "Refresh Transitions Guidance", "Occasionally, transitions do not get updated.\r\n\r\nThis function will refresh transitions in all procedures selected below whether they were selected individually or as a group via a procedure set.", "If more than one procedure is selected, it is recommened that this be performed during off hours.", "WARNING:", false, false, RefreshTransitions);
|
||||
adminToolsList.Add("Refresh Referenced Objects and Transitions", "Referenced Objects and Transitions Guidance", "Occasionally, referenced objects and transitions do not get updated." + Environment.NewLine + Environment.NewLine + "This function will refresh referenced objects and transitions (based on the current ROFst) in all procedures selected below whether they were selected individually or as a group via a procedure set.", "If more than one procedure is selected, it is recommened that this be performed during off hours.", "WARNING:", false, false, RefreshReferencedObjectsAndTransitions);
|
||||
adminToolsList.Add("Delete PDFs", "Delete PDFs Guidance", "It is sometimes desirable to clean up the database by removing extra pdf files. This process allows for this to occur", "", "", true, true, "vesp_DeletePDFs", DeletePDFs);
|
||||
adminToolsList.Add("Identify Disconnected Items", "Identify Disconnected Items Guidance", "Everything in PROMS is inter-related. A working draft knows what is its first procedure and a procedure knows what is its first step. Likewise, a procedure knows what procedure is before it and after it.\r\n\r\nOccasionally, an item will become disconnected and does not know where it fits into the relationships. This tool identifies whether the database has this condition.", "This tool may take an extended period of time to execute.", "NOTE:", true, true, "vesp_GetDisconnectedItemsCount", IdentifyDisconnectedItems);
|
||||
adminToolsList.Add("Identify Non-Editable Items", "Identify Non-Editable Items Guidance", "Typically, a section in PROMS only has sub-sections or sub-steps. There are times when a section has both. When this occurs, the sub-step data can be marked as non-editable. If this occurs, the user can no longer get to these steps and they can become forgotten.\r\n\r\nThis tool will identify if the database has non-editable steps and provide a listing of these steps.", "This tool may take an extended period of time to execute.", "NOTE:", true, true,"vesp_GetNonEditableItems", IdentifyNonEditableItems);
|
||||
cbxAdminTools.DataSource = adminToolsList;
|
||||
cbxAdminTools.DisplayMember = "Title";
|
||||
cbxAdminTools.SelectedIndex = -1;
|
||||
@ -388,7 +387,7 @@ namespace VEPROMS
|
||||
txtProcess.AppendText(Environment.NewLine);
|
||||
txtProcess.AppendText(Environment.NewLine);
|
||||
Application.DoEvents();
|
||||
int affectedRows = ExecuteStoredProcedure.Execute(selectedAdminTool.StoredProcedure);
|
||||
int affectedRows = ExecuteStoredProcedureRowsAffected.Execute(selectedAdminTool.StoredProcedure);
|
||||
txtProcess.AppendText(string.Format("Deleted {0} PDFs", affectedRows));
|
||||
txtProcess.AppendText(Environment.NewLine);
|
||||
txtProcess.AppendText(Environment.NewLine);
|
||||
@ -398,6 +397,60 @@ namespace VEPROMS
|
||||
this.Cursor = Cursors.Default;
|
||||
MessageBox.Show(string.Format("{0} Completed", selectedAdminTool.Title), string.Format("{0} Complete", selectedAdminTool.Title));
|
||||
}
|
||||
private void IdentifyDisconnectedItems()
|
||||
{
|
||||
this.Cursor = Cursors.WaitCursor;
|
||||
DateTime pStart = DateTime.Now;
|
||||
txtProcess.AppendText(pStart.ToString("MM/dd/yyyy @ HH:mm"));
|
||||
txtProcess.AppendText(Environment.NewLine);
|
||||
txtProcess.AppendText(Environment.NewLine);
|
||||
Application.DoEvents();
|
||||
int rowCount = ExecuteStoredProcedureRowCount.Execute(selectedAdminTool.StoredProcedure);
|
||||
txtProcess.AppendText(string.Format("Disconnected Items Count: {0}", rowCount));
|
||||
txtProcess.AppendText(Environment.NewLine);
|
||||
txtProcess.AppendText(Environment.NewLine);
|
||||
if (rowCount > 0)
|
||||
{
|
||||
txtResults.AppendText(string.Format("The database contains {0} disconnected items.", rowCount));
|
||||
txtResults.AppendText(Environment.NewLine);
|
||||
txtResults.AppendText(Environment.NewLine);
|
||||
txtResults.AppendText("It is recommended you contact Volian to assist in resolving this condition");
|
||||
}
|
||||
DateTime pEnd = DateTime.Now;
|
||||
txtProcess.AppendText(pEnd.ToString("MM/dd/yyyy @ HH:mm"));
|
||||
Application.DoEvents();
|
||||
this.Cursor = Cursors.Default;
|
||||
MessageBox.Show(string.Format("{0} Completed", selectedAdminTool.Title), string.Format("{0} Complete", selectedAdminTool.Title));
|
||||
}
|
||||
private void IdentifyNonEditableItems()
|
||||
{
|
||||
this.Cursor = Cursors.WaitCursor;
|
||||
DateTime pStart = DateTime.Now;
|
||||
txtProcess.AppendText(pStart.ToString("MM/dd/yyyy @ HH:mm"));
|
||||
txtProcess.AppendText(Environment.NewLine);
|
||||
txtProcess.AppendText(Environment.NewLine);
|
||||
Application.DoEvents();
|
||||
List<ItemInfo> myItems = ExecuteStoredProcedureItemInfoList.Execute(selectedAdminTool.StoredProcedure);
|
||||
txtProcess.AppendText(string.Format("Non-Editable Items Count: {0}",myItems.Count));
|
||||
txtProcess.AppendText(Environment.NewLine);
|
||||
txtProcess.AppendText(Environment.NewLine);
|
||||
if (myItems.Count > 0)
|
||||
{
|
||||
txtResults.AppendText("The following items are non-editable...");
|
||||
txtResults.AppendText(Environment.NewLine);
|
||||
txtResults.AppendText(Environment.NewLine);
|
||||
foreach (ItemInfo ii in myItems)
|
||||
{
|
||||
txtResults.AppendText(ii.Path);
|
||||
txtResults.AppendText(Environment.NewLine);
|
||||
}
|
||||
}
|
||||
DateTime pEnd = DateTime.Now;
|
||||
txtProcess.AppendText(pEnd.ToString("MM/dd/yyyy @ HH:mm"));
|
||||
Application.DoEvents();
|
||||
this.Cursor = Cursors.Default;
|
||||
MessageBox.Show(string.Format("{0} Completed", selectedAdminTool.Title), string.Format("{0} Complete", selectedAdminTool.Title));
|
||||
}
|
||||
private void btnRefresh_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (btnRefresh.Text == "NO OPTION SELECTED")
|
||||
@ -668,6 +721,7 @@ namespace VEPROMS
|
||||
lblWarning.Visible = selectedAdminTool.Warning.Length > 0;
|
||||
ResetTV(selectedAdminTool.NoProcedures);
|
||||
btnRefresh.Text = selectedAdminTool.Title;
|
||||
lblCaption.Focus();
|
||||
}
|
||||
}
|
||||
private void chkLater_CheckedChanged(object sender, EventArgs e)
|
||||
|
160
PROMS/VEPROMS.CSLA.Library/Extension/AdminToolsExt.cs
Normal file
160
PROMS/VEPROMS.CSLA.Library/Extension/AdminToolsExt.cs
Normal file
@ -0,0 +1,160 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using Csla;
|
||||
using Csla.Data;
|
||||
using Csla.Validation;
|
||||
|
||||
namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
public class ExecuteStoredProcedureRowsAffected : CommandBase
|
||||
{
|
||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
#region Factory Methods
|
||||
private string _StoredProcedure;
|
||||
public string StoredProcedure
|
||||
{
|
||||
get { return _StoredProcedure; }
|
||||
set { _StoredProcedure = value; }
|
||||
}
|
||||
private int _AffectedRows;
|
||||
public int AffectedRows
|
||||
{
|
||||
get { return _AffectedRows; }
|
||||
set { _AffectedRows = value; }
|
||||
}
|
||||
public static int Execute(string storedProcedure)
|
||||
{
|
||||
ExecuteStoredProcedureRowsAffected cmd = new ExecuteStoredProcedureRowsAffected();
|
||||
cmd.StoredProcedure = storedProcedure;
|
||||
DataPortal.Execute<ExecuteStoredProcedureRowsAffected>(cmd);
|
||||
return cmd.AffectedRows;
|
||||
}
|
||||
#endregion
|
||||
#region Server-Side code
|
||||
protected override void DataPortal_Execute()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
{
|
||||
using (SqlCommand cmd = new SqlCommand(StoredProcedure, cn))
|
||||
{
|
||||
cmd.CommandType = CommandType.StoredProcedure;
|
||||
cmd.CommandTimeout = 0;
|
||||
AffectedRows = cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ExecuteStoredProcedureRowsAffected Error", ex);
|
||||
throw new ApplicationException("Failure on ExecuteStoredProcedureRowsAffected", ex);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
public class ExecuteStoredProcedureRowCount : CommandBase
|
||||
{
|
||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
#region Factory Methods
|
||||
private string _StoredProcedure;
|
||||
public string StoredProcedure
|
||||
{
|
||||
get { return _StoredProcedure; }
|
||||
set { _StoredProcedure = value; }
|
||||
}
|
||||
private int _RowCount;
|
||||
public int RowCount
|
||||
{
|
||||
get { return _RowCount; }
|
||||
set { _RowCount = value; }
|
||||
}
|
||||
public static int Execute(string storedProcedure)
|
||||
{
|
||||
ExecuteStoredProcedureRowCount cmd = new ExecuteStoredProcedureRowCount();
|
||||
cmd.StoredProcedure = storedProcedure;
|
||||
DataPortal.Execute<ExecuteStoredProcedureRowCount>(cmd);
|
||||
return cmd.RowCount;
|
||||
}
|
||||
#endregion
|
||||
#region Server-Side code
|
||||
protected override void DataPortal_Execute()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
{
|
||||
using (SqlCommand cmd = new SqlCommand(StoredProcedure, cn))
|
||||
{
|
||||
cmd.CommandType = CommandType.StoredProcedure;
|
||||
cmd.CommandTimeout = 0;
|
||||
SqlDataReader dr = cmd.ExecuteReader();
|
||||
while (dr.Read())
|
||||
{
|
||||
RowCount = dr.GetInt32(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ExecuteStoredProcedureRowCount Error", ex);
|
||||
throw new ApplicationException("Failure on ExecuteStoredProcedureRowCount", ex);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
public class ExecuteStoredProcedureItemInfoList : CommandBase
|
||||
{
|
||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
#region Factory Methods
|
||||
private string _StoredProcedure;
|
||||
public string StoredProcedure
|
||||
{
|
||||
get { return _StoredProcedure; }
|
||||
set { _StoredProcedure = value; }
|
||||
}
|
||||
private List<ItemInfo> _ItemInfoList = new List<ItemInfo>();
|
||||
public List<ItemInfo> ItemInfoList
|
||||
{
|
||||
get { return _ItemInfoList; }
|
||||
set { _ItemInfoList = value; }
|
||||
}
|
||||
public static List<ItemInfo> Execute(string storedProcedure)
|
||||
{
|
||||
ExecuteStoredProcedureItemInfoList cmd = new ExecuteStoredProcedureItemInfoList();
|
||||
cmd.StoredProcedure = storedProcedure;
|
||||
DataPortal.Execute<ExecuteStoredProcedureItemInfoList>(cmd);
|
||||
return cmd.ItemInfoList;
|
||||
}
|
||||
#endregion
|
||||
#region Server-Side code
|
||||
protected override void DataPortal_Execute()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
{
|
||||
using (SqlCommand cmd = new SqlCommand(StoredProcedure, cn))
|
||||
{
|
||||
cmd.CommandType = CommandType.StoredProcedure;
|
||||
cmd.CommandTimeout = 0;
|
||||
using (SafeDataReader dr = new SafeDataReader(cmd.ExecuteReader()))
|
||||
{
|
||||
while (dr.Read()) ItemInfoList.Add(new ItemInfo(dr));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ExecuteStoredProcedureItemInfoList Error", ex);
|
||||
throw new ApplicationException("Failure on ExecuteStoredProcedureItemInfoList", ex);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -92,51 +92,4 @@ namespace VEPROMS.CSLA.Library
|
||||
public partial class PdfInfoList
|
||||
{
|
||||
}
|
||||
public class ExecuteStoredProcedure : CommandBase
|
||||
{
|
||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
#region Factory Methods
|
||||
private string _StoredProcedure;
|
||||
public string StoredProcedure
|
||||
{
|
||||
get { return _StoredProcedure; }
|
||||
set { _StoredProcedure = value; }
|
||||
}
|
||||
private int _AffectedRows;
|
||||
public int AffectedRows
|
||||
{
|
||||
get { return _AffectedRows; }
|
||||
set { _AffectedRows = value; }
|
||||
}
|
||||
public static int Execute(string storedProcedure)
|
||||
{
|
||||
ExecuteStoredProcedure cmd = new ExecuteStoredProcedure();
|
||||
cmd.StoredProcedure = storedProcedure;
|
||||
DataPortal.Execute<ExecuteStoredProcedure>(cmd);
|
||||
return cmd.AffectedRows;
|
||||
}
|
||||
#endregion
|
||||
#region Server-Side code
|
||||
protected override void DataPortal_Execute()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
{
|
||||
using (SqlCommand cmd = new SqlCommand(StoredProcedure, cn))
|
||||
{
|
||||
cmd.CommandType = CommandType.StoredProcedure;
|
||||
cmd.CommandTimeout = 0;
|
||||
AffectedRows = cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ExecuteStoredProcedure Error", ex);
|
||||
throw new ApplicationException("Failure on ExecuteStoredProcedure", ex);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user