602 lines
		
	
	
		
			17 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			602 lines
		
	
	
		
			17 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| 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 ESP_FixHyphens : 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)
 | |
| 		{
 | |
| 			ESP_DeletePDFs cmd = new ESP_DeletePDFs();
 | |
| 			cmd.StoredProcedure = storedProcedure;
 | |
| 			DataPortal.Execute<ESP_DeletePDFs>(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 ESP_DeletePDFs : 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)
 | |
| 		{
 | |
| 			ESP_DeletePDFs cmd = new ESP_DeletePDFs();
 | |
| 			cmd.StoredProcedure = storedProcedure;
 | |
| 			DataPortal.Execute<ESP_DeletePDFs>(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 ESP_IdentifyDisconnectedItems : 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_IdentifyDisconnectedItems cmd = new ESP_IdentifyDisconnectedItems();
 | |
| 			cmd.StoredProcedure = storedProcedure;
 | |
| 			DataPortal.Execute<ESP_IdentifyDisconnectedItems>(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_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
 | |
| 	}
 | |
| 	#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);
 | |
| 		#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)
 | |
| 		{
 | |
| 			ESP_IdentifyNonEditableItems cmd = new ESP_IdentifyNonEditableItems();
 | |
| 			cmd.StoredProcedure = storedProcedure;
 | |
| 			DataPortal.Execute<ESP_IdentifyNonEditableItems>(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
 | |
| 	}
 | |
| 	public class ESP_GetDatabaseSessions : 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 string _ResultsString;
 | |
| 		public string ResultsString
 | |
| 		{
 | |
| 			get { return _ResultsString; }
 | |
| 			set { _ResultsString = value; }
 | |
| 		}
 | |
| 		public static string Execute(string storedProcedure)
 | |
| 		{
 | |
| 			ESP_GetDatabaseSessions cmd = new ESP_GetDatabaseSessions();
 | |
| 			cmd.StoredProcedure = storedProcedure;
 | |
| 			DataPortal.Execute<ESP_GetDatabaseSessions>(cmd);
 | |
| 			return cmd.ResultsString;
 | |
| 		}
 | |
| 		#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();
 | |
| 						StringBuilder sbs = new StringBuilder();
 | |
| 						int sessionid = 0;
 | |
| 						string ownertypename = string.Empty;
 | |
| 						while (dr.Read())
 | |
| 						{
 | |
| 							if (dr.GetInt32(0) != sessionid)
 | |
| 							{
 | |
| 								if (sessionid != 0)
 | |
| 									sbs.AppendLine();
 | |
| 								sessionid = dr.GetInt32(0);
 | |
| 								ownertypename = string.Empty;
 | |
| 								sbs.AppendLine(string.Format("The User {0} on computer {1} has an {2} session.", dr.GetString(1), dr.GetString(2), dr.GetString(5)));
 | |
| 								if (dr.GetInt32(4) == 0)
 | |
| 								{
 | |
| 									sbs.AppendLine(string.Format("This user has {0} checked out", dr.GetString(3)));
 | |
| 								}
 | |
| 								else
 | |
| 								{
 | |
| 									sbs.AppendLine(string.Format("This user has {0} {1}(s) checked out...", dr.GetInt32(4), dr.GetString(3)));
 | |
| 									sbs.AppendLine(string.Format("{0} -> {1} -> {2} -> {3} checked out at {4}", dr.GetString(6), dr.GetString(7), dr.GetString(8), dr.GetString(9), dr.GetDateTime(10)));
 | |
| 									ownertypename = dr.GetString(3);
 | |
| 								}
 | |
| 							}
 | |
| 							else
 | |
| 							{
 | |
| 								if (dr.GetInt32(4) > 0)
 | |
| 								{
 | |
| 									if (dr.GetString(3) != ownertypename)
 | |
| 									{
 | |
| 										sbs.AppendLine(string.Format("This user has {0} {1}(s) checked out...", dr.GetInt32(4), dr.GetString(3)));
 | |
| 										sbs.AppendLine(string.Format("{0} -> {1} -> {2} -> {3} checked out at {4}", dr.GetString(6), dr.GetString(7), dr.GetString(8), dr.GetString(9), dr.GetDateTime(10)));
 | |
| 										ownertypename = dr.GetString(3);
 | |
| 									}
 | |
| 									else
 | |
| 										sbs.AppendLine(string.Format("{0} -> {1} -> {2} -> {3} checked out at {4}", dr.GetString(6), dr.GetString(7), dr.GetString(8), dr.GetString(9), dr.GetDateTime(10)));
 | |
| 								}
 | |
| 							}
 | |
| 						}
 | |
| 						_ResultsString = sbs.ToString();
 | |
| 					}
 | |
| 				}
 | |
| 			}
 | |
| 			catch (Exception ex)
 | |
| 			{
 | |
| 				if (_MyLog.IsErrorEnabled) _MyLog.Error("ExecuteStoredProcedureString Error", ex);
 | |
| 				throw new ApplicationException("Failure on ExecuteStoredProcedureString", ex);
 | |
| 			}
 | |
| 		}
 | |
| 		#endregion
 | |
| 	}
 | |
| 	public class ESP_FindROProblems : CommandBase
 | |
| 	{
 | |
| 		private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
 | |
| 		#region Factory Methods
 | |
| 		#endregion
 | |
| 		#region Server-Side Code
 | |
| 		#endregion
 | |
| 	}
 | |
| } | 
