569 lines
		
	
	
		
			16 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			569 lines
		
	
	
		
			16 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
using System;
 | 
						|
using System.Collections.Generic;
 | 
						|
using System.Text;
 | 
						|
using System.Data;
 | 
						|
using System.Data.SqlClient;
 | 
						|
using System.Text.RegularExpressions;
 | 
						|
using Csla;
 | 
						|
using Csla.Data;
 | 
						|
 | 
						|
namespace VEPROMS.CSLA.Library
 | 
						|
{
 | 
						|
	public partial class AnnotationInfo
 | 
						|
	{
 | 
						|
		public override string ToString()
 | 
						|
		{
 | 
						|
			return _SearchText;
 | 
						|
		}
 | 
						|
		#region JCB Annotation Status
 | 
						|
		private bool _IsAnnotationNew = false;
 | 
						|
 | 
						|
		public bool IsAnnotationNew
 | 
						|
		{
 | 
						|
			get
 | 
						|
			{
 | 
						|
				ProcedureInfo pi = this.MyItem.MyProcedure;
 | 
						|
				if (pi != null)
 | 
						|
					//todo figure out audit count
 | 
						|
					_IsAnnotationNew = (this.DTS > pi.DTS);
 | 
						|
				return _IsAnnotationNew;
 | 
						|
			}
 | 
						|
		}
 | 
						|
		private bool _IsAnnotationChanged;
 | 
						|
 | 
						|
		public bool IsAnnotationChanged
 | 
						|
		{
 | 
						|
			get
 | 
						|
			{
 | 
						|
				ProcedureInfo pi = this.MyItem.MyProcedure;
 | 
						|
				if (pi != null)
 | 
						|
				{
 | 
						|
					//todo figure out audit count
 | 
						|
					_IsAnnotationChanged = (this.DTS > pi.DTS);
 | 
						|
				}
 | 
						|
				return _IsAnnotationChanged;
 | 
						|
			}
 | 
						|
		}
 | 
						|
		#endregion
 | 
						|
 | 
						|
	}
 | 
						|
	public partial class AnnotationType
 | 
						|
	{
 | 
						|
		public override string ToString()
 | 
						|
		{
 | 
						|
			return _Name;
 | 
						|
		}
 | 
						|
		[NonSerialized]
 | 
						|
		private AnnotationTypeConfig _AnnotationTypeConfig;
 | 
						|
		public AnnotationTypeConfig AnnotationTypeConfig
 | 
						|
		{
 | 
						|
			get
 | 
						|
			{
 | 
						|
				if (_AnnotationTypeConfig == null)
 | 
						|
				{
 | 
						|
					_AnnotationTypeConfig = new AnnotationTypeConfig(this);
 | 
						|
				}
 | 
						|
				return _AnnotationTypeConfig;
 | 
						|
			}
 | 
						|
		}
 | 
						|
 | 
						|
  }
 | 
						|
	public partial class AnnotationTypeInfo
 | 
						|
	{
 | 
						|
		[NonSerialized]
 | 
						|
		private AnnotationTypeConfig _AnnotationTypeConfig;
 | 
						|
		public AnnotationTypeConfig AnnotationTypeConfig
 | 
						|
		{
 | 
						|
			get
 | 
						|
			{
 | 
						|
				if (_AnnotationTypeConfig == null)
 | 
						|
				{
 | 
						|
					_AnnotationTypeConfig = new AnnotationTypeConfig(this);
 | 
						|
				}
 | 
						|
				return _AnnotationTypeConfig;
 | 
						|
			}
 | 
						|
		}
 | 
						|
		public static List<AnnotationTypeInfo> AllList()
 | 
						|
		{
 | 
						|
			//return _AllList;
 | 
						|
			return AnnotationTypeInfo._CacheList;
 | 
						|
		}
 | 
						|
		public override string ToString()
 | 
						|
		{
 | 
						|
			return _Name;
 | 
						|
		}
 | 
						|
    public static AnnotationTypeInfo GetByName(string name)
 | 
						|
    {
 | 
						|
      try
 | 
						|
      {
 | 
						|
        AnnotationTypeInfo tmp = DataPortal.Fetch<AnnotationTypeInfo>(new GetByNameCriteria(name));
 | 
						|
        if (tmp.ErrorMessage == "No Record Found")
 | 
						|
        {
 | 
						|
          tmp.Dispose(); // Clean-up AnnotationTypeInfo
 | 
						|
          tmp = null;
 | 
						|
        }
 | 
						|
        return tmp;
 | 
						|
      }
 | 
						|
      catch (Exception ex)
 | 
						|
      {
 | 
						|
        throw new DbCslaException("Error on AnnotationTypeInfo.GetByName", ex);
 | 
						|
      }
 | 
						|
    }
 | 
						|
    [Serializable()]
 | 
						|
    protected class GetByNameCriteria
 | 
						|
    {
 | 
						|
      private string _Name;
 | 
						|
      public string Name { get { return _Name; } }
 | 
						|
      public GetByNameCriteria(string name)
 | 
						|
      {
 | 
						|
        _Name = name;
 | 
						|
      }
 | 
						|
    }
 | 
						|
    private void DataPortal_Fetch(GetByNameCriteria criteria)
 | 
						|
    {
 | 
						|
      if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AnnotationTypeInfo.DataPortal_Fetch", GetHashCode());
 | 
						|
      try
 | 
						|
      {
 | 
						|
        using (SqlConnection cn = Database.VEPROMS_SqlConnection)
 | 
						|
        {
 | 
						|
          ApplicationContext.LocalContext["cn"] = cn;
 | 
						|
          using (SqlCommand cm = cn.CreateCommand())
 | 
						|
          {
 | 
						|
            cm.CommandType = CommandType.StoredProcedure;
 | 
						|
            cm.CommandText = "getAnnotationTypeByName";
 | 
						|
						cm.CommandTimeout = Database.SQLTimeout;
 | 
						|
            cm.Parameters.AddWithValue("@Name", criteria.Name);
 | 
						|
            using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
 | 
						|
            {
 | 
						|
              if (!dr.Read())
 | 
						|
              {
 | 
						|
                _ErrorMessage = "No Record Found";
 | 
						|
                return;
 | 
						|
              }
 | 
						|
              ReadData(dr);
 | 
						|
            }
 | 
						|
          }
 | 
						|
          // removing of item only needed for local data portal
 | 
						|
          if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
 | 
						|
            ApplicationContext.LocalContext.Remove("cn");
 | 
						|
        }
 | 
						|
      }
 | 
						|
      catch (Exception ex)
 | 
						|
      {
 | 
						|
        if (_MyLog.IsErrorEnabled) _MyLog.Error("AnnotationTypeInfo.DataPortal_Fetch", ex);
 | 
						|
        _ErrorMessage = ex.Message;
 | 
						|
        throw new DbCslaException("AnnotationTypeInfo.DataPortal_Fetch", ex);
 | 
						|
      }
 | 
						|
    }
 | 
						|
  }
 | 
						|
	public partial class AnnotationTypeInfoList
 | 
						|
	{
 | 
						|
		public static void Refresh()
 | 
						|
		{
 | 
						|
			Reset();
 | 
						|
			_AnnotationTypeInfoList = Get();
 | 
						|
		}
 | 
						|
	}
 | 
						|
	public partial class Annotation
 | 
						|
	{
 | 
						|
		/// <summary>
 | 
						|
		/// Change the annotation type and update the Annotation record
 | 
						|
		/// </summary>
 | 
						|
		/// <param name="anotypeid"></param>
 | 
						|
		public void Update(int anotypeid)
 | 
						|
		{
 | 
						|
			if (_TypeID != anotypeid)
 | 
						|
			{
 | 
						|
				_TypeID = anotypeid;
 | 
						|
				MarkDirty(); // force the record update
 | 
						|
				Save();
 | 
						|
				//Update(); // commit record to database
 | 
						|
			}
 | 
						|
		}
 | 
						|
		public void CommitChanges()
 | 
						|
		{
 | 
						|
			MarkDirty(); // force the record update
 | 
						|
			Save(true);
 | 
						|
			//Update();
 | 
						|
		}
 | 
						|
 | 
						|
		public static void DeleteAnnotation(AnnotationInfo obj)
 | 
						|
		{
 | 
						|
			if (!CanDeleteObject())
 | 
						|
				throw new System.Security.SecurityException("User not authorized to remove a Annotation");
 | 
						|
			try
 | 
						|
			{
 | 
						|
				//				ItemInfo nextItem = item.NextItem;
 | 
						|
				//				ItemInfo prevItem = item.MyPrevious;
 | 
						|
				//				item.OnBeforeDelete();
 | 
						|
				DataPortal.Delete(new DeleteCriteria(obj.AnnotationID, Volian.Base.Library.VlnSettings.UserID));
 | 
						|
				AnnotationInfo.StaticOnInfoChanged();
 | 
						|
				//				if (nextItem != null) // Adjust PreviousID for NextItem
 | 
						|
				//				{
 | 
						|
				//					ItemInfo.RefreshPrevious(nextItem.ItemID, item.PreviousID);
 | 
						|
				//					// The order of the next two methods was required to fix a null reference
 | 
						|
				//					// when getting myparent. This bug was found when deleting a node from the 
 | 
						|
				//					// tree when the RTBItem was not open (i.e. in the step editor window).
 | 
						|
				//					nextItem.RefreshItemParts();
 | 
						|
				//					//nextItem.ResetOrdinal(); - UpdateTransitionText calls ResetOrdinal
 | 
						|
				//					nextItem.UpdateTransitionText();
 | 
						|
				//				}
 | 
						|
				//				else if (prevItem != null)
 | 
						|
				//				{
 | 
						|
				//					prevItem.RefreshNextItems();
 | 
						|
				//					if (prevItem.IsCaution || prevItem.IsNote) prevItem.ResetOrdinal();
 | 
						|
				//					prevItem.UpdateTransitionText();
 | 
						|
				//				}
 | 
						|
				//				ItemInfo.DeleteItemInfoAndChildren(item.ItemID); // Dispose ItemInfo and Children
 | 
						|
			}
 | 
						|
			catch (Exception ex)
 | 
						|
			{
 | 
						|
				System.Data.SqlClient.SqlException exSQL = SqlException(ex);
 | 
						|
				if (exSQL != null && exSQL.Message.Contains("###Cannot Delete Item###"))
 | 
						|
					throw exSQL;
 | 
						|
				Console.WriteLine("AnnotationExt: Stacktrace = {0}", ex.StackTrace);
 | 
						|
				throw new DbCslaException("Error on Annotation.Delete", ex);
 | 
						|
			}
 | 
						|
		}
 | 
						|
 | 
						|
		public static void DeleteAnnotationProcByType(int typID, string procList)
 | 
						|
		{
 | 
						|
			if (!CanDeleteObject())
 | 
						|
				throw new System.Security.SecurityException("User not authorized to remove a Annotation");
 | 
						|
			try
 | 
						|
			{
 | 
						|
				DataPortal.Delete(new DeleteAnnotationProcByTypeCriteria(typID, procList));
 | 
						|
				AnnotationInfo.StaticOnInfoChanged();
 | 
						|
			}
 | 
						|
			catch (Exception ex)
 | 
						|
			{
 | 
						|
				System.Data.SqlClient.SqlException exSQL = SqlException(ex);
 | 
						|
				if (exSQL != null && exSQL.Message.Contains("###Cannot Delete Item###"))
 | 
						|
					throw exSQL;
 | 
						|
				Console.WriteLine("AnnotationExt: Stacktrace = {0}", ex.StackTrace);
 | 
						|
				throw new DbCslaException("Error on Annotation.Delete", ex);
 | 
						|
			}
 | 
						|
		}
 | 
						|
 | 
						|
		public static void DeleteAnnotationDocvByType(int typID, string versionID)
 | 
						|
		{
 | 
						|
			if (!CanDeleteObject())
 | 
						|
				throw new System.Security.SecurityException("User not authorized to remove a Annotation");
 | 
						|
			try
 | 
						|
			{
 | 
						|
				DataPortal.Delete(new DeleteAnnotationDocvByTypeCriteria(typID, versionID));
 | 
						|
				AnnotationInfo.StaticOnInfoChanged();
 | 
						|
			}
 | 
						|
			catch (Exception ex)
 | 
						|
			{
 | 
						|
				System.Data.SqlClient.SqlException exSQL = SqlException(ex);
 | 
						|
				if (exSQL != null && exSQL.Message.Contains("###Cannot Delete Item###"))
 | 
						|
					throw exSQL;
 | 
						|
				Console.WriteLine("AnnotationExt: Stacktrace = {0}", ex.StackTrace);
 | 
						|
				throw new DbCslaException("Error on Annotation.Delete", ex);
 | 
						|
			}
 | 
						|
		}
 | 
						|
 | 
						|
		public static int getAnnotationProcCnt(int typID, string procList)
 | 
						|
		{
 | 
						|
			if (!CanGetObject())
 | 
						|
				throw new System.Security.SecurityException("User not authorized to remove a Annotation");
 | 
						|
			try
 | 
						|
			{
 | 
						|
				Annotation ProcCnt  = DataPortal.Fetch<Annotation>(new getAnnotationCountProcCriteria(typID, procList));
 | 
						|
				AnnotationInfo.StaticOnInfoChanged();
 | 
						|
				return Annotation.ProcCnt;
 | 
						|
				//return Int32.Parse(ProcCnt);
 | 
						|
			}
 | 
						|
			catch (Exception ex)
 | 
						|
			{
 | 
						|
				System.Data.SqlClient.SqlException exSQL = SqlException(ex);
 | 
						|
				if (exSQL != null && exSQL.Message.Contains("###Cannot retrieve Item###"))
 | 
						|
					throw exSQL;
 | 
						|
				Console.WriteLine("AnnotationExt: Stacktrace = {0}", ex.StackTrace);
 | 
						|
				throw new DbCslaException("Error on getAnnotationCountProcCriteria", ex);
 | 
						|
			}
 | 
						|
		}
 | 
						|
 | 
						|
		public static int getAnnotationCountDocv(int typID, string procList)
 | 
						|
		{
 | 
						|
			if (!CanGetObject())
 | 
						|
				throw new System.Security.SecurityException("User not authorized to remove a Annotation");
 | 
						|
			try
 | 
						|
			{
 | 
						|
				Annotation DocvCnt = DataPortal.Fetch<Annotation>(new getAnnotationCountDocvCriteria(typID, procList));
 | 
						|
				AnnotationInfo.StaticOnInfoChanged();
 | 
						|
				return Annotation.DocvCnt;
 | 
						|
			}
 | 
						|
			catch (Exception ex)
 | 
						|
			{
 | 
						|
				System.Data.SqlClient.SqlException exSQL = SqlException(ex);
 | 
						|
				if (exSQL != null && exSQL.Message.Contains("###Cannot retrieve Item###"))
 | 
						|
					throw exSQL;
 | 
						|
				Console.WriteLine("AnnotationExt: Stacktrace = {0}", ex.StackTrace);
 | 
						|
				throw new DbCslaException("Error on getAnnotationCountDocvCriteria", ex);
 | 
						|
			}
 | 
						|
		}
 | 
						|
 | 
						|
		private static System.Data.SqlClient.SqlException SqlException(Exception ex)
 | 
						|
		{
 | 
						|
			Type sqlExType = typeof(System.Data.SqlClient.SqlException);
 | 
						|
			while (ex != null)
 | 
						|
			{
 | 
						|
				if (ex.GetType() == sqlExType) return ex as System.Data.SqlClient.SqlException;
 | 
						|
				ex = ex.InnerException;
 | 
						|
			}
 | 
						|
			return null;
 | 
						|
		}
 | 
						|
 | 
						|
		[Serializable()]
 | 
						|
		protected class DeleteCriteria
 | 
						|
		{
 | 
						|
			private int _AnnotationID;
 | 
						|
			public int AnnotationID
 | 
						|
			{ get { return _AnnotationID; } }
 | 
						|
			private string _UserID;
 | 
						|
			public string UserID
 | 
						|
			{
 | 
						|
				get { return _UserID; }
 | 
						|
				set { _UserID = value; }
 | 
						|
			}
 | 
						|
			public DeleteCriteria(int annotationID, String userID)
 | 
						|
			{
 | 
						|
				_AnnotationID = annotationID;
 | 
						|
				_UserID = userID;
 | 
						|
			}
 | 
						|
		}
 | 
						|
		[Transactional(TransactionalTypes.TransactionScope)]
 | 
						|
		private void DataPortal_Delete(DeleteCriteria criteria)
 | 
						|
		{
 | 
						|
			if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Item.DataPortal_Delete", GetHashCode());
 | 
						|
			try
 | 
						|
			{
 | 
						|
				using (SqlConnection cn = Database.VEPROMS_SqlConnection)
 | 
						|
				{
 | 
						|
					using (SqlCommand cm = cn.CreateCommand())
 | 
						|
					{
 | 
						|
						cm.CommandType = CommandType.StoredProcedure;
 | 
						|
						cm.CommandTimeout = Database.SQLTimeout;
 | 
						|
						cm.CommandText = "deleteAnnotationWithUserID";
 | 
						|
						cm.Parameters.AddWithValue("@AnnotationID", criteria.AnnotationID);
 | 
						|
						cm.Parameters.AddWithValue("@UserID", criteria.UserID);
 | 
						|
						cm.ExecuteNonQuery();
 | 
						|
					}
 | 
						|
				}
 | 
						|
			}
 | 
						|
			catch (Exception ex)
 | 
						|
			{
 | 
						|
				if (_MyLog.IsErrorEnabled) _MyLog.Error("Item.DataPortal_Delete", ex);
 | 
						|
				_ErrorMessage = ex.Message;
 | 
						|
				throw new DbCslaException("Item.DataPortal_Delete", ex);
 | 
						|
			}
 | 
						|
		}
 | 
						|
 | 
						|
		[Serializable()]
 | 
						|
		protected class DeleteAnnotationProcByTypeCriteria
 | 
						|
		{
 | 
						|
			private int _typeID;
 | 
						|
			public int TypeID
 | 
						|
			{ get { return _typeID; } }
 | 
						|
 | 
						|
			private string _procList;
 | 
						|
			public string ProcList
 | 
						|
			{ get { return _procList; } }
 | 
						|
			public DeleteAnnotationProcByTypeCriteria(int typeID, string procList)
 | 
						|
			{
 | 
						|
				_typeID = typeID;
 | 
						|
				_procList = procList;
 | 
						|
			}
 | 
						|
		}
 | 
						|
		[Transactional(TransactionalTypes.TransactionScope)]
 | 
						|
		private void DataPortal_Delete(DeleteAnnotationProcByTypeCriteria criteria)
 | 
						|
		{
 | 
						|
			if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Item.DataPortal_Delete", GetHashCode());
 | 
						|
			try
 | 
						|
			{
 | 
						|
				using (SqlConnection cn = Database.VEPROMS_SqlConnection)
 | 
						|
				{
 | 
						|
					using (SqlCommand cm = cn.CreateCommand())
 | 
						|
					{
 | 
						|
						cm.CommandType = CommandType.StoredProcedure;
 | 
						|
						cm.CommandTimeout = Database.SQLTimeout;
 | 
						|
						cm.CommandText = "deleteAnnotationsProcByType";
 | 
						|
						cm.Parameters.AddWithValue("@typeid", criteria.TypeID);
 | 
						|
						cm.Parameters.AddWithValue("@procList", criteria.ProcList);
 | 
						|
						cm.ExecuteNonQuery();
 | 
						|
					}
 | 
						|
				}
 | 
						|
			}
 | 
						|
			catch (Exception ex)
 | 
						|
			{
 | 
						|
				if (_MyLog.IsErrorEnabled) _MyLog.Error("Item.DataPortal_Delete", ex);
 | 
						|
				_ErrorMessage = ex.Message;
 | 
						|
				throw new DbCslaException("Item.DataPortal_Delete Annotations by group", ex);
 | 
						|
			}
 | 
						|
		}
 | 
						|
 | 
						|
		[Serializable()]
 | 
						|
		protected class DeleteAnnotationDocvByTypeCriteria
 | 
						|
		{
 | 
						|
			private int _typeID;
 | 
						|
			public int TypeID
 | 
						|
			{ get { return _typeID; } }
 | 
						|
 | 
						|
			private string _versionID;
 | 
						|
			public string VersionID
 | 
						|
			{ get { return _versionID; } }
 | 
						|
			public DeleteAnnotationDocvByTypeCriteria(int typeID, string versionID)
 | 
						|
			{
 | 
						|
				_typeID = typeID;
 | 
						|
				_versionID = versionID;
 | 
						|
			}
 | 
						|
		}
 | 
						|
		[Transactional(TransactionalTypes.TransactionScope)]
 | 
						|
		private void DataPortal_Delete(DeleteAnnotationDocvByTypeCriteria criteria)
 | 
						|
		{
 | 
						|
			if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Delete Annotations by Type Docv", GetHashCode());
 | 
						|
			try
 | 
						|
			{
 | 
						|
				using (SqlConnection cn = Database.VEPROMS_SqlConnection)
 | 
						|
				{
 | 
						|
					using (SqlCommand cm = cn.CreateCommand())
 | 
						|
					{
 | 
						|
						cm.CommandType = CommandType.StoredProcedure;
 | 
						|
						cm.CommandTimeout = Database.SQLTimeout;
 | 
						|
						cm.CommandText = "deleteAnnotationsDocvByType";
 | 
						|
						cm.Parameters.AddWithValue("@typeid", criteria.TypeID);
 | 
						|
						cm.Parameters.AddWithValue("@docvList", criteria.VersionID);
 | 
						|
						cm.ExecuteNonQuery();
 | 
						|
					}
 | 
						|
				}
 | 
						|
			}
 | 
						|
			catch (Exception ex)
 | 
						|
			{
 | 
						|
				if (_MyLog.IsErrorEnabled) _MyLog.Error("Item.DataPortal_Delete", ex);
 | 
						|
				_ErrorMessage = ex.Message;
 | 
						|
				throw new DbCslaException("Item.DataPortal_Delete Annotations by type Docv", ex);
 | 
						|
			}
 | 
						|
		}
 | 
						|
 | 
						|
		private static int _procCnt;
 | 
						|
		public static int ProcCnt
 | 
						|
		{
 | 
						|
			get { return _procCnt; }
 | 
						|
			set { _procCnt = value; }
 | 
						|
		}
 | 
						|
 | 
						|
		[Serializable()]
 | 
						|
		protected class getAnnotationCountProcCriteria
 | 
						|
		{
 | 
						|
			private int _procCnt;
 | 
						|
			public int ProcCnt
 | 
						|
			{ get { return _procCnt; }
 | 
						|
			  set { _procCnt = value; }
 | 
						|
			}
 | 
						|
			private int _typeID;
 | 
						|
			public int TypeID
 | 
						|
			{ get { return _typeID; } }
 | 
						|
			private string _procList;
 | 
						|
			public string ProcList
 | 
						|
			{ get { return _procList; } }
 | 
						|
			public getAnnotationCountProcCriteria(int typeID, string procList, int procCnt = 0)
 | 
						|
			{
 | 
						|
				_typeID = typeID;
 | 
						|
				_procList = procList;
 | 
						|
				_procCnt = procCnt;
 | 
						|
			}
 | 
						|
		}
 | 
						|
 | 
						|
		[Transactional(TransactionalTypes.TransactionScope)]
 | 
						|
		private getAnnotationCountProcCriteria DataPortal_Fetch(getAnnotationCountProcCriteria criteria)
 | 
						|
		{
 | 
						|
			if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Item.DataPortal_Fetch", GetHashCode());
 | 
						|
			try
 | 
						|
			{
 | 
						|
				//int ProcCnt;
 | 
						|
				using (SqlConnection cn = Database.VEPROMS_SqlConnection)
 | 
						|
				{
 | 
						|
					using (SqlCommand cm = cn.CreateCommand())
 | 
						|
					{
 | 
						|
						cm.CommandType = CommandType.StoredProcedure;
 | 
						|
						cm.CommandTimeout = Database.SQLTimeout;
 | 
						|
						cm.CommandText = "getAnnotationProcCount";						
 | 
						|
						cm.Parameters.AddWithValue("@procList", criteria.ProcList);
 | 
						|
						cm.Parameters.AddWithValue("@typeid", criteria.TypeID);
 | 
						|
						Annotation.ProcCnt = (int)cm.ExecuteScalar();
 | 
						|
 | 
						|
					}
 | 
						|
				}
 | 
						|
				return criteria; //_procCnt.ToString();
 | 
						|
			}
 | 
						|
			catch (Exception ex)
 | 
						|
			{
 | 
						|
				if (_MyLog.IsErrorEnabled) _MyLog.Error("Annotation.GetAnnotationProcCnt", ex);
 | 
						|
				_ErrorMessage = ex.Message;
 | 
						|
				throw new DbCslaException("Annotation.GetAnnotationProcCnt by group", ex);
 | 
						|
			}
 | 
						|
		}
 | 
						|
 | 
						|
		private static int _docvCnt;
 | 
						|
		public static int DocvCnt
 | 
						|
		{ get { return _docvCnt; } 
 | 
						|
		set { _docvCnt = value; }
 | 
						|
		}
 | 
						|
 | 
						|
		[Serializable()]
 | 
						|
		protected class getAnnotationCountDocvCriteria
 | 
						|
		{
 | 
						|
			private int _docvCnt;
 | 
						|
			public int DocvCnt
 | 
						|
			{ get { return _docvCnt; }
 | 
						|
			  set { _docvCnt = value; }
 | 
						|
			}
 | 
						|
			private int _TypeID;
 | 
						|
			public int TypeID
 | 
						|
			{ get { return _TypeID; } }
 | 
						|
			private string _docvList;
 | 
						|
			public string DocvList
 | 
						|
			{ get { return _docvList; } }
 | 
						|
			public getAnnotationCountDocvCriteria(int typeID, string docvList, int docvCnt = 0)
 | 
						|
			{
 | 
						|
				_TypeID = typeID;
 | 
						|
				_docvList = docvList;
 | 
						|
				_docvCnt = docvCnt;
 | 
						|
			}
 | 
						|
		}
 | 
						|
 | 
						|
		[Transactional(TransactionalTypes.TransactionScope)]
 | 
						|
		private getAnnotationCountDocvCriteria DataPortal_Fetch(getAnnotationCountDocvCriteria criteria)
 | 
						|
		{
 | 
						|
			if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Annotation.DataPortal_Fetch", GetHashCode());
 | 
						|
			try
 | 
						|
			{
 | 
						|
				//int ProcCnt;
 | 
						|
				using (SqlConnection cn = Database.VEPROMS_SqlConnection)
 | 
						|
				{
 | 
						|
					using (SqlCommand cm = cn.CreateCommand())
 | 
						|
					{
 | 
						|
						cm.CommandType = CommandType.StoredProcedure;
 | 
						|
						cm.CommandTimeout = Database.SQLTimeout;
 | 
						|
						cm.CommandText = "getAnnotationDocvCount";
 | 
						|
						cm.Parameters.AddWithValue("@typeid", criteria.TypeID);
 | 
						|
						cm.Parameters.AddWithValue("@DocvList", criteria.DocvList);
 | 
						|
						Annotation.DocvCnt = (int)cm.ExecuteScalar();
 | 
						|
					}
 | 
						|
					return criteria;
 | 
						|
				}
 | 
						|
			}
 | 
						|
			catch (Exception ex)
 | 
						|
			{
 | 
						|
				if (_MyLog.IsErrorEnabled) _MyLog.Error("Item.DataPortal_Delete", ex);
 | 
						|
				_ErrorMessage = ex.Message;
 | 
						|
				throw new DbCslaException("Item.DataPortal_Delete Annotations by group", ex);
 | 
						|
			}
 | 
						|
		}
 | 
						|
	}
 | 
						|
}
 | 
						|
 | 
						|
 |