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(); }
private void detach_Orders(Order entity) { this.SendPropertyChanging(); entity.Customer = null; }
private void attach_Orders(Order entity) { this.SendPropertyChanging(); entity.Customer = this; }
partial void DeleteOrder(Order instance);
partial void UpdateOrder(Order instance);
partial void InsertOrder(Order instance);