private void GetAndAddOrderrowsToOrderhead(OrderHead orderhead) { var sessionOrderrow = CartManger.Items; foreach (var cartItem in sessionOrderrow) { var orderrow = new OrderRow(); orderrow.OrderHeadID = orderhead.OrderHeadID; orderrow.ProductID = cartItem.ProductID; orderrow.Quantity = cartItem.Quantity; orderrow.ProductName = cartItem.ProductName; orderrow.ProductNumber = (db.Products .Where(p => p.ProductID == cartItem.ProductID) .Select(p => p.ProductNumber)).FirstOrDefault(); orderrow.ProductPrice = cartItem.ProductPrice; db.OrderRows.InsertOnSubmit(orderrow); db.SubmitChanges(); } }
partial void DeleteOrderRow(OrderRow instance);
partial void UpdateOrderRow(OrderRow instance);
partial void InsertOrderRow(OrderRow instance);
private void detach_OrderRows(OrderRow entity) { this.SendPropertyChanging(); entity.OrderHead = null; }
private void attach_OrderRows(OrderRow entity) { this.SendPropertyChanging(); entity.OrderHead = this; }