public void addAdjV(List <AdjustmentVoucherItemcart> list) { AdjustmentVoucher adjvoucher = new AdjustmentVoucher(); adjvoucher.storeStaffID = (string)System.Web.HttpContext.Current.Session["loginID"]; adjvoucher.adjDate = DateTime.Now; adjvoucher.status = "pending"; adjvoucher.authorisedBy = ""; context.AdjustmentVouchers.Add(adjvoucher); int adjvID = adjvoucher.adjVID; /*************Then Add ADJVItems******************/ AdjustmentVoucherItemDAO adjvidao = new AdjustmentVoucherItemDAO(); foreach (AdjustmentVoucherItemcart cartitem in list) { AdjustmentVoucherItem adjvi = new AdjustmentVoucherItem(); adjvi.adjVID = adjvoucher.adjVID; adjvi.itemID = cartitem.ItemID; adjvi.quantity = cartitem.Qty; adjvi.record = cartitem.Record; context.AdjustmentVoucherItems.Add(adjvi); } context.SaveChanges(); }
public AdjustmentVoucherItem addAdjustmentVoucherItem(int adjVID, string itemID, int qty, string record) { AdjustmentVoucherItem adjvoucheritem = new AdjustmentVoucherItem(); adjvoucheritem.quantity = qty; adjvoucheritem.itemID = itemID; adjvoucheritem.adjVID = adjVID; adjvoucheritem.record = record; return(adjvoucheritem); }