#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
//     此代码由工具生成。
//     运行时版本:2.0.50727.5456
//
//     对此文件的更改可能会导致不正确的行为，并且如果
//     重新生成代码，这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.Linq;
using System.Data.Linq.Mapping;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;



[System.Data.Linq.Mapping.DatabaseAttribute(Name="myPetShop")]
public partial class myShopDataContext : System.Data.Linq.DataContext
{
	
	private static System.Data.Linq.Mapping.MappingSource mappingSource = new AttributeMappingSource();
	
  #region Extensibility Method Definitions
  partial void OnCreated();
  partial void InsertCategory(Category instance);
  partial void UpdateCategory(Category instance);
  partial void DeleteCategory(Category instance);
  partial void InsertOrder(Order instance);
  partial void UpdateOrder(Order instance);
  partial void DeleteOrder(Order instance);
  partial void InsertOrderItem(OrderItem instance);
  partial void UpdateOrderItem(OrderItem instance);
  partial void DeleteOrderItem(OrderItem instance);
  partial void InsertProduct(Product instance);
  partial void UpdateProduct(Product instance);
  partial void DeleteProduct(Product instance);
  partial void InsertSupplier(Supplier instance);
  partial void UpdateSupplier(Supplier instance);
  partial void DeleteSupplier(Supplier instance);
  partial void InsertUser(User instance);
  partial void UpdateUser(User instance);
  partial void DeleteUser(User instance);
  partial void InsertUserInfo(UserInfo instance);
  partial void UpdateUserInfo(UserInfo instance);
  partial void DeleteUserInfo(UserInfo instance);
  #endregion
	
	public myShopDataContext() : 
			base(global::System.Configuration.ConfigurationManager.ConnectionStrings["myPetShopConnectionString2"].ConnectionString, mappingSource)
	{
		OnCreated();
	}
	
	public myShopDataContext(string connection) : 
			base(connection, mappingSource)
	{
		OnCreated();
	}
	
	public myShopDataContext(System.Data.IDbConnection connection) : 
			base(connection, mappingSource)
	{
		OnCreated();
	}
	
	public myShopDataContext(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : 
			base(connection, mappingSource)
	{
		OnCreated();
	}
	
	public myShopDataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : 
			base(connection, mappingSource)
	{
		OnCreated();
	}
	
	public System.Data.Linq.Table<Category> Category
	{
		get
		{
			return this.GetTable<Category>();
		}
	}
	
	public System.Data.Linq.Table<Order> Order
	{
		get
		{
			return this.GetTable<Order>();
		}
	}
	
	public System.Data.Linq.Table<OrderItem> OrderItem
	{
		get
		{
			return this.GetTable<OrderItem>();
		}
	}
	
	public System.Data.Linq.Table<Product> Product
	{
		get
		{
			return this.GetTable<Product>();
		}
	}
	
	public System.Data.Linq.Table<Supplier> Supplier
	{
		get
		{
			return this.GetTable<Supplier>();
		}
	}
	
	public System.Data.Linq.Table<User> User
	{
		get
		{
			return this.GetTable<User>();
		}
	}
	
	public System.Data.Linq.Table<UserInfo> UserInfo
	{
		get
		{
			return this.GetTable<UserInfo>();
		}
	}
}

[Table(Name="dbo.Category")]
public partial class Category : INotifyPropertyChanging, INotifyPropertyChanged
{
	
	private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
	
	private int _CategoryId;
	
	private string _Name;
	
	private string _Descn;
	
	private string _ImageFile;
	
	private EntitySet<Product> _Product;
	
    #region Extensibility Method Definitions
    partial void OnLoaded();
    partial void OnValidate(System.Data.Linq.ChangeAction action);
    partial void OnCreated();
    partial void OnCategoryIdChanging(int value);
    partial void OnCategoryIdChanged();
    partial void OnNameChanging(string value);
    partial void OnNameChanged();
    partial void OnDescnChanging(string value);
    partial void OnDescnChanged();
    partial void OnImageFileChanging(string value);
    partial void OnImageFileChanged();
    #endregion
	
	public Category()
	{
		this._Product = new EntitySet<Product>(new Action<Product>(this.attach_Product), new Action<Product>(this.detach_Product));
		OnCreated();
	}
	
	[Column(Storage="_CategoryId", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
	public int CategoryId
	{
		get
		{
			return this._CategoryId;
		}
		set
		{
			if ((this._CategoryId != value))
			{
				this.OnCategoryIdChanging(value);
				this.SendPropertyChanging();
				this._CategoryId = value;
				this.SendPropertyChanged("CategoryId");
				this.OnCategoryIdChanged();
			}
		}
	}
	
	[Column(Storage="_Name", DbType="VarChar(80)")]
	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="_Descn", DbType="VarChar(255)")]
	public string Descn
	{
		get
		{
			return this._Descn;
		}
		set
		{
			if ((this._Descn != value))
			{
				this.OnDescnChanging(value);
				this.SendPropertyChanging();
				this._Descn = value;
				this.SendPropertyChanged("Descn");
				this.OnDescnChanged();
			}
		}
	}
	
	[Column(Storage="_ImageFile", DbType="VarChar(50)")]
	public string ImageFile
	{
		get
		{
			return this._ImageFile;
		}
		set
		{
			if ((this._ImageFile != value))
			{
				this.OnImageFileChanging(value);
				this.SendPropertyChanging();
				this._ImageFile = value;
				this.SendPropertyChanged("ImageFile");
				this.OnImageFileChanged();
			}
		}
	}
	
	[Association(Name="Category_Product", Storage="_Product", OtherKey="CategoryId")]
	public EntitySet<Product> Product
	{
		get
		{
			return this._Product;
		}
		set
		{
			this._Product.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_Product(Product entity)
	{
		this.SendPropertyChanging();
		entity.Category = this;
	}
	
	private void detach_Product(Product entity)
	{
		this.SendPropertyChanging();
		entity.Category = null;
	}
}

[Table(Name="dbo.[Order]")]
public partial class Order : INotifyPropertyChanging, INotifyPropertyChanged
{
	
	private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
	
	private int _OrderId;
	
	private string _uid;
	
	private string _UserName;
	
	private System.DateTime _OrderDate;
	
	private string _Addr1;
	
	private string _Addr2;
	
	private string _City;
	
	private string _State;
	
	private string _Zip;
	
	private string _Phone;
	
	private string _Status;
	
	private EntitySet<OrderItem> _OrderItem;
	
	private EntityRef<User> _User;
	
    #region Extensibility Method Definitions
    partial void OnLoaded();
    partial void OnValidate(System.Data.Linq.ChangeAction action);
    partial void OnCreated();
    partial void OnOrderIdChanging(int value);
    partial void OnOrderIdChanged();
    partial void OnuidChanging(string value);
    partial void OnuidChanged();
    partial void OnUserNameChanging(string value);
    partial void OnUserNameChanged();
    partial void OnOrderDateChanging(System.DateTime value);
    partial void OnOrderDateChanged();
    partial void OnAddr1Changing(string value);
    partial void OnAddr1Changed();
    partial void OnAddr2Changing(string value);
    partial void OnAddr2Changed();
    partial void OnCityChanging(string value);
    partial void OnCityChanged();
    partial void OnStateChanging(string value);
    partial void OnStateChanged();
    partial void OnZipChanging(string value);
    partial void OnZipChanged();
    partial void OnPhoneChanging(string value);
    partial void OnPhoneChanged();
    partial void OnStatusChanging(string value);
    partial void OnStatusChanged();
    #endregion
	
	public Order()
	{
		this._OrderItem = new EntitySet<OrderItem>(new Action<OrderItem>(this.attach_OrderItem), new Action<OrderItem>(this.detach_OrderItem));
		this._User = default(EntityRef<User>);
		OnCreated();
	}
	
	[Column(Storage="_OrderId", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
	public int OrderId
	{
		get
		{
			return this._OrderId;
		}
		set
		{
			if ((this._OrderId != value))
			{
				this.OnOrderIdChanging(value);
				this.SendPropertyChanging();
				this._OrderId = value;
				this.SendPropertyChanged("OrderId");
				this.OnOrderIdChanged();
			}
		}
	}
	
	[Column(Storage="_uid", DbType="VarChar(20) NOT NULL", CanBeNull=false)]
	public string uid
	{
		get
		{
			return this._uid;
		}
		set
		{
			if ((this._uid != value))
			{
				if (this._User.HasLoadedOrAssignedValue)
				{
					throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
				}
				this.OnuidChanging(value);
				this.SendPropertyChanging();
				this._uid = value;
				this.SendPropertyChanged("uid");
				this.OnuidChanged();
			}
		}
	}
	
	[Column(Storage="_UserName", DbType="VarChar(80) NOT NULL", CanBeNull=false)]
	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="_OrderDate", DbType="DateTime NOT NULL")]
	public System.DateTime OrderDate
	{
		get
		{
			return this._OrderDate;
		}
		set
		{
			if ((this._OrderDate != value))
			{
				this.OnOrderDateChanging(value);
				this.SendPropertyChanging();
				this._OrderDate = value;
				this.SendPropertyChanged("OrderDate");
				this.OnOrderDateChanged();
			}
		}
	}
	
	[Column(Storage="_Addr1", DbType="VarChar(80)")]
	public string Addr1
	{
		get
		{
			return this._Addr1;
		}
		set
		{
			if ((this._Addr1 != value))
			{
				this.OnAddr1Changing(value);
				this.SendPropertyChanging();
				this._Addr1 = value;
				this.SendPropertyChanged("Addr1");
				this.OnAddr1Changed();
			}
		}
	}
	
	[Column(Storage="_Addr2", DbType="VarChar(80)")]
	public string Addr2
	{
		get
		{
			return this._Addr2;
		}
		set
		{
			if ((this._Addr2 != value))
			{
				this.OnAddr2Changing(value);
				this.SendPropertyChanging();
				this._Addr2 = value;
				this.SendPropertyChanged("Addr2");
				this.OnAddr2Changed();
			}
		}
	}
	
	[Column(Storage="_City", DbType="VarChar(80)")]
	public string City
	{
		get
		{
			return this._City;
		}
		set
		{
			if ((this._City != value))
			{
				this.OnCityChanging(value);
				this.SendPropertyChanging();
				this._City = value;
				this.SendPropertyChanged("City");
				this.OnCityChanged();
			}
		}
	}
	
	[Column(Storage="_State", DbType="VarChar(80)")]
	public string State
	{
		get
		{
			return this._State;
		}
		set
		{
			if ((this._State != value))
			{
				this.OnStateChanging(value);
				this.SendPropertyChanging();
				this._State = value;
				this.SendPropertyChanged("State");
				this.OnStateChanged();
			}
		}
	}
	
	[Column(Storage="_Zip", DbType="VarChar(5)")]
	public string Zip
	{
		get
		{
			return this._Zip;
		}
		set
		{
			if ((this._Zip != value))
			{
				this.OnZipChanging(value);
				this.SendPropertyChanging();
				this._Zip = value;
				this.SendPropertyChanged("Zip");
				this.OnZipChanged();
			}
		}
	}
	
	[Column(Storage="_Phone", DbType="VarChar(40)")]
	public string Phone
	{
		get
		{
			return this._Phone;
		}
		set
		{
			if ((this._Phone != value))
			{
				this.OnPhoneChanging(value);
				this.SendPropertyChanging();
				this._Phone = value;
				this.SendPropertyChanged("Phone");
				this.OnPhoneChanged();
			}
		}
	}
	
	[Column(Storage="_Status", DbType="VarChar(10)")]
	public string Status
	{
		get
		{
			return this._Status;
		}
		set
		{
			if ((this._Status != value))
			{
				this.OnStatusChanging(value);
				this.SendPropertyChanging();
				this._Status = value;
				this.SendPropertyChanged("Status");
				this.OnStatusChanged();
			}
		}
	}
	
	[Association(Name="Order_OrderItem", Storage="_OrderItem", OtherKey="OrderId")]
	public EntitySet<OrderItem> OrderItem
	{
		get
		{
			return this._OrderItem;
		}
		set
		{
			this._OrderItem.Assign(value);
		}
	}
	
	[Association(Name="User_Order", Storage="_User", ThisKey="uid", IsForeignKey=true)]
	public User User
	{
		get
		{
			return this._User.Entity;
		}
		set
		{
			User previousValue = this._User.Entity;
			if (((previousValue != value) 
						|| (this._User.HasLoadedOrAssignedValue == false)))
			{
				this.SendPropertyChanging();
				if ((previousValue != null))
				{
					this._User.Entity = null;
					previousValue.Order.Remove(this);
				}
				this._User.Entity = value;
				if ((value != null))
				{
					value.Order.Add(this);
					this._uid = value.uid;
				}
				else
				{
					this._uid = default(string);
				}
				this.SendPropertyChanged("User");
			}
		}
	}
	
	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_OrderItem(OrderItem entity)
	{
		this.SendPropertyChanging();
		entity.Order = this;
	}
	
	private void detach_OrderItem(OrderItem entity)
	{
		this.SendPropertyChanging();
		entity.Order = null;
	}
}

[Table(Name="dbo.OrderItem")]
public partial class OrderItem : INotifyPropertyChanging, INotifyPropertyChanged
{
	
	private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
	
	private int _ItemId;
	
	private int _OrderId;
	
	private string _ProName;
	
	private System.Nullable<decimal> _ListPrice;
	
	private int _Qty;
	
	private System.Nullable<decimal> _TotalPrice;
	
	private int _productId;
	
	private EntityRef<Order> _Order;
	
	private EntityRef<Product> _Product;
	
    #region Extensibility Method Definitions
    partial void OnLoaded();
    partial void OnValidate(System.Data.Linq.ChangeAction action);
    partial void OnCreated();
    partial void OnItemIdChanging(int value);
    partial void OnItemIdChanged();
    partial void OnOrderIdChanging(int value);
    partial void OnOrderIdChanged();
    partial void OnProNameChanging(string value);
    partial void OnProNameChanged();
    partial void OnListPriceChanging(System.Nullable<decimal> value);
    partial void OnListPriceChanged();
    partial void OnQtyChanging(int value);
    partial void OnQtyChanged();
    partial void OnTotalPriceChanging(System.Nullable<decimal> value);
    partial void OnTotalPriceChanged();
    partial void OnproductIdChanging(int value);
    partial void OnproductIdChanged();
    #endregion
	
	public OrderItem()
	{
		this._Order = default(EntityRef<Order>);
		this._Product = default(EntityRef<Product>);
		OnCreated();
	}
	
	[Column(Storage="_ItemId", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
	public int ItemId
	{
		get
		{
			return this._ItemId;
		}
		set
		{
			if ((this._ItemId != value))
			{
				this.OnItemIdChanging(value);
				this.SendPropertyChanging();
				this._ItemId = value;
				this.SendPropertyChanged("ItemId");
				this.OnItemIdChanged();
			}
		}
	}
	
	[Column(Storage="_OrderId", DbType="Int NOT NULL")]
	public int OrderId
	{
		get
		{
			return this._OrderId;
		}
		set
		{
			if ((this._OrderId != value))
			{
				if (this._Order.HasLoadedOrAssignedValue)
				{
					throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
				}
				this.OnOrderIdChanging(value);
				this.SendPropertyChanging();
				this._OrderId = value;
				this.SendPropertyChanged("OrderId");
				this.OnOrderIdChanged();
			}
		}
	}
	
	[Column(Storage="_ProName", DbType="VarChar(80)")]
	public string ProName
	{
		get
		{
			return this._ProName;
		}
		set
		{
			if ((this._ProName != value))
			{
				this.OnProNameChanging(value);
				this.SendPropertyChanging();
				this._ProName = value;
				this.SendPropertyChanged("ProName");
				this.OnProNameChanged();
			}
		}
	}
	
	[Column(Storage="_ListPrice", DbType="Decimal(10,2)")]
	public System.Nullable<decimal> ListPrice
	{
		get
		{
			return this._ListPrice;
		}
		set
		{
			if ((this._ListPrice != value))
			{
				this.OnListPriceChanging(value);
				this.SendPropertyChanging();
				this._ListPrice = value;
				this.SendPropertyChanged("ListPrice");
				this.OnListPriceChanged();
			}
		}
	}
	
	[Column(Storage="_Qty", DbType="Int NOT NULL")]
	public int Qty
	{
		get
		{
			return this._Qty;
		}
		set
		{
			if ((this._Qty != value))
			{
				this.OnQtyChanging(value);
				this.SendPropertyChanging();
				this._Qty = value;
				this.SendPropertyChanged("Qty");
				this.OnQtyChanged();
			}
		}
	}
	
	[Column(Storage="_TotalPrice", DbType="Decimal(10,2)")]
	public System.Nullable<decimal> TotalPrice
	{
		get
		{
			return this._TotalPrice;
		}
		set
		{
			if ((this._TotalPrice != value))
			{
				this.OnTotalPriceChanging(value);
				this.SendPropertyChanging();
				this._TotalPrice = value;
				this.SendPropertyChanged("TotalPrice");
				this.OnTotalPriceChanged();
			}
		}
	}
	
	[Column(Storage="_productId", DbType="Int NOT NULL")]
	public int productId
	{
		get
		{
			return this._productId;
		}
		set
		{
			if ((this._productId != value))
			{
				if (this._Product.HasLoadedOrAssignedValue)
				{
					throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
				}
				this.OnproductIdChanging(value);
				this.SendPropertyChanging();
				this._productId = value;
				this.SendPropertyChanged("productId");
				this.OnproductIdChanged();
			}
		}
	}
	
	[Association(Name="Order_OrderItem", Storage="_Order", ThisKey="OrderId", IsForeignKey=true)]
	public Order Order
	{
		get
		{
			return this._Order.Entity;
		}
		set
		{
			Order previousValue = this._Order.Entity;
			if (((previousValue != value) 
						|| (this._Order.HasLoadedOrAssignedValue == false)))
			{
				this.SendPropertyChanging();
				if ((previousValue != null))
				{
					this._Order.Entity = null;
					previousValue.OrderItem.Remove(this);
				}
				this._Order.Entity = value;
				if ((value != null))
				{
					value.OrderItem.Add(this);
					this._OrderId = value.OrderId;
				}
				else
				{
					this._OrderId = default(int);
				}
				this.SendPropertyChanged("Order");
			}
		}
	}
	
	[Association(Name="Product_OrderItem", Storage="_Product", ThisKey="productId", IsForeignKey=true)]
	public Product Product
	{
		get
		{
			return this._Product.Entity;
		}
		set
		{
			Product previousValue = this._Product.Entity;
			if (((previousValue != value) 
						|| (this._Product.HasLoadedOrAssignedValue == false)))
			{
				this.SendPropertyChanging();
				if ((previousValue != null))
				{
					this._Product.Entity = null;
					previousValue.OrderItem.Remove(this);
				}
				this._Product.Entity = value;
				if ((value != null))
				{
					value.OrderItem.Add(this);
					this._productId = value.ProductId;
				}
				else
				{
					this._productId = default(int);
				}
				this.SendPropertyChanged("Product");
			}
		}
	}
	
	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.Product")]
public partial class Product : INotifyPropertyChanging, INotifyPropertyChanged
{
	
	private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
	
	private int _ProductId;
	
	private int _CategoryId;
	
	private System.Nullable<decimal> _ListPrice;
	
	private System.Nullable<int> _SuppId;
	
	private string _Name;
	
	private string _Descn;
	
	private string _Image;
	
	private int _Qty;
	
	private EntitySet<OrderItem> _OrderItem;
	
	private EntityRef<Category> _Category;
	
	private EntityRef<Supplier> _Supplier;
	
    #region Extensibility Method Definitions
    partial void OnLoaded();
    partial void OnValidate(System.Data.Linq.ChangeAction action);
    partial void OnCreated();
    partial void OnProductIdChanging(int value);
    partial void OnProductIdChanged();
    partial void OnCategoryIdChanging(int value);
    partial void OnCategoryIdChanged();
    partial void OnListPriceChanging(System.Nullable<decimal> value);
    partial void OnListPriceChanged();
    partial void OnSuppIdChanging(System.Nullable<int> value);
    partial void OnSuppIdChanged();
    partial void OnNameChanging(string value);
    partial void OnNameChanged();
    partial void OnDescnChanging(string value);
    partial void OnDescnChanged();
    partial void OnImageChanging(string value);
    partial void OnImageChanged();
    partial void OnQtyChanging(int value);
    partial void OnQtyChanged();
    #endregion
	
	public Product()
	{
		this._OrderItem = new EntitySet<OrderItem>(new Action<OrderItem>(this.attach_OrderItem), new Action<OrderItem>(this.detach_OrderItem));
		this._Category = default(EntityRef<Category>);
		this._Supplier = default(EntityRef<Supplier>);
		OnCreated();
	}
	
	[Column(Storage="_ProductId", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
	public int ProductId
	{
		get
		{
			return this._ProductId;
		}
		set
		{
			if ((this._ProductId != value))
			{
				this.OnProductIdChanging(value);
				this.SendPropertyChanging();
				this._ProductId = value;
				this.SendPropertyChanged("ProductId");
				this.OnProductIdChanged();
			}
		}
	}
	
	[Column(Storage="_CategoryId", DbType="Int NOT NULL")]
	public int CategoryId
	{
		get
		{
			return this._CategoryId;
		}
		set
		{
			if ((this._CategoryId != value))
			{
				if (this._Category.HasLoadedOrAssignedValue)
				{
					throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
				}
				this.OnCategoryIdChanging(value);
				this.SendPropertyChanging();
				this._CategoryId = value;
				this.SendPropertyChanged("CategoryId");
				this.OnCategoryIdChanged();
			}
		}
	}
	
	[Column(Storage="_ListPrice", DbType="Decimal(10,2)")]
	public System.Nullable<decimal> ListPrice
	{
		get
		{
			return this._ListPrice;
		}
		set
		{
			if ((this._ListPrice != value))
			{
				this.OnListPriceChanging(value);
				this.SendPropertyChanging();
				this._ListPrice = value;
				this.SendPropertyChanged("ListPrice");
				this.OnListPriceChanged();
			}
		}
	}
	
	[Column(Storage="_SuppId", DbType="Int")]
	public System.Nullable<int> SuppId
	{
		get
		{
			return this._SuppId;
		}
		set
		{
			if ((this._SuppId != value))
			{
				if (this._Supplier.HasLoadedOrAssignedValue)
				{
					throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
				}
				this.OnSuppIdChanging(value);
				this.SendPropertyChanging();
				this._SuppId = value;
				this.SendPropertyChanged("SuppId");
				this.OnSuppIdChanged();
			}
		}
	}
	
	[Column(Storage="_Name", DbType="VarChar(80)")]
	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="_Descn", DbType="VarChar(MAX)")]
	public string Descn
	{
		get
		{
			return this._Descn;
		}
		set
		{
			if ((this._Descn != value))
			{
				this.OnDescnChanging(value);
				this.SendPropertyChanging();
				this._Descn = value;
				this.SendPropertyChanged("Descn");
				this.OnDescnChanged();
			}
		}
	}
	
	[Column(Storage="_Image", DbType="VarChar(80)")]
	public string Image
	{
		get
		{
			return this._Image;
		}
		set
		{
			if ((this._Image != value))
			{
				this.OnImageChanging(value);
				this.SendPropertyChanging();
				this._Image = value;
				this.SendPropertyChanged("Image");
				this.OnImageChanged();
			}
		}
	}
	
	[Column(Storage="_Qty", DbType="Int NOT NULL")]
	public int Qty
	{
		get
		{
			return this._Qty;
		}
		set
		{
			if ((this._Qty != value))
			{
				this.OnQtyChanging(value);
				this.SendPropertyChanging();
				this._Qty = value;
				this.SendPropertyChanged("Qty");
				this.OnQtyChanged();
			}
		}
	}
	
	[Association(Name="Product_OrderItem", Storage="_OrderItem", OtherKey="productId")]
	public EntitySet<OrderItem> OrderItem
	{
		get
		{
			return this._OrderItem;
		}
		set
		{
			this._OrderItem.Assign(value);
		}
	}
	
	[Association(Name="Category_Product", Storage="_Category", ThisKey="CategoryId", IsForeignKey=true)]
	public Category Category
	{
		get
		{
			return this._Category.Entity;
		}
		set
		{
			Category previousValue = this._Category.Entity;
			if (((previousValue != value) 
						|| (this._Category.HasLoadedOrAssignedValue == false)))
			{
				this.SendPropertyChanging();
				if ((previousValue != null))
				{
					this._Category.Entity = null;
					previousValue.Product.Remove(this);
				}
				this._Category.Entity = value;
				if ((value != null))
				{
					value.Product.Add(this);
					this._CategoryId = value.CategoryId;
				}
				else
				{
					this._CategoryId = default(int);
				}
				this.SendPropertyChanged("Category");
			}
		}
	}
	
	[Association(Name="Supplier_Product", Storage="_Supplier", ThisKey="SuppId", IsForeignKey=true)]
	public Supplier Supplier
	{
		get
		{
			return this._Supplier.Entity;
		}
		set
		{
			Supplier previousValue = this._Supplier.Entity;
			if (((previousValue != value) 
						|| (this._Supplier.HasLoadedOrAssignedValue == false)))
			{
				this.SendPropertyChanging();
				if ((previousValue != null))
				{
					this._Supplier.Entity = null;
					previousValue.Product.Remove(this);
				}
				this._Supplier.Entity = value;
				if ((value != null))
				{
					value.Product.Add(this);
					this._SuppId = value.SuppId;
				}
				else
				{
					this._SuppId = default(Nullable<int>);
				}
				this.SendPropertyChanged("Supplier");
			}
		}
	}
	
	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_OrderItem(OrderItem entity)
	{
		this.SendPropertyChanging();
		entity.Product = this;
	}
	
	private void detach_OrderItem(OrderItem entity)
	{
		this.SendPropertyChanging();
		entity.Product = null;
	}
}

[Table(Name="dbo.Supplier")]
public partial class Supplier : INotifyPropertyChanging, INotifyPropertyChanged
{
	
	private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
	
	private int _SuppId;
	
	private string _Name;
	
	private string _Addr1;
	
	private string _Zip;
	
	private string _Phone;
	
	private string _city;
	
	private string _state;
	
	private EntitySet<Product> _Product;
	
    #region Extensibility Method Definitions
    partial void OnLoaded();
    partial void OnValidate(System.Data.Linq.ChangeAction action);
    partial void OnCreated();
    partial void OnSuppIdChanging(int value);
    partial void OnSuppIdChanged();
    partial void OnNameChanging(string value);
    partial void OnNameChanged();
    partial void OnAddr1Changing(string value);
    partial void OnAddr1Changed();
    partial void OnZipChanging(string value);
    partial void OnZipChanged();
    partial void OnPhoneChanging(string value);
    partial void OnPhoneChanged();
    partial void OncityChanging(string value);
    partial void OncityChanged();
    partial void OnstateChanging(string value);
    partial void OnstateChanged();
    #endregion
	
	public Supplier()
	{
		this._Product = new EntitySet<Product>(new Action<Product>(this.attach_Product), new Action<Product>(this.detach_Product));
		OnCreated();
	}
	
	[Column(Storage="_SuppId", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
	public int SuppId
	{
		get
		{
			return this._SuppId;
		}
		set
		{
			if ((this._SuppId != value))
			{
				this.OnSuppIdChanging(value);
				this.SendPropertyChanging();
				this._SuppId = value;
				this.SendPropertyChanged("SuppId");
				this.OnSuppIdChanged();
			}
		}
	}
	
	[Column(Storage="_Name", DbType="VarChar(80)")]
	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="_Addr1", DbType="VarChar(80)")]
	public string Addr1
	{
		get
		{
			return this._Addr1;
		}
		set
		{
			if ((this._Addr1 != value))
			{
				this.OnAddr1Changing(value);
				this.SendPropertyChanging();
				this._Addr1 = value;
				this.SendPropertyChanged("Addr1");
				this.OnAddr1Changed();
			}
		}
	}
	
	[Column(Storage="_Zip", DbType="VarChar(6)")]
	public string Zip
	{
		get
		{
			return this._Zip;
		}
		set
		{
			if ((this._Zip != value))
			{
				this.OnZipChanging(value);
				this.SendPropertyChanging();
				this._Zip = value;
				this.SendPropertyChanged("Zip");
				this.OnZipChanged();
			}
		}
	}
	
	[Column(Storage="_Phone", DbType="VarChar(40)")]
	public string Phone
	{
		get
		{
			return this._Phone;
		}
		set
		{
			if ((this._Phone != value))
			{
				this.OnPhoneChanging(value);
				this.SendPropertyChanging();
				this._Phone = value;
				this.SendPropertyChanged("Phone");
				this.OnPhoneChanged();
			}
		}
	}
	
	[Column(Storage="_city", DbType="VarChar(50)")]
	public string city
	{
		get
		{
			return this._city;
		}
		set
		{
			if ((this._city != value))
			{
				this.OncityChanging(value);
				this.SendPropertyChanging();
				this._city = value;
				this.SendPropertyChanged("city");
				this.OncityChanged();
			}
		}
	}
	
	[Column(Storage="_state", DbType="VarChar(50)")]
	public string state
	{
		get
		{
			return this._state;
		}
		set
		{
			if ((this._state != value))
			{
				this.OnstateChanging(value);
				this.SendPropertyChanging();
				this._state = value;
				this.SendPropertyChanged("state");
				this.OnstateChanged();
			}
		}
	}
	
	[Association(Name="Supplier_Product", Storage="_Product", OtherKey="SuppId")]
	public EntitySet<Product> Product
	{
		get
		{
			return this._Product;
		}
		set
		{
			this._Product.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_Product(Product entity)
	{
		this.SendPropertyChanging();
		entity.Supplier = this;
	}
	
	private void detach_Product(Product entity)
	{
		this.SendPropertyChanging();
		entity.Supplier = null;
	}
}

[Table(Name="dbo.[User]")]
public partial class User : INotifyPropertyChanging, INotifyPropertyChanged
{
	
	private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
	
	private string _uid;
	
	private string _pwd;
	
	private string _role;
	
	private EntitySet<Order> _Order;
	
	private EntityRef<UserInfo> _UserInfo;
	
    #region Extensibility Method Definitions
    partial void OnLoaded();
    partial void OnValidate(System.Data.Linq.ChangeAction action);
    partial void OnCreated();
    partial void OnuidChanging(string value);
    partial void OnuidChanged();
    partial void OnpwdChanging(string value);
    partial void OnpwdChanged();
    partial void OnroleChanging(string value);
    partial void OnroleChanged();
    #endregion
	
	public User()
	{
		this._Order = new EntitySet<Order>(new Action<Order>(this.attach_Order), new Action<Order>(this.detach_Order));
		this._UserInfo = default(EntityRef<UserInfo>);
		OnCreated();
	}
	
	[Column(Storage="_uid", DbType="VarChar(20) NOT NULL", CanBeNull=false, IsPrimaryKey=true)]
	public string uid
	{
		get
		{
			return this._uid;
		}
		set
		{
			if ((this._uid != value))
			{
				this.OnuidChanging(value);
				this.SendPropertyChanging();
				this._uid = value;
				this.SendPropertyChanged("uid");
				this.OnuidChanged();
			}
		}
	}
	
	[Column(Storage="_pwd", DbType="VarChar(20) NOT NULL", CanBeNull=false)]
	public string pwd
	{
		get
		{
			return this._pwd;
		}
		set
		{
			if ((this._pwd != value))
			{
				this.OnpwdChanging(value);
				this.SendPropertyChanging();
				this._pwd = value;
				this.SendPropertyChanged("pwd");
				this.OnpwdChanged();
			}
		}
	}
	
	[Column(Storage="_role", DbType="Char(10) NOT NULL", CanBeNull=false)]
	public string role
	{
		get
		{
			return this._role;
		}
		set
		{
			if ((this._role != value))
			{
				this.OnroleChanging(value);
				this.SendPropertyChanging();
				this._role = value;
				this.SendPropertyChanged("role");
				this.OnroleChanged();
			}
		}
	}
	
	[Association(Name="User_Order", Storage="_Order", OtherKey="uid")]
	public EntitySet<Order> Order
	{
		get
		{
			return this._Order;
		}
		set
		{
			this._Order.Assign(value);
		}
	}
	
	[Association(Name="User_UserInfo", Storage="_UserInfo", ThisKey="uid", IsUnique=true, IsForeignKey=false)]
	public UserInfo UserInfo
	{
		get
		{
			return this._UserInfo.Entity;
		}
		set
		{
			UserInfo previousValue = this._UserInfo.Entity;
			if (((previousValue != value) 
						|| (this._UserInfo.HasLoadedOrAssignedValue == false)))
			{
				this.SendPropertyChanging();
				if ((previousValue != null))
				{
					this._UserInfo.Entity = null;
					previousValue.User = null;
				}
				this._UserInfo.Entity = value;
				if ((value != null))
				{
					value.User = this;
				}
				this.SendPropertyChanged("UserInfo");
			}
		}
	}
	
	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_Order(Order entity)
	{
		this.SendPropertyChanging();
		entity.User = this;
	}
	
	private void detach_Order(Order entity)
	{
		this.SendPropertyChanging();
		entity.User = null;
	}
}

[Table(Name="dbo.UserInfo")]
public partial class UserInfo : INotifyPropertyChanging, INotifyPropertyChanged
{
	
	private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
	
	private string _uid;
	
	private string _uname;
	
	private string _sex;
	
	private string _email;
	
	private string _addr1;
	
	private string _code;
	
	private string _phone;
	
	private string _xueli;
	
	private string _userImage;
	
	private EntityRef<User> _User;
	
    #region Extensibility Method Definitions
    partial void OnLoaded();
    partial void OnValidate(System.Data.Linq.ChangeAction action);
    partial void OnCreated();
    partial void OnuidChanging(string value);
    partial void OnuidChanged();
    partial void OnunameChanging(string value);
    partial void OnunameChanged();
    partial void OnsexChanging(string value);
    partial void OnsexChanged();
    partial void OnemailChanging(string value);
    partial void OnemailChanged();
    partial void Onaddr1Changing(string value);
    partial void Onaddr1Changed();
    partial void OncodeChanging(string value);
    partial void OncodeChanged();
    partial void OnphoneChanging(string value);
    partial void OnphoneChanged();
    partial void OnxueliChanging(string value);
    partial void OnxueliChanged();
    partial void OnuserImageChanging(string value);
    partial void OnuserImageChanged();
    #endregion
	
	public UserInfo()
	{
		this._User = default(EntityRef<User>);
		OnCreated();
	}
	
	[Column(Storage="_uid", DbType="VarChar(20) NOT NULL", CanBeNull=false, IsPrimaryKey=true)]
	public string uid
	{
		get
		{
			return this._uid;
		}
		set
		{
			if ((this._uid != value))
			{
				if (this._User.HasLoadedOrAssignedValue)
				{
					throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
				}
				this.OnuidChanging(value);
				this.SendPropertyChanging();
				this._uid = value;
				this.SendPropertyChanged("uid");
				this.OnuidChanged();
			}
		}
	}
	
	[Column(Storage="_uname", DbType="VarChar(20)")]
	public string uname
	{
		get
		{
			return this._uname;
		}
		set
		{
			if ((this._uname != value))
			{
				this.OnunameChanging(value);
				this.SendPropertyChanging();
				this._uname = value;
				this.SendPropertyChanged("uname");
				this.OnunameChanged();
			}
		}
	}
	
	[Column(Storage="_sex", DbType="NChar(2) NOT NULL", CanBeNull=false)]
	public string sex
	{
		get
		{
			return this._sex;
		}
		set
		{
			if ((this._sex != value))
			{
				this.OnsexChanging(value);
				this.SendPropertyChanging();
				this._sex = value;
				this.SendPropertyChanged("sex");
				this.OnsexChanged();
			}
		}
	}
	
	[Column(Storage="_email", DbType="VarChar(50) NOT NULL", CanBeNull=false)]
	public string email
	{
		get
		{
			return this._email;
		}
		set
		{
			if ((this._email != value))
			{
				this.OnemailChanging(value);
				this.SendPropertyChanging();
				this._email = value;
				this.SendPropertyChanged("email");
				this.OnemailChanged();
			}
		}
	}
	
	[Column(Storage="_addr1", DbType="VarChar(50)")]
	public string addr1
	{
		get
		{
			return this._addr1;
		}
		set
		{
			if ((this._addr1 != value))
			{
				this.Onaddr1Changing(value);
				this.SendPropertyChanging();
				this._addr1 = value;
				this.SendPropertyChanged("addr1");
				this.Onaddr1Changed();
			}
		}
	}
	
	[Column(Storage="_code", DbType="NChar(6)")]
	public string 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="_phone", DbType="NVarChar(50)")]
	public string phone
	{
		get
		{
			return this._phone;
		}
		set
		{
			if ((this._phone != value))
			{
				this.OnphoneChanging(value);
				this.SendPropertyChanging();
				this._phone = value;
				this.SendPropertyChanged("phone");
				this.OnphoneChanged();
			}
		}
	}
	
	[Column(Storage="_xueli", DbType="VarChar(50) NOT NULL", CanBeNull=false)]
	public string xueli
	{
		get
		{
			return this._xueli;
		}
		set
		{
			if ((this._xueli != value))
			{
				this.OnxueliChanging(value);
				this.SendPropertyChanging();
				this._xueli = value;
				this.SendPropertyChanged("xueli");
				this.OnxueliChanged();
			}
		}
	}
	
	[Column(Storage="_userImage", DbType="NVarChar(MAX)")]
	public string userImage
	{
		get
		{
			return this._userImage;
		}
		set
		{
			if ((this._userImage != value))
			{
				this.OnuserImageChanging(value);
				this.SendPropertyChanging();
				this._userImage = value;
				this.SendPropertyChanged("userImage");
				this.OnuserImageChanged();
			}
		}
	}
	
	[Association(Name="User_UserInfo", Storage="_User", ThisKey="uid", IsForeignKey=true)]
	public User User
	{
		get
		{
			return this._User.Entity;
		}
		set
		{
			User previousValue = this._User.Entity;
			if (((previousValue != value) 
						|| (this._User.HasLoadedOrAssignedValue == false)))
			{
				this.SendPropertyChanging();
				if ((previousValue != null))
				{
					this._User.Entity = null;
					previousValue.UserInfo = null;
				}
				this._User.Entity = value;
				if ((value != null))
				{
					value.UserInfo = this;
					this._uid = value.uid;
				}
				else
				{
					this._uid = default(string);
				}
				this.SendPropertyChanged("User");
			}
		}
	}
	
	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
