1646 lines
		
	
	
		
			48 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			1646 lines
		
	
	
		
			48 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;
 | |
| using Volian.Base.Library;
 | |
| using System.ComponentModel;
 | |
| using System.Xml;
 | |
| using System.Xml.Serialization;
 | |
| using System.Text.RegularExpressions;
 | |
| 
 | |
| namespace VEPROMS.CSLA.Library
 | |
| {
 | |
| 	public partial class ItemInfo
 | |
| 	{
 | |
| 		internal string _CheckXML;
 | |
| 		public string CheckXML
 | |
| 		{
 | |
| 			get { return _CheckXML; }
 | |
| 			set { _CheckXML = value; }
 | |
| 		}
 | |
| 		private ConsistencyChecks _MyDifferences;
 | |
| 		public ConsistencyChecks MyDifferences
 | |
| 		{
 | |
| 			get 
 | |
| 			{
 | |
| 				if (CheckXML == null)
 | |
| 				{
 | |
| 					return null;
 | |
| 				}
 | |
| 				if (_MyDifferences == null)
 | |
| 				{
 | |
| 					_MyDifferences = GenericSerializer<ConsistencyChecks>.StringDeserialize(CheckXML);
 | |
| 				}
 | |
| 				return _MyDifferences; 
 | |
| 			}
 | |
| 		}
 | |
| 		private string _MyDifferenceReasons;
 | |
| 		public string MyDifferenceReasons
 | |
| 		{
 | |
| 			get 
 | |
| 			{
 | |
| 				_MyDifferenceReasons = string.Empty;
 | |
| 				string sep = "";
 | |
| 				if (MyDifferences != null)
 | |
| 				{
 | |
| 					if (MyDifferences.ROConsistency.MyROChecks.Length > 0)
 | |
| 					{
 | |
| 						_MyDifferenceReasons += sep + "Reference Object";
 | |
| 						sep = ", ";
 | |
| 					}
 | |
| 					if (MyDifferences.TransitionConsistency.MyTransitionChecks.Length > 0)
 | |
| 					{
 | |
| 						_MyDifferenceReasons += sep + "Transition";
 | |
| 						sep = ", ";
 | |
| 					}
 | |
| 					if (MyDifferences.LibDocConsistency.MyLibDocChecks.Length > 0)
 | |
| 					{
 | |
| 						_MyDifferenceReasons += sep + "Library Document";
 | |
| 					}
 | |
| 				}
 | |
| 				if (_MyDifferenceReasons == string.Empty)
 | |
| 					_MyDifferenceReasons = "No Differences Found";
 | |
| 				return _MyDifferenceReasons; 
 | |
| 			}
 | |
| 		}
 | |
| 		private string _MyDifferencesText;
 | |
| 		public string MyDifferencesText
 | |
| 		{
 | |
| 			get 
 | |
| 			{
 | |
| 				_MyDifferencesText = string.Empty;
 | |
| 				StringBuilder sb = new StringBuilder();
 | |
| 				if (MyDifferences != null)
 | |
| 				{
 | |
| 					if (MyDifferences.ROConsistency.MyROChecks.Length > 0)
 | |
| 					{
 | |
| 						sb.Append("Reference Objects Differences:\r\n");
 | |
| 						ROFSTLookup lu = MyDocVersion.DocVersionAssociations[0].MyROFst.GetROFSTLookup(MyDocVersion);
 | |
| 						foreach (ROCheck roc in MyDifferences.ROConsistency.MyROChecks)
 | |
| 						{
 | |
| 							ROFSTLookup.rochild rocc = lu.GetRoChild(roc.ROID);
 | |
| 							if (rocc.ID == -1)  //  B2020-125: View of Consistency check report displaying error message and crashing.
 | |
| 							{
 | |
| 								sb.Append(string.Format("     {0}\r\n", lu.GetROTitle(roc.ROID)));
 | |
| 							}
 | |
| 							else
 | |
| 							{
 | |
| 								if (rocc.type == 1)
 | |
| 									sb.Append(string.Format("     {0} - Old Value: {1} - New Value: {2}\r\n", lu.GetROTitle(roc.ROID), roc.OldROValue, roc.ROValue));
 | |
| 								else
 | |
| 									sb.Append(string.Format("     {0} - Value has changed.\r\n", lu.GetROTitle(roc.ROID)));
 | |
| 							}
 | |
| 						}
 | |
| 					}
 | |
| //jcb
 | |
| 					if (MyDifferences.TransitionConsistency.MyTransitionChecks.Length > 0)
 | |
| 					{
 | |
| 						if (sb.Length > 0)
 | |
| 							sb.AppendLine();
 | |
| 						sb.Append("Transition Differences:\r\n");
 | |
| 						foreach (TransitionCheck tc in MyDifferences.TransitionConsistency.MyTransitionChecks)
 | |
| 						{
 | |
| 							TransitionInfo tmp = TransitionInfo.Get(tc.TransitionID);
 | |
| 							string tt = tmp.MyContent.ContentItems[0].Path;
 | |
| 							string ov = ItemInfo.ConvertToDisplayText(tc.OldTransitionValue);
 | |
| 							string nv = ItemInfo.ConvertToDisplayText(tc.TransitionValue);
 | |
| 							sb.Append(string.Format("     From {0}\r\n", tt));
 | |
| 							sb.Append(string.Format("          Old To: {0}\r\n", ov));
 | |
| 							sb.Append(string.Format("          New To: {0}\r\n", nv));
 | |
| 						}
 | |
| 					}
 | |
| //end jcb
 | |
| 					if (MyDifferences.LibDocConsistency.MyLibDocChecks.Length > 0)
 | |
| 					{
 | |
| 						if (sb.Length > 0)
 | |
| 							sb.AppendLine();
 | |
| 						sb.Append("Library Document Differences:\r\n");
 | |
| 						foreach (LibDocCheck ldc in MyDifferences.LibDocConsistency.MyLibDocChecks)
 | |
| 						{
 | |
| 							DocumentInfo di = DocumentInfo.Get(ldc.DocID);
 | |
| 							string libdoc = string.Format("     {0} - Old Date: {1} - New Date: {2}\r\n", di.DocumentTitle, ldc.OldDocDate.ToString(), ldc.DocDate.ToString());
 | |
| 							sb.Append(libdoc);
 | |
| 						}
 | |
| 					}
 | |
| 					_MyDifferencesText = sb.ToString();
 | |
| 				}
 | |
| 				if (_MyDifferencesText == string.Empty)
 | |
| 					_MyDifferencesText = MyDifferenceReasons;
 | |
| 				return _MyDifferencesText; 
 | |
| 			}
 | |
| 		}
 | |
| 		private bool _IsSelected = false;
 | |
| 		public bool IsSelected
 | |
| 		{
 | |
| 			get { return _IsSelected; }
 | |
| 			set { _IsSelected = value; }
 | |
| 		}
 | |
| 	}
 | |
| 	public delegate void ItemInfoListCCEvent(object sender, ItemInfoListCCEventArgs args);
 | |
| 	public class ItemInfoListCCEventArgs : EventArgs
 | |
| 	{
 | |
| 		private ProcedureInfo _MyProcedure;
 | |
| 
 | |
| 		public ProcedureInfo MyProcedure
 | |
| 		{
 | |
| 			get { return _MyProcedure; }
 | |
| 			set { _MyProcedure = value; }
 | |
| 		}
 | |
| 		private int _MyCount;
 | |
| 
 | |
| 		public int MyCount
 | |
| 		{
 | |
| 			get { return _MyCount; }
 | |
| 			set { _MyCount = value; }
 | |
| 		}
 | |
| 		public ItemInfoListCCEventArgs(ProcedureInfo myProcedure, int myCount)
 | |
| 		{
 | |
| 			_MyProcedure = myProcedure;
 | |
| 			_MyCount = myCount;
 | |
| 		}
 | |
| 	}
 | |
| 	public partial class ItemInfoList
 | |
| 	{
 | |
| 		public static event ItemInfoListCCEvent ConsistencyCheckUpdated;
 | |
| 		private static void OnConsistencyCheckUpdated(object sender, ItemInfoListCCEventArgs args)
 | |
| 		{
 | |
| 			if (ConsistencyCheckUpdated != null)
 | |
| 				ConsistencyCheckUpdated(sender, args);
 | |
| 		}
 | |
| 		public static ItemInfoList GetMoreProcedures(List<ProcedureInfo> procs)
 | |
| 		{
 | |
| 			StringBuilder sb = new StringBuilder("<Items>");
 | |
| 			int count = 1;
 | |
| 			foreach (ProcedureInfo pi in procs)
 | |
| 			{
 | |
| 				OnConsistencyCheckUpdated(pi, new ItemInfoListCCEventArgs(pi, count++));
 | |
| 				string cc = RevisionInfo.BuildRevisionChecks(pi);
 | |
| 				cc = Regex.Replace(cc, @"\<\?.*?\?\>", "");
 | |
| 				sb.Append(cc);
 | |
| 			}
 | |
| 			sb.Append("</Items>");
 | |
| 			OnConsistencyCheckUpdated(null, new ItemInfoListCCEventArgs(null, -1));
 | |
| 			try
 | |
| 			{
 | |
| 				ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new ItemListConsistencyCheckCriteria(procs[0].MyDocVersion.VersionID, sb.ToString()));
 | |
| 				ItemInfo.AddList(tmp);
 | |
| 				tmp.AddEvents();
 | |
| 				return tmp;
 | |
| 			}
 | |
| 			catch (Exception ex)
 | |
| 			{
 | |
| 				throw new DbCslaException("Error on ItemInfoList.GetMoreProcedures", ex);
 | |
| 			}
 | |
| 		}
 | |
| 		[Serializable()]
 | |
| 		private class ItemListConsistencyCheckCriteria
 | |
| 		{
 | |
| 			private int _DocVersionID;
 | |
| 			public int DocVersionID
 | |
| 			{
 | |
| 				get { return _DocVersionID; }
 | |
| 				set { _DocVersionID = value; }
 | |
| 			}
 | |
| 			private string _CheckXML;
 | |
| 			public string CheckXML
 | |
| 			{
 | |
| 				get { return _CheckXML; }
 | |
| 				set { _CheckXML = value; }
 | |
| 			}
 | |
| 			public ItemListConsistencyCheckCriteria(int docVersionID, string checkXML)
 | |
| 			{
 | |
| 				_DocVersionID = docVersionID;
 | |
| 				_CheckXML = checkXML;
 | |
| 			}
 | |
| 		}
 | |
| 		private void DataPortal_Fetch(ItemListConsistencyCheckCriteria criteria)
 | |
| 		{
 | |
| 			this.RaiseListChangedEvents = false;
 | |
| 			try
 | |
| 			{
 | |
| 				using (SqlConnection cn = Database.VEPROMS_SqlConnection)
 | |
| 				{
 | |
| 					using (SqlCommand cm = cn.CreateCommand())
 | |
| 					{
 | |
| 						cm.CommandType = CommandType.StoredProcedure;
 | |
| 						cm.CommandText = "vesp_GetConsistencyCheckProcedures";
 | |
| 						cm.Parameters.AddWithValue("@DocVersionID", criteria.DocVersionID);
 | |
| 						cm.Parameters.AddWithValue("@MyXml", criteria.CheckXML);
 | |
| 						cm.CommandTimeout = Database.DefaultTimeout;
 | |
| 						using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
 | |
| 						{
 | |
| 							while (dr.Read())
 | |
| 							{
 | |
| 								ItemInfo itemInfo = null;
 | |
| 								int itemType = dr.GetInt32("Type") / 10000;
 | |
| 								switch (itemType)
 | |
| 								{
 | |
| 									case 0:
 | |
| 										itemInfo = new ProcedureInfo(dr);
 | |
| 										break;
 | |
| 									case 1:
 | |
| 										itemInfo = new SectionInfo(dr);
 | |
| 										break;
 | |
| 									default:
 | |
| 										itemInfo = new StepInfo(dr);
 | |
| 										break;
 | |
| 								}
 | |
| 								itemInfo.AddContent(dr);
 | |
| 								itemInfo.CheckXML = dr.GetString("ChkXml");
 | |
| 								IsReadOnly = false;
 | |
| 								this.Add(itemInfo);
 | |
| 								IsReadOnly = true;
 | |
| 							}
 | |
| 						}
 | |
| 					}
 | |
| 				}
 | |
| 			}
 | |
| 			catch (Exception ex)
 | |
| 			{
 | |
| 				Database.LogException("ItemInfoList.DataPortal_Fetch", ex);
 | |
| 				throw new DbCslaException("ItemInfoList.DataPortal_Fetch", ex);
 | |
| 			}
 | |
| 			this.RaiseListChangedEvents = true;
 | |
| 		}
 | |
| 		//new for all procs
 | |
| 		public static ItemInfoList GetAllInconsistencies(int docVersionID)
 | |
| 		{
 | |
| 			try
 | |
| 			{
 | |
| 				ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new ItemListAllInConsistenciesCriteria(docVersionID));
 | |
| 				ItemInfo.AddList(tmp);
 | |
| 				tmp.AddEvents();
 | |
| 				return tmp;
 | |
| 			}
 | |
| 			catch (Exception ex)
 | |
| 			{
 | |
| 				throw new DbCslaException("Error on ItemInfoList.GetAllInconsistencies", ex);
 | |
| 			}
 | |
| 		}
 | |
| 		[Serializable()]
 | |
| 		private class ItemListAllInConsistenciesCriteria
 | |
| 		{
 | |
| 			private int _DocVersionID;
 | |
| 			public int DocVersionID
 | |
| 			{
 | |
| 				get { return _DocVersionID; }
 | |
| 				set { _DocVersionID = value; }
 | |
| 			}
 | |
| 			public ItemListAllInConsistenciesCriteria(int docVersionID)
 | |
| 			{
 | |
| 				_DocVersionID = docVersionID;
 | |
| 			}
 | |
| 		}
 | |
| 		private void DataPortal_Fetch(ItemListAllInConsistenciesCriteria criteria)
 | |
| 		{
 | |
| 			this.RaiseListChangedEvents = false;
 | |
| 			try
 | |
| 			{
 | |
| 				using (SqlConnection cn = Database.VEPROMS_SqlConnection)
 | |
| 				{
 | |
| 					using (SqlCommand cm = cn.CreateCommand())
 | |
| 					{
 | |
| 						cm.CommandType = CommandType.StoredProcedure;
 | |
| 						cm.CommandText = "vesp_GetAllConsistencyIssues";
 | |
| 						cm.Parameters.AddWithValue("@DocVersionID", criteria.DocVersionID);
 | |
| 						cm.CommandTimeout = Database.DefaultTimeout;
 | |
| 						using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
 | |
| 						{
 | |
| 							while (dr.Read())
 | |
| 							{
 | |
| 								ItemInfo itemInfo = null;
 | |
| 								int itemType = dr.GetInt32("Type") / 10000;
 | |
| 								switch (itemType)
 | |
| 								{
 | |
| 									case 0:
 | |
| 										itemInfo = new ProcedureInfo(dr);
 | |
| 										break;
 | |
| 									case 1:
 | |
| 										itemInfo = new SectionInfo(dr);
 | |
| 										break;
 | |
| 									default:
 | |
| 										itemInfo = new StepInfo(dr);
 | |
| 										break;
 | |
| 								}
 | |
| 								itemInfo.AddContent(dr);
 | |
| 								itemInfo.CheckXML = dr.GetString("ChkXml");
 | |
| 								IsReadOnly = false;
 | |
| 								this.Add(itemInfo);
 | |
| 								IsReadOnly = true;
 | |
| 							}
 | |
| 						}
 | |
| 					}
 | |
| 				}
 | |
| 			}
 | |
| 			catch (Exception ex)
 | |
| 			{
 | |
| 				Database.LogException("ItemInfoList.DataPortal_Fetch", ex);
 | |
| 				throw new DbCslaException("ItemInfoList.DataPortal_Fetch", ex);
 | |
| 			}
 | |
| 			this.RaiseListChangedEvents = true;
 | |
| 		}
 | |
| 		//end new for all procs
 | |
| 	}
 | |
| 	public partial class Revision
 | |
| 	{
 | |
| 		private RevisionConfig _MyConfig;
 | |
| 		public RevisionConfig MyConfig
 | |
| 		{
 | |
| 			get 
 | |
| 			{
 | |
| 				if (_MyConfig == null)
 | |
| 					_MyConfig = new RevisionConfig(this);
 | |
| 				return _MyConfig; 
 | |
| 			}
 | |
| 		}
 | |
| 		public static Revision GetByItemIDAndRevisionNumber(int itemID, string revisionNumber)
 | |
| 		{
 | |
| 			if (!CanGetObject())
 | |
| 				throw new System.Security.SecurityException("User not authorized to view a Revision");
 | |
| 			try
 | |
| 			{
 | |
| 				//Revision tmp = GetCachedByPrimaryKey(revisionID);
 | |
| 				//if (tmp == null)
 | |
| 				//{
 | |
| 					Revision tmp = DataPortal.Fetch<Revision>(new ItemRevisionNumberCriteria(itemID, revisionNumber));
 | |
| 				//  AddToCache(tmp);
 | |
| 				//}
 | |
| 				if (tmp.ErrorMessage == "No Record Found")
 | |
| 				{
 | |
| 					tmp.Dispose(); // Clean-up Revision
 | |
| 					tmp = null;
 | |
| 				}
 | |
| 				return tmp;
 | |
| 			}
 | |
| 			catch (Exception ex)
 | |
| 			{
 | |
| 				throw new DbCslaException("Error on Revision.GetByItemIDAndRevisionNumber", ex);
 | |
| 			}
 | |
| 		}
 | |
| 		[Serializable()]
 | |
| 		protected class ItemRevisionNumberCriteria
 | |
| 		{
 | |
| 			private int _ItemID;
 | |
| 			public int ItemID
 | |
| 			{ get { return _ItemID; } }
 | |
| 			private string _RevisionNumber;
 | |
| 			public string RevisionNumber
 | |
| 			{ get { return _RevisionNumber; } }
 | |
| 			public ItemRevisionNumberCriteria(int itemID, string revisionNumber)
 | |
| 			{
 | |
| 				_ItemID = itemID;
 | |
| 				_RevisionNumber = revisionNumber;
 | |
| 			}
 | |
| 		}
 | |
| 		private void DataPortal_Fetch(ItemRevisionNumberCriteria criteria)
 | |
| 		{
 | |
| 			if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Revision.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 = "getRevisionByItemIDandRevisionNumber";
 | |
| 						cm.Parameters.AddWithValue("@ItemID", criteria.ItemID);
 | |
| 						cm.Parameters.AddWithValue("@RevisionNumber", criteria.RevisionNumber);
 | |
| 						cm.CommandTimeout = Database.DefaultTimeout;
 | |
| 						using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
 | |
| 						{
 | |
| 							if (!dr.Read())
 | |
| 							{
 | |
| 								_ErrorMessage = "No Record Found";
 | |
| 								return;
 | |
| 							}
 | |
| 							ReadData(dr);
 | |
| 							// load child objects
 | |
| 							dr.NextResult();
 | |
| 							_RevisionChecks = RevisionChecks.Get(dr);
 | |
| 							// load child objects
 | |
| 							dr.NextResult();
 | |
| 							_RevisionVersions = RevisionVersions.Get(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("Revision.DataPortal_Fetch", ex);
 | |
| 				_ErrorMessage = ex.Message;
 | |
| 				throw new DbCslaException("Revision.DataPortal_Fetch", ex);
 | |
| 			}
 | |
| 		}
 | |
| 		//jcb 20120625
 | |
| 		public static Revision GetByItemIDAndRevisionNumberAndUnitID(int itemID, string revisionNumber, int unitID)
 | |
| 		{
 | |
| 			if (!CanGetObject())
 | |
| 				throw new System.Security.SecurityException("User not authorized to view a Revision");
 | |
| 			try
 | |
| 			{
 | |
| 				//Revision tmp = GetCachedByPrimaryKey(revisionID);
 | |
| 				//if (tmp == null)
 | |
| 				//{
 | |
| 				Revision tmp = DataPortal.Fetch<Revision>(new UnitItemRevisionNumberCriteria(itemID, revisionNumber, unitID));
 | |
| 				//  AddToCache(tmp);
 | |
| 				//}
 | |
| 				if (tmp.ErrorMessage == "No Record Found")
 | |
| 				{
 | |
| 					tmp.Dispose(); // Clean-up Revision
 | |
| 					tmp = null;
 | |
| 				}
 | |
| 				return tmp;
 | |
| 			}
 | |
| 			catch (Exception ex)
 | |
| 			{
 | |
| 				throw new DbCslaException("Error on Revision.GetByItemIDAndRevisionNumber", ex);
 | |
| 			}
 | |
| 		}
 | |
| 		[Serializable()]
 | |
| 		protected class UnitItemRevisionNumberCriteria
 | |
| 		{
 | |
| 			private int _ItemID;
 | |
| 			public int ItemID
 | |
| 			{ get { return _ItemID; } }
 | |
| 			private string _RevisionNumber;
 | |
| 			public string RevisionNumber
 | |
| 			{ get { return _RevisionNumber; } }
 | |
| 			private int _UnitID;
 | |
| 			public int UnitID
 | |
| 			{ get { return _UnitID; } }
 | |
| 			public UnitItemRevisionNumberCriteria(int itemID, string revisionNumber, int unitID)
 | |
| 			{
 | |
| 				_ItemID = itemID;
 | |
| 				_RevisionNumber = revisionNumber;
 | |
| 				_UnitID = unitID;
 | |
| 			}
 | |
| 		}
 | |
| 		private void DataPortal_Fetch(UnitItemRevisionNumberCriteria criteria)
 | |
| 		{
 | |
| 			if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Revision.DataPortal_Fetch", GetHashCode());
 | |
| 			try
 | |
| 			{
 | |
| 				using (SqlConnection cn = Database.VEPROMS_SqlConnection)
 | |
| 				{
 | |
| 					ApplicationContext.LocalContext["cn"] = cn;
 | |
| 					using (SqlCommand cm = cn.CreateCommand())
 | |
| 					{
 | |
| 						cm.CommandType = CommandType.StoredProcedure;
 | |
| 						cm.CommandTimeout = Database.SQLTimeout;
 | |
| 						cm.CommandText = "getRevisionByItemIDandRevisionNumberAndUnitID";
 | |
| 						cm.Parameters.AddWithValue("@ItemID", criteria.ItemID);
 | |
| 						cm.Parameters.AddWithValue("@RevisionNumber", criteria.RevisionNumber);
 | |
| 						cm.Parameters.AddWithValue("@UnitID", criteria.UnitID);
 | |
| 						using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
 | |
| 						{
 | |
| 							if (!dr.Read())
 | |
| 							{
 | |
| 								_ErrorMessage = "No Record Found";
 | |
| 								return;
 | |
| 							}
 | |
| 							ReadData(dr);
 | |
| 							// load child objects
 | |
| 							dr.NextResult();
 | |
| 							_RevisionChecks = RevisionChecks.Get(dr);
 | |
| 							// load child objects
 | |
| 							dr.NextResult();
 | |
| 							_RevisionVersions = RevisionVersions.Get(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("Revision.DataPortal_Fetch", ex);
 | |
| 				_ErrorMessage = ex.Message;
 | |
| 				throw new DbCslaException("Revision.DataPortal_Fetch", ex);
 | |
| 			}
 | |
| 		}
 | |
| 		//end jcb 20120625
 | |
| 	}
 | |
| 	public partial class RevisionInfoList
 | |
| 	{
 | |
| 		public static RevisionInfoList GetByItemID(int itemID)
 | |
| 		{
 | |
| 			try
 | |
| 			{
 | |
| 				//if (_RevisionInfoList != null)
 | |
| 				//  return _RevisionInfoList;
 | |
| 				RevisionInfoList tmp = DataPortal.Fetch<RevisionInfoList>(new ItemCriteria(itemID));
 | |
| 				RevisionInfo.AddList(tmp);
 | |
| 				tmp.AddEvents();
 | |
| 				//_RevisionInfoList = tmp;
 | |
| 				return tmp;
 | |
| 			}
 | |
| 			catch (Exception ex)
 | |
| 			{
 | |
| 				throw new DbCslaException("Error on RevisionInfoList.GetByItemID", ex);
 | |
| 			}
 | |
| 		}
 | |
| 		[Serializable()]
 | |
| 		protected class ItemCriteria
 | |
| 		{
 | |
| 			private int _ItemID;
 | |
| 			public int ItemID
 | |
| 			{ get { return _ItemID; } }
 | |
| 			public ItemCriteria(int itemID)
 | |
| 			{
 | |
| 				_ItemID = itemID;
 | |
| 			}
 | |
| 		}
 | |
| 		private void DataPortal_Fetch(ItemCriteria criteria)
 | |
| 		{
 | |
| 			this.RaiseListChangedEvents = false;
 | |
| 			if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RevisionInfoList.DataPortal_Fetch", GetHashCode());
 | |
| 			try
 | |
| 			{
 | |
| 				using (SqlConnection cn = Database.VEPROMS_SqlConnection)
 | |
| 				{
 | |
| 					using (SqlCommand cm = cn.CreateCommand())
 | |
| 					{
 | |
| 						cm.CommandType = CommandType.StoredProcedure;
 | |
| 						cm.CommandText = "getRevisionsByItemID";
 | |
| 						cm.Parameters.AddWithValue("@ItemID", criteria.ItemID);
 | |
| 						cm.CommandTimeout = Database.DefaultTimeout;
 | |
| 						using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
 | |
| 						{
 | |
| 							IsReadOnly = false;
 | |
| 							while (dr.Read()) this.Add(new RevisionInfo(dr));
 | |
| 							IsReadOnly = true;
 | |
| 						}
 | |
| 					}
 | |
| 				}
 | |
| 			}
 | |
| 			catch (Exception ex)
 | |
| 			{
 | |
| 				if (_MyLog.IsErrorEnabled) _MyLog.Error("RevisionInfoList.DataPortal_Fetch", ex);
 | |
| 				throw new DbCslaException("RevisionInfoList.DataPortal_Fetch", ex);
 | |
| 			}
 | |
| 			this.RaiseListChangedEvents = true;
 | |
| 		}
 | |
| 		//jcb 20120626
 | |
| 		public static RevisionInfoList GetByItemIDandUnitID(int itemID, int unitID)
 | |
| 		{
 | |
| 			try
 | |
| 			{
 | |
| 				//if (_RevisionInfoList != null)
 | |
| 				//  return _RevisionInfoList;
 | |
| 				RevisionInfoList tmp = DataPortal.Fetch<RevisionInfoList>(new ItemUnitCriteria(itemID, unitID));
 | |
| 
 | |
| 				foreach (var x in tmp)
 | |
| 				{
 | |
| 					x.LatestVersion.ApprovedXML = x.RevisionID.ToString();
 | |
| 					x.LatestVersion.PDF = Encoding.ASCII.GetBytes(x.RevisionID.ToString());
 | |
| 					x.LatestVersion.SummaryPDF = Encoding.ASCII.GetBytes(x.RevisionID.ToString());
 | |
| 				}
 | |
| 				RevisionInfo.AddList(tmp);
 | |
| 				tmp.AddEvents();
 | |
| 				//_RevisionInfoList = tmp;
 | |
| 				return tmp;
 | |
| 			}
 | |
| 			catch (Exception ex)
 | |
| 			{
 | |
| 				throw new DbCslaException("Error on RevisionInfoList.GetByItemID", ex);
 | |
| 			}
 | |
| 		}
 | |
| 		[Serializable()]
 | |
| 		protected class ItemUnitCriteria
 | |
| 		{
 | |
| 			private int _ItemID;
 | |
| 			public int ItemID
 | |
| 			{ get { return _ItemID; } }
 | |
| 			private int _UnitID;
 | |
| 			public int UnitID
 | |
| 			{ get { return _UnitID; } }
 | |
| 			public ItemUnitCriteria(int itemID, int unitID)
 | |
| 			{
 | |
| 				_ItemID = itemID;
 | |
| 				_UnitID = unitID;
 | |
| 			}
 | |
| 		}
 | |
| 		private void DataPortal_Fetch(ItemUnitCriteria criteria)
 | |
| 		{
 | |
| 			this.RaiseListChangedEvents = false;
 | |
| 			if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RevisionInfoList.DataPortal_Fetch", GetHashCode());
 | |
| 			try
 | |
| 			{
 | |
| 				using (SqlConnection cn = Database.VEPROMS_SqlConnection)
 | |
| 				{
 | |
| 					using (SqlCommand cm = cn.CreateCommand())
 | |
| 					{
 | |
| 						cm.CommandType = CommandType.StoredProcedure;
 | |
| 						cm.CommandTimeout = Database.SQLTimeout;
 | |
| 						cm.CommandText = "getRevisionsByItemIDandUnitID";
 | |
| 						cm.Parameters.AddWithValue("@ItemID", criteria.ItemID);
 | |
| 						cm.Parameters.AddWithValue("@UnitID", criteria.UnitID);
 | |
| 						using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
 | |
| 						{
 | |
| 							IsReadOnly = false;
 | |
| 							while (dr.Read()) this.Add(new RevisionInfo(dr));
 | |
| 							IsReadOnly = true;
 | |
| 						}
 | |
| 					}
 | |
| 				}
 | |
| 			}
 | |
| 			catch (Exception ex)
 | |
| 			{
 | |
| 				if (_MyLog.IsErrorEnabled) _MyLog.Error("RevisionInfoList.DataPortal_Fetch", ex);
 | |
| 				throw new DbCslaException("RevisionInfoList.DataPortal_Fetch", ex);
 | |
| 			}
 | |
| 			this.RaiseListChangedEvents = true;
 | |
| 		}
 | |
| 		//end jcb 20120626
 | |
| 	}
 | |
| 	public partial class RevisionInfo
 | |
| 	{
 | |
| 		private RevisionConfig _MyConfig;
 | |
| 		public RevisionConfig MyConfig
 | |
| 		{
 | |
| 			get
 | |
| 			{
 | |
| 				if (_MyConfig == null)
 | |
| 					_MyConfig = new RevisionConfig(this);
 | |
| 				return _MyConfig;
 | |
| 			}
 | |
| 		}
 | |
| 		#region new bozo
 | |
| 		[Serializable()]
 | |
| 		protected class ItemCriteria
 | |
| 		{
 | |
| 			private int _ItemID;
 | |
| 			public int ItemID
 | |
| 			{ get { return _ItemID; } }
 | |
| 			public ItemCriteria(int itemID)
 | |
| 			{
 | |
| 				_ItemID = itemID;
 | |
| 			}
 | |
| 			private int _UnitID = 0;
 | |
| 			public int UnitID
 | |
| 			{
 | |
| 				get{return _UnitID;}
 | |
| 				set{_UnitID = value;}
 | |
| 			}
 | |
| 		}
 | |
| 		[Serializable()]
 | |
| 		protected class CurrentItemCriteria : ItemCriteria
 | |
| 		{
 | |
| 			public CurrentItemCriteria(int itemID)
 | |
| 				: base(itemID)
 | |
| 			{
 | |
| 			}
 | |
| 		}
 | |
| 		[Serializable()]
 | |
| 		protected class CurrentItemUnitCriteria : ItemCriteria
 | |
| 		{
 | |
| 			public CurrentItemUnitCriteria(int itemID, int unitID)
 | |
| 				: base(itemID)
 | |
| 			{
 | |
| 				UnitID = unitID;
 | |
| 			}
 | |
| 		}
 | |
| 		[Serializable()]
 | |
| 		protected class PreviousItemCriteria : ItemCriteria
 | |
| 		{
 | |
| 			public PreviousItemCriteria(int itemID)
 | |
| 				: base(itemID)
 | |
| 			{
 | |
| 			}
 | |
| 		}
 | |
| 		public static RevisionInfo GetCurrentByItemID(int itemID)
 | |
| 		{
 | |
| 			try
 | |
| 			{
 | |
| 				//RevisionInfo tmp = GetCachedByPrimaryKey(revisionID);
 | |
| 				//if (tmp == null)
 | |
| 				//{
 | |
| 				//  tmp = DataPortal.Fetch<RevisionInfo>(new PKCriteria(revisionID));
 | |
| 				//  AddToCache(tmp);
 | |
| 				//}
 | |
| 				RevisionInfo tmp = DataPortal.Fetch<RevisionInfo>(new CurrentItemCriteria(itemID));
 | |
| 				if (tmp.ErrorMessage == "No Record Found")
 | |
| 				{
 | |
| 					tmp.Dispose(); // Clean-up RevisionInfo
 | |
| 					tmp = null;
 | |
| 				}
 | |
| 				return tmp;
 | |
| 			}
 | |
| 			catch (Exception ex)
 | |
| 			{
 | |
| 				throw new DbCslaException("Error on RevisionInfo.GetCurrentByItemID", ex);
 | |
| 			}
 | |
| 		}
 | |
| 		public static RevisionInfo GetCurrentByItemIDandUnitID(int itemID, int unitID)
 | |
| 		{
 | |
| 			try
 | |
| 			{
 | |
| 				RevisionInfo tmp = DataPortal.Fetch<RevisionInfo>(new CurrentItemUnitCriteria(itemID, unitID));
 | |
| 				if (tmp.ErrorMessage == "No Record Found")
 | |
| 				{
 | |
| 					tmp.Dispose(); // Clean-up RevisionInfo
 | |
| 					tmp = null;
 | |
| 				}
 | |
| 				return tmp;
 | |
| 			}
 | |
| 			catch (Exception ex)
 | |
| 			{
 | |
| 				throw new DbCslaException("Error on RevisionInfo.GetCurrentByItemID", ex);
 | |
| 			}
 | |
| 		}
 | |
| 		public static RevisionInfo GetPreviousByItemID(int itemID)
 | |
| 		{
 | |
| 			try
 | |
| 			{
 | |
| 				//RevisionInfo tmp = GetCachedByPrimaryKey(revisionID);
 | |
| 				//if (tmp == null)
 | |
| 				//{
 | |
| 				//  tmp = DataPortal.Fetch<RevisionInfo>(new PKCriteria(revisionID));
 | |
| 				//  AddToCache(tmp);
 | |
| 				//}
 | |
| 				RevisionInfo tmp = DataPortal.Fetch<RevisionInfo>(new PreviousItemCriteria(itemID));
 | |
| 				if (tmp.ErrorMessage == "No Record Found")
 | |
| 				{
 | |
| 					tmp.Dispose(); // Clean-up RevisionInfo
 | |
| 					tmp = null;
 | |
| 				}
 | |
| 				return tmp;
 | |
| 			}
 | |
| 			catch (Exception ex)
 | |
| 			{
 | |
| 				throw new DbCslaException("Error on RevisionInfo.GetPreviousByItemID", ex);
 | |
| 			}
 | |
| 		}
 | |
| 		private void DataPortal_Fetch(CurrentItemCriteria criteria)
 | |
| 		{
 | |
| 			if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RevisionInfo.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 = "getCurrentRevisionByItemID";
 | |
| 						cm.Parameters.AddWithValue("@ItemID", criteria.ItemID);
 | |
| 						cm.CommandTimeout = Database.DefaultTimeout;
 | |
| 						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("RevisionInfo.DataPortal_Fetch", ex);
 | |
| 				_ErrorMessage = ex.Message;
 | |
| 				throw new DbCslaException("RevisionInfo.DataPortal_Fetch", ex);
 | |
| 			}
 | |
| 		}
 | |
| 		private void DataPortal_Fetch(PreviousItemCriteria criteria)
 | |
| 		{
 | |
| 			if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RevisionInfo.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 = "getPreviousRevisionByItemID";
 | |
| 						cm.Parameters.AddWithValue("@ItemID", criteria.ItemID);
 | |
| 						cm.CommandTimeout = Database.DefaultTimeout;
 | |
| 						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("RevisionInfo.DataPortal_Fetch", ex);
 | |
| 				_ErrorMessage = ex.Message;
 | |
| 				throw new DbCslaException("RevisionInfo.DataPortal_Fetch", ex);
 | |
| 			}
 | |
| 		}
 | |
| 		private void DataPortal_Fetch(CurrentItemUnitCriteria criteria)
 | |
| 		{
 | |
| 			if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RevisionInfo.DataPortal_Fetch", GetHashCode());
 | |
| 			try
 | |
| 			{
 | |
| 				using (SqlConnection cn = Database.VEPROMS_SqlConnection)
 | |
| 				{
 | |
| 					ApplicationContext.LocalContext["cn"] = cn;
 | |
| 					using (SqlCommand cm = cn.CreateCommand())
 | |
| 					{
 | |
| 						cm.CommandType = CommandType.StoredProcedure;
 | |
| 						cm.CommandTimeout = Database.SQLTimeout;
 | |
| 						cm.CommandText = "getCurrentRevisionByItemIDandUnitID";
 | |
| 						cm.Parameters.AddWithValue("@ItemID", criteria.ItemID);
 | |
| 						cm.Parameters.AddWithValue("@UnitID", criteria.UnitID);
 | |
| 						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("RevisionInfo.DataPortal_Fetch", ex);
 | |
| 				_ErrorMessage = ex.Message;
 | |
| 				throw new DbCslaException("RevisionInfo.DataPortal_Fetch", ex);
 | |
| 			}
 | |
| 		}
 | |
| 		#endregion
 | |
| 		//jcb stuff
 | |
| 		public VersionInfo LatestVersion
 | |
| 		{
 | |
| 			get
 | |
| 			{
 | |
| 				//_MyLog.WarnFormat("LatestVersion 1 - {0}",GC.GetTotalMemory(true));
 | |
| 				if (this.RevisionVersions == null || this.RevisionVersions.Count == 0) return null;
 | |
| 					VersionInfo latest = this.RevisionVersions[0];
 | |
| 					foreach (VersionInfo vi in this.RevisionVersions)
 | |
| 					{
 | |
| 						if (vi.DTS > latest.DTS)
 | |
| 							latest = vi;
 | |
| 					}
 | |
| 					//_MyLog.WarnFormat("LatestVersion 2 - {0}", GC.GetTotalMemory(true));
 | |
| 					return latest;
 | |
| 			}
 | |
| 		}
 | |
| 		public override string ToString()
 | |
| 		{
 | |
| 			return string.Format("{0} Revision {1} on {2}", LatestVersion.MyStage.Name, this.RevisionNumber, this.RevisionDate.Value.ToShortDateString());
 | |
| 		}
 | |
| 		public static string BuildRevisionChecks(ProcedureInfo proc)
 | |
| 		{
 | |
| 			ConsistencyChecks cc = new ConsistencyChecks();
 | |
| 			cc.ItemID = proc.ItemID;
 | |
| 			BuildROChecks(cc, proc);
 | |
| 			BuildTransitionFromChecks(cc, proc);
 | |
| 			BuildTransitionToChecks(cc, proc);
 | |
| 			BuildLibDocChecks(cc, proc);
 | |
|       // B2018-016 approve errors trying to process open/close quote characters
 | |
|       // B2018-019 approve errors trying to process non-standard dash charcter  so replace it with a '-'
 | |
|       return cc.ToString().Replace("OldDocDate=\"0001-01-01T00:00:00\"", "").Replace("", """).Replace("", """).Replace("","-");
 | |
| 		}
 | |
| 		//end jcb stuff
 | |
| 		private static void BuildROChecks(ConsistencyChecks cc, ProcedureInfo proc)
 | |
| 		{
 | |
| 			//grab all roids from rousages for this proc and children
 | |
| 			List<string> myROIDs = new List<string>();
 | |
| 			//_MyTimer.ActiveProcess = "Build Distinct RO Usage List";
 | |
| 			using (RoUsageInfoList myList = RoUsageInfoList.GetAllForProcedure(proc))
 | |
| 				foreach (RoUsageInfo myRO in myList)
 | |
| 					if (!myROIDs.Contains(myRO.ShortROID))
 | |
| 						myROIDs.Add(myRO.ShortROID);
 | |
| 			using (DROUsageInfoList myList = DROUsageInfoList.GetAllForProcedure(proc))
 | |
| 				foreach (DROUsageInfo myRO in myList)
 | |
| 					if (!myROIDs.Contains(myRO.ROID.ToUpper()))
 | |
| 						myROIDs.Add(myRO.ROID.ToUpper());
 | |
| 
 | |
| 			//create checkro record for each roid
 | |
| 			//_MyTimer.ActiveProcess = "Get DocVersionInfo";
 | |
| //			DocVersionInfo dbi = proc.ActiveParent as DocVersionInfo;
 | |
| 			DocVersionInfo dvi = proc.MyDocVersion;
 | |
| 			//_MyTimer.ActiveProcess = "Get MyROFst";
 | |
| 			if (dvi.DocVersionAssociations == null || dvi.DocVersionAssociations.Count == 0) return;	// B2020-124: don't crash if docversion doesn't have rofst
 | |
| 			ROFstInfo rofst = ROFstInfo.GetJustROFst(dvi.DocVersionAssociations[0].ROFstID);
 | |
| 			//_MyTimer.ActiveProcess = "Get ROFst Lookup";
 | |
| 			//rofst.docVer = dvi;
 | |
| 			ROFSTLookup lookup = rofst.GetROFSTLookup(dvi);
 | |
| 			//_MyTimer.ActiveProcess = "Populating RevisionChecksXML table";
 | |
| 			cc.ROConsistency.ROFstDate = rofst.DTS;
 | |
| 
 | |
| 			foreach (string s in myROIDs)
 | |
| 			{
 | |
| 				// B2022-088: Find Doc Ro button not working in Word Sections
 | |
| 				cc.AddROCheck(s, ItemInfo.ConvertToDisplayText(((ROFSTLookup.rochild)lookup.GetRoChild(s)).value));
 | |
| 			}
 | |
| 
 | |
| 			//_MyTimer.ActiveProcess = "External";
 | |
| 		}
 | |
| 		private static void BuildTransitionFromChecks(ConsistencyChecks cc, ProcedureInfo proc)
 | |
| 		{
 | |
| 			using (TransitionInfoList myList = TransitionInfoList.GetAllForProcedure(proc, true))
 | |
| 				foreach (TransitionInfo myTI in myList)
 | |
| 				{
 | |
| 					//\v <START]\v0 EMG\u160?ES\u8209?02, REACTOR TRIP RESPONSE, Step 14\v #Link:Transition:0 1 102[END>\v0
 | |
|           string lookFor = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v '?{{}}~\\]+)*( |\\u[0-9]{{1,4}}?|\\'[0-9a-fA-F]{{2}}|\\[{{}}~])(.*?)(\\[^v'?{{}}~ \\]+)*\\v(\\[^v \\]+)* #Link:Transition[^:]*?:{0} {1}( [0-9]*){{1,2}}\[END>", myTI.TranType, myTI.TransitionID);
 | |
|           //string lookFor = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v \\]+)* ([^#]*?)(\\[^v'? \\]+)*\\v(\\[^v \\]+)* #Link:Transition[^:]*?:{0} {1}( [0-9]*){{1,2}}\[END>", myTI.TranType, myTI.TransitionID);
 | |
| 					//string lookFor = string.Format(@"<START\]\\v0 ([^#]*?)\\v #Link:Transition[^:]*?:{0} {1} [0-9]*\[END>", tran.TranType, tran.TransitionID);
 | |
| 					Match m = Regex.Match(myTI.ContentText, lookFor);
 | |
| 					if (m != null && m.Groups.Count > 1)
 | |
| 					{
 | |
|             int myIndex = m.Groups[4].Index;
 | |
|             int myLength = m.Groups[4].Length;
 | |
|             if (m.Groups[3].Value != " ")
 | |
|             {
 | |
|               myIndex = m.Groups[3].Index;
 | |
|               myLength += m.Groups[3].Length;
 | |
|             }
 | |
|             string gg = myTI.ContentText.Substring(myIndex, myLength);
 | |
|             cc.AddTransitionFromCheck(myTI.TransitionID, gg);
 | |
| //						System.Text.RegularExpressions.Group g = m.Groups[3];
 | |
| //						cc.AddTransitionFromCheck(myTI.TransitionID, g.ToString());
 | |
| 					}
 | |
| 					//_MyTimer.ActiveProcess = "get from path";
 | |
| 					//string myPath = myTI.MyItemToID.ShortPath;
 | |
| 				}
 | |
| 		}
 | |
| 		private static void BuildTransitionToChecks(ConsistencyChecks cc, ProcedureInfo proc)
 | |
| 		{
 | |
| 			using (TransitionInfoList myList = TransitionInfoList.GetAllForProcedure(proc, false))
 | |
| 				foreach (TransitionInfo myTI in myList)
 | |
| 				{
 | |
|           string lookFor = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v '?{{}}~\\]+)*( |\\u[0-9]{{1,4}}?|\\'[0-9a-fA-F]{{2}}|\\[{{}}~])(.*?)(\\[^v'?{{}}~ \\]+)*\\v(\\[^v \\]+)* #Link:Transition[^:]*?:{0} {1}( [0-9]*){{1,2}}\[END>", myTI.TranType, myTI.TransitionID);
 | |
|           //string lookFor = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v \\]+)* ([^#]*?)(\\[^v'? \\]+)*\\v(\\[^v \\]+)* #Link:Transition[^:]*?:{0} {1}( [0-9]*){{1,2}}\[END>", myTI.TranType, myTI.TransitionID);
 | |
| 					//string lookFor = string.Format(@"<START\]\\v0 ([^#]*?)\\v #Link:Transition[^:]*?:{0} {1} [0-9]*\[END>", tran.TranType, tran.TransitionID);
 | |
| 					Match m = Regex.Match(myTI.ContentText, lookFor);
 | |
| 					if (m != null && m.Groups.Count > 1)
 | |
| 					{
 | |
|             int myIndex = m.Groups[4].Index;
 | |
|             int myLength = m.Groups[4].Length;
 | |
|             if (m.Groups[3].Value != " ")
 | |
|             {
 | |
|               myIndex = m.Groups[3].Index;
 | |
|               myLength += m.Groups[3].Length;
 | |
|             }
 | |
|             string gg = myTI.ContentText.Substring(myIndex, myLength);
 | |
|             gg = gg.Replace("{", @"\{").Replace("}", @"\}");
 | |
|             cc.AddTransitionToCheck(myTI.TransitionID, gg);
 | |
| //            System.Text.RegularExpressions.Group g = m.Groups[3];
 | |
| //						cc.AddTransitionToCheck(myTI.TransitionID, g.ToString());
 | |
| 					}
 | |
| 				}
 | |
| 		}
 | |
| 		private static void BuildLibDocChecks(ConsistencyChecks cc, ProcedureInfo proc)
 | |
| 		{
 | |
| 			using (DocumentInfoList myList = DocumentInfoList.GetAllForProcedure(proc))
 | |
| 				foreach (DocumentInfo myDI in myList)
 | |
| 					cc.AddLibDocCheck(myDI.DocID, myDI.DTS);
 | |
| 		}
 | |
| 		private static Volian.Base.Library.VlnTimer _MyTimer;
 | |
| 		public static void SetupTimer()
 | |
| 		{
 | |
| 			_MyTimer = new Volian.Base.Library.VlnTimer();
 | |
| 		}
 | |
| 		public static void ShowTimer()
 | |
| 		{
 | |
| 			_MyTimer.ShowElapsedTimes("BuildROChecks");
 | |
| 		}
 | |
| 	}
 | |
| 	public partial class RoUsageInfoList
 | |
| 	{
 | |
| 		[Serializable()]
 | |
| 		private class AllForProcedureCriteria
 | |
| 		{
 | |
| 			public AllForProcedureCriteria(int itemID)
 | |
| 			{
 | |
| 				_ItemID = itemID;
 | |
| 			}
 | |
| 			private int _ItemID;
 | |
| 			public int ItemID
 | |
| 			{
 | |
| 				get { return _ItemID; }
 | |
| 				set { _ItemID = value; }
 | |
| 			}
 | |
| 		}
 | |
| 		public static RoUsageInfoList GetAllForProcedure(ProcedureInfo proc)
 | |
| 		{
 | |
| 			try
 | |
| 			{
 | |
| 				RoUsageInfoList tmp = DataPortal.Fetch<RoUsageInfoList>(new AllForProcedureCriteria(proc.ItemID));
 | |
| 				RoUsageInfo.AddList(tmp);
 | |
| 				tmp.AddEvents();
 | |
| 				return tmp;
 | |
| 			}
 | |
| 			catch (Exception ex)
 | |
| 			{
 | |
| 				throw new DbCslaException("Error on ROUsageInfoList.GetAllForProcedure", ex);
 | |
| 			}
 | |
| 		}
 | |
| 		private void DataPortal_Fetch(AllForProcedureCriteria criteria)
 | |
| 		{
 | |
| 			this.RaiseListChangedEvents = false;
 | |
| 			if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROUsageInfoList.DataPortal_FetchAllForProc", GetHashCode());
 | |
| 			try
 | |
| 			{
 | |
| 				using (SqlConnection cn = Database.VEPROMS_SqlConnection)
 | |
| 				{
 | |
| 					using (SqlCommand cm = cn.CreateCommand())
 | |
| 					{
 | |
| 						cm.CommandType = CommandType.StoredProcedure;
 | |
| 						cm.CommandText = "getRoUsagesForProc";
 | |
| 						cm.Parameters.AddWithValue("@ItemID", criteria.ItemID);
 | |
| 
 | |
| 						cm.CommandTimeout = Database.DefaultTimeout;
 | |
| 						using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
 | |
| 						{
 | |
| 							IsReadOnly = false;
 | |
| 							while (dr.Read())
 | |
| 								this.Add(new RoUsageInfo(dr));
 | |
| 							IsReadOnly = true;
 | |
| 						}
 | |
| 					}
 | |
| 				}
 | |
| 			}
 | |
| 			catch (Exception ex)
 | |
| 			{
 | |
| 				if (_MyLog.IsErrorEnabled) _MyLog.Error("RoUsageInfoList.DataPortal_FetchAllForProc", ex);
 | |
| 				throw new DbCslaException("ROUsageInfoList.DataPortal_Fetch", ex);
 | |
| 			}
 | |
| 			this.RaiseListChangedEvents = true;
 | |
| 		}
 | |
| 	}
 | |
| 	public partial class DROUsageInfoList
 | |
| 	{
 | |
| 		[Serializable()]
 | |
| 		private class AllForProcedureCriteria
 | |
| 		{
 | |
| 			public AllForProcedureCriteria(int itemID)
 | |
| 			{
 | |
| 				_ItemID = itemID;
 | |
| 			}
 | |
| 			private int _ItemID;
 | |
| 			public int ItemID
 | |
| 			{
 | |
| 				get { return _ItemID; }
 | |
| 				set { _ItemID = value; }
 | |
| 			}
 | |
| 		}
 | |
| 		public static DROUsageInfoList GetAllForProcedure(ProcedureInfo proc)
 | |
| 		{
 | |
| 			try
 | |
| 			{
 | |
| 				DROUsageInfoList tmp = DataPortal.Fetch<DROUsageInfoList>(new AllForProcedureCriteria(proc.ItemID));
 | |
| 				DROUsageInfo.AddList(tmp);
 | |
| 				tmp.AddEvents();
 | |
| 				return tmp;
 | |
| 			}
 | |
| 			catch (Exception ex)
 | |
| 			{
 | |
| 				throw new DbCslaException("Error on DROUsageInfoList.GetAllForProcedure", ex);
 | |
| 			}
 | |
| 		}
 | |
| 		private void DataPortal_Fetch(AllForProcedureCriteria criteria)
 | |
| 		{
 | |
| 			this.RaiseListChangedEvents = false;
 | |
| 			if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DROUsageInfoList.DataPortal_FetchAllForProc", GetHashCode());
 | |
| 			try
 | |
| 			{
 | |
| 				using (SqlConnection cn = Database.VEPROMS_SqlConnection)
 | |
| 				{
 | |
| 					using (SqlCommand cm = cn.CreateCommand())
 | |
| 					{
 | |
| 						cm.CommandType = CommandType.StoredProcedure;
 | |
| 						cm.CommandText = "getDROUsagesForProc";
 | |
| 						cm.Parameters.AddWithValue("@ItemID", criteria.ItemID);
 | |
| 
 | |
| 						cm.CommandTimeout = Database.DefaultTimeout;
 | |
| 						using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
 | |
| 						{
 | |
| 							IsReadOnly = false;
 | |
| 							while (dr.Read())
 | |
| 								this.Add(new DROUsageInfo(dr));
 | |
| 							IsReadOnly = true;
 | |
| 						}
 | |
| 					}
 | |
| 				}
 | |
| 			}
 | |
| 			catch (Exception ex)
 | |
| 			{
 | |
| 				if (_MyLog.IsErrorEnabled) _MyLog.Error("DROUsageInfoList.DataPortal_FetchAllForProc", ex);
 | |
| 				throw new DbCslaException("DROUsageInfoList.DataPortal_Fetch", ex);
 | |
| 			}
 | |
| 			this.RaiseListChangedEvents = true;
 | |
| 		}
 | |
| 	}
 | |
| 	public partial class TransitionInfo
 | |
| 	{
 | |
| 		internal string _ContentText;
 | |
| 		public string ContentText
 | |
| 		{
 | |
| 			get { return _ContentText; }
 | |
| 			set { _ContentText = value; }
 | |
| 		}
 | |
| 	}
 | |
| 	public partial class TransitionInfoList
 | |
| 	{
 | |
| 		[Serializable()]
 | |
| 		private class AllForProcedureCriteria
 | |
| 		{
 | |
| 			public AllForProcedureCriteria(int itemID, bool from)
 | |
| 			{
 | |
| 				_ItemID = itemID;
 | |
| 				_From = from;
 | |
| 			}
 | |
| 			private int _ItemID;
 | |
| 			public int ItemID
 | |
| 			{
 | |
| 				get { return _ItemID; }
 | |
| 				set { _ItemID = value; }
 | |
| 			}
 | |
| 			private bool _From;
 | |
| 			public bool From
 | |
| 			{
 | |
| 				get { return _From; }
 | |
| 				set { _From = value; }
 | |
| 			}
 | |
| 		}
 | |
| 		public static TransitionInfoList GetAllForProcedure(ProcedureInfo proc, bool from)
 | |
| 		{
 | |
| 			try
 | |
| 			{
 | |
| 				TransitionInfoList tmp = DataPortal.Fetch<TransitionInfoList>(new AllForProcedureCriteria(proc.ItemID, from));
 | |
| 				TransitionInfo.AddList(tmp);
 | |
| 				tmp.AddEvents();
 | |
| 				return tmp;
 | |
| 			}
 | |
| 			catch (Exception ex)
 | |
| 			{
 | |
| 				throw new DbCslaException("Error on TransitionInfoList.GetAllForProcedure", ex);
 | |
| 			}
 | |
| 		}
 | |
| 		private void DataPortal_Fetch(AllForProcedureCriteria criteria)
 | |
| 		{
 | |
| 			this.RaiseListChangedEvents = false;
 | |
| 			if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] TransitionInfoList.DataPortal_FetchAllForProc", GetHashCode());
 | |
| 			try
 | |
| 			{
 | |
| 				using (SqlConnection cn = Database.VEPROMS_SqlConnection)
 | |
| 				{
 | |
| 					using (SqlCommand cm = cn.CreateCommand())
 | |
| 					{
 | |
| 						cm.CommandType = CommandType.StoredProcedure;
 | |
| 						if(criteria.From)
 | |
| 							cm.CommandText = "getTransitionsFromProc";
 | |
| 						else
 | |
| 							cm.CommandText = "getTransitionsToProc";
 | |
| 						cm.Parameters.AddWithValue("@ItemID", criteria.ItemID);
 | |
| 
 | |
| 						cm.CommandTimeout = Database.DefaultTimeout;
 | |
| 						using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
 | |
| 						{
 | |
| 							IsReadOnly = false;
 | |
| 							while (dr.Read())
 | |
| 							{
 | |
| 								TransitionInfo ti = new TransitionInfo(dr);
 | |
| 								ti.ContentText = dr.GetString("ContentText");
 | |
| 								this.Add(ti);
 | |
| 							}
 | |
| 							IsReadOnly = true;
 | |
| 						}
 | |
| 					}
 | |
| 				}
 | |
| 			}
 | |
| 			catch (Exception ex)
 | |
| 			{
 | |
| 				if (_MyLog.IsErrorEnabled) _MyLog.Error("TransitionInfoList.DataPortal_FetchAllForProc", ex);
 | |
| 				throw new DbCslaException("TransitionInfoList.DataPortal_Fetch", ex);
 | |
| 			}
 | |
| 			this.RaiseListChangedEvents = true;
 | |
| 		}
 | |
| 	}
 | |
| 	public partial class DocumentInfoList
 | |
| 	{
 | |
| 		[Serializable()]
 | |
| 		private class AllForProcedureCriteria
 | |
| 		{
 | |
| 			public AllForProcedureCriteria(int itemID)
 | |
| 			{
 | |
| 				_ItemID = itemID;
 | |
| 			}
 | |
| 			private int _ItemID;
 | |
| 			public int ItemID
 | |
| 			{
 | |
| 				get { return _ItemID; }
 | |
| 				set { _ItemID = value; }
 | |
| 			}
 | |
| 		}
 | |
| 		public static DocumentInfoList GetAllForProcedure(ProcedureInfo proc)
 | |
| 		{
 | |
| 			try
 | |
| 			{
 | |
| 				DocumentInfoList tmp = DataPortal.Fetch<DocumentInfoList>(new AllForProcedureCriteria(proc.ItemID));
 | |
| 				DocumentInfo.AddList(tmp);
 | |
| 				tmp.AddEvents();
 | |
| 				return tmp;
 | |
| 			}
 | |
| 			catch (Exception ex)
 | |
| 			{
 | |
| 				throw new DbCslaException("Error on DocumentInfoList.GetAllForProcedure", ex);
 | |
| 			}
 | |
| 		}
 | |
| 		private void DataPortal_Fetch(AllForProcedureCriteria criteria)
 | |
| 		{
 | |
| 			this.RaiseListChangedEvents = false;
 | |
| 			if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocumentInfoList.DataPortal_FetchAllForProc", GetHashCode());
 | |
| 			try
 | |
| 			{
 | |
| 				using (SqlConnection cn = Database.VEPROMS_SqlConnection)
 | |
| 				{
 | |
| 					using (SqlCommand cm = cn.CreateCommand())
 | |
| 					{
 | |
| 						cm.CommandType = CommandType.StoredProcedure;
 | |
| 						cm.CommandText = "getLibDocsForProc";
 | |
| 						cm.Parameters.AddWithValue("@ItemID", criteria.ItemID);
 | |
| 
 | |
| 						cm.CommandTimeout = Database.DefaultTimeout;
 | |
| 						using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
 | |
| 						{
 | |
| 							IsReadOnly = false;
 | |
| 							while (dr.Read())
 | |
| 								this.Add(new DocumentInfo(dr));
 | |
| 							IsReadOnly = true;
 | |
| 						}
 | |
| 					}
 | |
| 				}
 | |
| 			}
 | |
| 			catch (Exception ex)
 | |
| 			{
 | |
| 				if (_MyLog.IsErrorEnabled) _MyLog.Error("DocumentInfoList.DataPortal_FetchAllForProc", ex);
 | |
| 				throw new DbCslaException("DocumentInfoList.DataPortal_Fetch", ex);
 | |
| 			}
 | |
| 			this.RaiseListChangedEvents = true;
 | |
| 		}
 | |
| 	}
 | |
| 	[Serializable]
 | |
| 	[XmlRoot("ConsistencyChecks")]
 | |
| 	public class ConsistencyChecks
 | |
| 	{
 | |
| 		public static ConsistencyChecks Get(string xml)
 | |
| 		{
 | |
| 			return GenericSerializer<ConsistencyChecks>.StringDeserialize(xml);
 | |
| 		}
 | |
| 		public override string ToString()
 | |
| 		{
 | |
| 			return GenericSerializer<ConsistencyChecks>.StringSerialize(this);
 | |
| 		}
 | |
| 		private int _ItemID;
 | |
| 		[XmlAttribute("ItemID")]
 | |
| 		public int ItemID
 | |
| 		{
 | |
| 			get { return _ItemID; }
 | |
| 			set { _ItemID = value; }
 | |
| 		}
 | |
| 		private ROConsistency _ROConsistency = new ROConsistency();
 | |
| 		[XmlElement("ROChecks")]
 | |
| 		[Category("Referenced Objects")]
 | |
| 		[Description("RO Consistency Data")]
 | |
| 		[DisplayName("RO Consistency")]
 | |
| 		public ROConsistency ROConsistency
 | |
| 		{
 | |
| 			get { return _ROConsistency; }
 | |
| 			set { _ROConsistency = value; }
 | |
| 		}
 | |
| 		public void AddROCheck(string roid, string roValue)
 | |
| 		{
 | |
| 			ROConsistency.AddROCheck(roid, roValue);
 | |
| 		}
 | |
| 
 | |
| 		private TransitionConsistency _TransitionFromConsistency = new TransitionConsistency();
 | |
| 		[XmlElement("TransitionFromChecks")]
 | |
| 		[Category("Transitions")]
 | |
| 		[Description("Transition From Consistency Data")]
 | |
| 		[DisplayName("Transition From Consistency")]
 | |
| 		public TransitionConsistency TransitionFromConsistency
 | |
| 		{
 | |
| 			get { return _TransitionFromConsistency; }
 | |
| 			set { _TransitionFromConsistency = value; }
 | |
| 		}
 | |
| 		public void AddTransitionFromCheck(int transitionid, string transitionValue)
 | |
| 		{
 | |
| 			TransitionFromConsistency.AddTransitionCheck(transitionid, transitionValue);
 | |
| 		}
 | |
| 		private TransitionConsistency _TransitionToConsistency = new TransitionConsistency();
 | |
| 		[XmlElement("TransitionToChecks")]
 | |
| 		[Category("Transitions")]
 | |
| 		[Description("Transition To Consistency Data")]
 | |
| 		[DisplayName("Transition To Consistency")]
 | |
| 		public TransitionConsistency TransitionToConsistency
 | |
| 		{
 | |
| 			get { return _TransitionToConsistency; }
 | |
| 			set { _TransitionToConsistency = value; }
 | |
| 		}
 | |
| 		public void AddTransitionToCheck(int transitionid, string transitionValue)
 | |
| 		{
 | |
| 			TransitionToConsistency.AddTransitionCheck(transitionid, transitionValue);
 | |
| 		}
 | |
| 		private TransitionConsistency _TransitionConsistency = new TransitionConsistency();
 | |
| 		[XmlElement("TransitionChecks")]
 | |
| 		[Category("Transitions")]
 | |
| 		[Description("Transition Consistency Data")]
 | |
| 		[DisplayName("Transition Consistency")]
 | |
| 		public TransitionConsistency TransitionConsistency
 | |
| 		{
 | |
| 			get { return _TransitionConsistency; }
 | |
| 			set { _TransitionConsistency = value; }
 | |
| 		}
 | |
| 
 | |
| 		private LibDocConsistency _LibDocConsistency = new LibDocConsistency();
 | |
| 		[XmlElement("LibDocChecks")]
 | |
| 		[Category("Library Documents")]
 | |
| 		[Description("Lib Doc Consistency Data")]
 | |
| 		[DisplayName("Lib Doc Consistency")]
 | |
| 		public LibDocConsistency LibDocConsistency
 | |
| 		{
 | |
| 			get { return _LibDocConsistency; }
 | |
| 			set { _LibDocConsistency = value; }
 | |
| 		}
 | |
| 		public void AddLibDocCheck(int docid, DateTime docdate)
 | |
| 		{
 | |
| 			LibDocConsistency.AddLibDocCheck(docid, docdate);
 | |
| 		}
 | |
| 	}
 | |
| 	[Serializable]
 | |
| 	[TypeConverter(typeof(ExpandableObjectConverter))]
 | |
| 	public class ROConsistency
 | |
| 	{
 | |
| 		private DateTime _ROFstDate = DateTime.Now;
 | |
| 		[XmlAttribute("ROFstDate")]
 | |
| 		[Description("Date ROFst Generated")]
 | |
| 		[DisplayName("ROFst Date")]
 | |
| 		public DateTime ROFstDate
 | |
| 		{
 | |
| 			get { return _ROFstDate; }
 | |
| 			set { _ROFstDate = value; }
 | |
| 		}
 | |
| 		private SortedDictionary<string, ROCheck> _ROCheckList = new SortedDictionary<string, ROCheck>();
 | |
| 		[XmlElement("ROCheck")]
 | |
| 		[Description("RO Data")]
 | |
| 		[DisplayName("RO Data")]
 | |
| 		public ROCheck[] MyROChecks
 | |
| 		{
 | |
| 			get
 | |
| 			{
 | |
| 				ROCheck[] ros = new ROCheck[_ROCheckList.Count];
 | |
| 				_ROCheckList.Values.CopyTo(ros, 0);
 | |
| 				return ros;
 | |
| 			}
 | |
| 			set
 | |
| 			{
 | |
| 				_ROCheckList = new SortedDictionary<string, ROCheck>();
 | |
| 				foreach (ROCheck ro in value)
 | |
| 					_ROCheckList.Add(ro.ROID, ro);
 | |
| 			}
 | |
| 		}
 | |
| 		public void AddROCheck(string roid, string roValue)
 | |
| 		{
 | |
| 			if (!_ROCheckList.ContainsKey(roid))
 | |
| 				_ROCheckList.Add(roid, new ROCheck(roid, roValue));
 | |
| 		}
 | |
| 		public override string ToString()
 | |
| 		{
 | |
| 			return string.Format("{0} ROs", _ROCheckList.Count);
 | |
| 		}
 | |
| 	}
 | |
| 	[Serializable]
 | |
| 	[TypeConverter(typeof(ExpandableObjectConverter))]
 | |
| 	public class ROCheck
 | |
| 	{
 | |
| 		private string _ROID;
 | |
| 		[XmlAttribute("ROID")]
 | |
| 		[Description("RO Unique ID")]
 | |
| 		public string ROID
 | |
| 		{
 | |
| 			get { return _ROID; }
 | |
| 			set { _ROID = value; }
 | |
| 		}
 | |
| 		private string _ROValue;
 | |
| 		[XmlAttribute("ROValue")]
 | |
| 		[Description("RO Value")]
 | |
| 		public string ROValue
 | |
| 		{
 | |
| 			get { return _ROValue; }
 | |
| 			set { _ROValue = value; }
 | |
| 		}
 | |
| 		private string _OldROValue;
 | |
| 		[XmlAttribute("OldROValue")]
 | |
| 		[Description("Old RO Value")]
 | |
| 		public string OldROValue
 | |
| 		{
 | |
| 			get { return _OldROValue; }
 | |
| 			set { _OldROValue = value; }
 | |
| 		}
 | |
| 		public ROCheck(string roid, string rovalue)
 | |
| 		{
 | |
| 			_ROID = roid;
 | |
| 			_ROValue = rovalue;
 | |
| 		}
 | |
| 		public ROCheck()
 | |
| 		{
 | |
| 		}
 | |
| 		public override string ToString()
 | |
| 		{
 | |
| 			return string.Format("{0} - '{1}'", ROID, ROValue);
 | |
| 		}
 | |
| 	}
 | |
| 
 | |
| 	[Serializable]
 | |
| 	[TypeConverter(typeof(ExpandableObjectConverter))]
 | |
| 	public class TransitionConsistency
 | |
| 	{
 | |
| 		private SortedDictionary<int, TransitionCheck> _TransitionCheckList = new SortedDictionary<int, TransitionCheck>();
 | |
| 		[XmlElement("TransitionCheck")]
 | |
| 		[Description("Transition Data")]
 | |
| 		[DisplayName("Transition Data")]
 | |
| 		public TransitionCheck[] MyTransitionChecks
 | |
| 		{
 | |
| 			get
 | |
| 			{
 | |
| 				TransitionCheck[] ts = new TransitionCheck[_TransitionCheckList.Count];
 | |
| 				_TransitionCheckList.Values.CopyTo(ts, 0);
 | |
| 				return ts;
 | |
| 			}
 | |
| 			set
 | |
| 			{
 | |
| 				_TransitionCheckList = new SortedDictionary<int, TransitionCheck>();
 | |
| 				foreach (TransitionCheck tc in value)
 | |
| 					_TransitionCheckList.Add(tc.TransitionID, tc);
 | |
| 			}
 | |
| 		}
 | |
| 		public void AddTransitionCheck(int transitionid, string transitionValue)
 | |
| 		{
 | |
| 			if (!_TransitionCheckList.ContainsKey(transitionid))
 | |
| 				_TransitionCheckList.Add(transitionid, new TransitionCheck(transitionid, transitionValue));
 | |
| 		}
 | |
| 		public override string ToString()
 | |
| 		{
 | |
| 			return string.Format("{0} Transitions", _TransitionCheckList.Count);
 | |
| 		}
 | |
| 	}
 | |
| 	[Serializable]
 | |
| 	[TypeConverter(typeof(ExpandableObjectConverter))]
 | |
| 	public class TransitionCheck
 | |
| 	{
 | |
| 		private int _TransitionID;
 | |
| 		[XmlAttribute("TransitionID")]
 | |
| 		[Description("Transition Unique ID")]
 | |
| 		public int TransitionID
 | |
| 		{
 | |
| 			get { return _TransitionID; }
 | |
| 			set { _TransitionID = value; }
 | |
| 		}
 | |
| 		private string _TransitionValue;
 | |
| 		[XmlAttribute("TransitionValue")]
 | |
| 		[Description("Transition Value")]
 | |
| 		public string TransitionValue
 | |
| 		{
 | |
| 			get { return _TransitionValue; }
 | |
| 			set { _TransitionValue = value; }
 | |
| 		}
 | |
| 		private string _OldTransitionValue;
 | |
| 		[XmlAttribute("OldTransitionValue")]
 | |
| 		[Description("Old Transition Value")]
 | |
| 		public string OldTransitionValue
 | |
| 		{
 | |
| 			get { return _OldTransitionValue; }
 | |
| 			set { _OldTransitionValue = value; }
 | |
| 		}
 | |
| 		public TransitionCheck(int transitionid, string transitionvalue)
 | |
| 		{
 | |
| 			_TransitionID = transitionid;
 | |
| 			_TransitionValue = transitionvalue;
 | |
| 		}
 | |
| 		public TransitionCheck()
 | |
| 		{
 | |
| 		}
 | |
| 		public override string ToString()
 | |
| 		{
 | |
| 			return string.Format("{0} - '{1}'", TransitionID, TransitionValue);
 | |
| 		}
 | |
| 	}
 | |
| 
 | |
| 	[Serializable]
 | |
| 	[TypeConverter(typeof(ExpandableObjectConverter))]
 | |
| 	public class LibDocConsistency
 | |
| 	{
 | |
| 		private SortedDictionary<int, LibDocCheck> _LibDocCheckList = new SortedDictionary<int, LibDocCheck>();
 | |
| 		[XmlElement("LibDocCheck")]
 | |
| 		[Description("LibDoc Data")]
 | |
| 		[DisplayName("LibDoc Data")]
 | |
| 		public LibDocCheck[] MyLibDocChecks
 | |
| 		{
 | |
| 			get
 | |
| 			{
 | |
| 				LibDocCheck[] lds = new LibDocCheck[_LibDocCheckList.Count];
 | |
| 				_LibDocCheckList.Values.CopyTo(lds, 0);
 | |
| 				return lds;
 | |
| 			}
 | |
| 			set
 | |
| 			{
 | |
| 				_LibDocCheckList = new SortedDictionary<int, LibDocCheck>();
 | |
| 				foreach (LibDocCheck ld in value)
 | |
| 					_LibDocCheckList.Add(ld.DocID, ld);
 | |
| 			}
 | |
| 		}
 | |
| 		public void AddLibDocCheck(int docid, DateTime docDate)
 | |
| 		{
 | |
| 			if (!_LibDocCheckList.ContainsKey(docid))
 | |
| 				_LibDocCheckList.Add(docid, new LibDocCheck(docid, docDate));
 | |
| 		}
 | |
| 		public override string ToString()
 | |
| 		{
 | |
| 			return string.Format("{0} LibDocs", _LibDocCheckList.Count);
 | |
| 		}
 | |
| 	}
 | |
| 	[Serializable]
 | |
| 	[TypeConverter(typeof(ExpandableObjectConverter))]
 | |
| 	public class LibDocCheck
 | |
| 	{
 | |
| 		private int _DocID;
 | |
| 		[XmlAttribute("DocID")]
 | |
| 		[Description("Lib Doc Unique ID")]
 | |
| 		public int DocID
 | |
| 		{
 | |
| 			get { return _DocID; }
 | |
| 			set { _DocID = value; }
 | |
| 		}
 | |
| 		private DateTime _DocDate;
 | |
| 		[XmlAttribute("DocDate")]
 | |
| 		[Description("Lib Doc Date")]
 | |
| 		public DateTime DocDate
 | |
| 		{
 | |
| 			get { return _DocDate; }
 | |
| 			set { _DocDate = value; }
 | |
| 		}
 | |
| 		private DateTime _OldDocDate;
 | |
| 		[XmlAttribute("OldDocDate")]
 | |
| 		[Description("Old Lib Doc Date")]
 | |
| 		public DateTime OldDocDate
 | |
| 		{
 | |
| 			get 
 | |
| 			{
 | |
| 				//if (_OldDocDate == DateTime.MinValue)
 | |
| 				//  return null;
 | |
| 				return _OldDocDate;
 | |
| 			}
 | |
| 			set 
 | |
| 			{
 | |
| 				//if (value == null)
 | |
| 				//  _OldDocDate = DateTime.MinValue;
 | |
| 				//else
 | |
| 				//  _OldDocDate = value.Value;
 | |
| 				_OldDocDate = value;
 | |
| 			}
 | |
| 		}
 | |
| 		public LibDocCheck(int docid, DateTime docdate)
 | |
| 		{
 | |
| 			_DocID = docid;
 | |
| 			_DocDate = docdate;
 | |
| 		}
 | |
| 		public LibDocCheck()
 | |
| 		{
 | |
| 		}
 | |
| 		public override string ToString()
 | |
| 		{
 | |
| 			return string.Format("{0} - '{1}'", DocID, DocDate);
 | |
| 		}
 | |
| 	}
 | |
| 	public enum Rev_Types : int
 | |
| 	{
 | |
| 		Revision = 1, TempMod = 2
 | |
| 	}
 | |
| 
 | |
| }
 |