예제 #1
0
        protected void NewOrder_Click(object sender, EventArgs e)
        {
            NorthwindDataContext db = new NorthwindDataContext();

            Product chai = db.Products.Single(p => p.ProductName == "Chai");
            Product tofu = db.Products.Single(p => p.ProductName == "Tofu");

            Order o = new Order();
            o.OrderDate = DateTime.Now;
            o.RequiredDate = DateTime.Now.AddDays(-2);
            o.Freight = 4.30m;

            Order_Detail li1 = new Order_Detail() { Product = chai, Quantity = 23 };
            Order_Detail li2 = new Order_Detail() { Product = tofu, Quantity = 33 };

            o.Order_Details.Add(li1);
            o.Order_Details.Add(li2);

            Customer c = db.Customers.Single(asdf => asdf.CompanyName.StartsWith("Alfred"));
            c.Orders.Add(o);

            db.SubmitChanges();
        }
예제 #2
0
		private void detach_Orders(Order entity)
		{
			this.SendPropertyChanging();
			entity.Customer = null;
		}
예제 #3
0
		private void attach_Orders(Order entity)
		{
			this.SendPropertyChanging();
			entity.Customer = this;
		}
예제 #4
0
 partial void DeleteOrder(Order instance);
예제 #5
0
 partial void UpdateOrder(Order instance);
예제 #6
0
 partial void InsertOrder(Order instance);