#region Copyright Syncfusion® Inc. 2001-2025.
// Copyright Syncfusion® Inc. 2001-2025. All rights reserved.
// Use of this code is subject to the terms of our license.
// A copy of the current license can be obtained at any time by e-mailing
// licensing@syncfusion.com. Any infringement will be prosecuted under
// applicable laws. 
#endregion
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.3082
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace PortfolioManager.DataModel
{
	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 System;
	
	
	public partial class PortfolioManagerDB : System.Data.Linq.DataContext
	{
		
		private static System.Data.Linq.Mapping.MappingSource mappingSource = new AttributeMappingSource();
		
    #region Extensibility Method Definitions
    partial void OnCreated();
    partial void InsertAccounts(Accounts instance);
    partial void UpdateAccounts(Accounts instance);
    partial void DeleteAccounts(Accounts instance);
    partial void InsertHistoricalQuotes(HistoricalQuotes instance);
    partial void UpdateHistoricalQuotes(HistoricalQuotes instance);
    partial void DeleteHistoricalQuotes(HistoricalQuotes instance);
    partial void InsertHoldings(Holdings instance);
    partial void UpdateHoldings(Holdings instance);
    partial void DeleteHoldings(Holdings instance);
    partial void InsertIndustries(Industries instance);
    partial void UpdateIndustries(Industries instance);
    partial void DeleteIndustries(Industries instance);
    partial void InsertQuotes(Quotes instance);
    partial void UpdateQuotes(Quotes instance);
    partial void DeleteQuotes(Quotes instance);
    partial void InsertSectors(Sectors instance);
    partial void UpdateSectors(Sectors instance);
    partial void DeleteSectors(Sectors instance);
    partial void InsertStockExchanges(StockExchanges instance);
    partial void UpdateStockExchanges(StockExchanges instance);
    partial void DeleteStockExchanges(StockExchanges instance);
    #endregion
		
		public PortfolioManagerDB(string connection) : 
				base(connection, mappingSource)
		{
			OnCreated();
		}
		
		public PortfolioManagerDB(System.Data.IDbConnection connection) : 
				base(connection, mappingSource)
		{
			OnCreated();
		}
		
		public PortfolioManagerDB(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : 
				base(connection, mappingSource)
		{
			OnCreated();
		}
		
		public PortfolioManagerDB(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : 
				base(connection, mappingSource)
		{
			OnCreated();
		}
		
		public System.Data.Linq.Table<Accounts> Accounts
		{
			get
			{
				return this.GetTable<Accounts>();
			}
		}
		
		public System.Data.Linq.Table<HistoricalQuotes> HistoricalQuotes
		{
			get
			{
				return this.GetTable<HistoricalQuotes>();
			}
		}
		
		public System.Data.Linq.Table<Holdings> Holdings
		{
			get
			{
				return this.GetTable<Holdings>();
			}
		}
		
		public System.Data.Linq.Table<Industries> Industries
		{
			get
			{
				return this.GetTable<Industries>();
			}
		}
		
		public System.Data.Linq.Table<Quotes> Quotes
		{
			get
			{
				return this.GetTable<Quotes>();
			}
		}
		
		public System.Data.Linq.Table<Sectors> Sectors
		{
			get
			{
				return this.GetTable<Sectors>();
			}
		}
		
		public System.Data.Linq.Table<StockExchanges> StockExchanges
		{
			get
			{
				return this.GetTable<StockExchanges>();
			}
		}
	}
	
	[Table()]
	public partial class Accounts : INotifyPropertyChanging, INotifyPropertyChanged
	{
		
		private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
		
		private int _AccountID;
		
		private System.Nullable<decimal> _OpenBalance;
		
		private System.Nullable<System.DateTime> _CreationDate;
		
		private System.Nullable<int> _Users_UserID;
		
		private System.Nullable<decimal> _CashBalance;
		
		private System.Nullable<decimal> _AssetBalance;
		
		private string _AccountName;
		
		private EntitySet<Holdings> _Holdings;
		
    #region Extensibility Method Definitions
    partial void OnLoaded();
    partial void OnValidate(System.Data.Linq.ChangeAction action);
    partial void OnCreated();
    partial void OnAccountIDChanging(int value);
    partial void OnAccountIDChanged();
    partial void OnOpenBalanceChanging(System.Nullable<decimal> value);
    partial void OnOpenBalanceChanged();
    partial void OnCreationDateChanging(System.Nullable<System.DateTime> value);
    partial void OnCreationDateChanged();
    partial void OnUsers_UserIDChanging(System.Nullable<int> value);
    partial void OnUsers_UserIDChanged();
    partial void OnCashBalanceChanging(System.Nullable<decimal> value);
    partial void OnCashBalanceChanged();
    partial void OnAssetBalanceChanging(System.Nullable<decimal> value);
    partial void OnAssetBalanceChanged();
    partial void OnAccountNameChanging(string value);
    partial void OnAccountNameChanged();
    #endregion
		
		public Accounts()
		{
			this._Holdings = new EntitySet<Holdings>(new Action<Holdings>(this.attach_Holdings), new Action<Holdings>(this.detach_Holdings));
			OnCreated();
		}
		
		[Column(Storage="_AccountID", DbType="Int NOT NULL", IsPrimaryKey=true)]
		public int AccountID
		{
			get
			{
				return this._AccountID;
			}
			set
			{
				if ((this._AccountID != value))
				{
					this.OnAccountIDChanging(value);
					this.SendPropertyChanging();
					this._AccountID = value;
					this.SendPropertyChanged("AccountID");
					this.OnAccountIDChanged();
				}
			}
		}
		
		[Column(Storage="_OpenBalance", DbType="Decimal(12,2)")]
		public System.Nullable<decimal> OpenBalance
		{
			get
			{
				return this._OpenBalance;
			}
			set
			{
				if ((this._OpenBalance != value))
				{
					this.OnOpenBalanceChanging(value);
					this.SendPropertyChanging();
					this._OpenBalance = value;
					this.SendPropertyChanged("OpenBalance");
					this.OnOpenBalanceChanged();
				}
			}
		}
		
		[Column(Storage="_CreationDate", DbType="DateTime")]
		public System.Nullable<System.DateTime> CreationDate
		{
			get
			{
				return this._CreationDate;
			}
			set
			{
				if ((this._CreationDate != value))
				{
					this.OnCreationDateChanging(value);
					this.SendPropertyChanging();
					this._CreationDate = value;
					this.SendPropertyChanged("CreationDate");
					this.OnCreationDateChanged();
				}
			}
		}
		
		[Column(Storage="_Users_UserID", DbType="Int")]
		public System.Nullable<int> Users_UserID
		{
			get
			{
				return this._Users_UserID;
			}
			set
			{
				if ((this._Users_UserID != value))
				{
					this.OnUsers_UserIDChanging(value);
					this.SendPropertyChanging();
					this._Users_UserID = value;
					this.SendPropertyChanged("Users_UserID");
					this.OnUsers_UserIDChanged();
				}
			}
		}
		
		[Column(Storage="_CashBalance", DbType="Decimal(12,2)")]
		public System.Nullable<decimal> CashBalance
		{
			get
			{
				return this._CashBalance;
			}
			set
			{
				if ((this._CashBalance != value))
				{
					this.OnCashBalanceChanging(value);
					this.SendPropertyChanging();
					this._CashBalance = value;
					this.SendPropertyChanged("CashBalance");
					this.OnCashBalanceChanged();
				}
			}
		}
		
		[Column(Storage="_AssetBalance", DbType="Decimal(12,2)")]
		public System.Nullable<decimal> AssetBalance
		{
			get
			{
				return this._AssetBalance;
			}
			set
			{
				if ((this._AssetBalance != value))
				{
					this.OnAssetBalanceChanging(value);
					this.SendPropertyChanging();
					this._AssetBalance = value;
					this.SendPropertyChanged("AssetBalance");
					this.OnAssetBalanceChanged();
				}
			}
		}
		
		[Column(Storage="_AccountName", DbType="NVarChar(50)")]
		public string AccountName
		{
			get
			{
				return this._AccountName;
			}
			set
			{
				if ((this._AccountName != value))
				{
					this.OnAccountNameChanging(value);
					this.SendPropertyChanging();
					this._AccountName = value;
					this.SendPropertyChanged("AccountName");
					this.OnAccountNameChanged();
				}
			}
		}
		
		[Association(Name="Accounts_Holdings", Storage="_Holdings", ThisKey="AccountID", OtherKey="Accounts_AccountID")]
		public EntitySet<Holdings> Holdings
		{
			get
			{
				return this._Holdings;
			}
			set
			{
				this._Holdings.Assign(value);
			}
		}
		
		public event PropertyChangingEventHandler PropertyChanging;
		
		public event PropertyChangedEventHandler PropertyChanged;
		
		protected virtual void SendPropertyChanging()
		{
			if ((this.PropertyChanging != null))
			{
				this.PropertyChanging(this, emptyChangingEventArgs);
			}
		}
		
		protected virtual void SendPropertyChanged(String propertyName)
		{
			if ((this.PropertyChanged != null))
			{
				this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
			}
		}
		
		private void attach_Holdings(Holdings entity)
		{
			this.SendPropertyChanging();
			entity.Accounts = this;
		}
		
		private void detach_Holdings(Holdings entity)
		{
			this.SendPropertyChanging();
			entity.Accounts = null;
		}
	}
	
	[Table()]
	public partial class HistoricalQuotes : INotifyPropertyChanging, INotifyPropertyChanged
	{
		
		private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
		
		private int _QuoteID;
		
		private string _Symbol;
		
		private System.Nullable<System.DateTime> _Date;
		
		private System.Nullable<decimal> _Open;
		
		private System.Nullable<decimal> _High;
		
		private System.Nullable<decimal> _Low;
		
		private System.Nullable<decimal> _Close;
		
		private System.Nullable<long> _Volume;
		
    #region Extensibility Method Definitions
    partial void OnLoaded();
    partial void OnValidate(System.Data.Linq.ChangeAction action);
    partial void OnCreated();
    partial void OnQuoteIDChanging(int value);
    partial void OnQuoteIDChanged();
    partial void OnSymbolChanging(string value);
    partial void OnSymbolChanged();
    partial void OnDateChanging(System.Nullable<System.DateTime> value);
    partial void OnDateChanged();
    partial void OnOpenChanging(System.Nullable<decimal> value);
    partial void OnOpenChanged();
    partial void OnHighChanging(System.Nullable<decimal> value);
    partial void OnHighChanged();
    partial void OnLowChanging(System.Nullable<decimal> value);
    partial void OnLowChanged();
    partial void OnCloseChanging(System.Nullable<decimal> value);
    partial void OnCloseChanged();
    partial void OnVolumeChanging(System.Nullable<long> value);
    partial void OnVolumeChanged();
    #endregion
		
		public HistoricalQuotes()
		{
			OnCreated();
		}
		
		[Column(Storage="_QuoteID", DbType="Int NOT NULL", IsPrimaryKey=true)]
		public int QuoteID
		{
			get
			{
				return this._QuoteID;
			}
			set
			{
				if ((this._QuoteID != value))
				{
					this.OnQuoteIDChanging(value);
					this.SendPropertyChanging();
					this._QuoteID = value;
					this.SendPropertyChanged("QuoteID");
					this.OnQuoteIDChanged();
				}
			}
		}
		
		[Column(Storage="_Symbol", DbType="NVarChar(20) NOT NULL", CanBeNull=false)]
		public string Symbol
		{
			get
			{
				return this._Symbol;
			}
			set
			{
				if ((this._Symbol != value))
				{
					this.OnSymbolChanging(value);
					this.SendPropertyChanging();
					this._Symbol = value;
					this.SendPropertyChanged("Symbol");
					this.OnSymbolChanged();
				}
			}
		}
		
		[Column(Storage="_Date", DbType="DateTime")]
		public System.Nullable<System.DateTime> Date
		{
			get
			{
				return this._Date;
			}
			set
			{
				if ((this._Date != value))
				{
					this.OnDateChanging(value);
					this.SendPropertyChanging();
					this._Date = value;
					this.SendPropertyChanged("Date");
					this.OnDateChanged();
				}
			}
		}
		
		[Column(Storage="_Open", DbType="Decimal(12,2)")]
		public System.Nullable<decimal> Open
		{
			get
			{
				return this._Open;
			}
			set
			{
				if ((this._Open != value))
				{
					this.OnOpenChanging(value);
					this.SendPropertyChanging();
					this._Open = value;
					this.SendPropertyChanged("Open");
					this.OnOpenChanged();
				}
			}
		}
		
		[Column(Storage="_High", DbType="Decimal(12,2)")]
		public System.Nullable<decimal> High
		{
			get
			{
				return this._High;
			}
			set
			{
				if ((this._High != value))
				{
					this.OnHighChanging(value);
					this.SendPropertyChanging();
					this._High = value;
					this.SendPropertyChanged("High");
					this.OnHighChanged();
				}
			}
		}
		
		[Column(Storage="_Low", DbType="Decimal(12,2)")]
		public System.Nullable<decimal> Low
		{
			get
			{
				return this._Low;
			}
			set
			{
				if ((this._Low != value))
				{
					this.OnLowChanging(value);
					this.SendPropertyChanging();
					this._Low = value;
					this.SendPropertyChanged("Low");
					this.OnLowChanged();
				}
			}
		}
		
		[Column(Storage="_Close", DbType="Decimal(12,2)")]
		public System.Nullable<decimal> Close
		{
			get
			{
				return this._Close;
			}
			set
			{
				if ((this._Close != value))
				{
					this.OnCloseChanging(value);
					this.SendPropertyChanging();
					this._Close = value;
					this.SendPropertyChanged("Close");
					this.OnCloseChanged();
				}
			}
		}
		
		[Column(Storage="_Volume", DbType="BigInt")]
		public System.Nullable<long> Volume
		{
			get
			{
				return this._Volume;
			}
			set
			{
				if ((this._Volume != value))
				{
					this.OnVolumeChanging(value);
					this.SendPropertyChanging();
					this._Volume = value;
					this.SendPropertyChanged("Volume");
					this.OnVolumeChanged();
				}
			}
		}
		
		public event PropertyChangingEventHandler PropertyChanging;
		
		public event PropertyChangedEventHandler PropertyChanged;
		
		protected virtual void SendPropertyChanging()
		{
			if ((this.PropertyChanging != null))
			{
				this.PropertyChanging(this, emptyChangingEventArgs);
			}
		}
		
		protected virtual void SendPropertyChanged(String propertyName)
		{
			if ((this.PropertyChanged != null))
			{
				this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
			}
		}
	}
	
	[Table()]
	public partial class Holdings : INotifyPropertyChanging, INotifyPropertyChanged
	{
		
		private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
		
		private int _HoldingID;
		
		private string _Quotes_Symbol;
		
		private System.Nullable<decimal> _Quantity;
		
		private System.Nullable<decimal> _PricePaid;
		
		private System.Nullable<System.DateTime> _PurchaseDate;
		
		private int _Accounts_AccountID;
		
		private int _StockExchangeID;
		
		private System.Nullable<bool> _Open;
		
		private EntityRef<Accounts> _Accounts;
		
		private EntityRef<Quotes> _Quotes;
		
		private EntityRef<StockExchanges> _StockExchanges;
		
    #region Extensibility Method Definitions
    partial void OnLoaded();
    partial void OnValidate(System.Data.Linq.ChangeAction action);
    partial void OnCreated();
    partial void OnHoldingIDChanging(int value);
    partial void OnHoldingIDChanged();
    partial void OnQuotes_SymbolChanging(string value);
    partial void OnQuotes_SymbolChanged();
    partial void OnQuantityChanging(System.Nullable<decimal> value);
    partial void OnQuantityChanged();
    partial void OnPricePaidChanging(System.Nullable<decimal> value);
    partial void OnPricePaidChanged();
    partial void OnPurchaseDateChanging(System.Nullable<System.DateTime> value);
    partial void OnPurchaseDateChanged();
    partial void OnAccounts_AccountIDChanging(int value);
    partial void OnAccounts_AccountIDChanged();
    partial void OnStockExchangeIDChanging(int value);
    partial void OnStockExchangeIDChanged();
    partial void OnOpenChanging(System.Nullable<bool> value);
    partial void OnOpenChanged();
    #endregion
		
		public Holdings()
		{
			this._Accounts = default(EntityRef<Accounts>);
			this._Quotes = default(EntityRef<Quotes>);
			this._StockExchanges = default(EntityRef<StockExchanges>);
			OnCreated();
		}
		
		[Column(Storage="_HoldingID", DbType="Int NOT NULL", IsPrimaryKey=true)]
		public int HoldingID
		{
			get
			{
				return this._HoldingID;
			}
			set
			{
				if ((this._HoldingID != value))
				{
					this.OnHoldingIDChanging(value);
					this.SendPropertyChanging();
					this._HoldingID = value;
					this.SendPropertyChanged("HoldingID");
					this.OnHoldingIDChanged();
				}
			}
		}
		
		[Column(Storage="_Quotes_Symbol", DbType="NVarChar(50) NOT NULL", CanBeNull=false)]
		public string Quotes_Symbol
		{
			get
			{
				return this._Quotes_Symbol;
			}
			set
			{
				if ((this._Quotes_Symbol != value))
				{
					if (this._Quotes.HasLoadedOrAssignedValue)
					{
						throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
					}
					this.OnQuotes_SymbolChanging(value);
					this.SendPropertyChanging();
					this._Quotes_Symbol = value;
					this.SendPropertyChanged("Quotes_Symbol");
					this.OnQuotes_SymbolChanged();
				}
			}
		}
		
		[Column(Storage="_Quantity", DbType="Decimal(10,0)")]
		public System.Nullable<decimal> Quantity
		{
			get
			{
				return this._Quantity;
			}
			set
			{
				if ((this._Quantity != value))
				{
					this.OnQuantityChanging(value);
					this.SendPropertyChanging();
					this._Quantity = value;
					this.SendPropertyChanged("Quantity");
					this.OnQuantityChanged();
				}
			}
		}
		
		[Column(Storage="_PricePaid", DbType="Decimal(10,2)")]
		public System.Nullable<decimal> PricePaid
		{
			get
			{
				return this._PricePaid;
			}
			set
			{
				if ((this._PricePaid != value))
				{
					this.OnPricePaidChanging(value);
					this.SendPropertyChanging();
					this._PricePaid = value;
					this.SendPropertyChanged("PricePaid");
					this.OnPricePaidChanged();
				}
			}
		}
		
		[Column(Storage="_PurchaseDate", DbType="DateTime")]
		public System.Nullable<System.DateTime> PurchaseDate
		{
			get
			{
				return this._PurchaseDate;
			}
			set
			{
				if ((this._PurchaseDate != value))
				{
					this.OnPurchaseDateChanging(value);
					this.SendPropertyChanging();
					this._PurchaseDate = value;
					this.SendPropertyChanged("PurchaseDate");
					this.OnPurchaseDateChanged();
				}
			}
		}
		
		[Column(Storage="_Accounts_AccountID", DbType="Int NOT NULL")]
		public int Accounts_AccountID
		{
			get
			{
				return this._Accounts_AccountID;
			}
			set
			{
				if ((this._Accounts_AccountID != value))
				{
					if (this._Accounts.HasLoadedOrAssignedValue)
					{
						throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
					}
					this.OnAccounts_AccountIDChanging(value);
					this.SendPropertyChanging();
					this._Accounts_AccountID = value;
					this.SendPropertyChanged("Accounts_AccountID");
					this.OnAccounts_AccountIDChanged();
				}
			}
		}
		
		[Column(Storage="_StockExchangeID", DbType="Int NOT NULL")]
		public int StockExchangeID
		{
			get
			{
				return this._StockExchangeID;
			}
			set
			{
				if ((this._StockExchangeID != value))
				{
					if (this._StockExchanges.HasLoadedOrAssignedValue)
					{
						throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
					}
					this.OnStockExchangeIDChanging(value);
					this.SendPropertyChanging();
					this._StockExchangeID = value;
					this.SendPropertyChanged("StockExchangeID");
					this.OnStockExchangeIDChanged();
				}
			}
		}
		
		[Column(Storage="_Open", DbType="Bit")]
		public System.Nullable<bool> Open
		{
			get
			{
				return this._Open;
			}
			set
			{
				if ((this._Open != value))
				{
					this.OnOpenChanging(value);
					this.SendPropertyChanging();
					this._Open = value;
					this.SendPropertyChanged("Open");
					this.OnOpenChanged();
				}
			}
		}
		
		[Association(Name="Accounts_Holdings", Storage="_Accounts", ThisKey="Accounts_AccountID", OtherKey="AccountID", IsForeignKey=true)]
		public Accounts Accounts
		{
			get
			{
				return this._Accounts.Entity;
			}
			set
			{
				Accounts previousValue = this._Accounts.Entity;
				if (((previousValue != value) 
							|| (this._Accounts.HasLoadedOrAssignedValue == false)))
				{
					this.SendPropertyChanging();
					if ((previousValue != null))
					{
						this._Accounts.Entity = null;
						previousValue.Holdings.Remove(this);
					}
					this._Accounts.Entity = value;
					if ((value != null))
					{
						value.Holdings.Add(this);
						this._Accounts_AccountID = value.AccountID;
					}
					else
					{
						this._Accounts_AccountID = default(int);
					}
					this.SendPropertyChanged("Accounts");
				}
			}
		}
		
		[Association(Name="Quotes_Holdings", Storage="_Quotes", ThisKey="Quotes_Symbol", OtherKey="Symbol", IsForeignKey=true)]
		public Quotes Quotes
		{
			get
			{
				return this._Quotes.Entity;
			}
			set
			{
				Quotes previousValue = this._Quotes.Entity;
				if (((previousValue != value) 
							|| (this._Quotes.HasLoadedOrAssignedValue == false)))
				{
					this.SendPropertyChanging();
					if ((previousValue != null))
					{
						this._Quotes.Entity = null;
						previousValue.Holdings.Remove(this);
					}
					this._Quotes.Entity = value;
					if ((value != null))
					{
						value.Holdings.Add(this);
						this._Quotes_Symbol = value.Symbol;
					}
					else
					{
						this._Quotes_Symbol = default(string);
					}
					this.SendPropertyChanged("Quotes");
				}
			}
		}
		
		[Association(Name="StockExchanges_Holdings", Storage="_StockExchanges", ThisKey="StockExchangeID", OtherKey="StockExchangeID", IsForeignKey=true)]
		public StockExchanges StockExchanges
		{
			get
			{
				return this._StockExchanges.Entity;
			}
			set
			{
				StockExchanges previousValue = this._StockExchanges.Entity;
				if (((previousValue != value) 
							|| (this._StockExchanges.HasLoadedOrAssignedValue == false)))
				{
					this.SendPropertyChanging();
					if ((previousValue != null))
					{
						this._StockExchanges.Entity = null;
						previousValue.Holdings.Remove(this);
					}
					this._StockExchanges.Entity = value;
					if ((value != null))
					{
						value.Holdings.Add(this);
						this._StockExchangeID = value.StockExchangeID;
					}
					else
					{
						this._StockExchangeID = default(int);
					}
					this.SendPropertyChanged("StockExchanges");
				}
			}
		}
		
		public event PropertyChangingEventHandler PropertyChanging;
		
		public event PropertyChangedEventHandler PropertyChanged;
		
		protected virtual void SendPropertyChanging()
		{
			if ((this.PropertyChanging != null))
			{
				this.PropertyChanging(this, emptyChangingEventArgs);
			}
		}
		
		protected virtual void SendPropertyChanged(String propertyName)
		{
			if ((this.PropertyChanged != null))
			{
				this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
			}
		}
	}
	
	[Table()]
	public partial class Industries : INotifyPropertyChanging, INotifyPropertyChanged
	{
		
		private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
		
		private int _IndustryID;
		
		private string _IndusrtyName;
		
		private int _SectorID;
		
		private EntitySet<Quotes> _Quotes;
		
		private EntityRef<Sectors> _Sectors;
		
    #region Extensibility Method Definitions
    partial void OnLoaded();
    partial void OnValidate(System.Data.Linq.ChangeAction action);
    partial void OnCreated();
    partial void OnIndustryIDChanging(int value);
    partial void OnIndustryIDChanged();
    partial void OnIndusrtyNameChanging(string value);
    partial void OnIndusrtyNameChanged();
    partial void OnSectorIDChanging(int value);
    partial void OnSectorIDChanged();
    #endregion
		
		public Industries()
		{
			this._Quotes = new EntitySet<Quotes>(new Action<Quotes>(this.attach_Quotes), new Action<Quotes>(this.detach_Quotes));
			this._Sectors = default(EntityRef<Sectors>);
			OnCreated();
		}
		
		[Column(Storage="_IndustryID", DbType="Int NOT NULL", IsPrimaryKey=true)]
		public int IndustryID
		{
			get
			{
				return this._IndustryID;
			}
			set
			{
				if ((this._IndustryID != value))
				{
					this.OnIndustryIDChanging(value);
					this.SendPropertyChanging();
					this._IndustryID = value;
					this.SendPropertyChanged("IndustryID");
					this.OnIndustryIDChanged();
				}
			}
		}
		
		[Column(Storage="_IndusrtyName", DbType="NVarChar(255)")]
		public string IndusrtyName
		{
			get
			{
				return this._IndusrtyName;
			}
			set
			{
				if ((this._IndusrtyName != value))
				{
					this.OnIndusrtyNameChanging(value);
					this.SendPropertyChanging();
					this._IndusrtyName = value;
					this.SendPropertyChanged("IndusrtyName");
					this.OnIndusrtyNameChanged();
				}
			}
		}
		
		[Column(Storage="_SectorID", DbType="Int NOT NULL")]
		public int SectorID
		{
			get
			{
				return this._SectorID;
			}
			set
			{
				if ((this._SectorID != value))
				{
					if (this._Sectors.HasLoadedOrAssignedValue)
					{
						throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
					}
					this.OnSectorIDChanging(value);
					this.SendPropertyChanging();
					this._SectorID = value;
					this.SendPropertyChanged("SectorID");
					this.OnSectorIDChanged();
				}
			}
		}
		
		[Association(Name="Industries_Quotes", Storage="_Quotes", ThisKey="IndustryID", OtherKey="Industry_IndustryID")]
		public EntitySet<Quotes> Quotes
		{
			get
			{
				return this._Quotes;
			}
			set
			{
				this._Quotes.Assign(value);
			}
		}
		
		[Association(Name="Sectors_Industries", Storage="_Sectors", ThisKey="SectorID", OtherKey="SectorID", IsForeignKey=true)]
		public Sectors Sectors
		{
			get
			{
				return this._Sectors.Entity;
			}
			set
			{
				Sectors previousValue = this._Sectors.Entity;
				if (((previousValue != value) 
							|| (this._Sectors.HasLoadedOrAssignedValue == false)))
				{
					this.SendPropertyChanging();
					if ((previousValue != null))
					{
						this._Sectors.Entity = null;
						previousValue.Industries.Remove(this);
					}
					this._Sectors.Entity = value;
					if ((value != null))
					{
						value.Industries.Add(this);
						this._SectorID = value.SectorID;
					}
					else
					{
						this._SectorID = default(int);
					}
					this.SendPropertyChanged("Sectors");
				}
			}
		}
		
		public event PropertyChangingEventHandler PropertyChanging;
		
		public event PropertyChangedEventHandler PropertyChanged;
		
		protected virtual void SendPropertyChanging()
		{
			if ((this.PropertyChanging != null))
			{
				this.PropertyChanging(this, emptyChangingEventArgs);
			}
		}
		
		protected virtual void SendPropertyChanged(String propertyName)
		{
			if ((this.PropertyChanged != null))
			{
				this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
			}
		}
		
		private void attach_Quotes(Quotes entity)
		{
			this.SendPropertyChanging();
			entity.Industries = this;
		}
		
		private void detach_Quotes(Quotes entity)
		{
			this.SendPropertyChanging();
			entity.Industries = null;
		}
	}
	
	[Table()]
	public partial class Quotes : INotifyPropertyChanging, INotifyPropertyChanged
	{
		
		private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
		
		private string _Symbol;
		
		private string _CompanyName;
		
		private System.Nullable<decimal> _Price;
		
		private System.Nullable<double> _Change;
		
		private System.Nullable<double> @__Change;
		
		private System.Nullable<decimal> _Open;
		
		private System.Nullable<decimal> _High;
		
		private System.Nullable<decimal> _Low;
		
		private System.Nullable<double> _Volume;
		
		private int _Industry_IndustryID;
		
		private EntitySet<Holdings> _Holdings;
		
		private EntityRef<Industries> _Industries;
		
    #region Extensibility Method Definitions
    partial void OnLoaded();
    partial void OnValidate(System.Data.Linq.ChangeAction action);
    partial void OnCreated();
    partial void OnSymbolChanging(string value);
    partial void OnSymbolChanged();
    partial void OnCompanyNameChanging(string value);
    partial void OnCompanyNameChanged();
    partial void OnPriceChanging(System.Nullable<decimal> value);
    partial void OnPriceChanged();
    partial void OnChangeChanging(System.Nullable<double> value);
    partial void OnChangeChanged();
    partial void On_ChangeChanging(System.Nullable<double> value);
    partial void On_ChangeChanged();
    partial void OnOpenChanging(System.Nullable<decimal> value);
    partial void OnOpenChanged();
    partial void OnHighChanging(System.Nullable<decimal> value);
    partial void OnHighChanged();
    partial void OnLowChanging(System.Nullable<decimal> value);
    partial void OnLowChanged();
    partial void OnVolumeChanging(System.Nullable<double> value);
    partial void OnVolumeChanged();
    partial void OnIndustry_IndustryIDChanging(int value);
    partial void OnIndustry_IndustryIDChanged();
    #endregion
		
		public Quotes()
		{
			this._Holdings = new EntitySet<Holdings>(new Action<Holdings>(this.attach_Holdings), new Action<Holdings>(this.detach_Holdings));
			this._Industries = default(EntityRef<Industries>);
			OnCreated();
		}
		
		[Column(Storage="_Symbol", DbType="NVarChar(50) NOT NULL", CanBeNull=false, IsPrimaryKey=true)]
		public string Symbol
		{
			get
			{
				return this._Symbol;
			}
			set
			{
				if ((this._Symbol != value))
				{
					this.OnSymbolChanging(value);
					this.SendPropertyChanging();
					this._Symbol = value;
					this.SendPropertyChanged("Symbol");
					this.OnSymbolChanged();
				}
			}
		}
		
		[Column(Storage="_CompanyName", DbType="NVarChar(255)")]
		public string CompanyName
		{
			get
			{
				return this._CompanyName;
			}
			set
			{
				if ((this._CompanyName != value))
				{
					this.OnCompanyNameChanging(value);
					this.SendPropertyChanging();
					this._CompanyName = value;
					this.SendPropertyChanged("CompanyName");
					this.OnCompanyNameChanged();
				}
			}
		}
		
		[Column(Storage="_Price", DbType="Decimal(12,2)")]
		public System.Nullable<decimal> Price
		{
			get
			{
				return this._Price;
			}
			set
			{
				if ((this._Price != value))
				{
					this.OnPriceChanging(value);
					this.SendPropertyChanging();
					this._Price = value;
					this.SendPropertyChanged("Price");
					this.OnPriceChanged();
				}
			}
		}
		
		[Column(Storage="_Change", DbType="Float")]
		public System.Nullable<double> Change
		{
			get
			{
				return this._Change;
			}
			set
			{
				if ((this._Change != value))
				{
					this.OnChangeChanging(value);
					this.SendPropertyChanging();
					this._Change = value;
					this.SendPropertyChanged("Change");
					this.OnChangeChanged();
				}
			}
		}
		
		[Column(Name="% Change", Storage="__Change", DbType="Float")]
		public System.Nullable<double> PertChange
		{
			get
			{
				return this.@__Change;
			}
			set
			{
				if ((this.@__Change != value))
				{
					this.On_ChangeChanging(value);
					this.SendPropertyChanging();
					this.@__Change = value;
					this.SendPropertyChanged("_Change");
					this.On_ChangeChanged();
				}
			}
		}
		
		[Column(Storage="_Open", DbType="Decimal(12,2)")]
		public System.Nullable<decimal> Open
		{
			get
			{
				return this._Open;
			}
			set
			{
				if ((this._Open != value))
				{
					this.OnOpenChanging(value);
					this.SendPropertyChanging();
					this._Open = value;
					this.SendPropertyChanged("Open");
					this.OnOpenChanged();
				}
			}
		}
		
		[Column(Storage="_High", DbType="Decimal(12,2)")]
		public System.Nullable<decimal> High
		{
			get
			{
				return this._High;
			}
			set
			{
				if ((this._High != value))
				{
					this.OnHighChanging(value);
					this.SendPropertyChanging();
					this._High = value;
					this.SendPropertyChanged("High");
					this.OnHighChanged();
				}
			}
		}
		
		[Column(Storage="_Low", DbType="Decimal(12,2)")]
		public System.Nullable<decimal> Low
		{
			get
			{
				return this._Low;
			}
			set
			{
				if ((this._Low != value))
				{
					this.OnLowChanging(value);
					this.SendPropertyChanging();
					this._Low = value;
					this.SendPropertyChanged("Low");
					this.OnLowChanged();
				}
			}
		}
		
		[Column(Storage="_Volume", DbType="Float")]
		public System.Nullable<double> Volume
		{
			get
			{
				return this._Volume;
			}
			set
			{
				if ((this._Volume != value))
				{
					this.OnVolumeChanging(value);
					this.SendPropertyChanging();
					this._Volume = value;
					this.SendPropertyChanged("Volume");
					this.OnVolumeChanged();
				}
			}
		}
		
		[Column(Storage="_Industry_IndustryID", DbType="Int NOT NULL")]
		public int Industry_IndustryID
		{
			get
			{
				return this._Industry_IndustryID;
			}
			set
			{
				if ((this._Industry_IndustryID != value))
				{
					if (this._Industries.HasLoadedOrAssignedValue)
					{
						throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
					}
					this.OnIndustry_IndustryIDChanging(value);
					this.SendPropertyChanging();
					this._Industry_IndustryID = value;
					this.SendPropertyChanged("Industry_IndustryID");
					this.OnIndustry_IndustryIDChanged();
				}
			}
		}
		
		[Association(Name="Quotes_Holdings", Storage="_Holdings", ThisKey="Symbol", OtherKey="Quotes_Symbol")]
		public EntitySet<Holdings> Holdings
		{
			get
			{
				return this._Holdings;
			}
			set
			{
				this._Holdings.Assign(value);
			}
		}
		
		[Association(Name="Industries_Quotes", Storage="_Industries", ThisKey="Industry_IndustryID", OtherKey="IndustryID", IsForeignKey=true)]
		public Industries Industries
		{
			get
			{
				return this._Industries.Entity;
			}
			set
			{
				Industries previousValue = this._Industries.Entity;
				if (((previousValue != value) 
							|| (this._Industries.HasLoadedOrAssignedValue == false)))
				{
					this.SendPropertyChanging();
					if ((previousValue != null))
					{
						this._Industries.Entity = null;
						previousValue.Quotes.Remove(this);
					}
					this._Industries.Entity = value;
					if ((value != null))
					{
						value.Quotes.Add(this);
						this._Industry_IndustryID = value.IndustryID;
					}
					else
					{
						this._Industry_IndustryID = default(int);
					}
					this.SendPropertyChanged("Industries");
				}
			}
		}
		
		public event PropertyChangingEventHandler PropertyChanging;
		
		public event PropertyChangedEventHandler PropertyChanged;
		
		protected virtual void SendPropertyChanging()
		{
			if ((this.PropertyChanging != null))
			{
				this.PropertyChanging(this, emptyChangingEventArgs);
			}
		}
		
		protected virtual void SendPropertyChanged(String propertyName)
		{
			if ((this.PropertyChanged != null))
			{
				this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
			}
		}
		
		private void attach_Holdings(Holdings entity)
		{
			this.SendPropertyChanging();
			entity.Quotes = this;
		}
		
		private void detach_Holdings(Holdings entity)
		{
			this.SendPropertyChanging();
			entity.Quotes = null;
		}
	}
	
	[Table()]
	public partial class Sectors : INotifyPropertyChanging, INotifyPropertyChanged
	{
		
		private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
		
		private int _SectorID;
		
		private string _SectorName;
		
		private EntitySet<Industries> _Industries;
		
    #region Extensibility Method Definitions
    partial void OnLoaded();
    partial void OnValidate(System.Data.Linq.ChangeAction action);
    partial void OnCreated();
    partial void OnSectorIDChanging(int value);
    partial void OnSectorIDChanged();
    partial void OnSectorNameChanging(string value);
    partial void OnSectorNameChanged();
    #endregion
		
		public Sectors()
		{
			this._Industries = new EntitySet<Industries>(new Action<Industries>(this.attach_Industries), new Action<Industries>(this.detach_Industries));
			OnCreated();
		}
		
		[Column(Storage="_SectorID", DbType="Int NOT NULL", IsPrimaryKey=true)]
		public int SectorID
		{
			get
			{
				return this._SectorID;
			}
			set
			{
				if ((this._SectorID != value))
				{
					this.OnSectorIDChanging(value);
					this.SendPropertyChanging();
					this._SectorID = value;
					this.SendPropertyChanged("SectorID");
					this.OnSectorIDChanged();
				}
			}
		}
		
		[Column(Storage="_SectorName", DbType="NVarChar(255)")]
		public string SectorName
		{
			get
			{
				return this._SectorName;
			}
			set
			{
				if ((this._SectorName != value))
				{
					this.OnSectorNameChanging(value);
					this.SendPropertyChanging();
					this._SectorName = value;
					this.SendPropertyChanged("SectorName");
					this.OnSectorNameChanged();
				}
			}
		}
		
		[Association(Name="Sectors_Industries", Storage="_Industries", ThisKey="SectorID", OtherKey="SectorID")]
		public EntitySet<Industries> Industries
		{
			get
			{
				return this._Industries;
			}
			set
			{
				this._Industries.Assign(value);
			}
		}
		
		public event PropertyChangingEventHandler PropertyChanging;
		
		public event PropertyChangedEventHandler PropertyChanged;
		
		protected virtual void SendPropertyChanging()
		{
			if ((this.PropertyChanging != null))
			{
				this.PropertyChanging(this, emptyChangingEventArgs);
			}
		}
		
		protected virtual void SendPropertyChanged(String propertyName)
		{
			if ((this.PropertyChanged != null))
			{
				this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
			}
		}
		
		private void attach_Industries(Industries entity)
		{
			this.SendPropertyChanging();
			entity.Sectors = this;
		}
		
		private void detach_Industries(Industries entity)
		{
			this.SendPropertyChanging();
			entity.Sectors = null;
		}
	}
	
	[Table()]
	public partial class StockExchanges : INotifyPropertyChanging, INotifyPropertyChanged
	{
		
		private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
		
		private int _StockExchangeID;
		
		private string _StockExchangeName;
		
		private string _Country;
		
		private EntitySet<Holdings> _Holdings;
		
    #region Extensibility Method Definitions
    partial void OnLoaded();
    partial void OnValidate(System.Data.Linq.ChangeAction action);
    partial void OnCreated();
    partial void OnStockExchangeIDChanging(int value);
    partial void OnStockExchangeIDChanged();
    partial void OnStockExchangeNameChanging(string value);
    partial void OnStockExchangeNameChanged();
    partial void OnCountryChanging(string value);
    partial void OnCountryChanged();
    #endregion
		
		public StockExchanges()
		{
			this._Holdings = new EntitySet<Holdings>(new Action<Holdings>(this.attach_Holdings), new Action<Holdings>(this.detach_Holdings));
			OnCreated();
		}
		
		[Column(Storage="_StockExchangeID", DbType="Int NOT NULL", IsPrimaryKey=true)]
		public int StockExchangeID
		{
			get
			{
				return this._StockExchangeID;
			}
			set
			{
				if ((this._StockExchangeID != value))
				{
					this.OnStockExchangeIDChanging(value);
					this.SendPropertyChanging();
					this._StockExchangeID = value;
					this.SendPropertyChanged("StockExchangeID");
					this.OnStockExchangeIDChanged();
				}
			}
		}
		
		[Column(Storage="_StockExchangeName", DbType="NVarChar(50)")]
		public string StockExchangeName
		{
			get
			{
				return this._StockExchangeName;
			}
			set
			{
				if ((this._StockExchangeName != value))
				{
					this.OnStockExchangeNameChanging(value);
					this.SendPropertyChanging();
					this._StockExchangeName = value;
					this.SendPropertyChanged("StockExchangeName");
					this.OnStockExchangeNameChanged();
				}
			}
		}
		
		[Column(Storage="_Country", DbType="NVarChar(50)")]
		public string Country
		{
			get
			{
				return this._Country;
			}
			set
			{
				if ((this._Country != value))
				{
					this.OnCountryChanging(value);
					this.SendPropertyChanging();
					this._Country = value;
					this.SendPropertyChanged("Country");
					this.OnCountryChanged();
				}
			}
		}
		
		[Association(Name="StockExchanges_Holdings", Storage="_Holdings", ThisKey="StockExchangeID", OtherKey="StockExchangeID")]
		public EntitySet<Holdings> Holdings
		{
			get
			{
				return this._Holdings;
			}
			set
			{
				this._Holdings.Assign(value);
			}
		}
		
		public event PropertyChangingEventHandler PropertyChanging;
		
		public event PropertyChangedEventHandler PropertyChanged;
		
		protected virtual void SendPropertyChanging()
		{
			if ((this.PropertyChanging != null))
			{
				this.PropertyChanging(this, emptyChangingEventArgs);
			}
		}
		
		protected virtual void SendPropertyChanged(String propertyName)
		{
			if ((this.PropertyChanged != null))
			{
				this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
			}
		}
		
		private void attach_Holdings(Holdings entity)
		{
			this.SendPropertyChanging();
			entity.StockExchanges = this;
		}
		
		private void detach_Holdings(Holdings entity)
		{
			this.SendPropertyChanging();
			entity.StockExchanges = null;
		}
	}
}
#pragma warning restore 1591
