#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.4927
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace hukpiWinApp
{
	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;
	
	
	[System.Data.Linq.Mapping.DatabaseAttribute(Name="hukpiDatabase")]
	public partial class hukpiLINQDataContext : System.Data.Linq.DataContext
	{
		
		private static System.Data.Linq.Mapping.MappingSource mappingSource = new AttributeMappingSource();
		
    #region Extensibility Method Definitions
    partial void OnCreated();
    partial void InsertDepotData(DepotData instance);
    partial void UpdateDepotData(DepotData instance);
    partial void DeleteDepotData(DepotData instance);
    partial void InsertClassesForDepot(ClassesForDepot instance);
    partial void UpdateClassesForDepot(ClassesForDepot instance);
    partial void DeleteClassesForDepot(ClassesForDepot instance);
    partial void InsertDistanceBetweenDepot(DistanceBetweenDepot instance);
    partial void UpdateDistanceBetweenDepot(DistanceBetweenDepot instance);
    partial void DeleteDistanceBetweenDepot(DistanceBetweenDepot instance);
    partial void InsertDepotContainer(DepotContainer instance);
    partial void UpdateDepotContainer(DepotContainer instance);
    partial void DeleteDepotContainer(DepotContainer instance);
    partial void InsertRoute(Route instance);
    partial void UpdateRoute(Route instance);
    partial void DeleteRoute(Route instance);
    partial void InsertDepotsAndModality(DepotsAndModality instance);
    partial void UpdateDepotsAndModality(DepotsAndModality instance);
    partial void DeleteDepotsAndModality(DepotsAndModality instance);
    partial void InsertDefaultTransportDay(DefaultTransportDay instance);
    partial void UpdateDefaultTransportDay(DefaultTransportDay instance);
    partial void DeleteDefaultTransportDay(DefaultTransportDay instance);
    partial void InsertPartnerData(PartnerData instance);
    partial void UpdatePartnerData(PartnerData instance);
    partial void DeletePartnerData(PartnerData instance);
    partial void InsertContract(Contract instance);
    partial void UpdateContract(Contract instance);
    partial void DeleteContract(Contract instance);
    partial void InsertUser(User instance);
    partial void UpdateUser(User instance);
    partial void DeleteUser(User instance);
    partial void InsertGroup(Group instance);
    partial void UpdateGroup(Group instance);
    partial void DeleteGroup(Group instance);
    partial void InsertRouteCode(RouteCode instance);
    partial void UpdateRouteCode(RouteCode instance);
    partial void DeleteRouteCode(RouteCode instance);
    partial void InsertModality(Modality instance);
    partial void UpdateModality(Modality instance);
    partial void DeleteModality(Modality instance);
    partial void InsertGrantedModule(GrantedModule instance);
    partial void UpdateGrantedModule(GrantedModule instance);
    partial void DeleteGrantedModule(GrantedModule instance);
    #endregion
		
		public hukpiLINQDataContext() : 
				base(global::hukpiWinApp.Properties.Settings.Default.hukpiDatabaseConnectionString, mappingSource)
		{
			OnCreated();
		}
		
		public hukpiLINQDataContext(string connection) : 
				base(connection, mappingSource)
		{
			OnCreated();
		}
		
		public hukpiLINQDataContext(System.Data.IDbConnection connection) : 
				base(connection, mappingSource)
		{
			OnCreated();
		}
		
		public hukpiLINQDataContext(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : 
				base(connection, mappingSource)
		{
			OnCreated();
		}
		
		public hukpiLINQDataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : 
				base(connection, mappingSource)
		{
			OnCreated();
		}
		
		public System.Data.Linq.Table<DepotData> DepotDatas
		{
			get
			{
				return this.GetTable<DepotData>();
			}
		}
		
		public System.Data.Linq.Table<ClassesForDepot> ClassesForDepots
		{
			get
			{
				return this.GetTable<ClassesForDepot>();
			}
		}
		
		public System.Data.Linq.Table<DistanceBetweenDepot> DistanceBetweenDepots
		{
			get
			{
				return this.GetTable<DistanceBetweenDepot>();
			}
		}
		
		public System.Data.Linq.Table<DepotContainer> DepotContainers
		{
			get
			{
				return this.GetTable<DepotContainer>();
			}
		}
		
		public System.Data.Linq.Table<Route> Routes
		{
			get
			{
				return this.GetTable<Route>();
			}
		}
		
		public System.Data.Linq.Table<DepotsAndModality> DepotsAndModalities
		{
			get
			{
				return this.GetTable<DepotsAndModality>();
			}
		}
		
		public System.Data.Linq.Table<DefaultTransportDay> DefaultTransportDays
		{
			get
			{
				return this.GetTable<DefaultTransportDay>();
			}
		}
		
		public System.Data.Linq.Table<PartnerData> PartnerDatas
		{
			get
			{
				return this.GetTable<PartnerData>();
			}
		}
		
		public System.Data.Linq.Table<Contract> Contracts
		{
			get
			{
				return this.GetTable<Contract>();
			}
		}
		
		public System.Data.Linq.Table<User> Users
		{
			get
			{
				return this.GetTable<User>();
			}
		}
		
		public System.Data.Linq.Table<Group> Groups
		{
			get
			{
				return this.GetTable<Group>();
			}
		}
		
		public System.Data.Linq.Table<RouteCode> RouteCodes
		{
			get
			{
				return this.GetTable<RouteCode>();
			}
		}
		
		public System.Data.Linq.Table<Modality> Modalities
		{
			get
			{
				return this.GetTable<Modality>();
			}
		}
		
		public System.Data.Linq.Table<GrantedModule> GrantedModules
		{
			get
			{
				return this.GetTable<GrantedModule>();
			}
		}
	}
	
	[Table(Name="dbo.DepotData")]
	public partial class DepotData : INotifyPropertyChanging, INotifyPropertyChanged
	{
		
		private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
		
		private decimal _DepotId;
		
		private System.Nullable<decimal> _PartnerId;
		
		private string _DepotAddress;
		
		private string _DepotCode;
		
		private string _SiteDirectorName;
		
		private string _SiteDircetorPhone;
		
		private string _DepotPlace;
		
		private string _Weighing;
		
		private string _WeighingPlace;
		
		private string _Comments;
		
		private System.Nullable<System.DateTime> _ValidStart;
		
		private System.Nullable<System.DateTime> _ValidEnd;
		
		private System.Nullable<char> _StatusFlag;
		
		private System.Nullable<decimal> _RegionsId;
		
		private string _DepotName;
		
		private System.Nullable<char> _isTransportByNotification;
		
		private EntitySet<ClassesForDepot> _ClassesForDepots;
		
		private EntitySet<DistanceBetweenDepot> _DistanceBetweenDepots;
		
		private EntitySet<DepotContainer> _DepotContainers;
		
		private EntitySet<Route> _Routes;
		
		private EntitySet<DepotsAndModality> _DepotsAndModalities;
		
		private EntitySet<DefaultTransportDay> _DefaultTransportDays;
		
		private EntityRef<PartnerData> _PartnerData;
		
    #region Extensibility Method Definitions
    partial void OnLoaded();
    partial void OnValidate(System.Data.Linq.ChangeAction action);
    partial void OnCreated();
    partial void OnDepotIdChanging(decimal value);
    partial void OnDepotIdChanged();
    partial void OnPartnerIdChanging(System.Nullable<decimal> value);
    partial void OnPartnerIdChanged();
    partial void OnDepotAddressChanging(string value);
    partial void OnDepotAddressChanged();
    partial void OnDepotCodeChanging(string value);
    partial void OnDepotCodeChanged();
    partial void OnSiteDirectorNameChanging(string value);
    partial void OnSiteDirectorNameChanged();
    partial void OnSiteDircetorPhoneChanging(string value);
    partial void OnSiteDircetorPhoneChanged();
    partial void OnDepotPlaceChanging(string value);
    partial void OnDepotPlaceChanged();
    partial void OnWeighingChanging(string value);
    partial void OnWeighingChanged();
    partial void OnWeighingPlaceChanging(string value);
    partial void OnWeighingPlaceChanged();
    partial void OnCommentsChanging(string value);
    partial void OnCommentsChanged();
    partial void OnValidStartChanging(System.Nullable<System.DateTime> value);
    partial void OnValidStartChanged();
    partial void OnValidEndChanging(System.Nullable<System.DateTime> value);
    partial void OnValidEndChanged();
    partial void OnStatusFlagChanging(System.Nullable<char> value);
    partial void OnStatusFlagChanged();
    partial void OnRegionsIdChanging(System.Nullable<decimal> value);
    partial void OnRegionsIdChanged();
    partial void OnDepotNameChanging(string value);
    partial void OnDepotNameChanged();
    partial void OnisTransportByNotificationChanging(System.Nullable<char> value);
    partial void OnisTransportByNotificationChanged();
    #endregion
		
		public DepotData()
		{
			this._ClassesForDepots = new EntitySet<ClassesForDepot>(new Action<ClassesForDepot>(this.attach_ClassesForDepots), new Action<ClassesForDepot>(this.detach_ClassesForDepots));
			this._DistanceBetweenDepots = new EntitySet<DistanceBetweenDepot>(new Action<DistanceBetweenDepot>(this.attach_DistanceBetweenDepots), new Action<DistanceBetweenDepot>(this.detach_DistanceBetweenDepots));
			this._DepotContainers = new EntitySet<DepotContainer>(new Action<DepotContainer>(this.attach_DepotContainers), new Action<DepotContainer>(this.detach_DepotContainers));
			this._Routes = new EntitySet<Route>(new Action<Route>(this.attach_Routes), new Action<Route>(this.detach_Routes));
			this._DepotsAndModalities = new EntitySet<DepotsAndModality>(new Action<DepotsAndModality>(this.attach_DepotsAndModalities), new Action<DepotsAndModality>(this.detach_DepotsAndModalities));
			this._DefaultTransportDays = new EntitySet<DefaultTransportDay>(new Action<DefaultTransportDay>(this.attach_DefaultTransportDays), new Action<DefaultTransportDay>(this.detach_DefaultTransportDays));
			this._PartnerData = default(EntityRef<PartnerData>);
			OnCreated();
		}
		
		[Column(Storage="_DepotId", AutoSync=AutoSync.OnInsert, DbType="Decimal(18,0) NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
		public decimal DepotId
		{
			get
			{
				return this._DepotId;
			}
			set
			{
				if ((this._DepotId != value))
				{
					this.OnDepotIdChanging(value);
					this.SendPropertyChanging();
					this._DepotId = value;
					this.SendPropertyChanged("DepotId");
					this.OnDepotIdChanged();
				}
			}
		}
		
		[Column(Storage="_PartnerId", DbType="Decimal(18,0)")]
		public System.Nullable<decimal> PartnerId
		{
			get
			{
				return this._PartnerId;
			}
			set
			{
				if ((this._PartnerId != value))
				{
					if (this._PartnerData.HasLoadedOrAssignedValue)
					{
						throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
					}
					this.OnPartnerIdChanging(value);
					this.SendPropertyChanging();
					this._PartnerId = value;
					this.SendPropertyChanged("PartnerId");
					this.OnPartnerIdChanged();
				}
			}
		}
		
		[Column(Storage="_DepotAddress", DbType="VarChar(255)")]
		public string DepotAddress
		{
			get
			{
				return this._DepotAddress;
			}
			set
			{
				if ((this._DepotAddress != value))
				{
					this.OnDepotAddressChanging(value);
					this.SendPropertyChanging();
					this._DepotAddress = value;
					this.SendPropertyChanged("DepotAddress");
					this.OnDepotAddressChanged();
				}
			}
		}
		
		[Column(Storage="_DepotCode", DbType="VarChar(50)")]
		public string DepotCode
		{
			get
			{
				return this._DepotCode;
			}
			set
			{
				if ((this._DepotCode != value))
				{
					this.OnDepotCodeChanging(value);
					this.SendPropertyChanging();
					this._DepotCode = value;
					this.SendPropertyChanged("DepotCode");
					this.OnDepotCodeChanged();
				}
			}
		}
		
		[Column(Storage="_SiteDirectorName", DbType="VarChar(100)")]
		public string SiteDirectorName
		{
			get
			{
				return this._SiteDirectorName;
			}
			set
			{
				if ((this._SiteDirectorName != value))
				{
					this.OnSiteDirectorNameChanging(value);
					this.SendPropertyChanging();
					this._SiteDirectorName = value;
					this.SendPropertyChanged("SiteDirectorName");
					this.OnSiteDirectorNameChanged();
				}
			}
		}
		
		[Column(Storage="_SiteDircetorPhone", DbType="VarChar(45)")]
		public string SiteDircetorPhone
		{
			get
			{
				return this._SiteDircetorPhone;
			}
			set
			{
				if ((this._SiteDircetorPhone != value))
				{
					this.OnSiteDircetorPhoneChanging(value);
					this.SendPropertyChanging();
					this._SiteDircetorPhone = value;
					this.SendPropertyChanged("SiteDircetorPhone");
					this.OnSiteDircetorPhoneChanged();
				}
			}
		}
		
		[Column(Storage="_DepotPlace", DbType="VarChar(100)")]
		public string DepotPlace
		{
			get
			{
				return this._DepotPlace;
			}
			set
			{
				if ((this._DepotPlace != value))
				{
					this.OnDepotPlaceChanging(value);
					this.SendPropertyChanging();
					this._DepotPlace = value;
					this.SendPropertyChanged("DepotPlace");
					this.OnDepotPlaceChanged();
				}
			}
		}
		
		[Column(Storage="_Weighing", DbType="VarChar(45)")]
		public string Weighing
		{
			get
			{
				return this._Weighing;
			}
			set
			{
				if ((this._Weighing != value))
				{
					this.OnWeighingChanging(value);
					this.SendPropertyChanging();
					this._Weighing = value;
					this.SendPropertyChanged("Weighing");
					this.OnWeighingChanged();
				}
			}
		}
		
		[Column(Storage="_WeighingPlace", DbType="VarChar(255)")]
		public string WeighingPlace
		{
			get
			{
				return this._WeighingPlace;
			}
			set
			{
				if ((this._WeighingPlace != value))
				{
					this.OnWeighingPlaceChanging(value);
					this.SendPropertyChanging();
					this._WeighingPlace = value;
					this.SendPropertyChanged("WeighingPlace");
					this.OnWeighingPlaceChanged();
				}
			}
		}
		
		[Column(Storage="_Comments", DbType="VarChar(255)")]
		public string Comments
		{
			get
			{
				return this._Comments;
			}
			set
			{
				if ((this._Comments != value))
				{
					this.OnCommentsChanging(value);
					this.SendPropertyChanging();
					this._Comments = value;
					this.SendPropertyChanged("Comments");
					this.OnCommentsChanged();
				}
			}
		}
		
		[Column(Storage="_ValidStart", DbType="Date")]
		public System.Nullable<System.DateTime> ValidStart
		{
			get
			{
				return this._ValidStart;
			}
			set
			{
				if ((this._ValidStart != value))
				{
					this.OnValidStartChanging(value);
					this.SendPropertyChanging();
					this._ValidStart = value;
					this.SendPropertyChanged("ValidStart");
					this.OnValidStartChanged();
				}
			}
		}
		
		[Column(Storage="_ValidEnd", DbType="Date")]
		public System.Nullable<System.DateTime> ValidEnd
		{
			get
			{
				return this._ValidEnd;
			}
			set
			{
				if ((this._ValidEnd != value))
				{
					this.OnValidEndChanging(value);
					this.SendPropertyChanging();
					this._ValidEnd = value;
					this.SendPropertyChanged("ValidEnd");
					this.OnValidEndChanged();
				}
			}
		}
		
		[Column(Storage="_StatusFlag", DbType="Char(1)")]
		public System.Nullable<char> StatusFlag
		{
			get
			{
				return this._StatusFlag;
			}
			set
			{
				if ((this._StatusFlag != value))
				{
					this.OnStatusFlagChanging(value);
					this.SendPropertyChanging();
					this._StatusFlag = value;
					this.SendPropertyChanged("StatusFlag");
					this.OnStatusFlagChanged();
				}
			}
		}
		
		[Column(Storage="_RegionsId", DbType="Decimal(18,0)")]
		public System.Nullable<decimal> RegionsId
		{
			get
			{
				return this._RegionsId;
			}
			set
			{
				if ((this._RegionsId != value))
				{
					this.OnRegionsIdChanging(value);
					this.SendPropertyChanging();
					this._RegionsId = value;
					this.SendPropertyChanged("RegionsId");
					this.OnRegionsIdChanged();
				}
			}
		}
		
		[Column(Storage="_DepotName", DbType="VarChar(255)")]
		public string DepotName
		{
			get
			{
				return this._DepotName;
			}
			set
			{
				if ((this._DepotName != value))
				{
					this.OnDepotNameChanging(value);
					this.SendPropertyChanging();
					this._DepotName = value;
					this.SendPropertyChanged("DepotName");
					this.OnDepotNameChanged();
				}
			}
		}
		
		[Column(Storage="_isTransportByNotification", DbType="Char(1)")]
		public System.Nullable<char> isTransportByNotification
		{
			get
			{
				return this._isTransportByNotification;
			}
			set
			{
				if ((this._isTransportByNotification != value))
				{
					this.OnisTransportByNotificationChanging(value);
					this.SendPropertyChanging();
					this._isTransportByNotification = value;
					this.SendPropertyChanged("isTransportByNotification");
					this.OnisTransportByNotificationChanged();
				}
			}
		}
		
		[Association(Name="DepotData_ClassesForDepot", Storage="_ClassesForDepots", ThisKey="DepotId", OtherKey="DepotId")]
		public EntitySet<ClassesForDepot> ClassesForDepots
		{
			get
			{
				return this._ClassesForDepots;
			}
			set
			{
				this._ClassesForDepots.Assign(value);
			}
		}
		
		[Association(Name="DepotData_DistanceBetweenDepot", Storage="_DistanceBetweenDepots", ThisKey="DepotId", OtherKey="DepotId")]
		public EntitySet<DistanceBetweenDepot> DistanceBetweenDepots
		{
			get
			{
				return this._DistanceBetweenDepots;
			}
			set
			{
				this._DistanceBetweenDepots.Assign(value);
			}
		}
		
		[Association(Name="DepotData_DepotContainer", Storage="_DepotContainers", ThisKey="DepotId", OtherKey="DepotId")]
		public EntitySet<DepotContainer> DepotContainers
		{
			get
			{
				return this._DepotContainers;
			}
			set
			{
				this._DepotContainers.Assign(value);
			}
		}
		
		[Association(Name="DepotData_Route", Storage="_Routes", ThisKey="DepotId", OtherKey="DepotId")]
		public EntitySet<Route> Routes
		{
			get
			{
				return this._Routes;
			}
			set
			{
				this._Routes.Assign(value);
			}
		}
		
		[Association(Name="DepotData_DepotsAndModality", Storage="_DepotsAndModalities", ThisKey="DepotId", OtherKey="DepotId")]
		public EntitySet<DepotsAndModality> DepotsAndModalities
		{
			get
			{
				return this._DepotsAndModalities;
			}
			set
			{
				this._DepotsAndModalities.Assign(value);
			}
		}
		
		[Association(Name="DepotData_DefaultTransportDay", Storage="_DefaultTransportDays", ThisKey="DepotId", OtherKey="DepotId")]
		public EntitySet<DefaultTransportDay> DefaultTransportDays
		{
			get
			{
				return this._DefaultTransportDays;
			}
			set
			{
				this._DefaultTransportDays.Assign(value);
			}
		}
		
		[Association(Name="PartnerData_DepotData", Storage="_PartnerData", ThisKey="PartnerId", OtherKey="PartnerId", IsForeignKey=true)]
		public PartnerData PartnerData
		{
			get
			{
				return this._PartnerData.Entity;
			}
			set
			{
				PartnerData previousValue = this._PartnerData.Entity;
				if (((previousValue != value) 
							|| (this._PartnerData.HasLoadedOrAssignedValue == false)))
				{
					this.SendPropertyChanging();
					if ((previousValue != null))
					{
						this._PartnerData.Entity = null;
						previousValue.DepotDatas.Remove(this);
					}
					this._PartnerData.Entity = value;
					if ((value != null))
					{
						value.DepotDatas.Add(this);
						this._PartnerId = value.PartnerId;
					}
					else
					{
						this._PartnerId = default(Nullable<decimal>);
					}
					this.SendPropertyChanged("PartnerData");
				}
			}
		}
		
		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_ClassesForDepots(ClassesForDepot entity)
		{
			this.SendPropertyChanging();
			entity.DepotData = this;
		}
		
		private void detach_ClassesForDepots(ClassesForDepot entity)
		{
			this.SendPropertyChanging();
			entity.DepotData = null;
		}
		
		private void attach_DistanceBetweenDepots(DistanceBetweenDepot entity)
		{
			this.SendPropertyChanging();
			entity.DepotData = this;
		}
		
		private void detach_DistanceBetweenDepots(DistanceBetweenDepot entity)
		{
			this.SendPropertyChanging();
			entity.DepotData = null;
		}
		
		private void attach_DepotContainers(DepotContainer entity)
		{
			this.SendPropertyChanging();
			entity.DepotData = this;
		}
		
		private void detach_DepotContainers(DepotContainer entity)
		{
			this.SendPropertyChanging();
			entity.DepotData = null;
		}
		
		private void attach_Routes(Route entity)
		{
			this.SendPropertyChanging();
			entity.DepotData = this;
		}
		
		private void detach_Routes(Route entity)
		{
			this.SendPropertyChanging();
			entity.DepotData = null;
		}
		
		private void attach_DepotsAndModalities(DepotsAndModality entity)
		{
			this.SendPropertyChanging();
			entity.DepotData = this;
		}
		
		private void detach_DepotsAndModalities(DepotsAndModality entity)
		{
			this.SendPropertyChanging();
			entity.DepotData = null;
		}
		
		private void attach_DefaultTransportDays(DefaultTransportDay entity)
		{
			this.SendPropertyChanging();
			entity.DepotData = this;
		}
		
		private void detach_DefaultTransportDays(DefaultTransportDay entity)
		{
			this.SendPropertyChanging();
			entity.DepotData = null;
		}
	}
	
	[Table(Name="dbo.ClassesForDepots")]
	public partial class ClassesForDepot : INotifyPropertyChanging, INotifyPropertyChanged
	{
		
		private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
		
		private decimal _ClassesForDepotsId;
		
		private decimal _ClassesId;
		
		private decimal _DepotId;
		
		private System.Nullable<decimal> _ProcessingCodesId;
		
		private EntityRef<DepotData> _DepotData;
		
    #region Extensibility Method Definitions
    partial void OnLoaded();
    partial void OnValidate(System.Data.Linq.ChangeAction action);
    partial void OnCreated();
    partial void OnClassesForDepotsIdChanging(decimal value);
    partial void OnClassesForDepotsIdChanged();
    partial void OnClassesIdChanging(decimal value);
    partial void OnClassesIdChanged();
    partial void OnDepotIdChanging(decimal value);
    partial void OnDepotIdChanged();
    partial void OnProcessingCodesIdChanging(System.Nullable<decimal> value);
    partial void OnProcessingCodesIdChanged();
    #endregion
		
		public ClassesForDepot()
		{
			this._DepotData = default(EntityRef<DepotData>);
			OnCreated();
		}
		
		[Column(Storage="_ClassesForDepotsId", AutoSync=AutoSync.OnInsert, DbType="Decimal(18,0) NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
		public decimal ClassesForDepotsId
		{
			get
			{
				return this._ClassesForDepotsId;
			}
			set
			{
				if ((this._ClassesForDepotsId != value))
				{
					this.OnClassesForDepotsIdChanging(value);
					this.SendPropertyChanging();
					this._ClassesForDepotsId = value;
					this.SendPropertyChanged("ClassesForDepotsId");
					this.OnClassesForDepotsIdChanged();
				}
			}
		}
		
		[Column(Storage="_ClassesId", DbType="Decimal(18,0) NOT NULL")]
		public decimal ClassesId
		{
			get
			{
				return this._ClassesId;
			}
			set
			{
				if ((this._ClassesId != value))
				{
					this.OnClassesIdChanging(value);
					this.SendPropertyChanging();
					this._ClassesId = value;
					this.SendPropertyChanged("ClassesId");
					this.OnClassesIdChanged();
				}
			}
		}
		
		[Column(Storage="_DepotId", DbType="Decimal(18,0) NOT NULL")]
		public decimal DepotId
		{
			get
			{
				return this._DepotId;
			}
			set
			{
				if ((this._DepotId != value))
				{
					if (this._DepotData.HasLoadedOrAssignedValue)
					{
						throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
					}
					this.OnDepotIdChanging(value);
					this.SendPropertyChanging();
					this._DepotId = value;
					this.SendPropertyChanged("DepotId");
					this.OnDepotIdChanged();
				}
			}
		}
		
		[Column(Storage="_ProcessingCodesId", DbType="Decimal(18,0)")]
		public System.Nullable<decimal> ProcessingCodesId
		{
			get
			{
				return this._ProcessingCodesId;
			}
			set
			{
				if ((this._ProcessingCodesId != value))
				{
					this.OnProcessingCodesIdChanging(value);
					this.SendPropertyChanging();
					this._ProcessingCodesId = value;
					this.SendPropertyChanged("ProcessingCodesId");
					this.OnProcessingCodesIdChanged();
				}
			}
		}
		
		[Association(Name="DepotData_ClassesForDepot", Storage="_DepotData", ThisKey="DepotId", OtherKey="DepotId", IsForeignKey=true)]
		public DepotData DepotData
		{
			get
			{
				return this._DepotData.Entity;
			}
			set
			{
				DepotData previousValue = this._DepotData.Entity;
				if (((previousValue != value) 
							|| (this._DepotData.HasLoadedOrAssignedValue == false)))
				{
					this.SendPropertyChanging();
					if ((previousValue != null))
					{
						this._DepotData.Entity = null;
						previousValue.ClassesForDepots.Remove(this);
					}
					this._DepotData.Entity = value;
					if ((value != null))
					{
						value.ClassesForDepots.Add(this);
						this._DepotId = value.DepotId;
					}
					else
					{
						this._DepotId = default(decimal);
					}
					this.SendPropertyChanged("DepotData");
				}
			}
		}
		
		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(Name="dbo.DistanceBetweenDepots")]
	public partial class DistanceBetweenDepot : INotifyPropertyChanging, INotifyPropertyChanged
	{
		
		private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
		
		private decimal _DistanceBetweenDepotsId;
		
		private decimal _CompanyDepotsId;
		
		private decimal _DepotId;
		
		private System.Nullable<decimal> _Distance;
		
		private System.Nullable<decimal> _Priority;
		
		private EntityRef<DepotData> _DepotData;
		
    #region Extensibility Method Definitions
    partial void OnLoaded();
    partial void OnValidate(System.Data.Linq.ChangeAction action);
    partial void OnCreated();
    partial void OnDistanceBetweenDepotsIdChanging(decimal value);
    partial void OnDistanceBetweenDepotsIdChanged();
    partial void OnCompanyDepotsIdChanging(decimal value);
    partial void OnCompanyDepotsIdChanged();
    partial void OnDepotIdChanging(decimal value);
    partial void OnDepotIdChanged();
    partial void OnDistanceChanging(System.Nullable<decimal> value);
    partial void OnDistanceChanged();
    partial void OnPriorityChanging(System.Nullable<decimal> value);
    partial void OnPriorityChanged();
    #endregion
		
		public DistanceBetweenDepot()
		{
			this._DepotData = default(EntityRef<DepotData>);
			OnCreated();
		}
		
		[Column(Storage="_DistanceBetweenDepotsId", AutoSync=AutoSync.OnInsert, DbType="Decimal(18,0) NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
		public decimal DistanceBetweenDepotsId
		{
			get
			{
				return this._DistanceBetweenDepotsId;
			}
			set
			{
				if ((this._DistanceBetweenDepotsId != value))
				{
					this.OnDistanceBetweenDepotsIdChanging(value);
					this.SendPropertyChanging();
					this._DistanceBetweenDepotsId = value;
					this.SendPropertyChanged("DistanceBetweenDepotsId");
					this.OnDistanceBetweenDepotsIdChanged();
				}
			}
		}
		
		[Column(Storage="_CompanyDepotsId", DbType="Decimal(18,0) NOT NULL")]
		public decimal CompanyDepotsId
		{
			get
			{
				return this._CompanyDepotsId;
			}
			set
			{
				if ((this._CompanyDepotsId != value))
				{
					this.OnCompanyDepotsIdChanging(value);
					this.SendPropertyChanging();
					this._CompanyDepotsId = value;
					this.SendPropertyChanged("CompanyDepotsId");
					this.OnCompanyDepotsIdChanged();
				}
			}
		}
		
		[Column(Storage="_DepotId", DbType="Decimal(18,0) NOT NULL")]
		public decimal DepotId
		{
			get
			{
				return this._DepotId;
			}
			set
			{
				if ((this._DepotId != value))
				{
					if (this._DepotData.HasLoadedOrAssignedValue)
					{
						throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
					}
					this.OnDepotIdChanging(value);
					this.SendPropertyChanging();
					this._DepotId = value;
					this.SendPropertyChanged("DepotId");
					this.OnDepotIdChanged();
				}
			}
		}
		
		[Column(Storage="_Distance", DbType="Decimal(18,0)")]
		public System.Nullable<decimal> Distance
		{
			get
			{
				return this._Distance;
			}
			set
			{
				if ((this._Distance != value))
				{
					this.OnDistanceChanging(value);
					this.SendPropertyChanging();
					this._Distance = value;
					this.SendPropertyChanged("Distance");
					this.OnDistanceChanged();
				}
			}
		}
		
		[Column(Storage="_Priority", DbType="Decimal(18,0)")]
		public System.Nullable<decimal> Priority
		{
			get
			{
				return this._Priority;
			}
			set
			{
				if ((this._Priority != value))
				{
					this.OnPriorityChanging(value);
					this.SendPropertyChanging();
					this._Priority = value;
					this.SendPropertyChanged("Priority");
					this.OnPriorityChanged();
				}
			}
		}
		
		[Association(Name="DepotData_DistanceBetweenDepot", Storage="_DepotData", ThisKey="DepotId", OtherKey="DepotId", IsForeignKey=true)]
		public DepotData DepotData
		{
			get
			{
				return this._DepotData.Entity;
			}
			set
			{
				DepotData previousValue = this._DepotData.Entity;
				if (((previousValue != value) 
							|| (this._DepotData.HasLoadedOrAssignedValue == false)))
				{
					this.SendPropertyChanging();
					if ((previousValue != null))
					{
						this._DepotData.Entity = null;
						previousValue.DistanceBetweenDepots.Remove(this);
					}
					this._DepotData.Entity = value;
					if ((value != null))
					{
						value.DistanceBetweenDepots.Add(this);
						this._DepotId = value.DepotId;
					}
					else
					{
						this._DepotId = default(decimal);
					}
					this.SendPropertyChanged("DepotData");
				}
			}
		}
		
		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(Name="dbo.DepotContainers")]
	public partial class DepotContainer : INotifyPropertyChanging, INotifyPropertyChanged
	{
		
		private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
		
		private decimal _DepotContainersId;
		
		private decimal _DepotId;
		
		private decimal _ContainersId;
		
		private System.Nullable<decimal> _Number;
		
		private EntityRef<DepotData> _DepotData;
		
    #region Extensibility Method Definitions
    partial void OnLoaded();
    partial void OnValidate(System.Data.Linq.ChangeAction action);
    partial void OnCreated();
    partial void OnDepotContainersIdChanging(decimal value);
    partial void OnDepotContainersIdChanged();
    partial void OnDepotIdChanging(decimal value);
    partial void OnDepotIdChanged();
    partial void OnContainersIdChanging(decimal value);
    partial void OnContainersIdChanged();
    partial void OnNumberChanging(System.Nullable<decimal> value);
    partial void OnNumberChanged();
    #endregion
		
		public DepotContainer()
		{
			this._DepotData = default(EntityRef<DepotData>);
			OnCreated();
		}
		
		[Column(Storage="_DepotContainersId", AutoSync=AutoSync.OnInsert, DbType="Decimal(18,0) NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
		public decimal DepotContainersId
		{
			get
			{
				return this._DepotContainersId;
			}
			set
			{
				if ((this._DepotContainersId != value))
				{
					this.OnDepotContainersIdChanging(value);
					this.SendPropertyChanging();
					this._DepotContainersId = value;
					this.SendPropertyChanged("DepotContainersId");
					this.OnDepotContainersIdChanged();
				}
			}
		}
		
		[Column(Storage="_DepotId", DbType="Decimal(18,0) NOT NULL")]
		public decimal DepotId
		{
			get
			{
				return this._DepotId;
			}
			set
			{
				if ((this._DepotId != value))
				{
					if (this._DepotData.HasLoadedOrAssignedValue)
					{
						throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
					}
					this.OnDepotIdChanging(value);
					this.SendPropertyChanging();
					this._DepotId = value;
					this.SendPropertyChanged("DepotId");
					this.OnDepotIdChanged();
				}
			}
		}
		
		[Column(Storage="_ContainersId", DbType="Decimal(18,0) NOT NULL")]
		public decimal ContainersId
		{
			get
			{
				return this._ContainersId;
			}
			set
			{
				if ((this._ContainersId != value))
				{
					this.OnContainersIdChanging(value);
					this.SendPropertyChanging();
					this._ContainersId = value;
					this.SendPropertyChanged("ContainersId");
					this.OnContainersIdChanged();
				}
			}
		}
		
		[Column(Storage="_Number", DbType="Decimal(18,0)")]
		public System.Nullable<decimal> Number
		{
			get
			{
				return this._Number;
			}
			set
			{
				if ((this._Number != value))
				{
					this.OnNumberChanging(value);
					this.SendPropertyChanging();
					this._Number = value;
					this.SendPropertyChanged("Number");
					this.OnNumberChanged();
				}
			}
		}
		
		[Association(Name="DepotData_DepotContainer", Storage="_DepotData", ThisKey="DepotId", OtherKey="DepotId", IsForeignKey=true)]
		public DepotData DepotData
		{
			get
			{
				return this._DepotData.Entity;
			}
			set
			{
				DepotData previousValue = this._DepotData.Entity;
				if (((previousValue != value) 
							|| (this._DepotData.HasLoadedOrAssignedValue == false)))
				{
					this.SendPropertyChanging();
					if ((previousValue != null))
					{
						this._DepotData.Entity = null;
						previousValue.DepotContainers.Remove(this);
					}
					this._DepotData.Entity = value;
					if ((value != null))
					{
						value.DepotContainers.Add(this);
						this._DepotId = value.DepotId;
					}
					else
					{
						this._DepotId = default(decimal);
					}
					this.SendPropertyChanged("DepotData");
				}
			}
		}
		
		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(Name="dbo.Routes")]
	public partial class Route : INotifyPropertyChanging, INotifyPropertyChanged
	{
		
		private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
		
		private decimal _RoutesId;
		
		private decimal _RouteCodesId;
		
		private decimal _DepotId;
		
		private System.Nullable<decimal> _Priority;
		
		private EntityRef<DepotData> _DepotData;
		
		private EntityRef<RouteCode> _RouteCode;
		
    #region Extensibility Method Definitions
    partial void OnLoaded();
    partial void OnValidate(System.Data.Linq.ChangeAction action);
    partial void OnCreated();
    partial void OnRoutesIdChanging(decimal value);
    partial void OnRoutesIdChanged();
    partial void OnRouteCodesIdChanging(decimal value);
    partial void OnRouteCodesIdChanged();
    partial void OnDepotIdChanging(decimal value);
    partial void OnDepotIdChanged();
    partial void OnPriorityChanging(System.Nullable<decimal> value);
    partial void OnPriorityChanged();
    #endregion
		
		public Route()
		{
			this._DepotData = default(EntityRef<DepotData>);
			this._RouteCode = default(EntityRef<RouteCode>);
			OnCreated();
		}
		
		[Column(Storage="_RoutesId", AutoSync=AutoSync.OnInsert, DbType="Decimal(18,0) NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
		public decimal RoutesId
		{
			get
			{
				return this._RoutesId;
			}
			set
			{
				if ((this._RoutesId != value))
				{
					this.OnRoutesIdChanging(value);
					this.SendPropertyChanging();
					this._RoutesId = value;
					this.SendPropertyChanged("RoutesId");
					this.OnRoutesIdChanged();
				}
			}
		}
		
		[Column(Storage="_RouteCodesId", DbType="Decimal(18,0) NOT NULL")]
		public decimal RouteCodesId
		{
			get
			{
				return this._RouteCodesId;
			}
			set
			{
				if ((this._RouteCodesId != value))
				{
					if (this._RouteCode.HasLoadedOrAssignedValue)
					{
						throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
					}
					this.OnRouteCodesIdChanging(value);
					this.SendPropertyChanging();
					this._RouteCodesId = value;
					this.SendPropertyChanged("RouteCodesId");
					this.OnRouteCodesIdChanged();
				}
			}
		}
		
		[Column(Storage="_DepotId", DbType="Decimal(18,0) NOT NULL")]
		public decimal DepotId
		{
			get
			{
				return this._DepotId;
			}
			set
			{
				if ((this._DepotId != value))
				{
					if (this._DepotData.HasLoadedOrAssignedValue)
					{
						throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
					}
					this.OnDepotIdChanging(value);
					this.SendPropertyChanging();
					this._DepotId = value;
					this.SendPropertyChanged("DepotId");
					this.OnDepotIdChanged();
				}
			}
		}
		
		[Column(Storage="_Priority", DbType="Decimal(18,0)")]
		public System.Nullable<decimal> Priority
		{
			get
			{
				return this._Priority;
			}
			set
			{
				if ((this._Priority != value))
				{
					this.OnPriorityChanging(value);
					this.SendPropertyChanging();
					this._Priority = value;
					this.SendPropertyChanged("Priority");
					this.OnPriorityChanged();
				}
			}
		}
		
		[Association(Name="DepotData_Route", Storage="_DepotData", ThisKey="DepotId", OtherKey="DepotId", IsForeignKey=true)]
		public DepotData DepotData
		{
			get
			{
				return this._DepotData.Entity;
			}
			set
			{
				DepotData previousValue = this._DepotData.Entity;
				if (((previousValue != value) 
							|| (this._DepotData.HasLoadedOrAssignedValue == false)))
				{
					this.SendPropertyChanging();
					if ((previousValue != null))
					{
						this._DepotData.Entity = null;
						previousValue.Routes.Remove(this);
					}
					this._DepotData.Entity = value;
					if ((value != null))
					{
						value.Routes.Add(this);
						this._DepotId = value.DepotId;
					}
					else
					{
						this._DepotId = default(decimal);
					}
					this.SendPropertyChanged("DepotData");
				}
			}
		}
		
		[Association(Name="RouteCode_Route", Storage="_RouteCode", ThisKey="RouteCodesId", OtherKey="RouteCodesId", IsForeignKey=true)]
		public RouteCode RouteCode
		{
			get
			{
				return this._RouteCode.Entity;
			}
			set
			{
				RouteCode previousValue = this._RouteCode.Entity;
				if (((previousValue != value) 
							|| (this._RouteCode.HasLoadedOrAssignedValue == false)))
				{
					this.SendPropertyChanging();
					if ((previousValue != null))
					{
						this._RouteCode.Entity = null;
						previousValue.Routes.Remove(this);
					}
					this._RouteCode.Entity = value;
					if ((value != null))
					{
						value.Routes.Add(this);
						this._RouteCodesId = value.RouteCodesId;
					}
					else
					{
						this._RouteCodesId = default(decimal);
					}
					this.SendPropertyChanged("RouteCode");
				}
			}
		}
		
		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(Name="dbo.DepotsAndModalities")]
	public partial class DepotsAndModality : INotifyPropertyChanging, INotifyPropertyChanged
	{
		
		private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
		
		private decimal _DepotsAndModalitiesId;
		
		private decimal _DepotId;
		
		private System.Nullable<decimal> _ModalityId;
		
		private System.Nullable<decimal> _Priority;
		
		private EntityRef<DepotData> _DepotData;
		
		private EntityRef<Modality> _Modality;
		
    #region Extensibility Method Definitions
    partial void OnLoaded();
    partial void OnValidate(System.Data.Linq.ChangeAction action);
    partial void OnCreated();
    partial void OnDepotsAndModalitiesIdChanging(decimal value);
    partial void OnDepotsAndModalitiesIdChanged();
    partial void OnDepotIdChanging(decimal value);
    partial void OnDepotIdChanged();
    partial void OnModalityIdChanging(System.Nullable<decimal> value);
    partial void OnModalityIdChanged();
    partial void OnPriorityChanging(System.Nullable<decimal> value);
    partial void OnPriorityChanged();
    #endregion
		
		public DepotsAndModality()
		{
			this._DepotData = default(EntityRef<DepotData>);
			this._Modality = default(EntityRef<Modality>);
			OnCreated();
		}
		
		[Column(Storage="_DepotsAndModalitiesId", AutoSync=AutoSync.OnInsert, DbType="Decimal(18,0) NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
		public decimal DepotsAndModalitiesId
		{
			get
			{
				return this._DepotsAndModalitiesId;
			}
			set
			{
				if ((this._DepotsAndModalitiesId != value))
				{
					this.OnDepotsAndModalitiesIdChanging(value);
					this.SendPropertyChanging();
					this._DepotsAndModalitiesId = value;
					this.SendPropertyChanged("DepotsAndModalitiesId");
					this.OnDepotsAndModalitiesIdChanged();
				}
			}
		}
		
		[Column(Storage="_DepotId", DbType="Decimal(18,0) NOT NULL")]
		public decimal DepotId
		{
			get
			{
				return this._DepotId;
			}
			set
			{
				if ((this._DepotId != value))
				{
					if (this._DepotData.HasLoadedOrAssignedValue)
					{
						throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
					}
					this.OnDepotIdChanging(value);
					this.SendPropertyChanging();
					this._DepotId = value;
					this.SendPropertyChanged("DepotId");
					this.OnDepotIdChanged();
				}
			}
		}
		
		[Column(Storage="_ModalityId", DbType="Decimal(18,0)")]
		public System.Nullable<decimal> ModalityId
		{
			get
			{
				return this._ModalityId;
			}
			set
			{
				if ((this._ModalityId != value))
				{
					if (this._Modality.HasLoadedOrAssignedValue)
					{
						throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
					}
					this.OnModalityIdChanging(value);
					this.SendPropertyChanging();
					this._ModalityId = value;
					this.SendPropertyChanged("ModalityId");
					this.OnModalityIdChanged();
				}
			}
		}
		
		[Column(Storage="_Priority", DbType="Decimal(18,0)")]
		public System.Nullable<decimal> Priority
		{
			get
			{
				return this._Priority;
			}
			set
			{
				if ((this._Priority != value))
				{
					this.OnPriorityChanging(value);
					this.SendPropertyChanging();
					this._Priority = value;
					this.SendPropertyChanged("Priority");
					this.OnPriorityChanged();
				}
			}
		}
		
		[Association(Name="DepotData_DepotsAndModality", Storage="_DepotData", ThisKey="DepotId", OtherKey="DepotId", IsForeignKey=true)]
		public DepotData DepotData
		{
			get
			{
				return this._DepotData.Entity;
			}
			set
			{
				DepotData previousValue = this._DepotData.Entity;
				if (((previousValue != value) 
							|| (this._DepotData.HasLoadedOrAssignedValue == false)))
				{
					this.SendPropertyChanging();
					if ((previousValue != null))
					{
						this._DepotData.Entity = null;
						previousValue.DepotsAndModalities.Remove(this);
					}
					this._DepotData.Entity = value;
					if ((value != null))
					{
						value.DepotsAndModalities.Add(this);
						this._DepotId = value.DepotId;
					}
					else
					{
						this._DepotId = default(decimal);
					}
					this.SendPropertyChanged("DepotData");
				}
			}
		}
		
		[Association(Name="Modality_DepotsAndModality", Storage="_Modality", ThisKey="ModalityId", OtherKey="ModalityId", IsForeignKey=true)]
		public Modality Modality
		{
			get
			{
				return this._Modality.Entity;
			}
			set
			{
				Modality previousValue = this._Modality.Entity;
				if (((previousValue != value) 
							|| (this._Modality.HasLoadedOrAssignedValue == false)))
				{
					this.SendPropertyChanging();
					if ((previousValue != null))
					{
						this._Modality.Entity = null;
						previousValue.DepotsAndModalities.Remove(this);
					}
					this._Modality.Entity = value;
					if ((value != null))
					{
						value.DepotsAndModalities.Add(this);
						this._ModalityId = value.ModalityId;
					}
					else
					{
						this._ModalityId = default(Nullable<decimal>);
					}
					this.SendPropertyChanged("Modality");
				}
			}
		}
		
		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(Name="dbo.DefaultTransportDays")]
	public partial class DefaultTransportDay : INotifyPropertyChanging, INotifyPropertyChanged
	{
		
		private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
		
		private decimal _DtdId;
		
		private decimal _DepotId;
		
		private System.Nullable<char> _isWinter;
		
		private System.Nullable<char> _monday;
		
		private System.Nullable<char> _tuesday;
		
		private System.Nullable<char> _wednesday;
		
		private System.Nullable<char> _thursday;
		
		private System.Nullable<char> _friday;
		
		private System.Nullable<char> _saturday;
		
		private System.Nullable<char> _sunday;
		
		private System.Nullable<decimal> _weeklyTransport;
		
		private EntityRef<DepotData> _DepotData;
		
    #region Extensibility Method Definitions
    partial void OnLoaded();
    partial void OnValidate(System.Data.Linq.ChangeAction action);
    partial void OnCreated();
    partial void OnDtdIdChanging(decimal value);
    partial void OnDtdIdChanged();
    partial void OnDepotIdChanging(decimal value);
    partial void OnDepotIdChanged();
    partial void OnisWinterChanging(System.Nullable<char> value);
    partial void OnisWinterChanged();
    partial void OnmondayChanging(System.Nullable<char> value);
    partial void OnmondayChanged();
    partial void OntuesdayChanging(System.Nullable<char> value);
    partial void OntuesdayChanged();
    partial void OnwednesdayChanging(System.Nullable<char> value);
    partial void OnwednesdayChanged();
    partial void OnthursdayChanging(System.Nullable<char> value);
    partial void OnthursdayChanged();
    partial void OnfridayChanging(System.Nullable<char> value);
    partial void OnfridayChanged();
    partial void OnsaturdayChanging(System.Nullable<char> value);
    partial void OnsaturdayChanged();
    partial void OnsundayChanging(System.Nullable<char> value);
    partial void OnsundayChanged();
    partial void OnweeklyTransportChanging(System.Nullable<decimal> value);
    partial void OnweeklyTransportChanged();
    #endregion
		
		public DefaultTransportDay()
		{
			this._DepotData = default(EntityRef<DepotData>);
			OnCreated();
		}
		
		[Column(Storage="_DtdId", AutoSync=AutoSync.OnInsert, DbType="Decimal(18,0) NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
		public decimal DtdId
		{
			get
			{
				return this._DtdId;
			}
			set
			{
				if ((this._DtdId != value))
				{
					this.OnDtdIdChanging(value);
					this.SendPropertyChanging();
					this._DtdId = value;
					this.SendPropertyChanged("DtdId");
					this.OnDtdIdChanged();
				}
			}
		}
		
		[Column(Storage="_DepotId", DbType="Decimal(18,0) NOT NULL")]
		public decimal DepotId
		{
			get
			{
				return this._DepotId;
			}
			set
			{
				if ((this._DepotId != value))
				{
					if (this._DepotData.HasLoadedOrAssignedValue)
					{
						throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
					}
					this.OnDepotIdChanging(value);
					this.SendPropertyChanging();
					this._DepotId = value;
					this.SendPropertyChanged("DepotId");
					this.OnDepotIdChanged();
				}
			}
		}
		
		[Column(Storage="_isWinter", DbType="Char(1)")]
		public System.Nullable<char> isWinter
		{
			get
			{
				return this._isWinter;
			}
			set
			{
				if ((this._isWinter != value))
				{
					this.OnisWinterChanging(value);
					this.SendPropertyChanging();
					this._isWinter = value;
					this.SendPropertyChanged("isWinter");
					this.OnisWinterChanged();
				}
			}
		}
		
		[Column(Storage="_monday", DbType="Char(1)")]
		public System.Nullable<char> monday
		{
			get
			{
				return this._monday;
			}
			set
			{
				if ((this._monday != value))
				{
					this.OnmondayChanging(value);
					this.SendPropertyChanging();
					this._monday = value;
					this.SendPropertyChanged("monday");
					this.OnmondayChanged();
				}
			}
		}
		
		[Column(Storage="_tuesday", DbType="Char(1)")]
		public System.Nullable<char> tuesday
		{
			get
			{
				return this._tuesday;
			}
			set
			{
				if ((this._tuesday != value))
				{
					this.OntuesdayChanging(value);
					this.SendPropertyChanging();
					this._tuesday = value;
					this.SendPropertyChanged("tuesday");
					this.OntuesdayChanged();
				}
			}
		}
		
		[Column(Storage="_wednesday", DbType="Char(1)")]
		public System.Nullable<char> wednesday
		{
			get
			{
				return this._wednesday;
			}
			set
			{
				if ((this._wednesday != value))
				{
					this.OnwednesdayChanging(value);
					this.SendPropertyChanging();
					this._wednesday = value;
					this.SendPropertyChanged("wednesday");
					this.OnwednesdayChanged();
				}
			}
		}
		
		[Column(Storage="_thursday", DbType="Char(1)")]
		public System.Nullable<char> thursday
		{
			get
			{
				return this._thursday;
			}
			set
			{
				if ((this._thursday != value))
				{
					this.OnthursdayChanging(value);
					this.SendPropertyChanging();
					this._thursday = value;
					this.SendPropertyChanged("thursday");
					this.OnthursdayChanged();
				}
			}
		}
		
		[Column(Storage="_friday", DbType="Char(1)")]
		public System.Nullable<char> friday
		{
			get
			{
				return this._friday;
			}
			set
			{
				if ((this._friday != value))
				{
					this.OnfridayChanging(value);
					this.SendPropertyChanging();
					this._friday = value;
					this.SendPropertyChanged("friday");
					this.OnfridayChanged();
				}
			}
		}
		
		[Column(Storage="_saturday", DbType="Char(1)")]
		public System.Nullable<char> saturday
		{
			get
			{
				return this._saturday;
			}
			set
			{
				if ((this._saturday != value))
				{
					this.OnsaturdayChanging(value);
					this.SendPropertyChanging();
					this._saturday = value;
					this.SendPropertyChanged("saturday");
					this.OnsaturdayChanged();
				}
			}
		}
		
		[Column(Storage="_sunday", DbType="Char(1)")]
		public System.Nullable<char> sunday
		{
			get
			{
				return this._sunday;
			}
			set
			{
				if ((this._sunday != value))
				{
					this.OnsundayChanging(value);
					this.SendPropertyChanging();
					this._sunday = value;
					this.SendPropertyChanged("sunday");
					this.OnsundayChanged();
				}
			}
		}
		
		[Column(Storage="_weeklyTransport", DbType="Decimal(18,0)")]
		public System.Nullable<decimal> weeklyTransport
		{
			get
			{
				return this._weeklyTransport;
			}
			set
			{
				if ((this._weeklyTransport != value))
				{
					this.OnweeklyTransportChanging(value);
					this.SendPropertyChanging();
					this._weeklyTransport = value;
					this.SendPropertyChanged("weeklyTransport");
					this.OnweeklyTransportChanged();
				}
			}
		}
		
		[Association(Name="DepotData_DefaultTransportDay", Storage="_DepotData", ThisKey="DepotId", OtherKey="DepotId", IsForeignKey=true)]
		public DepotData DepotData
		{
			get
			{
				return this._DepotData.Entity;
			}
			set
			{
				DepotData previousValue = this._DepotData.Entity;
				if (((previousValue != value) 
							|| (this._DepotData.HasLoadedOrAssignedValue == false)))
				{
					this.SendPropertyChanging();
					if ((previousValue != null))
					{
						this._DepotData.Entity = null;
						previousValue.DefaultTransportDays.Remove(this);
					}
					this._DepotData.Entity = value;
					if ((value != null))
					{
						value.DefaultTransportDays.Add(this);
						this._DepotId = value.DepotId;
					}
					else
					{
						this._DepotId = default(decimal);
					}
					this.SendPropertyChanged("DepotData");
				}
			}
		}
		
		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(Name="dbo.PartnerData")]
	public partial class PartnerData : INotifyPropertyChanging, INotifyPropertyChanged
	{
		
		private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
		
		private decimal _PartnerId;
		
		private string _Name;
		
		private string _Place;
		
		private string _ZipCode;
		
		private string _Address;
		
		private string _PartnerNumber;
		
		private string _OrderNumber;
		
		private string _Administrator;
		
		private string _LetterAddress;
		
		private string _Owner;
		
		private string _ContactPerson;
		
		private System.Nullable<System.DateTime> _ValidStart;
		
		private System.Nullable<System.DateTime> _ValidEnd;
		
		private System.Nullable<char> _StatusFlag;
		
		private System.Nullable<decimal> _RegionsId;
		
		private System.Nullable<decimal> _ContractTypesId;
		
		private string _PartnerDataComment;
		
		private System.Nullable<decimal> _ContractId;
		
		private EntitySet<DepotData> _DepotDatas;
		
		private EntityRef<Contract> _Contract;
		
    #region Extensibility Method Definitions
    partial void OnLoaded();
    partial void OnValidate(System.Data.Linq.ChangeAction action);
    partial void OnCreated();
    partial void OnPartnerIdChanging(decimal value);
    partial void OnPartnerIdChanged();
    partial void OnNameChanging(string value);
    partial void OnNameChanged();
    partial void OnPlaceChanging(string value);
    partial void OnPlaceChanged();
    partial void OnZipCodeChanging(string value);
    partial void OnZipCodeChanged();
    partial void OnAddressChanging(string value);
    partial void OnAddressChanged();
    partial void OnPartnerNumberChanging(string value);
    partial void OnPartnerNumberChanged();
    partial void OnOrderNumberChanging(string value);
    partial void OnOrderNumberChanged();
    partial void OnAdministratorChanging(string value);
    partial void OnAdministratorChanged();
    partial void OnLetterAddressChanging(string value);
    partial void OnLetterAddressChanged();
    partial void OnOwnerChanging(string value);
    partial void OnOwnerChanged();
    partial void OnContactPersonChanging(string value);
    partial void OnContactPersonChanged();
    partial void OnValidStartChanging(System.Nullable<System.DateTime> value);
    partial void OnValidStartChanged();
    partial void OnValidEndChanging(System.Nullable<System.DateTime> value);
    partial void OnValidEndChanged();
    partial void OnStatusFlagChanging(System.Nullable<char> value);
    partial void OnStatusFlagChanged();
    partial void OnRegionsIdChanging(System.Nullable<decimal> value);
    partial void OnRegionsIdChanged();
    partial void OnContractTypesIdChanging(System.Nullable<decimal> value);
    partial void OnContractTypesIdChanged();
    partial void OnPartnerDataCommentChanging(string value);
    partial void OnPartnerDataCommentChanged();
    partial void OnContractIdChanging(System.Nullable<decimal> value);
    partial void OnContractIdChanged();
    #endregion
		
		public PartnerData()
		{
			this._DepotDatas = new EntitySet<DepotData>(new Action<DepotData>(this.attach_DepotDatas), new Action<DepotData>(this.detach_DepotDatas));
			this._Contract = default(EntityRef<Contract>);
			OnCreated();
		}
		
		[Column(Storage="_PartnerId", AutoSync=AutoSync.OnInsert, DbType="Decimal(18,0) NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
		public decimal PartnerId
		{
			get
			{
				return this._PartnerId;
			}
			set
			{
				if ((this._PartnerId != value))
				{
					this.OnPartnerIdChanging(value);
					this.SendPropertyChanging();
					this._PartnerId = value;
					this.SendPropertyChanged("PartnerId");
					this.OnPartnerIdChanged();
				}
			}
		}
		
		[Column(Storage="_Name", DbType="VarChar(255)")]
		public string Name
		{
			get
			{
				return this._Name;
			}
			set
			{
				if ((this._Name != value))
				{
					this.OnNameChanging(value);
					this.SendPropertyChanging();
					this._Name = value;
					this.SendPropertyChanged("Name");
					this.OnNameChanged();
				}
			}
		}
		
		[Column(Storage="_Place", DbType="VarChar(100)")]
		public string Place
		{
			get
			{
				return this._Place;
			}
			set
			{
				if ((this._Place != value))
				{
					this.OnPlaceChanging(value);
					this.SendPropertyChanging();
					this._Place = value;
					this.SendPropertyChanged("Place");
					this.OnPlaceChanged();
				}
			}
		}
		
		[Column(Storage="_ZipCode", DbType="VarChar(50)")]
		public string ZipCode
		{
			get
			{
				return this._ZipCode;
			}
			set
			{
				if ((this._ZipCode != value))
				{
					this.OnZipCodeChanging(value);
					this.SendPropertyChanging();
					this._ZipCode = value;
					this.SendPropertyChanged("ZipCode");
					this.OnZipCodeChanged();
				}
			}
		}
		
		[Column(Storage="_Address", DbType="VarChar(255)")]
		public string Address
		{
			get
			{
				return this._Address;
			}
			set
			{
				if ((this._Address != value))
				{
					this.OnAddressChanging(value);
					this.SendPropertyChanging();
					this._Address = value;
					this.SendPropertyChanged("Address");
					this.OnAddressChanged();
				}
			}
		}
		
		[Column(Storage="_PartnerNumber", DbType="VarChar(50)")]
		public string PartnerNumber
		{
			get
			{
				return this._PartnerNumber;
			}
			set
			{
				if ((this._PartnerNumber != value))
				{
					this.OnPartnerNumberChanging(value);
					this.SendPropertyChanging();
					this._PartnerNumber = value;
					this.SendPropertyChanged("PartnerNumber");
					this.OnPartnerNumberChanged();
				}
			}
		}
		
		[Column(Storage="_OrderNumber", DbType="VarChar(50)")]
		public string OrderNumber
		{
			get
			{
				return this._OrderNumber;
			}
			set
			{
				if ((this._OrderNumber != value))
				{
					this.OnOrderNumberChanging(value);
					this.SendPropertyChanging();
					this._OrderNumber = value;
					this.SendPropertyChanged("OrderNumber");
					this.OnOrderNumberChanged();
				}
			}
		}
		
		[Column(Storage="_Administrator", DbType="VarChar(100)")]
		public string Administrator
		{
			get
			{
				return this._Administrator;
			}
			set
			{
				if ((this._Administrator != value))
				{
					this.OnAdministratorChanging(value);
					this.SendPropertyChanging();
					this._Administrator = value;
					this.SendPropertyChanged("Administrator");
					this.OnAdministratorChanged();
				}
			}
		}
		
		[Column(Storage="_LetterAddress", DbType="VarChar(255)")]
		public string LetterAddress
		{
			get
			{
				return this._LetterAddress;
			}
			set
			{
				if ((this._LetterAddress != value))
				{
					this.OnLetterAddressChanging(value);
					this.SendPropertyChanging();
					this._LetterAddress = value;
					this.SendPropertyChanged("LetterAddress");
					this.OnLetterAddressChanged();
				}
			}
		}
		
		[Column(Storage="_Owner", DbType="VarChar(100)")]
		public string Owner
		{
			get
			{
				return this._Owner;
			}
			set
			{
				if ((this._Owner != value))
				{
					this.OnOwnerChanging(value);
					this.SendPropertyChanging();
					this._Owner = value;
					this.SendPropertyChanged("Owner");
					this.OnOwnerChanged();
				}
			}
		}
		
		[Column(Storage="_ContactPerson", DbType="VarChar(255)")]
		public string ContactPerson
		{
			get
			{
				return this._ContactPerson;
			}
			set
			{
				if ((this._ContactPerson != value))
				{
					this.OnContactPersonChanging(value);
					this.SendPropertyChanging();
					this._ContactPerson = value;
					this.SendPropertyChanged("ContactPerson");
					this.OnContactPersonChanged();
				}
			}
		}
		
		[Column(Storage="_ValidStart", DbType="Date")]
		public System.Nullable<System.DateTime> ValidStart
		{
			get
			{
				return this._ValidStart;
			}
			set
			{
				if ((this._ValidStart != value))
				{
					this.OnValidStartChanging(value);
					this.SendPropertyChanging();
					this._ValidStart = value;
					this.SendPropertyChanged("ValidStart");
					this.OnValidStartChanged();
				}
			}
		}
		
		[Column(Storage="_ValidEnd", DbType="Date")]
		public System.Nullable<System.DateTime> ValidEnd
		{
			get
			{
				return this._ValidEnd;
			}
			set
			{
				if ((this._ValidEnd != value))
				{
					this.OnValidEndChanging(value);
					this.SendPropertyChanging();
					this._ValidEnd = value;
					this.SendPropertyChanged("ValidEnd");
					this.OnValidEndChanged();
				}
			}
		}
		
		[Column(Storage="_StatusFlag", DbType="Char(1)")]
		public System.Nullable<char> StatusFlag
		{
			get
			{
				return this._StatusFlag;
			}
			set
			{
				if ((this._StatusFlag != value))
				{
					this.OnStatusFlagChanging(value);
					this.SendPropertyChanging();
					this._StatusFlag = value;
					this.SendPropertyChanged("StatusFlag");
					this.OnStatusFlagChanged();
				}
			}
		}
		
		[Column(Storage="_RegionsId", DbType="Decimal(18,0)")]
		public System.Nullable<decimal> RegionsId
		{
			get
			{
				return this._RegionsId;
			}
			set
			{
				if ((this._RegionsId != value))
				{
					this.OnRegionsIdChanging(value);
					this.SendPropertyChanging();
					this._RegionsId = value;
					this.SendPropertyChanged("RegionsId");
					this.OnRegionsIdChanged();
				}
			}
		}
		
		[Column(Storage="_ContractTypesId", DbType="Decimal(18,0)")]
		public System.Nullable<decimal> ContractTypesId
		{
			get
			{
				return this._ContractTypesId;
			}
			set
			{
				if ((this._ContractTypesId != value))
				{
					this.OnContractTypesIdChanging(value);
					this.SendPropertyChanging();
					this._ContractTypesId = value;
					this.SendPropertyChanged("ContractTypesId");
					this.OnContractTypesIdChanged();
				}
			}
		}
		
		[Column(Storage="_PartnerDataComment", DbType="VarChar(255)")]
		public string PartnerDataComment
		{
			get
			{
				return this._PartnerDataComment;
			}
			set
			{
				if ((this._PartnerDataComment != value))
				{
					this.OnPartnerDataCommentChanging(value);
					this.SendPropertyChanging();
					this._PartnerDataComment = value;
					this.SendPropertyChanged("PartnerDataComment");
					this.OnPartnerDataCommentChanged();
				}
			}
		}
		
		[Column(Storage="_ContractId", DbType="Decimal(18,0)")]
		public System.Nullable<decimal> ContractId
		{
			get
			{
				return this._ContractId;
			}
			set
			{
				if ((this._ContractId != value))
				{
					if (this._Contract.HasLoadedOrAssignedValue)
					{
						throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
					}
					this.OnContractIdChanging(value);
					this.SendPropertyChanging();
					this._ContractId = value;
					this.SendPropertyChanged("ContractId");
					this.OnContractIdChanged();
				}
			}
		}
		
		[Association(Name="PartnerData_DepotData", Storage="_DepotDatas", ThisKey="PartnerId", OtherKey="PartnerId")]
		public EntitySet<DepotData> DepotDatas
		{
			get
			{
				return this._DepotDatas;
			}
			set
			{
				this._DepotDatas.Assign(value);
			}
		}
		
		[Association(Name="Contract_PartnerData", Storage="_Contract", ThisKey="ContractId", OtherKey="Contractid", IsForeignKey=true)]
		public Contract Contract
		{
			get
			{
				return this._Contract.Entity;
			}
			set
			{
				Contract previousValue = this._Contract.Entity;
				if (((previousValue != value) 
							|| (this._Contract.HasLoadedOrAssignedValue == false)))
				{
					this.SendPropertyChanging();
					if ((previousValue != null))
					{
						this._Contract.Entity = null;
						previousValue.PartnerDatas.Remove(this);
					}
					this._Contract.Entity = value;
					if ((value != null))
					{
						value.PartnerDatas.Add(this);
						this._ContractId = value.Contractid;
					}
					else
					{
						this._ContractId = default(Nullable<decimal>);
					}
					this.SendPropertyChanged("Contract");
				}
			}
		}
		
		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_DepotDatas(DepotData entity)
		{
			this.SendPropertyChanging();
			entity.PartnerData = this;
		}
		
		private void detach_DepotDatas(DepotData entity)
		{
			this.SendPropertyChanging();
			entity.PartnerData = null;
		}
	}
	
	[Table(Name="dbo.Contract")]
	public partial class Contract : INotifyPropertyChanging, INotifyPropertyChanged
	{
		
		private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
		
		private decimal _Contractid;
		
		private string _BankAccount;
		
		private string _KSHNumber;
		
		private string _KUJNumber;
		
		private string _TradeRegister;
		
		private string _TaxNumber;
		
		private string _TaxIdentifier;
		
		private string _MotherName;
		
		private string _IdentityCardNumber;
		
		private string _TownShipIdentifier;
		
		private string _Address;
		
		private System.Nullable<System.DateTime> _ValidStart;
		
		private System.Nullable<System.DateTime> _ValidEnd;
		
		private System.Nullable<char> _StatusFlag;
		
		private string _MVHNumber;
		
		private EntitySet<PartnerData> _PartnerDatas;
		
    #region Extensibility Method Definitions
    partial void OnLoaded();
    partial void OnValidate(System.Data.Linq.ChangeAction action);
    partial void OnCreated();
    partial void OnContractidChanging(decimal value);
    partial void OnContractidChanged();
    partial void OnBankAccountChanging(string value);
    partial void OnBankAccountChanged();
    partial void OnKSHNumberChanging(string value);
    partial void OnKSHNumberChanged();
    partial void OnKUJNumberChanging(string value);
    partial void OnKUJNumberChanged();
    partial void OnTradeRegisterChanging(string value);
    partial void OnTradeRegisterChanged();
    partial void OnTaxNumberChanging(string value);
    partial void OnTaxNumberChanged();
    partial void OnTaxIdentifierChanging(string value);
    partial void OnTaxIdentifierChanged();
    partial void OnMotherNameChanging(string value);
    partial void OnMotherNameChanged();
    partial void OnIdentityCardNumberChanging(string value);
    partial void OnIdentityCardNumberChanged();
    partial void OnTownShipIdentifierChanging(string value);
    partial void OnTownShipIdentifierChanged();
    partial void OnAddressChanging(string value);
    partial void OnAddressChanged();
    partial void OnValidStartChanging(System.Nullable<System.DateTime> value);
    partial void OnValidStartChanged();
    partial void OnValidEndChanging(System.Nullable<System.DateTime> value);
    partial void OnValidEndChanged();
    partial void OnStatusFlagChanging(System.Nullable<char> value);
    partial void OnStatusFlagChanged();
    partial void OnMVHNumberChanging(string value);
    partial void OnMVHNumberChanged();
    #endregion
		
		public Contract()
		{
			this._PartnerDatas = new EntitySet<PartnerData>(new Action<PartnerData>(this.attach_PartnerDatas), new Action<PartnerData>(this.detach_PartnerDatas));
			OnCreated();
		}
		
		[Column(Storage="_Contractid", AutoSync=AutoSync.OnInsert, DbType="Decimal(18,0) NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
		public decimal Contractid
		{
			get
			{
				return this._Contractid;
			}
			set
			{
				if ((this._Contractid != value))
				{
					this.OnContractidChanging(value);
					this.SendPropertyChanging();
					this._Contractid = value;
					this.SendPropertyChanged("Contractid");
					this.OnContractidChanged();
				}
			}
		}
		
		[Column(Storage="_BankAccount", DbType="VarChar(100)")]
		public string BankAccount
		{
			get
			{
				return this._BankAccount;
			}
			set
			{
				if ((this._BankAccount != value))
				{
					this.OnBankAccountChanging(value);
					this.SendPropertyChanging();
					this._BankAccount = value;
					this.SendPropertyChanged("BankAccount");
					this.OnBankAccountChanged();
				}
			}
		}
		
		[Column(Storage="_KSHNumber", DbType="VarChar(100)")]
		public string KSHNumber
		{
			get
			{
				return this._KSHNumber;
			}
			set
			{
				if ((this._KSHNumber != value))
				{
					this.OnKSHNumberChanging(value);
					this.SendPropertyChanging();
					this._KSHNumber = value;
					this.SendPropertyChanged("KSHNumber");
					this.OnKSHNumberChanged();
				}
			}
		}
		
		[Column(Storage="_KUJNumber", DbType="VarChar(100)")]
		public string KUJNumber
		{
			get
			{
				return this._KUJNumber;
			}
			set
			{
				if ((this._KUJNumber != value))
				{
					this.OnKUJNumberChanging(value);
					this.SendPropertyChanging();
					this._KUJNumber = value;
					this.SendPropertyChanged("KUJNumber");
					this.OnKUJNumberChanged();
				}
			}
		}
		
		[Column(Storage="_TradeRegister", DbType="VarChar(100)")]
		public string TradeRegister
		{
			get
			{
				return this._TradeRegister;
			}
			set
			{
				if ((this._TradeRegister != value))
				{
					this.OnTradeRegisterChanging(value);
					this.SendPropertyChanging();
					this._TradeRegister = value;
					this.SendPropertyChanged("TradeRegister");
					this.OnTradeRegisterChanged();
				}
			}
		}
		
		[Column(Storage="_TaxNumber", DbType="VarChar(100)")]
		public string TaxNumber
		{
			get
			{
				return this._TaxNumber;
			}
			set
			{
				if ((this._TaxNumber != value))
				{
					this.OnTaxNumberChanging(value);
					this.SendPropertyChanging();
					this._TaxNumber = value;
					this.SendPropertyChanged("TaxNumber");
					this.OnTaxNumberChanged();
				}
			}
		}
		
		[Column(Storage="_TaxIdentifier", DbType="VarChar(100)")]
		public string TaxIdentifier
		{
			get
			{
				return this._TaxIdentifier;
			}
			set
			{
				if ((this._TaxIdentifier != value))
				{
					this.OnTaxIdentifierChanging(value);
					this.SendPropertyChanging();
					this._TaxIdentifier = value;
					this.SendPropertyChanged("TaxIdentifier");
					this.OnTaxIdentifierChanged();
				}
			}
		}
		
		[Column(Storage="_MotherName", DbType="VarChar(100)")]
		public string MotherName
		{
			get
			{
				return this._MotherName;
			}
			set
			{
				if ((this._MotherName != value))
				{
					this.OnMotherNameChanging(value);
					this.SendPropertyChanging();
					this._MotherName = value;
					this.SendPropertyChanged("MotherName");
					this.OnMotherNameChanged();
				}
			}
		}
		
		[Column(Storage="_IdentityCardNumber", DbType="VarChar(100)")]
		public string IdentityCardNumber
		{
			get
			{
				return this._IdentityCardNumber;
			}
			set
			{
				if ((this._IdentityCardNumber != value))
				{
					this.OnIdentityCardNumberChanging(value);
					this.SendPropertyChanging();
					this._IdentityCardNumber = value;
					this.SendPropertyChanged("IdentityCardNumber");
					this.OnIdentityCardNumberChanged();
				}
			}
		}
		
		[Column(Storage="_TownShipIdentifier", DbType="VarChar(100)")]
		public string TownShipIdentifier
		{
			get
			{
				return this._TownShipIdentifier;
			}
			set
			{
				if ((this._TownShipIdentifier != value))
				{
					this.OnTownShipIdentifierChanging(value);
					this.SendPropertyChanging();
					this._TownShipIdentifier = value;
					this.SendPropertyChanged("TownShipIdentifier");
					this.OnTownShipIdentifierChanged();
				}
			}
		}
		
		[Column(Storage="_Address", DbType="VarChar(255)")]
		public string Address
		{
			get
			{
				return this._Address;
			}
			set
			{
				if ((this._Address != value))
				{
					this.OnAddressChanging(value);
					this.SendPropertyChanging();
					this._Address = value;
					this.SendPropertyChanged("Address");
					this.OnAddressChanged();
				}
			}
		}
		
		[Column(Storage="_ValidStart", DbType="Date")]
		public System.Nullable<System.DateTime> ValidStart
		{
			get
			{
				return this._ValidStart;
			}
			set
			{
				if ((this._ValidStart != value))
				{
					this.OnValidStartChanging(value);
					this.SendPropertyChanging();
					this._ValidStart = value;
					this.SendPropertyChanged("ValidStart");
					this.OnValidStartChanged();
				}
			}
		}
		
		[Column(Storage="_ValidEnd", DbType="Date")]
		public System.Nullable<System.DateTime> ValidEnd
		{
			get
			{
				return this._ValidEnd;
			}
			set
			{
				if ((this._ValidEnd != value))
				{
					this.OnValidEndChanging(value);
					this.SendPropertyChanging();
					this._ValidEnd = value;
					this.SendPropertyChanged("ValidEnd");
					this.OnValidEndChanged();
				}
			}
		}
		
		[Column(Storage="_StatusFlag", DbType="Char(1)")]
		public System.Nullable<char> StatusFlag
		{
			get
			{
				return this._StatusFlag;
			}
			set
			{
				if ((this._StatusFlag != value))
				{
					this.OnStatusFlagChanging(value);
					this.SendPropertyChanging();
					this._StatusFlag = value;
					this.SendPropertyChanged("StatusFlag");
					this.OnStatusFlagChanged();
				}
			}
		}
		
		[Column(Storage="_MVHNumber", DbType="VarChar(100)")]
		public string MVHNumber
		{
			get
			{
				return this._MVHNumber;
			}
			set
			{
				if ((this._MVHNumber != value))
				{
					this.OnMVHNumberChanging(value);
					this.SendPropertyChanging();
					this._MVHNumber = value;
					this.SendPropertyChanged("MVHNumber");
					this.OnMVHNumberChanged();
				}
			}
		}
		
		[Association(Name="Contract_PartnerData", Storage="_PartnerDatas", ThisKey="Contractid", OtherKey="ContractId")]
		public EntitySet<PartnerData> PartnerDatas
		{
			get
			{
				return this._PartnerDatas;
			}
			set
			{
				this._PartnerDatas.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_PartnerDatas(PartnerData entity)
		{
			this.SendPropertyChanging();
			entity.Contract = this;
		}
		
		private void detach_PartnerDatas(PartnerData entity)
		{
			this.SendPropertyChanging();
			entity.Contract = null;
		}
	}
	
	[Table(Name="dbo.Users")]
	public partial class User : INotifyPropertyChanging, INotifyPropertyChanged
	{
		
		private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
		
		private decimal _usersId;
		
		private decimal _groupId;
		
		private string _userName;
		
		private string _userPassword;
		
		private string _userFullName;
		
		private System.Nullable<decimal> _isActive;
		
		private EntityRef<Group> _Group;
		
    #region Extensibility Method Definitions
    partial void OnLoaded();
    partial void OnValidate(System.Data.Linq.ChangeAction action);
    partial void OnCreated();
    partial void OnusersIdChanging(decimal value);
    partial void OnusersIdChanged();
    partial void OngroupIdChanging(decimal value);
    partial void OngroupIdChanged();
    partial void OnuserNameChanging(string value);
    partial void OnuserNameChanged();
    partial void OnuserPasswordChanging(string value);
    partial void OnuserPasswordChanged();
    partial void OnuserFullNameChanging(string value);
    partial void OnuserFullNameChanged();
    partial void OnisActiveChanging(System.Nullable<decimal> value);
    partial void OnisActiveChanged();
    #endregion
		
		public User()
		{
			this._Group = default(EntityRef<Group>);
			OnCreated();
		}
		
		[Column(Storage="_usersId", AutoSync=AutoSync.OnInsert, DbType="Decimal(18,0) NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
		public decimal usersId
		{
			get
			{
				return this._usersId;
			}
			set
			{
				if ((this._usersId != value))
				{
					this.OnusersIdChanging(value);
					this.SendPropertyChanging();
					this._usersId = value;
					this.SendPropertyChanged("usersId");
					this.OnusersIdChanged();
				}
			}
		}
		
		[Column(Storage="_groupId", DbType="Decimal(18,0) NOT NULL")]
		public decimal groupId
		{
			get
			{
				return this._groupId;
			}
			set
			{
				if ((this._groupId != value))
				{
					if (this._Group.HasLoadedOrAssignedValue)
					{
						throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
					}
					this.OngroupIdChanging(value);
					this.SendPropertyChanging();
					this._groupId = value;
					this.SendPropertyChanged("groupId");
					this.OngroupIdChanged();
				}
			}
		}
		
		[Column(Storage="_userName", DbType="VarChar(255)")]
		public string userName
		{
			get
			{
				return this._userName;
			}
			set
			{
				if ((this._userName != value))
				{
					this.OnuserNameChanging(value);
					this.SendPropertyChanging();
					this._userName = value;
					this.SendPropertyChanged("userName");
					this.OnuserNameChanged();
				}
			}
		}
		
		[Column(Storage="_userPassword", DbType="VarChar(255)")]
		public string userPassword
		{
			get
			{
				return this._userPassword;
			}
			set
			{
				if ((this._userPassword != value))
				{
					this.OnuserPasswordChanging(value);
					this.SendPropertyChanging();
					this._userPassword = value;
					this.SendPropertyChanged("userPassword");
					this.OnuserPasswordChanged();
				}
			}
		}
		
		[Column(Storage="_userFullName", DbType="VarChar(255)")]
		public string userFullName
		{
			get
			{
				return this._userFullName;
			}
			set
			{
				if ((this._userFullName != value))
				{
					this.OnuserFullNameChanging(value);
					this.SendPropertyChanging();
					this._userFullName = value;
					this.SendPropertyChanged("userFullName");
					this.OnuserFullNameChanged();
				}
			}
		}
		
		[Column(Storage="_isActive", DbType="Decimal(18,0)")]
		public System.Nullable<decimal> isActive
		{
			get
			{
				return this._isActive;
			}
			set
			{
				if ((this._isActive != value))
				{
					this.OnisActiveChanging(value);
					this.SendPropertyChanging();
					this._isActive = value;
					this.SendPropertyChanged("isActive");
					this.OnisActiveChanged();
				}
			}
		}
		
		[Association(Name="Group_User", Storage="_Group", ThisKey="groupId", OtherKey="groupId", IsForeignKey=true)]
		public Group Group
		{
			get
			{
				return this._Group.Entity;
			}
			set
			{
				Group previousValue = this._Group.Entity;
				if (((previousValue != value) 
							|| (this._Group.HasLoadedOrAssignedValue == false)))
				{
					this.SendPropertyChanging();
					if ((previousValue != null))
					{
						this._Group.Entity = null;
						previousValue.Users.Remove(this);
					}
					this._Group.Entity = value;
					if ((value != null))
					{
						value.Users.Add(this);
						this._groupId = value.groupId;
					}
					else
					{
						this._groupId = default(decimal);
					}
					this.SendPropertyChanged("Group");
				}
			}
		}
		
		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(Name="dbo.Groups")]
	public partial class Group : INotifyPropertyChanging, INotifyPropertyChanged
	{
		
		private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
		
		private decimal _groupId;
		
		private string _groupName;
		
		private System.Nullable<decimal> _isActive;
		
		private string _details;
		
		private EntitySet<User> _Users;
		
		private EntitySet<GrantedModule> _GrantedModules;
		
    #region Extensibility Method Definitions
    partial void OnLoaded();
    partial void OnValidate(System.Data.Linq.ChangeAction action);
    partial void OnCreated();
    partial void OngroupIdChanging(decimal value);
    partial void OngroupIdChanged();
    partial void OngroupNameChanging(string value);
    partial void OngroupNameChanged();
    partial void OnisActiveChanging(System.Nullable<decimal> value);
    partial void OnisActiveChanged();
    partial void OndetailsChanging(string value);
    partial void OndetailsChanged();
    #endregion
		
		public Group()
		{
			this._Users = new EntitySet<User>(new Action<User>(this.attach_Users), new Action<User>(this.detach_Users));
			this._GrantedModules = new EntitySet<GrantedModule>(new Action<GrantedModule>(this.attach_GrantedModules), new Action<GrantedModule>(this.detach_GrantedModules));
			OnCreated();
		}
		
		[Column(Storage="_groupId", AutoSync=AutoSync.OnInsert, DbType="Decimal(18,0) NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
		public decimal groupId
		{
			get
			{
				return this._groupId;
			}
			set
			{
				if ((this._groupId != value))
				{
					this.OngroupIdChanging(value);
					this.SendPropertyChanging();
					this._groupId = value;
					this.SendPropertyChanged("groupId");
					this.OngroupIdChanged();
				}
			}
		}
		
		[Column(Storage="_groupName", DbType="VarChar(255)")]
		public string groupName
		{
			get
			{
				return this._groupName;
			}
			set
			{
				if ((this._groupName != value))
				{
					this.OngroupNameChanging(value);
					this.SendPropertyChanging();
					this._groupName = value;
					this.SendPropertyChanged("groupName");
					this.OngroupNameChanged();
				}
			}
		}
		
		[Column(Storage="_isActive", DbType="Decimal(18,0)")]
		public System.Nullable<decimal> isActive
		{
			get
			{
				return this._isActive;
			}
			set
			{
				if ((this._isActive != value))
				{
					this.OnisActiveChanging(value);
					this.SendPropertyChanging();
					this._isActive = value;
					this.SendPropertyChanged("isActive");
					this.OnisActiveChanged();
				}
			}
		}
		
		[Column(Storage="_details", DbType="VarChar(255)")]
		public string details
		{
			get
			{
				return this._details;
			}
			set
			{
				if ((this._details != value))
				{
					this.OndetailsChanging(value);
					this.SendPropertyChanging();
					this._details = value;
					this.SendPropertyChanged("details");
					this.OndetailsChanged();
				}
			}
		}
		
		[Association(Name="Group_User", Storage="_Users", ThisKey="groupId", OtherKey="groupId")]
		public EntitySet<User> Users
		{
			get
			{
				return this._Users;
			}
			set
			{
				this._Users.Assign(value);
			}
		}
		
		[Association(Name="Group_GrantedModule", Storage="_GrantedModules", ThisKey="groupId", OtherKey="groupId")]
		public EntitySet<GrantedModule> GrantedModules
		{
			get
			{
				return this._GrantedModules;
			}
			set
			{
				this._GrantedModules.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_Users(User entity)
		{
			this.SendPropertyChanging();
			entity.Group = this;
		}
		
		private void detach_Users(User entity)
		{
			this.SendPropertyChanging();
			entity.Group = null;
		}
		
		private void attach_GrantedModules(GrantedModule entity)
		{
			this.SendPropertyChanging();
			entity.Group = this;
		}
		
		private void detach_GrantedModules(GrantedModule entity)
		{
			this.SendPropertyChanging();
			entity.Group = null;
		}
	}
	
	[Table(Name="dbo.RouteCodes")]
	public partial class RouteCode : INotifyPropertyChanging, INotifyPropertyChanged
	{
		
		private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
		
		private decimal _RouteCodesId;
		
		private System.Nullable<char> _Code;
		
		private string _Details;
		
		private EntitySet<Route> _Routes;
		
    #region Extensibility Method Definitions
    partial void OnLoaded();
    partial void OnValidate(System.Data.Linq.ChangeAction action);
    partial void OnCreated();
    partial void OnRouteCodesIdChanging(decimal value);
    partial void OnRouteCodesIdChanged();
    partial void OnCodeChanging(System.Nullable<char> value);
    partial void OnCodeChanged();
    partial void OnDetailsChanging(string value);
    partial void OnDetailsChanged();
    #endregion
		
		public RouteCode()
		{
			this._Routes = new EntitySet<Route>(new Action<Route>(this.attach_Routes), new Action<Route>(this.detach_Routes));
			OnCreated();
		}
		
		[Column(Storage="_RouteCodesId", AutoSync=AutoSync.OnInsert, DbType="Decimal(18,0) NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
		public decimal RouteCodesId
		{
			get
			{
				return this._RouteCodesId;
			}
			set
			{
				if ((this._RouteCodesId != value))
				{
					this.OnRouteCodesIdChanging(value);
					this.SendPropertyChanging();
					this._RouteCodesId = value;
					this.SendPropertyChanged("RouteCodesId");
					this.OnRouteCodesIdChanged();
				}
			}
		}
		
		[Column(Storage="_Code", DbType="Char(1)")]
		public System.Nullable<char> Code
		{
			get
			{
				return this._Code;
			}
			set
			{
				if ((this._Code != value))
				{
					this.OnCodeChanging(value);
					this.SendPropertyChanging();
					this._Code = value;
					this.SendPropertyChanged("Code");
					this.OnCodeChanged();
				}
			}
		}
		
		[Column(Storage="_Details", DbType="VarChar(255)")]
		public string Details
		{
			get
			{
				return this._Details;
			}
			set
			{
				if ((this._Details != value))
				{
					this.OnDetailsChanging(value);
					this.SendPropertyChanging();
					this._Details = value;
					this.SendPropertyChanged("Details");
					this.OnDetailsChanged();
				}
			}
		}
		
		[Association(Name="RouteCode_Route", Storage="_Routes", ThisKey="RouteCodesId", OtherKey="RouteCodesId")]
		public EntitySet<Route> Routes
		{
			get
			{
				return this._Routes;
			}
			set
			{
				this._Routes.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_Routes(Route entity)
		{
			this.SendPropertyChanging();
			entity.RouteCode = this;
		}
		
		private void detach_Routes(Route entity)
		{
			this.SendPropertyChanging();
			entity.RouteCode = null;
		}
	}
	
	[Table(Name="dbo.Modality")]
	public partial class Modality : INotifyPropertyChanging, INotifyPropertyChanged
	{
		
		private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
		
		private decimal _ModalityId;
		
		private string _Modality1;
		
		private string _ShortModality;
		
		private EntitySet<DepotsAndModality> _DepotsAndModalities;
		
    #region Extensibility Method Definitions
    partial void OnLoaded();
    partial void OnValidate(System.Data.Linq.ChangeAction action);
    partial void OnCreated();
    partial void OnModalityIdChanging(decimal value);
    partial void OnModalityIdChanged();
    partial void OnModality1Changing(string value);
    partial void OnModality1Changed();
    partial void OnShortModalityChanging(string value);
    partial void OnShortModalityChanged();
    #endregion
		
		public Modality()
		{
			this._DepotsAndModalities = new EntitySet<DepotsAndModality>(new Action<DepotsAndModality>(this.attach_DepotsAndModalities), new Action<DepotsAndModality>(this.detach_DepotsAndModalities));
			OnCreated();
		}
		
		[Column(Storage="_ModalityId", AutoSync=AutoSync.OnInsert, DbType="Decimal(18,0) NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
		public decimal ModalityId
		{
			get
			{
				return this._ModalityId;
			}
			set
			{
				if ((this._ModalityId != value))
				{
					this.OnModalityIdChanging(value);
					this.SendPropertyChanging();
					this._ModalityId = value;
					this.SendPropertyChanged("ModalityId");
					this.OnModalityIdChanged();
				}
			}
		}
		
		[Column(Name="Modality", Storage="_Modality1", DbType="VarChar(100) NOT NULL", CanBeNull=false)]
		public string Modality1
		{
			get
			{
				return this._Modality1;
			}
			set
			{
				if ((this._Modality1 != value))
				{
					this.OnModality1Changing(value);
					this.SendPropertyChanging();
					this._Modality1 = value;
					this.SendPropertyChanged("Modality1");
					this.OnModality1Changed();
				}
			}
		}
		
		[Column(Storage="_ShortModality", DbType="VarChar(20) NOT NULL", CanBeNull=false)]
		public string ShortModality
		{
			get
			{
				return this._ShortModality;
			}
			set
			{
				if ((this._ShortModality != value))
				{
					this.OnShortModalityChanging(value);
					this.SendPropertyChanging();
					this._ShortModality = value;
					this.SendPropertyChanged("ShortModality");
					this.OnShortModalityChanged();
				}
			}
		}
		
		[Association(Name="Modality_DepotsAndModality", Storage="_DepotsAndModalities", ThisKey="ModalityId", OtherKey="ModalityId")]
		public EntitySet<DepotsAndModality> DepotsAndModalities
		{
			get
			{
				return this._DepotsAndModalities;
			}
			set
			{
				this._DepotsAndModalities.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_DepotsAndModalities(DepotsAndModality entity)
		{
			this.SendPropertyChanging();
			entity.Modality = this;
		}
		
		private void detach_DepotsAndModalities(DepotsAndModality entity)
		{
			this.SendPropertyChanging();
			entity.Modality = null;
		}
	}
	
	[Table(Name="dbo.GrantedModules")]
	public partial class GrantedModule : INotifyPropertyChanging, INotifyPropertyChanged
	{
		
		private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
		
		private decimal _ProgramModulesId;
		
		private decimal _groupId;
		
		private decimal _grantedModulesId;
		
		private EntityRef<Group> _Group;
		
    #region Extensibility Method Definitions
    partial void OnLoaded();
    partial void OnValidate(System.Data.Linq.ChangeAction action);
    partial void OnCreated();
    partial void OnProgramModulesIdChanging(decimal value);
    partial void OnProgramModulesIdChanged();
    partial void OngroupIdChanging(decimal value);
    partial void OngroupIdChanged();
    partial void OngrantedModulesIdChanging(decimal value);
    partial void OngrantedModulesIdChanged();
    #endregion
		
		public GrantedModule()
		{
			this._Group = default(EntityRef<Group>);
			OnCreated();
		}
		
		[Column(Storage="_ProgramModulesId", DbType="Decimal(18,0) NOT NULL")]
		public decimal ProgramModulesId
		{
			get
			{
				return this._ProgramModulesId;
			}
			set
			{
				if ((this._ProgramModulesId != value))
				{
					this.OnProgramModulesIdChanging(value);
					this.SendPropertyChanging();
					this._ProgramModulesId = value;
					this.SendPropertyChanged("ProgramModulesId");
					this.OnProgramModulesIdChanged();
				}
			}
		}
		
		[Column(Storage="_groupId", DbType="Decimal(18,0) NOT NULL")]
		public decimal groupId
		{
			get
			{
				return this._groupId;
			}
			set
			{
				if ((this._groupId != value))
				{
					if (this._Group.HasLoadedOrAssignedValue)
					{
						throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
					}
					this.OngroupIdChanging(value);
					this.SendPropertyChanging();
					this._groupId = value;
					this.SendPropertyChanged("groupId");
					this.OngroupIdChanged();
				}
			}
		}
		
		[Column(Storage="_grantedModulesId", AutoSync=AutoSync.OnInsert, DbType="Decimal(18,0) NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
		public decimal grantedModulesId
		{
			get
			{
				return this._grantedModulesId;
			}
			set
			{
				if ((this._grantedModulesId != value))
				{
					this.OngrantedModulesIdChanging(value);
					this.SendPropertyChanging();
					this._grantedModulesId = value;
					this.SendPropertyChanged("grantedModulesId");
					this.OngrantedModulesIdChanged();
				}
			}
		}
		
		[Association(Name="Group_GrantedModule", Storage="_Group", ThisKey="groupId", OtherKey="groupId", IsForeignKey=true)]
		public Group Group
		{
			get
			{
				return this._Group.Entity;
			}
			set
			{
				Group previousValue = this._Group.Entity;
				if (((previousValue != value) 
							|| (this._Group.HasLoadedOrAssignedValue == false)))
				{
					this.SendPropertyChanging();
					if ((previousValue != null))
					{
						this._Group.Entity = null;
						previousValue.GrantedModules.Remove(this);
					}
					this._Group.Entity = value;
					if ((value != null))
					{
						value.GrantedModules.Add(this);
						this._groupId = value.groupId;
					}
					else
					{
						this._groupId = default(decimal);
					}
					this.SendPropertyChanged("Group");
				}
			}
		}
		
		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));
			}
		}
	}
}
#pragma warning restore 1591
