Added Class to support Purge of Disconnected Data

Allow Display of the SQL Code Revision
This commit is contained in:
Rich
2016-02-26 16:09:50 +00:00
parent e0c4f8b1f4
commit c2649727e1
2 changed files with 101 additions and 18 deletions

View File

@@ -107,6 +107,54 @@ namespace VEPROMS.CSLA.Library
}
#endregion
}
public class ESP_PurgeDisconnectedItems : 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_PurgeDisconnectedItems cmd = new ESP_PurgeDisconnectedItems();
cmd.StoredProcedure = storedProcedure;
DataPortal.Execute<ESP_PurgeDisconnectedItems>(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
}
public class ESP_IdentifyNonEditableItems : CommandBase
{
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);