C2016-022: Added purge of multiple RO/Associations and unused RoFsts and Figures

C2016-022: Additional admin tools queries for multiple RO/Associations & unused RoFsts and Figures
This commit is contained in:
2016-07-05 13:09:37 +00:00
parent 14bb3fcf3b
commit 12a3b053ac
3 changed files with 582 additions and 2 deletions

View File

@@ -61,6 +61,43 @@ namespace VEPROMS
, PurgeDisconnectedItems);
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);
adminToolsList.Add("Get Database Users", "Get Database Users Guidance", "This administrative tool will return all of the users currently with open sessions in the database and the details of any items they have checked out", "", "", true, true, "vesp_GetDatabaseSessions", GetDatabaseSessions);
adminToolsList.Add("Clean Up Referenced Object Associations"
, "Clean Up Referenced Object Associations Guidance"
, "Referenced Objects are associated with a procedure set (such as Working Draft). If unnecessary associations exist, these can be removed."
, "Be sure to have a backup prior to running this!!"
, "NOTE:"
, true
, true
, "vesp_CleanUpROAssociations"
, CleanUpROAssociations);
adminToolsList.Add("Remove Unused ROFSTs and Figures"
, "Remove Unused ROFSTs and Figures Guidance"
, "This tool removes any ROFSTs and Figures that are no longer used."
, "Be sure to have a backup prior to running this!!"
, "NOTE:"
, true
, true
, "vesp_RemoveUnusedRoFstsAndFigures"
, RemoveUnusedRoFstsAndFigures);
adminToolsList.Add("Identify Unused RO Associations"
, "Identify Unused RO Associations Guidance"
, "Referenced Objects are associated with a procedure set (such as Working Draft). If unnecessary associations exist, these can be removed."
, ""
, "NOTE:"
, true
, true
, "vesp_GetUnusedROAssociationsCount"
, IdentifyROAssociations);
adminToolsList.Add("Identify Unused ROFSTs and Figures"
, "Identify Unused ROFSTs and Figures Guidance"
, "This tool identifies any ROFSTs and Figures that are no longer used."
, ""
, "NOTE:"
, true
, true
, "vesp_GetUnusedRoFstsCount"
, IdentifyUnusedRoFstsAndFigures);
//adminToolsList.Add("Find Referenced Object Problems", "Find Referenced Object Problems Guidance", "description for find ro problems", "", "", true, true, "vesp_FindROProblems", FindROProblems);
adminToolsList.Sort();
cbxAdminTools.DataSource = adminToolsList;
@@ -515,6 +552,151 @@ namespace VEPROMS
this.Cursor = Cursors.Default;
MessageBox.Show(string.Format("{0} Completed", selectedAdminTool.Title), string.Format("{0} Complete", selectedAdminTool.Title));
}
private void IdentifyUnusedRoFstsAndFigures()
{
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 rowCountRoFst = ESP_GetUnusedRoFsts.Execute("vesp_GetUnusedRoFstsCount");
int rowCountFigures = ESP_GetUnusedFigures.Execute("vesp_GetUnusedFiguresCount");
txtProcess.AppendText(string.Format("Unused RoFsts Count: {0}, Unused Figures Count: {1}", rowCountRoFst, rowCountFigures));
txtProcess.AppendText(Environment.NewLine);
txtProcess.AppendText(Environment.NewLine);
if (rowCountRoFst > 0 || rowCountFigures > 0)
{
txtResults.Clear();
txtResults.AppendText(string.Format("The database contains {0} unused RoFsts.", rowCountRoFst));
txtResults.AppendText(Environment.NewLine);
txtResults.AppendText(string.Format("The database contains {0} unused Figures items.", rowCountFigures));
txtResults.AppendText(Environment.NewLine);
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 RemoveUnusedRoFstsAndFigures()
{
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 rowCountRoFst = ESP_GetUnusedRoFsts.Execute("vesp_GetUnusedRoFstsCount");
int rowCountFigures = ESP_GetUnusedFigures.Execute("vesp_GetUnusedFiguresCount");
if (rowCountRoFst > 0 || rowCountFigures > 0)
{
ESP_PurgeUnusedRoFstsAndFigures.Execute(selectedAdminTool.StoredProcedure);
int rowCountRoFst2 = ESP_GetUnusedRoFsts.Execute("vesp_GetUnusedRoFstsCount");
int rowCountFigures2 = ESP_GetUnusedFigures.Execute("vesp_GetUnusedFiguresCount");
txtProcess.AppendText(string.Format("Unsed RoFsts Purged", rowCountRoFst));
txtProcess.AppendText(Environment.NewLine);
txtProcess.AppendText(string.Format("Unsed Figures Purged", rowCountFigures));
txtProcess.AppendText(Environment.NewLine);
txtProcess.AppendText(Environment.NewLine);
txtResults.Clear();
txtResults.AppendText(string.Format("The database contained {0} unused RoFsts.", rowCountRoFst));
txtResults.AppendText(Environment.NewLine);
txtResults.AppendText(string.Format("The database contained {0} unused Figures items.", rowCountFigures));
txtResults.AppendText(Environment.NewLine);
txtResults.AppendText(Environment.NewLine);
txtResults.AppendText(string.Format("The database now contains {0} unused RoFsts.", rowCountRoFst2));
txtResults.AppendText(Environment.NewLine);
txtResults.AppendText(string.Format("The database now contains {0} unused Figures.", rowCountFigures2));
txtResults.AppendText(Environment.NewLine);
txtResults.AppendText(Environment.NewLine);
if (rowCountRoFst2 > 0 || rowCountFigures2 > 0)
txtResults.AppendText("It is recommended you contact Volian to assist in resolving this condition");
}
else
{
txtResults.Clear();
txtResults.AppendText(string.Format("The database contained {0} unused RoFsts or Figures items.", rowCountRoFst+rowCountFigures));
txtResults.AppendText(Environment.NewLine);
txtResults.AppendText(Environment.NewLine);
txtResults.AppendText(string.Format("No Unused Data to Purge!"));
}
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 IdentifyROAssociations()
{
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 = ESP_GetROAssoc.Execute("vesp_GetUnusedROAssociationsCount");
txtProcess.AppendText(string.Format("Unused RO Associations Count: {0}", rowCount));
txtProcess.AppendText(Environment.NewLine);
txtProcess.AppendText(Environment.NewLine);
if (rowCount > 0)
{
txtResults.Clear();
txtResults.AppendText(string.Format("The database contains {0} unused RO Associations.", rowCount));
txtResults.AppendText(Environment.NewLine);
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 CleanUpROAssociations()
{
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 = ESP_GetROAssoc.Execute("vesp_GetUnusedROAssociationsCount");
if (rowCount > 0)
{
ESP_CleanupROAssoc.Execute(selectedAdminTool.StoredProcedure);
int rowCount2 = ESP_GetROAssoc.Execute("vesp_GetUnusedROAssociationsCount");
txtProcess.AppendText(string.Format("Unused Referenced Object Associations Purged", rowCount));
txtProcess.AppendText(Environment.NewLine);
txtProcess.AppendText(Environment.NewLine);
txtResults.Clear();
txtResults.AppendText(string.Format("The database contained {0} unused items.", rowCount));
txtResults.AppendText(Environment.NewLine);
txtResults.AppendText(Environment.NewLine);
txtResults.AppendText(string.Format("The database now contains {0} unused items.", rowCount2));
txtResults.AppendText(Environment.NewLine);
txtResults.AppendText(Environment.NewLine);
if (rowCount2 > 0)
txtResults.AppendText("It is recommended you contact Volian to assist in resolving this condition");
}
else
{
txtResults.Clear();
txtResults.AppendText(string.Format("The database contained {0} unused items.", rowCount));
txtResults.AppendText(Environment.NewLine);
txtResults.AppendText(Environment.NewLine);
txtResults.AppendText(string.Format("No Disconnected Data to Purge!"));
}
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;