/** end by wu * */ public static int generatePO(string sCode) { UniversityStoreEntities context = new UniversityStoreEntities(); PurchaseOrder po = new PurchaseOrder(); po.SupplierCode = sCode; po.Status = "Pending"; po.DateCreated = DateTime.Now; context.AddToPurchaseOrders(po); context.SaveChanges(); return(po.PONumber); }
public static void CreatePurchaseOrder(PurchaseOrder purchaseorder, List <PurchaseOrderDetail> purchaselist) { UniversityStoreEntities context = new UniversityStoreEntities(); EntityCollection <PurchaseOrderDetail> purchaseorderdetailcoll = new EntityCollection <PurchaseOrderDetail>(); foreach (PurchaseOrderDetail p in purchaselist) { purchaseorderdetailcoll.Add(p); } purchaseorder.PurchaseOrderDetails = purchaseorderdetailcoll; context.AddToPurchaseOrders(purchaseorder); context.SaveChanges(); }