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:
parent
14bb3fcf3b
commit
12a3b053ac
@ -12939,6 +12939,151 @@ go
|
||||
|
||||
PRINT 'Enhanced Document Synchronization code.'
|
||||
|
||||
/****** Object: StoredProcedure [vesp_GetUnusedRoFstsCount] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vesp_GetUnusedRoFstsCount]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [vesp_GetUnusedRoFstsCount];
|
||||
GO
|
||||
|
||||
/*
|
||||
exec vesp_GetUnusedRoFstsCount
|
||||
*/
|
||||
/*****************************************************************************
|
||||
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||
Copyright 2016 - Volian Enterprises, Inc. All rights reserved.
|
||||
*****************************************************************************/
|
||||
CREATE PROCEDURE [dbo].[vesp_GetUnusedRoFstsCount]
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
Select COUNT(*) HowMany From ROFSTS where ROFstID not in(Select ROFSTID from Associations)
|
||||
RETURN
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: vesp_GetUnusedRoFstsCount Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: vesp_GetUnusedRoFstsCount Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [vesp_GetUnusedRoFstsCount] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vesp_GetUnusedFiguresCount]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [vesp_GetUnusedFiguresCount];
|
||||
GO
|
||||
|
||||
/*
|
||||
exec vesp_GetUnusedFiguresCount
|
||||
*/
|
||||
/*****************************************************************************
|
||||
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||
Copyright 2016 - Volian Enterprises, Inc. All rights reserved.
|
||||
*****************************************************************************/
|
||||
CREATE PROCEDURE [dbo].[vesp_GetUnusedFiguresCount]
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
Select COUNT(*) HowMany from Figures where ROFstID not in(Select ROFSTID from Associations)
|
||||
RETURN
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: vesp_GetUnusedFiguresCount Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: vesp_GetUnusedFiguresCount Error on Creation'
|
||||
GO
|
||||
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vesp_RemoveUnusedRoFstsAndFigures]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [vesp_RemoveUnusedRoFstsAndFigures];
|
||||
GO
|
||||
/*
|
||||
vesp_RemoveUnusedRoFstsAndFigures
|
||||
*/
|
||||
|
||||
/*****************************************************************************
|
||||
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||
Copyright 2016 - Volian Enterprises, Inc. All rights reserved.
|
||||
*****************************************************************************/
|
||||
CREATE PROCEDURE [dbo].[vesp_RemoveUnusedRoFstsAndFigures]
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
BEGIN TRY -- Try Block
|
||||
BEGIN TRANSACTION
|
||||
Delete From Figures where ROFstID not in(Select ROFSTID from Associations)
|
||||
Delete From ROFSTS where ROFstID not in(Select ROFSTID from Associations)
|
||||
IF (@@TRANCOUNT > 0) COMMIT
|
||||
END TRY
|
||||
BEGIN CATCH -- Catch Block
|
||||
IF( @@TRANCOUNT = 1 ) ROLLBACK -- Only rollback if top level
|
||||
ELSE IF( @@TRANCOUNT > 1 ) COMMIT -- Otherwise commit. Top level will rollback
|
||||
EXEC vlnErrorHandler
|
||||
END CATCH
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'StoredProcedure [vesp_RemoveUnusedRoFstsAndFigures] Succeeded'
|
||||
ELSE PRINT 'StoredProcedure [vesp_RemoveUnusedRoFstsAndFigures] Error on Creation'
|
||||
go
|
||||
|
||||
|
||||
/****** Object: StoredProcedure [vesp_GetUnusedROAssociationsCount] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vesp_GetUnusedROAssociationsCount]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [vesp_GetUnusedROAssociationsCount];
|
||||
GO
|
||||
|
||||
/*
|
||||
exec vesp_GetUnusedROAssociationsCount
|
||||
*/
|
||||
/*****************************************************************************
|
||||
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||
Copyright 2016 - Volian Enterprises, Inc. All rights reserved.
|
||||
*****************************************************************************/
|
||||
CREATE PROCEDURE [dbo].[vesp_GetUnusedROAssociationsCount]
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
--SELECT COUNT(*) HowMany FROM vefn_GetDisconnectedItems()
|
||||
begin
|
||||
with cte as (
|
||||
Select *, Row_Number() over (partition by VersionID order by associationID ) MyRank from Associations
|
||||
)
|
||||
select count(*) HowMany from CTE where MyRank > 1
|
||||
end
|
||||
RETURN
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: vesp_GetUnusedROAssociationsCount Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: vesp_GetUnusedROAssociationsCount Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [vesp_CleanUpROAssociations] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vesp_CleanUpROAssociations]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [vesp_CleanUpROAssociations];
|
||||
GO
|
||||
/*
|
||||
vesp_CleanUpROAssociations
|
||||
*/
|
||||
|
||||
/*****************************************************************************
|
||||
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||
Copyright 2016 - Volian Enterprises, Inc. All rights reserved.
|
||||
*****************************************************************************/
|
||||
CREATE PROCEDURE [dbo].[vesp_CleanUpROAssociations]
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
BEGIN TRY -- Try Block
|
||||
BEGIN TRANSACTION
|
||||
BEGIN
|
||||
with cte as (
|
||||
Select *, Row_Number() over (partition by VersionID order by associationID ) MyRank from Associations
|
||||
)
|
||||
delete CTE where MyRank > 1
|
||||
END
|
||||
IF( @@TRANCOUNT > 0 ) COMMIT
|
||||
END TRY
|
||||
BEGIN CATCH -- Catch Block
|
||||
IF( @@TRANCOUNT = 1 ) ROLLBACK -- Only rollback if top level
|
||||
ELSE IF( @@TRANCOUNT > 1 ) COMMIT -- Otherwise commit. Top level will rollback
|
||||
EXEC vlnErrorHandler
|
||||
END CATCH
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'StoredProcedure [vesp_CleanUpROAssociations] Succeeded'
|
||||
ELSE PRINT 'StoredProcedure [vesp_CleanUpROAssociations] Error on Creation'
|
||||
go
|
||||
|
||||
PRINT 'Admin Tools Additional queries for Cleanup RO Assoc and Cleanup of Unused RO Fsts and Figures.'
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
@ -12964,8 +13109,8 @@ BEGIN TRY -- Try Block
|
||||
set nocount on
|
||||
DECLARE @RevDate varchar(255)
|
||||
DECLARE @RevDescription varchar(255)
|
||||
set @RevDate = '6/21/2016 11:29 AM'
|
||||
set @RevDescription = 'Added logic to handle backslashes'
|
||||
set @RevDate = '7/5/2016 10:00 AM'
|
||||
set @RevDescription = 'Added admin tools for cleanup of ro assoc and unused rofst and figures'
|
||||
Select cast(@RevDate as datetime) RevDate, @RevDescription RevDescription
|
||||
PRINT 'SQL Code Revision ' + @RevDate + ' - ' + @RevDescription
|
||||
IF( @@TRANCOUNT > 0 ) COMMIT
|
||||
|
@ -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;
|
||||
|
@ -155,6 +155,259 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#region MultipleROAssociations
|
||||
public class ESP_GetROAssoc : 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)
|
||||
{
|
||||
ESP_GetROAssoc cmd = new ESP_GetROAssoc();
|
||||
cmd.StoredProcedure = storedProcedure;
|
||||
DataPortal.Execute<ESP_GetROAssoc>(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 ESP_CleanupROAssoc : 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)
|
||||
{
|
||||
ESP_CleanupROAssoc cmd = new ESP_CleanupROAssoc();
|
||||
cmd.StoredProcedure = storedProcedure;
|
||||
DataPortal.Execute<ESP_CleanupROAssoc>(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();
|
||||
RowCount = dr.RecordsAffected;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ExecuteStoredProcedureRowCount Error", ex);
|
||||
throw new ApplicationException("Failure on ExecuteStoredProcedureRowCount", ex);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
#region UnsedRoFstsAndFigures
|
||||
public class ESP_GetUnusedRoFsts : 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)
|
||||
{
|
||||
ESP_GetUnusedRoFsts cmd = new ESP_GetUnusedRoFsts();
|
||||
cmd.StoredProcedure = storedProcedure;
|
||||
DataPortal.Execute<ESP_GetUnusedRoFsts>(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 ESP_GetUnusedFigures : 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)
|
||||
{
|
||||
ESP_GetUnusedFigures cmd = new ESP_GetUnusedFigures();
|
||||
cmd.StoredProcedure = storedProcedure;
|
||||
DataPortal.Execute<ESP_GetUnusedFigures>(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 ESP_PurgeUnusedRoFstsAndFigures : 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)
|
||||
{
|
||||
ESP_PurgeUnusedRoFstsAndFigures cmd = new ESP_PurgeUnusedRoFstsAndFigures();
|
||||
cmd.StoredProcedure = storedProcedure;
|
||||
DataPortal.Execute<ESP_PurgeUnusedRoFstsAndFigures>(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();
|
||||
RowCount = dr.RecordsAffected;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ExecuteStoredProcedureRowCount Error", ex);
|
||||
throw new ApplicationException("Failure on ExecuteStoredProcedureRowCount", ex);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
public class ESP_IdentifyNonEditableItems : CommandBase
|
||||
{
|
||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
Loading…
x
Reference in New Issue
Block a user