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

namespace telif
{
	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="telephone")]
	public partial class DataClasses1DataContext : System.Data.Linq.DataContext
	{
		
		private static System.Data.Linq.Mapping.MappingSource mappingSource = new AttributeMappingSource();
		
    #region Extensibility Method Definitions
    partial void OnCreated();
    #endregion
		
		public DataClasses1DataContext() : 
				base(global::telif.Properties.Settings.Default.telephoneConnectionString, mappingSource)
		{
			OnCreated();
		}
		
		public DataClasses1DataContext(string connection) : 
				base(connection, mappingSource)
		{
			OnCreated();
		}
		
		public DataClasses1DataContext(System.Data.IDbConnection connection) : 
				base(connection, mappingSource)
		{
			OnCreated();
		}
		
		public DataClasses1DataContext(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : 
				base(connection, mappingSource)
		{
			OnCreated();
		}
		
		public DataClasses1DataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : 
				base(connection, mappingSource)
		{
			OnCreated();
		}
		
		public System.Data.Linq.Table<tel> tels
		{
			get
			{
				return this.GetTable<tel>();
			}
		}
		
		private void Inserttel(tel obj)
		{
			System.Nullable<long> p1 = obj.id;
			this.Storedadd(ref p1, obj.firstname, obj.lastname, obj.telephone);
			obj.id = p1.GetValueOrDefault();
		}
		
		private void Updatetel(tel obj)
		{
			this.Storedupdate(((System.Nullable<long>)(obj.id)), obj.firstname, obj.lastname, obj.telephone);
		}
		
		private void Deletetel(tel obj)
		{
			this.Storeddelete(((System.Nullable<long>)(obj.id)));
		}
		
		[Function(Name="dbo.Storedselectall")]
		public ISingleResult<tel> Storedselectall()
		{
			IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())));
			return ((ISingleResult<tel>)(result.ReturnValue));
		}
		
		[Function(Name="dbo.Storedsearch")]
		public ISingleResult<tel> Storedsearch([Parameter(DbType="NVarChar(20)")] string firstname, [Parameter(DbType="NVarChar(30)")] string lastname)
		{
			IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), firstname, lastname);
			return ((ISingleResult<tel>)(result.ReturnValue));
		}
		
		[Function(Name="dbo.Storedadd")]
		public int Storedadd([Parameter(DbType="BigInt")] ref System.Nullable<long> id, [Parameter(DbType="NVarChar(20)")] string firstname, [Parameter(DbType="NVarChar(30)")] string lastname, [Parameter(DbType="NVarChar(11)")] string telephone)
		{
			IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), id, firstname, lastname, telephone);
			id = ((System.Nullable<long>)(result.GetParameterValue(0)));
			return ((int)(result.ReturnValue));
		}
		
		[Function(Name="dbo.Storeddelete")]
		public int Storeddelete([Parameter(DbType="BigInt")] System.Nullable<long> id)
		{
			IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), id);
			return ((int)(result.ReturnValue));
		}
		
		[Function(Name="dbo.Storedupdate")]
		public int Storedupdate([Parameter(DbType="BigInt")] System.Nullable<long> id, [Parameter(DbType="NVarChar(20)")] string firstname, [Parameter(DbType="NVarChar(30)")] string lastname, [Parameter(DbType="NVarChar(11)")] string telephone)
		{
			IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), id, firstname, lastname, telephone);
			return ((int)(result.ReturnValue));
		}
	}
	
	[Table(Name="dbo.tel")]
	public partial class tel : INotifyPropertyChanging, INotifyPropertyChanged
	{
		
		private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
		
		private long _id;
		
		private string _firstname;
		
		private string _lastname;
		
		private string _telephone;
		
    #region Extensibility Method Definitions
    partial void OnLoaded();
    partial void OnValidate(System.Data.Linq.ChangeAction action);
    partial void OnCreated();
    partial void OnidChanging(long value);
    partial void OnidChanged();
    partial void OnfirstnameChanging(string value);
    partial void OnfirstnameChanged();
    partial void OnlastnameChanging(string value);
    partial void OnlastnameChanged();
    partial void OntelephoneChanging(string value);
    partial void OntelephoneChanged();
    #endregion
		
		public tel()
		{
			OnCreated();
		}
		
		[Column(Storage="_id", AutoSync=AutoSync.OnInsert, DbType="BigInt NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
		public long id
		{
			get
			{
				return this._id;
			}
			set
			{
				if ((this._id != value))
				{
					this.OnidChanging(value);
					this.SendPropertyChanging();
					this._id = value;
					this.SendPropertyChanged("id");
					this.OnidChanged();
				}
			}
		}
		
		[Column(Storage="_firstname", DbType="NVarChar(20) NOT NULL", CanBeNull=false)]
		public string firstname
		{
			get
			{
				return this._firstname;
			}
			set
			{
				if ((this._firstname != value))
				{
					this.OnfirstnameChanging(value);
					this.SendPropertyChanging();
					this._firstname = value;
					this.SendPropertyChanged("firstname");
					this.OnfirstnameChanged();
				}
			}
		}
		
		[Column(Storage="_lastname", DbType="NVarChar(30) NOT NULL", CanBeNull=false)]
		public string lastname
		{
			get
			{
				return this._lastname;
			}
			set
			{
				if ((this._lastname != value))
				{
					this.OnlastnameChanging(value);
					this.SendPropertyChanging();
					this._lastname = value;
					this.SendPropertyChanged("lastname");
					this.OnlastnameChanged();
				}
			}
		}
		
		[Column(Storage="_telephone", DbType="NVarChar(11) NOT NULL", CanBeNull=false)]
		public string telephone
		{
			get
			{
				return this._telephone;
			}
			set
			{
				if ((this._telephone != value))
				{
					this.OntelephoneChanging(value);
					this.SendPropertyChanging();
					this._telephone = value;
					this.SendPropertyChanged("telephone");
					this.OntelephoneChanged();
				}
			}
		}
		
		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
