// ========================================================================
// Copyright 2007 - Volian Enterprises, Inc. All rights reserved.          
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
// ------------------------------------------------------------------------
// $Workfile: $     $Revision: $                                           
// $Author: $   $Date: $                                                   
//                                                                         
// $History: $                                                             
// ========================================================================
using System;
using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
using System.Configuration;
using System.IO;
using System.ComponentModel;
using System.Collections.Generic;
using Csla.Validation;
namespace VEPROMS.CSLA.Library
{
	/// 
	///	RevisionCheck Generated by MyGeneration using the CSLA Object Mapping template
	/// 
	[Serializable()]
	[TypeConverter(typeof(RevisionCheckConverter))]
	public partial class RevisionCheck : BusinessBase, IVEHasBrokenRules, IDisposable
	{
		#region Log4Net
		private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
		#endregion
		#region Business Methods
		private string _ErrorMessage = string.Empty;
		public string ErrorMessage
		{
			get { return _ErrorMessage; }
		}
		private int _CheckID;
		[System.ComponentModel.DataObjectField(true, true)]
		public int CheckID
		{
			[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
			get
			{
				CanReadProperty("CheckID", true);
				if (_MyCheck != null) _CheckID = _MyCheck.CheckID;
				return _CheckID;
			}
		}
		private Check _MyCheck;
		[System.ComponentModel.DataObjectField(true, true)]
		public Check MyCheck
		{
			[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
			get
			{
				CanReadProperty("MyCheck", true);
				if (_MyCheck == null && _CheckID != 0) _MyCheck = Check.Get(_CheckID);
				return _MyCheck;
			}
		}
		private int _StageID;
		public int StageID
		{
			[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
			get
			{
				CanReadProperty("StageID", true);
				if (_MyStage != null) _StageID = _MyStage.StageID;
				return _StageID;
			}
		}
		private Stage _MyStage;
		public Stage MyStage
		{
			[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
			get
			{
				CanReadProperty("MyStage", true);
				if (_MyStage == null && _StageID != 0) _MyStage = Stage.Get(_StageID);
				return _MyStage;
			}
			[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
			set
			{
				CanWriteProperty("MyStage", true);
				if (_MyStage != value)
				{
					_MyStage = value;
					_StageID = value.StageID;// Update underlying data field
					PropertyHasChanged();
				}
			}
		}
		private string _ConsistencyChecks = string.Empty;
		public string ConsistencyChecks
		{
			[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
			get
			{
				CanReadProperty("ConsistencyChecks", true);
				return _ConsistencyChecks;
			}
			[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
			set
			{
				CanWriteProperty("ConsistencyChecks", true);
				if (value == null) value = string.Empty;
				if (_ConsistencyChecks != value)
				{
					_ConsistencyChecks = value;
					PropertyHasChanged();
				}
			}
		}
		private DateTime _DTS = new DateTime();
		public DateTime DTS
		{
			[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
			get
			{
				CanReadProperty("DTS", true);
				return _DTS;
			}
			[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
			set
			{
				CanWriteProperty("DTS", true);
				if (_DTS != value)
				{
					_DTS = value;
					PropertyHasChanged();
				}
			}
		}
		private string _UserID = string.Empty;
		public string UserID
		{
			[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
			get
			{
				CanReadProperty("UserID", true);
				return _UserID;
			}
			[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
			set
			{
				CanWriteProperty("UserID", true);
				if (value == null) value = string.Empty;
				if (_UserID != value)
				{
					_UserID = value;
					PropertyHasChanged();
				}
			}
		}
		private byte[] _LastChanged = new byte[8];//timestamp
		private string _Stage_Name = string.Empty;
		public string Stage_Name
		{
			[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
			get
			{
				CanReadProperty("Stage_Name", true);
				return _Stage_Name;
			}
		}
		private string _Stage_Description = string.Empty;
		public string Stage_Description
		{
			[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
			get
			{
				CanReadProperty("Stage_Description", true);
				return _Stage_Description;
			}
		}
		private int _Stage_IsApproved;
		public int Stage_IsApproved
		{
			[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
			get
			{
				CanReadProperty("Stage_IsApproved", true);
				return _Stage_IsApproved;
			}
		}
		private DateTime _Stage_DTS = new DateTime();
		public DateTime Stage_DTS
		{
			[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
			get
			{
				CanReadProperty("Stage_DTS", true);
				return _Stage_DTS;
			}
		}
		private string _Stage_UserID = string.Empty;
		public string Stage_UserID
		{
			[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
			get
			{
				CanReadProperty("Stage_UserID", true);
				return _Stage_UserID;
			}
		}
		// CSLATODO: Check RevisionCheck.GetIdValue to assure that the ID returned is unique
		/// 
		/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
		/// 
		/// A Unique ID for the current RevisionCheck
		protected override object GetIdValue()
		{
			return MyRevisionCheckUnique; // Absolutely Unique ID
		}
		// CSLATODO: Replace base RevisionCheck.ToString function as necessary
		/// 
		/// Overrides Base ToString
		/// 
		/// A string representation of current RevisionCheck
		//public override string ToString()
		//{
		//  return base.ToString();
		//}
		public override bool IsDirty
		{
			get 
			{
				if ( base.IsDirty ) 
					return true;
				return IsDirtyList(new List