context: using System; 
  using System.Data.Linq;
  using System.Data.Linq.Mapping;
  using System.Data;
  using System.Collections.Generic;
  using System.Reflection;
  using System.Linq;
  using System.Linq.Expressions;
  using System.ComponentModel;
  using CmsData.Infrastructure;
  
  namespace CmsData
  {
  	[Table(Name="dbo.BundleHeader")]
  	public partial class BundleHeader : INotifyPropertyChanging, INotifyPropertyChanged
  	{
  		private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
  		
  	#region Private Fields
  		
  		private int _BundleHeaderId;
  		
  		private int _ChurchId;
  		
  		private int _CreatedBy;
  		
  		private DateTime _CreatedDate;
  		
  		private bool _RecordStatus;
  		
  		private int _BundleStatusId;
  		
  		private DateTime _ContributionDate;
  		
  		private int _BundleHeaderTypeId;
  		
  		private DateTime? _DepositDate;
  		
  		private decimal? _BundleTotal;
  		
  		private decimal? _TotalCash;
  		
  		private decimal? _TotalChecks;
  		
  		private decimal? _TotalEnvelopes;
  		
  		private int? _ModifiedBy;
  		
  		private DateTime? _ModifiedDate;
  		
  		private int? _FundId;
  		
     		
     		private EntitySet< BundleDetail> _BundleDetails;
  		
      	
  		private EntityRef< ContributionFund> _Fund;
  		
  		private EntityRef< BundleHeaderType> _BundleHeaderType;
  		
  		private EntityRef< BundleStatusType> _BundleStatusType;
  		
  	#endregion
  	
      #region Extensibility Method Definitions
      partial void OnLoaded();
      partial void OnValidate(System.Data.Linq.ChangeAction action);
      partial void OnCreated();
  		
  		partial void OnBundleHeaderIdChanging(int value);
  		partial void OnBundleHeaderIdChanged();
  		
  		partial void OnChurchIdChanging(int value);
  		partial void OnChurchIdChanged();
  		
  		partial void OnCreatedByChanging(int value);
  		partial void OnCreatedByChanged();
  		
  		partial void OnCreatedDateChanging(DateTime value);
  		partial void OnCreatedDateChanged();
  		
  		partial void OnRecordStatusChanging(bool value);
  		partial void OnRecordStatusChanged();
  		
  		partial void OnBundleStatusIdChanging(int value);
  		partial void OnBundleStatusIdChanged();
  		
  		partial void OnContributionDateChanging(DateTime value);
  		partial void OnContributionDateChanged();
  		
  		partial void OnBundleHeaderTypeIdChanging(int value);
  		partial void OnBundleHeaderTypeIdChanged();
  		
  		partial void OnDepositDateChanging(DateTime? value);
  		partial void OnDepositDateChanged();
  		
  		partial void OnBundleTotalChanging(decimal? value);
  		partial void OnBundleTotalChanged();
  		
  		partial void OnTotalCashChanging(decimal? value);
  		partial void OnTotalCashChanged();
  		
  		partial void OnTotalChecksChanging(decimal? value);
  		partial void OnTotalChecksChanged();
  		
  		partial void OnTotalEnvelopesChanging(decimal? value);
  		partial void OnTotalEnvelopesChanged();
  		
  		partial void OnModifiedByChanging(int? value);
  		partial void OnModifiedByChanged();
  		
  		partial void OnModifiedDateChanging(DateTime? value);
  		partial void OnModifiedDateChanged();
  		
  		partial void OnFundIdChanging(int? value);
  		partial void OnFundIdChanged();
  		
      #endregion
  		public BundleHeader()
  		{
  			
  			this._BundleDetails = new EntitySet< BundleDetail>(new Action< BundleDetail>(this.attach_BundleDetails), new Action< BundleDetail>(this.detach_BundleDetails)); 
  			
  			
  			this._Fund = default(EntityRef< ContributionFund>); 
  			
  			this._BundleHeaderType = default(EntityRef< BundleHeaderType>); 
  			
  			this._BundleStatusType = default(EntityRef< BundleStatusType>); 
  			
  			OnCreated();
  		}
  
  		
      #region Columns
  		
  		[Column(Name="BundleHeaderId", UpdateCheck=UpdateCheck.Never, Storage="_BundleHeaderId", AutoSync=AutoSync.OnInsert, DbType="int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
  		public int BundleHeaderId
  		{
  			get { return this._BundleHeaderId; }
  
  			set
  			{
  				if (this._BundleHeaderId != value)
  				{
  				
                      this.OnBundleHeaderIdChanging(value);
  					this.SendPropertyChanging();
  					this._BundleHeaderId = value;
  					this.SendPropertyChanged("BundleHeaderId");
  					this.OnBundleHeaderIdChanged();
  				}
  
  			}
  
  		}
  
  		
  		[Column(Name="ChurchId", UpdateCheck=UpdateCheck.Never, Storage="_ChurchId", DbType="int NOT NULL")]
  		public int ChurchId
  		{
  			get { return this._ChurchId; }
  
  			set
  			{
  				if (this._ChurchId != value)
  				{
  				
                      this.OnChurchIdChanging(value);
  					this.SendPropertyChanging();
  					this._ChurchId = value;
  					this.SendPropertyChanged("ChurchId");
  					this.OnChurchIdChanged();
  				}
  
  			}
  
  		}
  
  		
  		[Column(Name="CreatedBy", UpdateCheck=UpdateCheck.Never, Storage="_CreatedBy", DbType="int NOT NULL")]
  		public int CreatedBy
  		{
  			get { return this._CreatedBy; }
  
  			set
  			{
  				if (this._CreatedBy != value)
  				{
  				
                      this.OnCreatedByChanging(value);
  					this.SendPropertyChanging();
  					this._CreatedBy = value;
  					this.SendPropertyChanged("CreatedBy");
  					this.OnCreatedByChanged();
  				}
  
  			}
  
  		}
  
  		
  		[Column(Name="CreatedDate", UpdateCheck=UpdateCheck.Never, Storage="_CreatedDate", DbType="datetime NOT NULL")]
  		public DateTime CreatedDate
  		{
  			get { return this._CreatedDate; }
  
  			set
  			{
  
gt: 				if (this._CreatedDate != value)