#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.1433
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace DAL
{
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.Runtime.Serialization;
using System.ComponentModel;
using System;
[System.Data.Linq.Mapping.DatabaseAttribute(Name="Database")]
public partial class DataClassesDataContext : System.Data.Linq.DataContext
{
private static System.Data.Linq.Mapping.MappingSource mappingSource = new AttributeMappingSource();
#region Extensibility Method Definitions
partial void OnCreated();
partial void InsertBill(Bill instance);
partial void UpdateBill(Bill instance);
partial void DeleteBill(Bill instance);
partial void InsertCustomer(Customer instance);
partial void UpdateCustomer(Customer instance);
partial void DeleteCustomer(Customer instance);
partial void InsertBillingItem(BillingItem instance);
partial void UpdateBillingItem(BillingItem instance);
partial void DeleteBillingItem(BillingItem instance);
#endregion
public DataClassesDataContext() :
base(global::System.Configuration.ConfigurationManager.ConnectionStrings["DatabaseConnectionString"].ConnectionString, mappingSource)
{
OnCreated();
}
public DataClassesDataContext(string connection) :
base(connection, mappingSource)
{
OnCreated();
}
public DataClassesDataContext(System.Data.IDbConnection connection) :
base(connection, mappingSource)
{
OnCreated();
}
public DataClassesDataContext(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) :
base(connection, mappingSource)
{
OnCreated();
}
public DataClassesDataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) :
base(connection, mappingSource)
{
OnCreated();
}
public System.Data.Linq.Table<Bill> Bills
{
get
{
return this.GetTable<Bill>();
}
}
public System.Data.Linq.Table<Customer> Customers
{
get
{
return this.GetTable<Customer>();
}
}
public System.Data.Linq.Table<BillingItem> BillingItems
{
get
{
return this.GetTable<BillingItem>();
}
}
}
[Table(Name="dbo.Bills")]
[DataContract()]
public partial class Bill : INotifyPropertyChanging, INotifyPropertyChanged
{
private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
private int _ID;
private System.Data.Linq.Binary _Version;
private int _CustomerID;
private System.DateTime _Date;
private EntitySet<BillingItem> _BillingItems;
private EntityRef<Customer> _Customer;
private bool serializing;
#region Extensibility Method Definitions
partial void OnLoaded();
partial void OnValidate(System.Data.Linq.ChangeAction action);
partial void OnCreated();
partial void OnIDChanging(int value);
partial void OnIDChanged();
partial void OnVersionChanging(System.Data.Linq.Binary value);
partial void OnVersionChanged();
partial void OnCustomerIDChanging(int value);
partial void OnCustomerIDChanged();
partial void OnDateChanging(System.DateTime value);
partial void OnDateChanged();
#endregion
public Bill()
{
this.Initialize();
}
[Column(Storage="_ID", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true, UpdateCheck=UpdateCheck.Never)]
[DataMember(Order=1)]
public int 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="_Version", AutoSync=AutoSync.Always, DbType="rowversion NOT NULL", CanBeNull=false, IsDbGenerated=true, IsVersion=true, UpdateCheck=UpdateCheck.Never)]
[DataMember(Order=2)]
public System.Data.Linq.Binary Version
{
get
{
return this._Version;
}
set
{
if ((this._Version != value))
{
this.OnVersionChanging(value);
this.SendPropertyChanging();
this._Version = value;
this.SendPropertyChanged("Version");
this.OnVersionChanged();
}
}
}
[Column(Storage="_CustomerID", DbType="Int NOT NULL", UpdateCheck=UpdateCheck.Never)]
[DataMember(Order=3)]
public int CustomerID
{
get
{
return this._CustomerID;
}
set
{
if ((this._CustomerID != value))
{
if (this._Customer.HasLoadedOrAssignedValue)
{
throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
}
this.OnCustomerIDChanging(value);
this.SendPropertyChanging();
this._CustomerID = value;
this.SendPropertyChanged("CustomerID");
this.OnCustomerIDChanged();
}
}
}
[Column(Storage="_Date", DbType="DateTime NOT NULL", UpdateCheck=UpdateCheck.Never)]
[DataMember(Order=4)]
public System.DateTime Date
{
get
{
return this._Date;
}
set
{
if ((this._Date != value))
{
this.OnDateChanging(value);
this.SendPropertyChanging();
this._Date = value;
this.SendPropertyChanged("Date");
this.OnDateChanged();
}
}
}
[Association(Name="Bill_BillingItem", Storage="_BillingItems", OtherKey="BillID")]
[DataMember(Order=5, EmitDefaultValue=false)]
public EntitySet<BillingItem> BillingItems
{
get
{
if ((this.serializing
&& (this._BillingItems.HasLoadedOrAssignedValues == false)))
{
return null;
}
return this._BillingItems;
}
set
{
this._BillingItems.Assign(value);
}
}
[Association(Name="Customer_Bill", Storage="_Customer", ThisKey="CustomerID", IsForeignKey=true)]
public Customer Customer
{
get
{
return this._Customer.Entity;
}
set
{
Customer previousValue = this._Customer.Entity;
if (((previousValue != value)
|| (this._Customer.HasLoadedOrAssignedValue == false)))
{
this.SendPropertyChanging();
if ((previousValue != null))
{
this._Customer.Entity = null;
previousValue.Bills.Remove(this);
}
this._Customer.Entity = value;
if ((value != null))
{
value.Bills.Add(this);
this._CustomerID = value.ID;
}
else
{
this._CustomerID = default(int);
}
this.SendPropertyChanged("Customer");
}
}
}
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_BillingItems(BillingItem entity)
{
this.SendPropertyChanging();
entity.Bill = this;
}
private void detach_BillingItems(BillingItem entity)
{
this.SendPropertyChanging();
entity.Bill = null;
}
private void Initialize()
{
this._BillingItems = new EntitySet<BillingItem>(new Action<BillingItem>(this.attach_BillingItems), new Action<BillingItem>(this.detach_BillingItems));
this._Customer = default(EntityRef<Customer>);
OnCreated();
}
[OnDeserializing()]
[System.ComponentModel.EditorBrowsableAttribute(EditorBrowsableState.Never)]
public void OnDeserializing(StreamingContext context)
{
this.Initialize();
}
[OnSerializing()]
[System.ComponentModel.EditorBrowsableAttribute(EditorBrowsableState.Never)]
public void OnSerializing(StreamingContext context)
{
this.serializing = true;
}
[OnSerialized()]
[System.ComponentModel.EditorBrowsableAttribute(EditorBrowsableState.Never)]
public void OnSerialized(StreamingContext context)
{
this.serializing = false;
}
}
[Table(Name="dbo.Customers")]
[DataContract()]
public partial class Customer : INotifyPropertyChanging, INotifyPropertyChanged
{
private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
private int _ID;
private System.Data.Linq.Binary _Version;
private string _FirstName;
private string _LastName;
private EntitySet<Bill> _Bills;
private bool serializing;
#region Extensibility Method Definitions
partial void OnLoaded();
partial void OnValidate(System.Data.Linq.ChangeAction action);
partial void OnCreated();
partial void OnIDChanging(int value);
partial void OnIDChanged();
partial void OnVersionChanging(System.Data.Linq.Binary value);
partial void OnVersionChanged();
partial void OnFirstNameChanging(string value);
partial void OnFirstNameChanged();
partial void OnLastNameChanging(string value);
partial void OnLastNameChanged();
#endregion
public Customer()
{
this.Initialize();
}
[Column(Storage="_ID", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true, UpdateCheck=UpdateCheck.Never)]
[DataMember(Order=1)]
public int 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="_Version", AutoSync=AutoSync.Always, DbType="rowversion NOT NULL", CanBeNull=false, IsDbGenerated=true, IsVersion=true, UpdateCheck=UpdateCheck.Never)]
[DataMember(Order=2)]
public System.Data.Linq.Binary Version
{
get
{
return this._Version;
}
set
{
if ((this._Version != value))
{
this.OnVersionChanging(value);
this.SendPropertyChanging();
this._Version = value;
this.SendPropertyChanged("Version");
this.OnVersionChanged();
}
}
}
[Column(Storage="_FirstName", DbType="NVarChar(50) NOT NULL", CanBeNull=false, UpdateCheck=UpdateCheck.Never)]
[DataMember(Order=3)]
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(50) NOT NULL", CanBeNull=false, UpdateCheck=UpdateCheck.Never)]
[DataMember(Order=4)]
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();
}
}
}
[Association(Name="Customer_Bill", Storage="_Bills", OtherKey="CustomerID")]
[DataMember(Order=5, EmitDefaultValue=false)]
public EntitySet<Bill> Bills
{
get
{
if ((this.serializing
&& (this._Bills.HasLoadedOrAssignedValues == false)))
{
return null;
}
return this._Bills;
}
set
{
this._Bills.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_Bills(Bill entity)
{
this.SendPropertyChanging();
entity.Customer = this;
}
private void detach_Bills(Bill entity)
{
this.SendPropertyChanging();
entity.Customer = null;
}
private void Initialize()
{
this._Bills = new EntitySet<Bill>(new Action<Bill>(this.attach_Bills), new Action<Bill>(this.detach_Bills));
OnCreated();
}
[OnDeserializing()]
[System.ComponentModel.EditorBrowsableAttribute(EditorBrowsableState.Never)]
public void OnDeserializing(StreamingContext context)
{
this.Initialize();
}
[OnSerializing()]
[System.ComponentModel.EditorBrowsableAttribute(EditorBrowsableState.Never)]
public void OnSerializing(StreamingContext context)
{
this.serializing = true;
}
[OnSerialized()]
[System.ComponentModel.EditorBrowsableAttribute(EditorBrowsableState.Never)]
public void OnSerialized(StreamingContext context)
{
this.serializing = false;
}
}
[Table(Name="dbo.BillingItems")]
[DataContract()]
public partial class BillingItem : INotifyPropertyChanging, INotifyPropertyChanged
{
private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
private int _ID;
private System.Data.Linq.Binary _Version;
private int _NumItems;
private int _BillID;
private decimal _ItemPrice;
private EntityRef<Bill> _Bill;
#region Extensibility Method Definitions
partial void OnLoaded();
partial void OnValidate(System.Data.Linq.ChangeAction action);
partial void OnCreated();
partial void OnIDChanging(int value);
partial void OnIDChanged();
partial void OnVersionChanging(System.Data.Linq.Binary value);
partial void OnVersionChanged();
partial void OnNumItemsChanging(int value);
partial void OnNumItemsChanged();
partial void OnBillIDChanging(int value);
partial void OnBillIDChanged();
partial void OnItemPriceChanging(decimal value);
partial void OnItemPriceChanged();
#endregion
public BillingItem()
{
this.Initialize();
}
[Column(Storage="_ID", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true, UpdateCheck=UpdateCheck.Never)]
[DataMember(Order=1)]
public int 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="_Version", AutoSync=AutoSync.Always, DbType="rowversion NOT NULL", CanBeNull=false, IsDbGenerated=true, IsVersion=true, UpdateCheck=UpdateCheck.Never)]
[DataMember(Order=2)]
public System.Data.Linq.Binary Version
{
get
{
return this._Version;
}
set
{
if ((this._Version != value))
{
this.OnVersionChanging(value);
this.SendPropertyChanging();
this._Version = value;
this.SendPropertyChanged("Version");
this.OnVersionChanged();
}
}
}
[Column(Storage="_NumItems", DbType="Int NOT NULL", UpdateCheck=UpdateCheck.Never)]
[DataMember(Order=3)]
public int NumItems
{
get
{
return this._NumItems;
}
set
{
if ((this._NumItems != value))
{
this.OnNumItemsChanging(value);
this.SendPropertyChanging();
this._NumItems = value;
this.SendPropertyChanged("NumItems");
this.OnNumItemsChanged();
}
}
}
[Column(Storage="_BillID", DbType="Int NOT NULL", UpdateCheck=UpdateCheck.Never)]
[DataMember(Order=4)]
public int BillID
{
get
{
return this._BillID;
}
set
{
if ((this._BillID != value))
{
if (this._Bill.HasLoadedOrAssignedValue)
{
throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
}
this.OnBillIDChanging(value);
this.SendPropertyChanging();
this._BillID = value;
this.SendPropertyChanged("BillID");
this.OnBillIDChanged();
}
}
}
[Column(Storage="_ItemPrice", DbType="Money NOT NULL", UpdateCheck=UpdateCheck.Never)]
[DataMember(Order=5)]
public decimal ItemPrice
{
get
{
return this._ItemPrice;
}
set
{
if ((this._ItemPrice != value))
{
this.OnItemPriceChanging(value);
this.SendPropertyChanging();
this._ItemPrice = value;
this.SendPropertyChanged("ItemPrice");
this.OnItemPriceChanged();
}
}
}
[Association(Name="Bill_BillingItem", Storage="_Bill", ThisKey="BillID", IsForeignKey=true)]
public Bill Bill
{
get
{
return this._Bill.Entity;
}
set
{
Bill previousValue = this._Bill.Entity;
if (((previousValue != value)
|| (this._Bill.HasLoadedOrAssignedValue == false)))
{
this.SendPropertyChanging();
if ((previousValue != null))
{
this._Bill.Entity = null;
previousValue.BillingItems.Remove(this);
}
this._Bill.Entity = value;
if ((value != null))
{
value.BillingItems.Add(this);
this._BillID = value.ID;
}
else
{
this._BillID = default(int);
}
this.SendPropertyChanged("Bill");
}
}
}
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 Initialize()
{
this._Bill = default(EntityRef<Bill>);
OnCreated();
}
[OnDeserializing()]
[System.ComponentModel.EditorBrowsableAttribute(EditorBrowsableState.Never)]
public void OnDeserializing(StreamingContext context)
{
this.Initialize();
}
}
}
#pragma warning restore 1591