1402 lines
		
	
	
		
			43 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			1402 lines
		
	
	
		
			43 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| using System;
 | |
| using System.Collections.Generic;
 | |
| using System.Text;
 | |
| using Csla;
 | |
| using Csla.Data;
 | |
| using Csla.Validation;
 | |
| using System.Data.SqlClient;
 | |
| using System.Data;
 | |
| 
 | |
| namespace VEPROMS.CSLA.Library
 | |
| {
 | |
| 	public partial class AnnotationAuditInfo
 | |
| 	{
 | |
| 		internal string _ActionWhat;
 | |
| 		public string ActionWhat
 | |
| 		{
 | |
| 			get { return _ActionWhat; }
 | |
| 			set { _ActionWhat = value; }
 | |
| 		}
 | |
| 		internal DateTime _ActionWhen;
 | |
| 		public DateTime ActionWhen
 | |
| 		{
 | |
| 			get { return _ActionWhen; }
 | |
| 			set { _ActionWhen = value; }
 | |
| 		}
 | |
| 		internal int _IContentID;
 | |
| 		public int IContentID
 | |
| 		{
 | |
| 			get { return _IContentID; }
 | |
| 			set { _IContentID = value; }
 | |
| 		}
 | |
| 		public override string ToString()
 | |
| 		{
 | |
| 			return string.Format("{0} by {1} on {2}", this.DeleteStatus == 0 ? "Changed" : "Deleted", this.UserID, this.DTS.ToString("MM/dd/yyyy @ HH:mm:ss"));
 | |
| 		}
 | |
| 	}
 | |
| 
 | |
| 	public partial class ContentAuditInfo
 | |
| 	{
 | |
| 		internal string _ActionWhat;
 | |
| 		public string ActionWhat
 | |
| 		{
 | |
| 			get { return _ActionWhat; }
 | |
| 			set { _ActionWhat = value; }
 | |
| 		}
 | |
| 		internal DateTime _ActionWhen;
 | |
| 		public DateTime ActionWhen
 | |
| 		{
 | |
| 			get { return _ActionWhen; }
 | |
| 			set { _ActionWhen = value; }
 | |
| 		}
 | |
| 		internal string _Path;
 | |
| 		public string Path
 | |
| 		{
 | |
| 			get { return _Path; }
 | |
| 			set { _Path = value; }
 | |
| 		}
 | |
| 		internal int _ItemID;
 | |
| 		public int ItemID
 | |
| 		{
 | |
| 			get { return _ItemID; }
 | |
| 			set { _ItemID = value; }
 | |
| 		}
 | |
| 		public override string ToString()
 | |
| 		{
 | |
| 			return string.Format("{0} by {1} on {2}", this.ActionWhat, this.UserID, this.DTS.ToString("MM/dd/yyyy @ HH:mm:ss"));
 | |
| 			//return string.Format("{0} by {1} on {2}", this.DeleteStatus == 0 ? "Changed" : "Deleted", this.UserID, this.DTS.ToString("MM/dd/yyyy @ HH:mm:ss"));
 | |
| 			//return string.Format("{0} - {1} {2}", this.UserID, this.DTS, this.DeleteStatus == 0 ? "" : "Deleted");
 | |
| 		}
 | |
| 
 | |
| 	}
 | |
| 
 | |
|   public partial class DocumentAuditInfo
 | |
|   {
 | |
|       public override string ToString()
 | |
|       {
 | |
|           return string.Format("{0} - {1} {2}", this.UserID, this.DTS, this.DeleteStatus == 0 ? "" : "Deleted");
 | |
|       }
 | |
|   }
 | |
| 
 | |
|   public partial class EntryAuditInfo
 | |
|   {
 | |
|       public override string ToString()
 | |
|       {
 | |
|           return string.Format("{0} - {1} {2}", this.UserID, this.DTS, this.DeleteStatus == 0 ? "" : "Deleted");
 | |
|       }
 | |
|   }
 | |
| 
 | |
|   public partial class GridAuditInfo
 | |
|   {
 | |
|       public override string ToString()
 | |
|       {
 | |
| 				return string.Format("{0} by {1} on {2}", this.DeleteStatus == 0 ? "Changed" : "Deleted", this.UserID, this.DTS.ToString("MM/dd/yyyy @ HH:mm:ss"));
 | |
| 				//return string.Format("{0} - {1} {2}", this.UserID, this.DTS, this.DeleteStatus == 0 ? "" : "Deleted");
 | |
|       }
 | |
|   }
 | |
| 
 | |
|   public partial class ImageAuditInfo
 | |
|   {
 | |
|       public override string ToString()
 | |
|       {
 | |
|           return string.Format("{0} - {1} {2}", this.UserID, this.DTS, this.DeleteStatus == 0 ? "" : "Deleted");
 | |
|       }
 | |
|   }
 | |
| 
 | |
|   public partial class ItemAuditInfo
 | |
| 	{
 | |
| 		public static bool IsChangeManagerVersion()
 | |
| 		{
 | |
| 			try
 | |
| 			{
 | |
| 				using (ItemAuditInfoList list = ItemAuditInfoList.Get())
 | |
| 				{
 | |
| 					;
 | |
| 				}
 | |
| 			}
 | |
| 			catch (Exception ex1)
 | |
| 			{
 | |
| 				Exception ex = ex1;
 | |
| 				while (ex.InnerException != null)
 | |
| 					ex = ex.InnerException;
 | |
| 				if (ex.Message.StartsWith("Could not find stored procedure"))
 | |
| 				{
 | |
| 					System.Windows.Forms.MessageBox.Show("Running Change Manager Code with Non-Change Manager Data", "Inconsistent Data", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
 | |
| 					return false;
 | |
| 				}
 | |
| 				throw new Exception("Failed on check of Change Manager Data",ex1);
 | |
| 			}
 | |
| 			return true;
 | |
| 		}
 | |
| 		internal int _Level;
 | |
| 		public int Level
 | |
| 		{
 | |
| 			get { return _Level; }
 | |
| 		}
 | |
| 		internal string _ItemType;
 | |
| 		public string ItemType
 | |
| 		{
 | |
| 			get { return _ItemType; }
 | |
| 		}
 | |
| 
 | |
| 		public override string ToString()
 | |
|       {
 | |
| 				return string.Format("{0}{1} deleted by {2} on {3} @ {4}", this.Level == 0 ? "Previous " : this.Level == 1 ? "Next " : "", this.ItemType, this.UserID, this.DTS.ToShortDateString(), this.DTS.ToShortTimeString());
 | |
| //				return string.Format("Deleted by {0} on {1} @ {2}", this.UserID, this.DTS.ToShortDateString(), this.DTS.ToShortTimeString());
 | |
| //				return string.Format("(ItemID: {4}, DeleteID: {5}, {0} by {1} on {2} Level: {3}", this.DeleteStatus == 0 ? "Changed" : "Deleted", this.UserID, this.DTS.ToString("MM/dd/yyyy @ HH:mm:ss"), Level.ToString(), this.ItemID.ToString(), this.DeleteStatus.ToString());
 | |
| //            return string.Format("Level: {3}, {0} - {1} {2}", this.UserID, this.DTS, this.DeleteStatus == 0 ? "" : "Deleted", this.Level.ToString());
 | |
|       }
 | |
|   }
 | |
| 
 | |
|   public partial class PartAuditInfo
 | |
|   {
 | |
|       public override string ToString()
 | |
|       {
 | |
|           return string.Format("{0} - {1} {2}", this.UserID, this.DTS, this.DeleteStatus == 0 ? "" : "Deleted");
 | |
|       }
 | |
|   }
 | |
| 
 | |
| 	public partial class AnnotationAuditInfoList
 | |
| 	{
 | |
| 		/// <summary>
 | |
| 		/// Return a list of all AnnotationAuditInfo by ItemID.
 | |
| 		/// </summary>
 | |
| 		/// <param name="ItemID">Selected ItemID for Annotation Audit Records</param>
 | |
| 		/// <returns></returns>
 | |
| 		public static AnnotationAuditInfoList GetByItemID(int itemID)
 | |
| 		{
 | |
| 			try
 | |
| 			{
 | |
| 				//if (_AnnotationAuditInfoList != null)
 | |
| 				//    return _AnnotationAuditInfoList;
 | |
| 				AnnotationAuditInfoList tmp = DataPortal.Fetch<AnnotationAuditInfoList>(new ItemIDCriteria(itemID));
 | |
| 				//AnnotationAuditInfo.AddList(tmp);
 | |
| 				//tmp.AddEvents();
 | |
| 				//_AnnotationAuditInfoList = tmp;
 | |
| 				return tmp;
 | |
| 			}
 | |
| 			catch (Exception ex)
 | |
| 			{
 | |
| 				throw new DbCslaException("Error on AnnotationAuditInfoList.GetByItemID", ex);
 | |
| 			}
 | |
| 		}
 | |
| 		[Serializable()]
 | |
| 		protected class ItemIDCriteria
 | |
| 		{
 | |
| 			private int _ItemID;
 | |
| 			public int ItemID
 | |
| 			{ get { return _ItemID; } }
 | |
| 			public ItemIDCriteria(int itemID)
 | |
| 			{
 | |
| 				_ItemID = itemID;
 | |
| 			}
 | |
| 		}
 | |
| 		private void DataPortal_Fetch(ItemIDCriteria criteria)
 | |
| 		{
 | |
| 			this.RaiseListChangedEvents = false;
 | |
| 			if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AnnotationAuditInfoList.DataPortal_Fetch", GetHashCode());
 | |
| 			try
 | |
| 			{
 | |
| 				using (SqlConnection cn = Database.VEPROMS_SqlConnection)
 | |
| 				{
 | |
| 					using (SqlCommand cm = cn.CreateCommand())
 | |
| 					{
 | |
| 						cm.CommandType = CommandType.StoredProcedure;
 | |
| 						cm.CommandText = "getAnnotationAuditsByItemID";
 | |
| 						cm.Parameters.AddWithValue("@ItemID", criteria.ItemID);
 | |
| 						using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
 | |
| 						{
 | |
| 							IsReadOnly = false;
 | |
| 							while (dr.Read()) this.Add(new AnnotationAuditInfo(dr));
 | |
| 							IsReadOnly = true;
 | |
| 						}
 | |
| 					}
 | |
| 				}
 | |
| 			}
 | |
| 			catch (Exception ex)
 | |
| 			{
 | |
| 				if (_MyLog.IsErrorEnabled) _MyLog.Error("AnnotationAuditInfoList.DataPortal_Fetch", ex);
 | |
| 				throw new DbCslaException("AnnotationAuditInfoList.DataPortal_Fetch", ex);
 | |
| 			}
 | |
| 			this.RaiseListChangedEvents = true;
 | |
| 		}
 | |
| 
 | |
| 		public static AnnotationAuditInfoList GetByAnnotationID(int annotationID)
 | |
| 		{
 | |
| 			try
 | |
| 			{
 | |
| 				//if (_AnnotationAuditInfoList != null)
 | |
| 				//    return _AnnotationAuditInfoList;
 | |
| 				AnnotationAuditInfoList tmp = DataPortal.Fetch<AnnotationAuditInfoList>(new AnnotationIDCriteria(annotationID));
 | |
| 				//AnnotationAuditInfo.AddList(tmp);
 | |
| 				//tmp.AddEvents();
 | |
| 				//_AnnotationAuditInfoList = tmp;
 | |
| 				return tmp;
 | |
| 			}
 | |
| 			catch (Exception ex)
 | |
| 			{
 | |
| 				throw new DbCslaException("Error on AnnotationAuditInfoList.GetByAnnotationID", ex);
 | |
| 			}
 | |
| 		}
 | |
| 		[Serializable()]
 | |
| 		protected class AnnotationIDCriteria
 | |
| 		{
 | |
| 			private int _AnnotationID;
 | |
| 			public int AnnotationID
 | |
| 			{ get { return _AnnotationID; } }
 | |
| 			public AnnotationIDCriteria(int annotationID)
 | |
| 			{
 | |
| 				_AnnotationID = annotationID;
 | |
| 			}
 | |
| 		}
 | |
| 		private void DataPortal_Fetch(AnnotationIDCriteria criteria)
 | |
| 		{
 | |
| 			this.RaiseListChangedEvents = false;
 | |
| 			if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AnnotationAuditInfoList.DataPortal_Fetch", GetHashCode());
 | |
| 			try
 | |
| 			{
 | |
| 				using (SqlConnection cn = Database.VEPROMS_SqlConnection)
 | |
| 				{
 | |
| 					using (SqlCommand cm = cn.CreateCommand())
 | |
| 					{
 | |
| 						cm.CommandType = CommandType.StoredProcedure;
 | |
| 						cm.CommandText = "getAnnotationAuditsByAnnotationID";
 | |
| 						cm.Parameters.AddWithValue("@AnnotationID", criteria.AnnotationID);
 | |
| 						using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
 | |
| 						{
 | |
| 							IsReadOnly = false;
 | |
| 							while (dr.Read()) this.Add(new AnnotationAuditInfo(dr));
 | |
| 							IsReadOnly = true;
 | |
| 						}
 | |
| 					}
 | |
| 				}
 | |
| 			}
 | |
| 			catch (Exception ex)
 | |
| 			{
 | |
| 				if (_MyLog.IsErrorEnabled) _MyLog.Error("AnnotationAuditInfoList.DataPortal_Fetch", ex);
 | |
| 				throw new DbCslaException("AnnotationAuditInfoList.DataPortal_Fetch", ex);
 | |
| 			}
 | |
| 			this.RaiseListChangedEvents = true;
 | |
| 		}
 | |
| 
 | |
| 		#region ChronologyReport
 | |
| 		//chronology report
 | |
| 		public static AnnotationAuditInfoList GetChronology(int @procItemID, int itemID)
 | |
| 		{
 | |
| 			try
 | |
| 			{
 | |
| 				AnnotationAuditInfoList tmp = DataPortal.Fetch<AnnotationAuditInfoList>(new ChronologyCriteria(procItemID, itemID));
 | |
| 				return tmp;
 | |
| 			}
 | |
| 			catch (Exception ex)
 | |
| 			{
 | |
| 				throw new DbCslaException("Error on AnnotationAuditInfoList.GetChronology", ex);
 | |
| 			}
 | |
| 		}
 | |
| 		[Serializable()]
 | |
| 		protected class ChronologyCriteria
 | |
| 		{
 | |
| 			private int _procItemID;
 | |
| 			public int ProcItemID
 | |
| 			{
 | |
| 				get { return _procItemID; }
 | |
| 			}
 | |
| 			private int _itemID;
 | |
| 			public int ItemID
 | |
| 			{
 | |
| 				get { return _itemID; }
 | |
| 			}
 | |
| 			public ChronologyCriteria(int procItemID, int itemID)
 | |
| 			{
 | |
| 				_procItemID = procItemID;
 | |
| 				_itemID = itemID;
 | |
| 			}
 | |
| 		}
 | |
| 		private void DataPortal_Fetch(ChronologyCriteria criteria)
 | |
| 		{
 | |
| 			this.RaiseListChangedEvents = false;
 | |
| 			if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AnnotationAuditInfoList.DataPortal_Fetch", GetHashCode());
 | |
| 			try
 | |
| 			{
 | |
| 				using (SqlConnection cn = Database.VEPROMS_SqlConnection)
 | |
| 				{
 | |
| 					using (SqlCommand cm = cn.CreateCommand())
 | |
| 					{
 | |
| 						cm.CommandType = CommandType.StoredProcedure;
 | |
| 						cm.CommandText = "getAnnotationAuditsChronologyByItemID";
 | |
| 						cm.Parameters.AddWithValue("@ProcItemID", criteria.ProcItemID);
 | |
| 						cm.Parameters.AddWithValue("@ItemID", criteria.ItemID);
 | |
| 						using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
 | |
| 						{
 | |
| 							IsReadOnly = false;
 | |
| 							while (dr.Read())
 | |
| 							{
 | |
| 								AnnotationAuditInfo aai = new AnnotationAuditInfo(dr);
 | |
| 								aai.ActionWhat = dr.GetString("ActionWhat");
 | |
| 								aai.ActionWhen = dr.GetDateTime("ActionWhen");
 | |
| 								aai.IContentID = dr.GetInt32("IContentID");
 | |
| 								this.Add(aai);
 | |
| 
 | |
| 							}
 | |
| 							IsReadOnly = true;
 | |
| 						}
 | |
| 					}
 | |
| 				}
 | |
| 			}
 | |
| 			catch (Exception ex)
 | |
| 			{
 | |
| 				if (_MyLog.IsErrorEnabled) _MyLog.Error("AnnotationAuditInfoList.DataPortal_Fetch", ex);
 | |
| 				throw new DbCslaException("AnnotationAuditInfoList.DataPortal_Fetch", ex);
 | |
| 			}
 | |
| 			this.RaiseListChangedEvents = true;
 | |
| 		}
 | |
| 		#endregion
 | |
| 
 | |
| 	}
 | |
| 
 | |
| 	public partial class ContentAuditInfoList
 | |
| 	{
 | |
| 		/// <summary>
 | |
| 		/// Return a list of all ContentAuditInfo by ContentID.
 | |
| 		/// </summary>
 | |
| 		/// <param name="ContentID">Selected ContentID for Content Audit Records</param>
 | |
| 		/// <returns></returns>
 | |
| 		public static ContentAuditInfoList Get(int contentID)
 | |
| 		{
 | |
| 			try
 | |
| 			{
 | |
| 				//if (_ContentAuditInfoList != null)
 | |
| 				//    return _ContentAuditInfoList;
 | |
| 				ContentAuditInfoList tmp = DataPortal.Fetch<ContentAuditInfoList>(new ContentIDCriteria(contentID));
 | |
| 				//ContentAuditInfo.AddList(tmp);
 | |
| 				//tmp.AddEvents();
 | |
| 				//_ContentAuditInfoList = tmp;
 | |
| 				return tmp;
 | |
| 			}
 | |
| 			catch (Exception ex)
 | |
| 			{
 | |
| 				throw new DbCslaException("Error on ContentAuditInfoList.Get", ex);
 | |
| 			}
 | |
| 		}
 | |
| 		[Serializable()]
 | |
| 		protected class ContentIDCriteria
 | |
| 		{
 | |
| 			private int _ContentID;
 | |
| 			public int ContentID
 | |
| 			{ get { return _ContentID; } }
 | |
| 			public ContentIDCriteria(int contentID)
 | |
| 			{
 | |
| 				_ContentID = contentID;
 | |
| 			}
 | |
| 		}
 | |
| 		private void DataPortal_Fetch(ContentIDCriteria criteria)
 | |
| 		{
 | |
| 			this.RaiseListChangedEvents = false;
 | |
| 			if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ContentAuditInfoList.DataPortal_Fetch", GetHashCode());
 | |
| 			try
 | |
| 			{
 | |
| 				using (SqlConnection cn = Database.VEPROMS_SqlConnection)
 | |
| 				{
 | |
| 					using (SqlCommand cm = cn.CreateCommand())
 | |
| 					{
 | |
| 						cm.CommandType = CommandType.StoredProcedure;
 | |
| 						cm.CommandText = "getContentAuditsByContentID";
 | |
| 						cm.Parameters.AddWithValue("@ContentID", criteria.ContentID);
 | |
| 						using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
 | |
| 						{
 | |
| 							IsReadOnly = false;
 | |
| 							while (dr.Read())
 | |
| 							{
 | |
| 								ContentAuditInfo cai = new ContentAuditInfo(dr);
 | |
| 								cai.ActionWhat = dr.GetString("ActionWhat");
 | |
| 								this.Add(cai);
 | |
| //								this.Add(new ContentAuditInfo(dr));
 | |
| 							}
 | |
| 							IsReadOnly = true;
 | |
| 						}
 | |
| 					}
 | |
| 				}
 | |
| 			}
 | |
| 			catch (Exception ex)
 | |
| 			{
 | |
| 				if (_MyLog.IsErrorEnabled) _MyLog.Error("ContentAuditInfoList.DataPortal_Fetch", ex);
 | |
| 				throw new DbCslaException("ContentAuditInfoList.DataPortal_Fetch", ex);
 | |
| 			}
 | |
| 			this.RaiseListChangedEvents = true;
 | |
| 		}
 | |
| 		//by delete status
 | |
| 		public static ContentAuditInfoList GetByDeleteStatus(int deleteStatus)
 | |
| 		{
 | |
| 			try
 | |
| 			{
 | |
| 				//if (_ContentAuditInfoList != null)
 | |
| 				//    return _ContentAuditInfoList;
 | |
| 				ContentAuditInfoList tmp = DataPortal.Fetch<ContentAuditInfoList>(new DeleteStatusCriteria(deleteStatus));
 | |
| 				//ContentAuditInfo.AddList(tmp);
 | |
| 				//tmp.AddEvents();
 | |
| 				//_ContentAuditInfoList = tmp;
 | |
| 				return tmp;
 | |
| 			}
 | |
| 			catch (Exception ex)
 | |
| 			{
 | |
| 				throw new DbCslaException("Error on ContentAuditInfoList.GetByDeleteStatus", ex);
 | |
| 			}
 | |
| 		}
 | |
| 		[Serializable()]
 | |
| 		protected class DeleteStatusCriteria
 | |
| 		{
 | |
| 			private int _DeleteStatus;
 | |
| 			public int DeleteStatus
 | |
| 			{ get { return _DeleteStatus; } }
 | |
| 			public DeleteStatusCriteria(int deleteStatus)
 | |
| 			{
 | |
| 				_DeleteStatus = deleteStatus;
 | |
| 			}
 | |
| 		}
 | |
| 		private void DataPortal_Fetch(DeleteStatusCriteria criteria)
 | |
| 		{
 | |
| 			this.RaiseListChangedEvents = false;
 | |
| 			if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ContentAuditInfoList.DataPortal_Fetch", GetHashCode());
 | |
| 			try
 | |
| 			{
 | |
| 				using (SqlConnection cn = Database.VEPROMS_SqlConnection)
 | |
| 				{
 | |
| 					using (SqlCommand cm = cn.CreateCommand())
 | |
| 					{
 | |
| 						cm.CommandType = CommandType.StoredProcedure;
 | |
| 						cm.CommandText = "getContentAuditsByDeleteStatus";
 | |
| 						cm.Parameters.AddWithValue("@DeleteStatus", criteria.DeleteStatus);
 | |
| 						using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
 | |
| 						{
 | |
| 							IsReadOnly = false;
 | |
| 							while (dr.Read()) this.Add(new ContentAuditInfo(dr));
 | |
| 							IsReadOnly = true;
 | |
| 						}
 | |
| 					}
 | |
| 				}
 | |
| 			}
 | |
| 			catch (Exception ex)
 | |
| 			{
 | |
| 				if (_MyLog.IsErrorEnabled) _MyLog.Error("ContentAuditInfoList.DataPortal_Fetch", ex);
 | |
| 				throw new DbCslaException("ContentAuditInfoList.DataPortal_Fetch", ex);
 | |
| 			}
 | |
| 			this.RaiseListChangedEvents = true;
 | |
| 		}
 | |
| 
 | |
| 		#region ChronologyReport
 | |
| 		//chronology report
 | |
| 		public static ContentAuditInfoList GetChronology(int procedureItemID, int currentItemID, bool includeDeletedChildren)
 | |
| 		{
 | |
| 			try
 | |
| 			{
 | |
| 				ContentAuditInfoList tmp = DataPortal.Fetch<ContentAuditInfoList>(new ChronologyCriteria(procedureItemID, currentItemID, includeDeletedChildren));
 | |
| 				return tmp;
 | |
| 			}
 | |
| 			catch (Exception ex)
 | |
| 			{
 | |
| 				throw new DbCslaException("Error on ContentAuditInfoList.GetChronology", ex);
 | |
| 			}
 | |
| 		}
 | |
| 		[Serializable()]
 | |
| 		protected class ChronologyCriteria
 | |
| 		{
 | |
| 			private int _ProcedureItemID;
 | |
| 
 | |
| 			public int ProcedureItemID
 | |
| 			{
 | |
| 				get { return _ProcedureItemID; }
 | |
| 			}
 | |
| 			private int _CurrentItemID;
 | |
| 
 | |
| 			public int CurrentItemID
 | |
| 			{
 | |
| 				get { return _CurrentItemID; }
 | |
| 			}
 | |
| 			private bool _IncludeDeletedChildren;
 | |
| 
 | |
| 			public bool IncludeDeletedChildren
 | |
| 			{
 | |
| 				get { return _IncludeDeletedChildren; }
 | |
| 			}
 | |
| 
 | |
| 			public ChronologyCriteria(int procedureItemID, int currentItemID, bool includeDeletedChildren)
 | |
| 			{
 | |
| 				_ProcedureItemID = procedureItemID;
 | |
| 				_CurrentItemID = currentItemID;
 | |
| 				_IncludeDeletedChildren = includeDeletedChildren;
 | |
| 			}
 | |
| 		}
 | |
| 		private void DataPortal_Fetch(ChronologyCriteria criteria)
 | |
| 		{
 | |
| 			this.RaiseListChangedEvents = false;
 | |
| 			if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ContentAuditInfoList.DataPortal_Fetch", GetHashCode());
 | |
| 			try
 | |
| 			{
 | |
| 				using (SqlConnection cn = Database.VEPROMS_SqlConnection)
 | |
| 				{
 | |
| 					using (SqlCommand cm = cn.CreateCommand())
 | |
| 					{
 | |
| 						cm.CommandType = CommandType.StoredProcedure;
 | |
| 						cm.CommandText = "getContentAuditsChronologyByItemID";
 | |
| 						cm.Parameters.AddWithValue("@ProcedureItemID", criteria.ProcedureItemID);
 | |
| 						cm.Parameters.AddWithValue("@SelectedItemID", criteria.CurrentItemID);
 | |
| 						cm.Parameters.AddWithValue("@IncludeDeletedChildren", criteria.IncludeDeletedChildren ? 1 : 0);
 | |
| 						using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
 | |
| 						{
 | |
| 							IsReadOnly = false;
 | |
| 							while (dr.Read())
 | |
| 							{
 | |
| 								ContentAuditInfo cai = new ContentAuditInfo(dr);
 | |
| 								cai.ActionWhat = dr.GetString("ActionWhat");
 | |
| 								cai.ActionWhen = dr.GetDateTime("ActionWhen");
 | |
| 								cai.Path = dr.GetString("Path");
 | |
| 								cai.ItemID = dr.GetInt32("ItemID");
 | |
| 								this.Add(cai);
 | |
| 
 | |
| 							}
 | |
| 							IsReadOnly = true;
 | |
| 						}
 | |
| 					}
 | |
| 				}
 | |
| 			}
 | |
| 			catch (Exception ex)
 | |
| 			{
 | |
| 				if (_MyLog.IsErrorEnabled) _MyLog.Error("ContentAuditInfoList.DataPortal_Fetch", ex);
 | |
| 				throw new DbCslaException("ContentAuditInfoList.DataPortal_Fetch", ex);
 | |
| 			}
 | |
| 			this.RaiseListChangedEvents = true;
 | |
| 		}
 | |
| 		#endregion
 | |
| 
 | |
| 		#region SummaryReport
 | |
| 		//summary report
 | |
| 		public static ContentAuditInfoList GetSummary(int procedureItemID, int currentItemID, bool includeDeletedChildren)
 | |
| 		{
 | |
| 			try
 | |
| 			{
 | |
| 				ContentAuditInfoList tmp = DataPortal.Fetch<ContentAuditInfoList>(new SummaryCriteria(procedureItemID, currentItemID, includeDeletedChildren));
 | |
| 				return tmp;
 | |
| 			}
 | |
| 			catch (Exception ex)
 | |
| 			{
 | |
| 				throw new DbCslaException("Error on ContentAuditInfoList.GetSummary", ex);
 | |
| 			}
 | |
| 		}
 | |
| 		[Serializable()]
 | |
| 		protected class SummaryCriteria
 | |
| 		{
 | |
| 			private int _ProcedureItemID;
 | |
| 
 | |
| 			public int ProcedureItemID
 | |
| 			{
 | |
| 				get { return _ProcedureItemID; }
 | |
| 			}
 | |
| 			private int _CurrentItemID;
 | |
| 
 | |
| 			public int CurrentItemID
 | |
| 			{
 | |
| 				get { return _CurrentItemID; }
 | |
| 			}
 | |
| 			private bool _IncludeDeletedChildren;
 | |
| 
 | |
| 			public bool IncludeDeletedChildren
 | |
| 			{
 | |
| 				get { return _IncludeDeletedChildren; }
 | |
| 			}
 | |
| 
 | |
| 			public SummaryCriteria(int procedureItemID, int currentItemID, bool includeDeletedChildren)
 | |
| 			{
 | |
| 				_ProcedureItemID = procedureItemID;
 | |
| 				_CurrentItemID = currentItemID;
 | |
| 				_IncludeDeletedChildren = includeDeletedChildren;
 | |
| 			}
 | |
| 		}
 | |
| 		private void DataPortal_Fetch(SummaryCriteria criteria)
 | |
| 		{
 | |
| 			this.RaiseListChangedEvents = false;
 | |
| 			if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ContentAuditInfoList.DataPortal_Fetch", GetHashCode());
 | |
| 			try
 | |
| 			{
 | |
| 				using (SqlConnection cn = Database.VEPROMS_SqlConnection)
 | |
| 				{
 | |
| 					using (SqlCommand cm = cn.CreateCommand())
 | |
| 					{
 | |
| 						cm.CommandType = CommandType.StoredProcedure;
 | |
| 						cm.CommandText = "getContentAuditsSummaryByItemID";
 | |
| 						cm.Parameters.AddWithValue("@ProcedureItemID", criteria.ProcedureItemID);
 | |
| 						cm.Parameters.AddWithValue("@SelectedItemID", criteria.CurrentItemID);
 | |
| 						cm.Parameters.AddWithValue("@IncludeDeletedChildren", criteria.IncludeDeletedChildren ? 1 : 0);
 | |
| 						using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
 | |
| 						{
 | |
| 							IsReadOnly = false;
 | |
| 							while (dr.Read())
 | |
| 							{
 | |
| 								ContentAuditInfo cai = new ContentAuditInfo(dr);
 | |
| 								cai.ActionWhat = dr.GetString("ActionWhat");
 | |
| 								cai.ActionWhen = dr.GetDateTime("ActionWhen");
 | |
| 								cai.Path = dr.GetString("Path");
 | |
| 								cai.ItemID = dr.GetInt32("ItemID");
 | |
| 								this.Add(cai);
 | |
| 
 | |
| 							}
 | |
| 							IsReadOnly = true;
 | |
| 						}
 | |
| 					}
 | |
| 				}
 | |
| 			}
 | |
| 			catch (Exception ex)
 | |
| 			{
 | |
| 				if (_MyLog.IsErrorEnabled) _MyLog.Error("ContentAuditInfoList.DataPortal_Fetch", ex);
 | |
| 				throw new DbCslaException("ContentAuditInfoList.DataPortal_Fetch", ex);
 | |
| 			}
 | |
| 			this.RaiseListChangedEvents = true;
 | |
| 		}
 | |
| 		#endregion
 | |
| 
 | |
| 	}
 | |
| 
 | |
|   public partial class DocumentAuditInfoList
 | |
|   {
 | |
|       /// <summary>
 | |
|       /// Return a list of all DocumentAuditInfo by DocID.
 | |
|       /// </summary>
 | |
|       /// <param name="DocumentID">Selected DocID for Document Audit Records</param>
 | |
|       /// <returns></returns>
 | |
|       public static DocumentAuditInfoList Get(int docID)
 | |
|       {
 | |
|           try
 | |
|           {
 | |
|               DocumentAuditInfoList tmp = DataPortal.Fetch<DocumentAuditInfoList>(new DocumentIDCriteria(docID));
 | |
|               return tmp;
 | |
|           }
 | |
|           catch (Exception ex)
 | |
|           {
 | |
|               throw new DbCslaException("Error on DocumentAuditInfoList.Get", ex);
 | |
|           }
 | |
|       }
 | |
|       [Serializable()]
 | |
|       protected class DocumentIDCriteria
 | |
|       {
 | |
|           private int _DocID;
 | |
|           public int DocID
 | |
|           { get { return _DocID; } }
 | |
|           public DocumentIDCriteria(int docID)
 | |
|           {
 | |
|               _DocID = docID;
 | |
|           }
 | |
|       }
 | |
|       private void DataPortal_Fetch(DocumentIDCriteria criteria)
 | |
|       {
 | |
|           this.RaiseListChangedEvents = false;
 | |
|           if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocumentAuditInfoList.DataPortal_Fetch", GetHashCode());
 | |
|           try
 | |
|           {
 | |
|               using (SqlConnection cn = Database.VEPROMS_SqlConnection)
 | |
|               {
 | |
|                   using (SqlCommand cm = cn.CreateCommand())
 | |
|                   {
 | |
|                       cm.CommandType = CommandType.StoredProcedure;
 | |
|                       cm.CommandText = "getDocumentAuditsByDocID";
 | |
|                       cm.Parameters.AddWithValue("@DocID", criteria.DocID);
 | |
|                       using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
 | |
|                       {
 | |
|                           IsReadOnly = false;
 | |
|                           while (dr.Read()) this.Add(new DocumentAuditInfo(dr));
 | |
|                           IsReadOnly = true;
 | |
|                       }
 | |
|                   }
 | |
|               }
 | |
|           }
 | |
|           catch (Exception ex)
 | |
|           {
 | |
|               if (_MyLog.IsErrorEnabled) _MyLog.Error("DocumentAuditInfoList.DataPortal_Fetch", ex);
 | |
|               throw new DbCslaException("DocumentAuditInfoList.DataPortal_Fetch", ex);
 | |
|           }
 | |
|           this.RaiseListChangedEvents = true;
 | |
|       }
 | |
|   }
 | |
| 
 | |
|   public partial class EntryAuditInfoList
 | |
|   {
 | |
|       /// <summary>
 | |
|       /// Return a list of all EntryAuditInfo by ContentID.
 | |
|       /// </summary>
 | |
|       /// <param name="ContentID">Selected ContentID for Entry Audit Records</param>
 | |
|       /// <returns></returns>
 | |
|       public static EntryAuditInfoList Get(int contentID)
 | |
|       {
 | |
|           try
 | |
|           {
 | |
|               EntryAuditInfoList tmp = DataPortal.Fetch<EntryAuditInfoList>(new ContentIDCriteria(contentID));
 | |
|               return tmp;
 | |
|           }
 | |
|           catch (Exception ex)
 | |
|           {
 | |
|               throw new DbCslaException("Error on EntryAuditInfoList.Get", ex);
 | |
|           }
 | |
|       }
 | |
|       [Serializable()]
 | |
|       protected class ContentIDCriteria
 | |
|       {
 | |
|           private int _ContentID;
 | |
|           public int ContentID
 | |
|           { get { return _ContentID; } }
 | |
|           public ContentIDCriteria(int contentID)
 | |
|           {
 | |
|               _ContentID = contentID;
 | |
|           }
 | |
|       }
 | |
|       private void DataPortal_Fetch(ContentIDCriteria criteria)
 | |
|       {
 | |
|           this.RaiseListChangedEvents = false;
 | |
|           if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] EntryAuditInfoList.DataPortal_Fetch", GetHashCode());
 | |
|           try
 | |
|           {
 | |
|               using (SqlConnection cn = Database.VEPROMS_SqlConnection)
 | |
|               {
 | |
|                   using (SqlCommand cm = cn.CreateCommand())
 | |
|                   {
 | |
|                       cm.CommandType = CommandType.StoredProcedure;
 | |
|                       cm.CommandText = "getEntryAuditsByContentID";
 | |
|                       cm.Parameters.AddWithValue("@ContentID", criteria.ContentID);
 | |
|                       using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
 | |
|                       {
 | |
|                           IsReadOnly = false;
 | |
|                           while (dr.Read()) this.Add(new EntryAuditInfo(dr));
 | |
|                           IsReadOnly = true;
 | |
|                       }
 | |
|                   }
 | |
|               }
 | |
|           }
 | |
|           catch (Exception ex)
 | |
|           {
 | |
|               if (_MyLog.IsErrorEnabled) _MyLog.Error("EntryAuditInfoList.DataPortal_Fetch", ex);
 | |
|               throw new DbCslaException("EntryAuditInfoList.DataPortal_Fetch", ex);
 | |
|           }
 | |
|           this.RaiseListChangedEvents = true;
 | |
|       }
 | |
|   }
 | |
| 
 | |
|   public partial class GridAuditInfoList
 | |
|   {
 | |
|       /// <summary>
 | |
|       /// Return a list of all GridAuditInfo by ContentID.
 | |
|       /// </summary>
 | |
|       /// <param name="ContentID">Selected ContentID for Grid Audit Records</param>
 | |
|       /// <returns></returns>
 | |
|       public static GridAuditInfoList Get(int contentID)
 | |
|       {
 | |
|           try
 | |
|           {
 | |
|               GridAuditInfoList tmp = DataPortal.Fetch<GridAuditInfoList>(new ContentIDCriteria(contentID));
 | |
|               return tmp;
 | |
|           }
 | |
|           catch (Exception ex)
 | |
|           {
 | |
|               throw new DbCslaException("Error on GridAuditInfoList.Get", ex);
 | |
|           }
 | |
|       }
 | |
|       [Serializable()]
 | |
|       protected class ContentIDCriteria
 | |
|       {
 | |
|           private int _ContentID;
 | |
|           public int ContentID
 | |
|           { get { return _ContentID; } }
 | |
|           public ContentIDCriteria(int contentID)
 | |
|           {
 | |
|               _ContentID = contentID;
 | |
|           }
 | |
|       }
 | |
|       private void DataPortal_Fetch(ContentIDCriteria criteria)
 | |
|       {
 | |
|           this.RaiseListChangedEvents = false;
 | |
|           if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] GridAuditInfoList.DataPortal_Fetch", GetHashCode());
 | |
|           try
 | |
|           {
 | |
|               using (SqlConnection cn = Database.VEPROMS_SqlConnection)
 | |
|               {
 | |
|                   using (SqlCommand cm = cn.CreateCommand())
 | |
|                   {
 | |
|                       cm.CommandType = CommandType.StoredProcedure;
 | |
|                       cm.CommandText = "getGridAuditsByContentID";
 | |
|                       cm.Parameters.AddWithValue("@ContentID", criteria.ContentID);
 | |
|                       using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
 | |
|                       {
 | |
|                           IsReadOnly = false;
 | |
|                           while (dr.Read()) this.Add(new GridAuditInfo(dr));
 | |
|                           IsReadOnly = true;
 | |
|                       }
 | |
|                   }
 | |
|               }
 | |
|           }
 | |
|           catch (Exception ex)
 | |
|           {
 | |
|               if (_MyLog.IsErrorEnabled) _MyLog.Error("GridAuditInfoList.DataPortal_Fetch", ex);
 | |
|               throw new DbCslaException("GridAuditInfoList.DataPortal_Fetch", ex);
 | |
|           }
 | |
|           this.RaiseListChangedEvents = true;
 | |
|       }
 | |
|   }
 | |
| 
 | |
|   public partial class ImageAuditInfoList
 | |
|   {
 | |
|       /// <summary>
 | |
|       /// Return a list of all ImageAuditInfo by ContentID.
 | |
|       /// </summary>
 | |
|       /// <param name="ContentID">Selected ContentID for Image Audit Records</param>
 | |
|       /// <returns></returns>
 | |
|       public static ImageAuditInfoList Get(int contentID)
 | |
|       {
 | |
|           try
 | |
|           {
 | |
|               ImageAuditInfoList tmp = DataPortal.Fetch<ImageAuditInfoList>(new ContentIDCriteria(contentID));
 | |
|               return tmp;
 | |
|           }
 | |
|           catch (Exception ex)
 | |
|           {
 | |
|               throw new DbCslaException("Error on ImageAuditInfoList.Get", ex);
 | |
|           }
 | |
|       }
 | |
|       [Serializable()]
 | |
|       protected class ContentIDCriteria
 | |
|       {
 | |
|           private int _ContentID;
 | |
|           public int ContentID
 | |
|           { get { return _ContentID; } }
 | |
|           public ContentIDCriteria(int contentID)
 | |
|           {
 | |
|               _ContentID = contentID;
 | |
|           }
 | |
|       }
 | |
|       private void DataPortal_Fetch(ContentIDCriteria criteria)
 | |
|       {
 | |
|           this.RaiseListChangedEvents = false;
 | |
|           if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ImageAuditInfoList.DataPortal_Fetch", GetHashCode());
 | |
|           try
 | |
|           {
 | |
|               using (SqlConnection cn = Database.VEPROMS_SqlConnection)
 | |
|               {
 | |
|                   using (SqlCommand cm = cn.CreateCommand())
 | |
|                   {
 | |
|                       cm.CommandType = CommandType.StoredProcedure;
 | |
|                       cm.CommandText = "getImageAuditsByContentID";
 | |
|                       cm.Parameters.AddWithValue("@ContentID", criteria.ContentID);
 | |
|                       using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
 | |
|                       {
 | |
|                           IsReadOnly = false;
 | |
|                           while (dr.Read()) this.Add(new ImageAuditInfo(dr));
 | |
|                           IsReadOnly = true;
 | |
|                       }
 | |
|                   }
 | |
|               }
 | |
|           }
 | |
|           catch (Exception ex)
 | |
|           {
 | |
|               if (_MyLog.IsErrorEnabled) _MyLog.Error("ImageAuditInfoList.DataPortal_Fetch", ex);
 | |
|               throw new DbCslaException("ImageAuditInfoList.DataPortal_Fetch", ex);
 | |
|           }
 | |
|           this.RaiseListChangedEvents = true;
 | |
|       }
 | |
|   }
 | |
| 
 | |
|   public partial class ItemAuditInfoList
 | |
|   {
 | |
|       /// <summary>
 | |
|       /// Return a list of all ItemAuditInfo by ItemID.
 | |
|       /// </summary>
 | |
|       /// <param name="ItemID">Selected ItemID for Item Audit Records</param>
 | |
|       /// <returns></returns>
 | |
|       public static ItemAuditInfoList Get(int itemID)
 | |
|       {
 | |
|           try
 | |
|           {
 | |
|               ItemAuditInfoList tmp = DataPortal.Fetch<ItemAuditInfoList>(new ItemIDCriteria(itemID));
 | |
|               return tmp;
 | |
|           }
 | |
|           catch (Exception ex)
 | |
|           {
 | |
|               throw new DbCslaException("Error on ItemAuditInfoList.Get", ex);
 | |
|           }
 | |
|       }
 | |
|       [Serializable()]
 | |
|       protected class ItemIDCriteria
 | |
|       {
 | |
|           private int _ItemID;
 | |
|           public int ItemID
 | |
|           { get { return _ItemID; } }
 | |
|           public ItemIDCriteria(int itemID)
 | |
|           {
 | |
|               _ItemID = itemID;
 | |
|           }
 | |
|       }
 | |
|       private void DataPortal_Fetch(ItemIDCriteria criteria)
 | |
|       {
 | |
|           this.RaiseListChangedEvents = false;
 | |
|           if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ItemAuditInfoList.DataPortal_Fetch", GetHashCode());
 | |
|           try
 | |
|           {
 | |
|               using (SqlConnection cn = Database.VEPROMS_SqlConnection)
 | |
|               {
 | |
|                   using (SqlCommand cm = cn.CreateCommand())
 | |
|                   {
 | |
|                       cm.CommandType = CommandType.StoredProcedure;
 | |
|                       cm.CommandText = "getItemAuditsByItemID";
 | |
|                       cm.Parameters.AddWithValue("@ItemID", criteria.ItemID);
 | |
|                       using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
 | |
|                       {
 | |
|                           IsReadOnly = false;
 | |
| 													while (dr.Read())
 | |
| 													{
 | |
| 														ItemAuditInfo iai = new ItemAuditInfo(dr);
 | |
| 														iai._Level = dr.GetInt32("Level");
 | |
| 														iai._ItemType = dr.GetString("ItemType");
 | |
| 														this.Add(iai);
 | |
| 													}
 | |
|                           IsReadOnly = true;
 | |
|                       }
 | |
|                   }
 | |
|               }
 | |
|           }
 | |
|           catch (Exception ex)
 | |
|           {
 | |
|               if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemAuditInfoList.DataPortal_Fetch", ex);
 | |
|               throw new DbCslaException("ItemAuditInfoList.DataPortal_Fetch", ex);
 | |
|           }
 | |
|           this.RaiseListChangedEvents = true;
 | |
|       }
 | |
| 
 | |
|   }
 | |
| 
 | |
|   public partial class PartAuditInfoList
 | |
|   {
 | |
|       /// <summary>
 | |
|       /// Return a list of all PartAuditInfo by ContentID.
 | |
|       /// </summary>
 | |
|       /// <param name="ContentID">Selected ContentID for Part Audit Records</param>
 | |
|       /// <returns></returns>
 | |
|       public static PartAuditInfoList Get(int contentID)
 | |
|       {
 | |
|           try
 | |
|           {
 | |
|               PartAuditInfoList tmp = DataPortal.Fetch<PartAuditInfoList>(new ContentIDCriteria(contentID));
 | |
|               return tmp;
 | |
|           }
 | |
|           catch (Exception ex)
 | |
|           {
 | |
|               throw new DbCslaException("Error on PartAuditInfoList.Get", ex);
 | |
|           }
 | |
|       }
 | |
|       [Serializable()]
 | |
|       protected class ContentIDCriteria
 | |
|       {
 | |
|           private int _ContentID;
 | |
|           public int ContentID
 | |
|           { get { return _ContentID; } }
 | |
|           public ContentIDCriteria(int contentID)
 | |
|           {
 | |
|               _ContentID = contentID;
 | |
|           }
 | |
|       }
 | |
|       private void DataPortal_Fetch(ContentIDCriteria criteria)
 | |
|       {
 | |
|           this.RaiseListChangedEvents = false;
 | |
|           if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PartAuditInfoList.DataPortal_Fetch", GetHashCode());
 | |
|           try
 | |
|           {
 | |
|               using (SqlConnection cn = Database.VEPROMS_SqlConnection)
 | |
|               {
 | |
|                   using (SqlCommand cm = cn.CreateCommand())
 | |
|                   {
 | |
|                       cm.CommandType = CommandType.StoredProcedure;
 | |
|                       cm.CommandText = "getPartAuditsByContentID";
 | |
|                       cm.Parameters.AddWithValue("@ContentID", criteria.ContentID);
 | |
|                       using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
 | |
|                       {
 | |
|                           IsReadOnly = false;
 | |
|                           while (dr.Read()) this.Add(new PartAuditInfo(dr));
 | |
|                           IsReadOnly = true;
 | |
|                       }
 | |
|                   }
 | |
|               }
 | |
|           }
 | |
|           catch (Exception ex)
 | |
|           {
 | |
|               if (_MyLog.IsErrorEnabled) _MyLog.Error("PartAuditInfoList.DataPortal_Fetch", ex);
 | |
|               throw new DbCslaException("PartAuditInfoList.DataPortal_Fetch", ex);
 | |
|           }
 | |
|           this.RaiseListChangedEvents = true;
 | |
|       }
 | |
| 
 | |
| 			public static PartAuditInfoList GetByDeleteStatus(int deleteStatus)
 | |
| 			{
 | |
| 				try
 | |
| 				{
 | |
| 					PartAuditInfoList tmp = DataPortal.Fetch<PartAuditInfoList>(new DeleteStatusCriteria(deleteStatus));
 | |
| 					return tmp;
 | |
| 				}
 | |
| 				catch (Exception ex)
 | |
| 				{
 | |
| 					throw new DbCslaException("Error on PartAuditInfoList.GetByDeleteStatus", ex);
 | |
| 				}
 | |
| 			}
 | |
| 			[Serializable()]
 | |
| 			protected class DeleteStatusCriteria
 | |
| 			{
 | |
| 				private int _DeleteStatus;
 | |
| 				public int DeleteStatus
 | |
| 				{ get { return _DeleteStatus; } }
 | |
| 				public DeleteStatusCriteria(int deleteStatus)
 | |
| 				{
 | |
| 					_DeleteStatus = deleteStatus;
 | |
| 				}
 | |
| 			}
 | |
| 			private void DataPortal_Fetch(DeleteStatusCriteria criteria)
 | |
| 			{
 | |
| 				this.RaiseListChangedEvents = false;
 | |
| 				if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PartAuditInfoList.DataPortal_Fetch", GetHashCode());
 | |
| 				try
 | |
| 				{
 | |
| 					using (SqlConnection cn = Database.VEPROMS_SqlConnection)
 | |
| 					{
 | |
| 						using (SqlCommand cm = cn.CreateCommand())
 | |
| 						{
 | |
| 							cm.CommandType = CommandType.StoredProcedure;
 | |
| 							cm.CommandText = "getPartAuditsByDeleteStatus";
 | |
| 							cm.Parameters.AddWithValue("@DeleteStatus", criteria.DeleteStatus);
 | |
| 							using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
 | |
| 							{
 | |
| 								IsReadOnly = false;
 | |
| 								while (dr.Read()) this.Add(new PartAuditInfo(dr));
 | |
| 								IsReadOnly = true;
 | |
| 							}
 | |
| 						}
 | |
| 					}
 | |
| 				}
 | |
| 				catch (Exception ex)
 | |
| 				{
 | |
| 					if (_MyLog.IsErrorEnabled) _MyLog.Error("PartAuditInfoList.DataPortal_Fetch", ex);
 | |
| 					throw new DbCslaException("PartAuditInfoList.DataPortal_Fetch", ex);
 | |
| 				}
 | |
| 				this.RaiseListChangedEvents = true;
 | |
| 			}
 | |
| 
 | |
| 			public static PartAuditInfoList GetByItemID(int itemID)
 | |
| 			{
 | |
| 				try
 | |
| 				{
 | |
| 					PartAuditInfoList tmp = DataPortal.Fetch<PartAuditInfoList>(new ItemIDCriteria(itemID));
 | |
| 					return tmp;
 | |
| 				}
 | |
| 				catch (Exception ex)
 | |
| 				{
 | |
| 					throw new DbCslaException("Error on PartAuditInfoList.GetByItemID", ex);
 | |
| 				}
 | |
| 			}
 | |
| 			[Serializable()]
 | |
| 			protected class ItemIDCriteria
 | |
| 			{
 | |
| 				private int _ItemID;
 | |
| 				public int ItemID
 | |
| 				{ get { return _ItemID; } }
 | |
| 				public ItemIDCriteria(int itemID)
 | |
| 				{
 | |
| 					_ItemID = itemID;
 | |
| 				}
 | |
| 			}
 | |
| 			private void DataPortal_Fetch(ItemIDCriteria criteria)
 | |
| 			{
 | |
| 				this.RaiseListChangedEvents = false;
 | |
| 				if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PartAuditInfoList.DataPortal_Fetch", GetHashCode());
 | |
| 				try
 | |
| 				{
 | |
| 					using (SqlConnection cn = Database.VEPROMS_SqlConnection)
 | |
| 					{
 | |
| 						using (SqlCommand cm = cn.CreateCommand())
 | |
| 						{
 | |
| 							cm.CommandType = CommandType.StoredProcedure;
 | |
| 							cm.CommandText = "getPartAuditsByItemID";
 | |
| 							cm.Parameters.AddWithValue("@ItemID", criteria.ItemID);
 | |
| 							using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
 | |
| 							{
 | |
| 								IsReadOnly = false;
 | |
| 								while (dr.Read()) this.Add(new PartAuditInfo(dr));
 | |
| 								IsReadOnly = true;
 | |
| 							}
 | |
| 						}
 | |
| 					}
 | |
| 				}
 | |
| 				catch (Exception ex)
 | |
| 				{
 | |
| 					if (_MyLog.IsErrorEnabled) _MyLog.Error("PartAuditInfoList.DataPortal_Fetch", ex);
 | |
| 					throw new DbCslaException("PartAuditInfoList.DataPortal_Fetch", ex);
 | |
| 				}
 | |
| 				this.RaiseListChangedEvents = true;
 | |
| 			}
 | |
| 
 | |
| 		}
 | |
| 
 | |
| 	public partial class ItemInfo
 | |
| 	{
 | |
| 		public static event ItemInfoEvent InfoRestored;
 | |
| 		private void OnInfoRestored(ItemInfo itemInfo)
 | |
| 		{
 | |
| 			if (InfoRestored != null)
 | |
| 				InfoRestored(this);
 | |
| 		}
 | |
| 		public ItemInfo RestoreSibling(ItemAuditInfo iai)
 | |
| 		{
 | |
| 			if (iai.DeleteStatus == 0)
 | |
| 				return null;
 | |
| 			int nextID = iai.Level == 0 ? ItemID : NextItem == null ? 0 : NextItem.ItemID;
 | |
| 			ItemInfo tmp = RestoreItem(iai);
 | |
| 			if(nextID > 0)
 | |
| 				using (Item item = Item.Get(nextID)) ItemInfo.Refresh(item);
 | |
| 			if (iai.Level == 0)
 | |
| 				OnNewSiblingBefore(new ItemInfoInsertEventArgs(tmp, EAddpingPart.Before));
 | |
| 			else
 | |
| 				OnNewSiblingAfter(new ItemInfoInsertEventArgs(tmp, EAddpingPart.After));
 | |
| 			((ItemInfo)ActiveParent).MyContent.RefreshContentParts();
 | |
| 			tmp.OnInfoRestored(tmp);
 | |
| 			return tmp;
 | |
| 		}
 | |
| 		public ItemInfo RestoreItem(ItemAuditInfo iai)
 | |
| 		{
 | |
| 			try
 | |
| 			{
 | |
| 				ItemInfo tmp = DataPortal.Fetch<ItemInfo>(new RestoreCriteria(iai, this));
 | |
| 				AddToCache(tmp);
 | |
| 				if (tmp.ErrorMessage == "No Record Found") tmp = null;
 | |
| 				if(iai.Level == 2)
 | |
| 					OnNewChild(new ItemInfoInsertEventArgs(tmp, EAddpingPart.Child));
 | |
| 				ItemInfo.RefreshPrevious(tmp.NextItem.ItemID, tmp.ItemID);
 | |
| 				tmp.NextItem.ResetOrdinal();
 | |
| 				//tmp.UpdateTransitionText();
 | |
| 				if (tmp.MyContent.ContentTransitions != null)
 | |
| 				{
 | |
| 					foreach (TransitionInfo tran in tmp.MyContent.ContentTransitions)
 | |
| 					{
 | |
| 						if(tran.MyItemToID != null)
 | |
| 							tran.MyItemToID.UpdateTransitionText();
 | |
| 					}
 | |
| 				}
 | |
| 				using (Content cont = tmp.MyContent.Get())
 | |
| 				{
 | |
| 					if (cont.ContentTransitionCount > 0)
 | |
| 					{
 | |
| 						foreach (ContentTransition tran in cont.ContentTransitions)
 | |
| 						{
 | |
| 							cont.FixTransitionText(TransitionInfo.Get(tran.TransitionID));
 | |
| 						}
 | |
| 						cont.Save();
 | |
| 					}
 | |
| 				}
 | |
| 				return tmp;
 | |
| 			}
 | |
| 			catch (Exception ex)
 | |
| 			{
 | |
| 				throw new DbCslaException("Error on ItemInfo.RestoreItem", ex);
 | |
| 			}
 | |
| 		}
 | |
| 		// Criteria to get Item and children
 | |
| 		[Serializable()]
 | |
| 		private class RestoreCriteria
 | |
| 		{
 | |
| 			public RestoreCriteria(ItemAuditInfo iai, ItemInfo ii)
 | |
| 			{
 | |
| 				_MyAudit = iai;
 | |
| 				_MyInfo = ii;
 | |
| 			}
 | |
| 			private ItemAuditInfo _MyAudit;
 | |
| 			public ItemAuditInfo MyAudit
 | |
| 			{
 | |
| 				get { return _MyAudit; }
 | |
| 				set { _MyAudit = value; }
 | |
| 			}
 | |
| 			private ItemInfo _MyInfo;
 | |
| 			public ItemInfo MyInfo
 | |
| 			{
 | |
| 				get { return _MyInfo; }
 | |
| 				set { _MyInfo = value; }
 | |
| 			}
 | |
| 		}
 | |
| 		private void DataPortal_Fetch(RestoreCriteria criteria)
 | |
| 		{
 | |
| 			ItemAuditInfo iai = criteria.MyAudit;
 | |
| 			ItemInfo ii = criteria.MyInfo;
 | |
| 			//if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ItemAuditInfoList.DataPortal_Fetch", GetHashCode());
 | |
| 			try
 | |
| 			{
 | |
| 				using (SqlConnection cn = Database.VEPROMS_SqlConnection)
 | |
| 				{
 | |
| 					using (SqlCommand cm = cn.CreateCommand())
 | |
| 					{
 | |
| 						cm.CommandType = CommandType.StoredProcedure;
 | |
| 						cm.CommandText = "restoreDeletedItem";
 | |
| 						cm.Parameters.AddWithValue("@ItemID", iai.ItemID);
 | |
| 						cm.Parameters.AddWithValue("@DeleteID", iai.DeleteStatus);
 | |
| 						cm.Parameters.AddWithValue("@CurrentID", ii.ItemID);
 | |
| 						cm.Parameters.AddWithValue("@Level", iai.Level);
 | |
| 						cm.ExecuteNonQuery();
 | |
| 					}
 | |
| 				}
 | |
| 			}
 | |
| 			catch (Exception ex)
 | |
| 			{
 | |
| 				//if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemAuditInfoList.DataPortal_Fetch", ex);
 | |
| 				//throw new DbCslaException("ItemAuditInfoList.DataPortal_Fetch", ex);
 | |
| 			}
 | |
| 			DataPortal_Fetch(new PKCriteria(iai.ItemID));
 | |
| 		}
 | |
| 	}
 | |
| 
 | |
| 	public partial class AnnotationInfo
 | |
| 	{
 | |
| 		public static AnnotationInfo RestoreAnnotation(AnnotationAuditInfo aai)
 | |
| 		{
 | |
| 			try
 | |
| 			{
 | |
| 				AnnotationInfo tmp = DataPortal.Fetch<AnnotationInfo>(new RestoreCriteria(aai));
 | |
| 				AddToCache(tmp);
 | |
| 				if (tmp.ErrorMessage == "No Record Found") tmp = null;
 | |
| 				tmp.MyItem.RefreshItemAnnotations();
 | |
| 				return tmp;
 | |
| 			}
 | |
| 			catch (Exception ex)
 | |
| 			{
 | |
| 				throw new DbCslaException("Error on AnnotaionInfo.RestoreAnnotation", ex);
 | |
| 			}
 | |
| 		}
 | |
| 		//criteria to get annotation
 | |
| 		[Serializable]
 | |
| 		private class RestoreCriteria
 | |
| 		{
 | |
| 			public RestoreCriteria(AnnotationAuditInfo aai)
 | |
| 			{
 | |
| 				_MyAudit = aai;
 | |
| 			}
 | |
| 			private AnnotationAuditInfo _MyAudit;
 | |
| 
 | |
| 			public AnnotationAuditInfo MyAudit
 | |
| 			{
 | |
| 				get { return _MyAudit; }
 | |
| 				set { _MyAudit = value; }
 | |
| 			}
 | |
| 		}
 | |
| 		private void DataPortal_Fetch(RestoreCriteria criteria)
 | |
| 		{
 | |
| 			AnnotationAuditInfo aai = criteria.MyAudit;
 | |
| 			if (aai.DeleteStatus == 0)
 | |
| 			{
 | |
| 				//if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ItemAuditInfoList.DataPortal_Fetch", GetHashCode());
 | |
| 				try
 | |
| 				{
 | |
| 					using (SqlConnection cn = Database.VEPROMS_SqlConnection)
 | |
| 					{
 | |
| 						using (SqlCommand cm = cn.CreateCommand())
 | |
| 						{
 | |
| 							cm.CommandType = CommandType.StoredProcedure;
 | |
| 							cm.CommandText = "restoreChangedAnnotation";
 | |
| 							cm.Parameters.AddWithValue("@AuditID", aai.AuditID);
 | |
| 							cm.ExecuteNonQuery();
 | |
| 						}
 | |
| 					}
 | |
| 				}
 | |
| 				catch (Exception ex)
 | |
| 				{
 | |
| 					//if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemAuditInfoList.DataPortal_Fetch", ex);
 | |
| 					//throw new DbCslaException("ItemAuditInfoList.DataPortal_Fetch", ex);
 | |
| 				}
 | |
| 			}
 | |
| 			else
 | |
| 			{
 | |
| 				//if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ItemAuditInfoList.DataPortal_Fetch", GetHashCode());
 | |
| 				try
 | |
| 				{
 | |
| 					using (SqlConnection cn = Database.VEPROMS_SqlConnection)
 | |
| 					{
 | |
| 						using (SqlCommand cm = cn.CreateCommand())
 | |
| 						{
 | |
| 							cm.CommandType = CommandType.StoredProcedure;
 | |
| 							cm.CommandText = "restoreDeletedAnnotation";
 | |
| 							cm.Parameters.AddWithValue("@AnnotationID", aai.AnnotationID);
 | |
| 							cm.ExecuteNonQuery();
 | |
| 						}
 | |
| 					}
 | |
| 				}
 | |
| 				catch (Exception ex)
 | |
| 				{
 | |
| 					//if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemAuditInfoList.DataPortal_Fetch", ex);
 | |
| 					//throw new DbCslaException("ItemAuditInfoList.DataPortal_Fetch", ex);
 | |
| 				}
 | |
| 			}
 | |
| 			DataPortal_Fetch(new PKCriteria(aai.AnnotationID));
 | |
| 		}
 | |
| 	}
 | |
| 
 | |
| 	public partial class ContentInfo
 | |
| 	{
 | |
| 		public static ContentInfo RestoreContent(ContentAuditInfo cai)
 | |
| 		{
 | |
| 			try
 | |
| 			{
 | |
| 				ContentInfo tmp = DataPortal.Fetch<ContentInfo>(new RestoreCriteria(cai));
 | |
| 				AddToCache(tmp);
 | |
| 				if (tmp.ErrorMessage == "No Record Found") tmp = null;
 | |
| 				tmp.RefreshContentDetails();
 | |
| 				tmp.RefreshContentItems();
 | |
| 				tmp.RefreshContentParts();
 | |
| 				tmp.RefreshContentRoUsages();
 | |
| 				tmp.RefreshContentTransitions();
 | |
| 				using (Content ctmp = tmp.Get())
 | |
| 				{
 | |
| 					ContentInfo.Refresh(ctmp);
 | |
| 				}
 | |
| 				return tmp;
 | |
| 			}
 | |
| 			catch (Exception ex)
 | |
| 			{
 | |
| 				throw new DbCslaException("Error on ContentInfo.RestoreContent", ex);
 | |
| 			}
 | |
| 		}
 | |
| 		//criteria to get content
 | |
| 		[Serializable]
 | |
| 		private class RestoreCriteria
 | |
| 		{
 | |
| 			public RestoreCriteria(ContentAuditInfo cai)
 | |
| 			{
 | |
| 				_MyAudit = cai;
 | |
| 			}
 | |
| 			private ContentAuditInfo _MyAudit;
 | |
| 			public ContentAuditInfo MyAudit
 | |
| 			{
 | |
| 				get { return _MyAudit; }
 | |
| 				set { _MyAudit = value; }
 | |
| 			}
 | |
| 		}
 | |
| 		private void DataPortal_Fetch(RestoreCriteria criteria)
 | |
| 		{
 | |
| 			ContentAuditInfo cai = criteria.MyAudit;
 | |
| 			//if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ItemAuditInfoList.DataPortal_Fetch", GetHashCode());
 | |
| 			try
 | |
| 			{
 | |
| 				using (SqlConnection cn = Database.VEPROMS_SqlConnection)
 | |
| 				{
 | |
| 					using (SqlCommand cm = cn.CreateCommand())
 | |
| 					{
 | |
| 						cm.CommandType = CommandType.StoredProcedure;
 | |
| 						cm.CommandText = "restoreChangedContent";
 | |
| 						cm.Parameters.AddWithValue("@AuditID", cai.AuditID);
 | |
| 						cm.ExecuteNonQuery();
 | |
| 					}
 | |
| 				}
 | |
| 			}
 | |
| 			catch (Exception ex)
 | |
| 			{
 | |
| 				//if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemAuditInfoList.DataPortal_Fetch", ex);
 | |
| 				//throw new DbCslaException("ItemAuditInfoList.DataPortal_Fetch", ex);
 | |
| 			}
 | |
| 			DataPortal_Fetch(new PKCriteria(cai.ContentID));
 | |
| 		}
 | |
| 	}
 | |
| }
 | 
