public void Update(OutStoreBillHd hd) { using (DCC dcc = DBMLFty.Dcc) { DALFty.Create <OutStoreBillDAL>().Update(dcc, hd); dcc.Save(); } }
public void Insert(OutStoreBillHd hd, List <OutStoreBillDtl> dtl) { using (DCC dcc = DBMLFty.Dcc) { DALFty.Create <OutStoreBillDAL>().Insert(dcc, hd, dtl); dcc.Save(); } }
public void Insert(DCC dcc, OutStoreBillHd hd, List <OutStoreBillDtl> dtl) { using (TransactionScope ts = new TransactionScope()) { dcc.OutStoreBillHd.InsertOnSubmit(hd); dcc.OutStoreBillDtl.InsertAllOnSubmit(dtl); dcc.SubmitChanges(); ts.Complete(); } }
public void Update(DCC dcc, OutStoreBillHd hd, List <OutStoreBillDtl> dtl) { using (TransactionScope ts = new TransactionScope()) { dcc.OutStoreBillHd.Attach(hd); dcc.Refresh(System.Data.Linq.RefreshMode.KeepCurrentValues, hd); //更新明细可能有新增记录,所有先将原有记录删除再全部添加 var lstHd = dcc.OutStoreBillDtl.Where(o => o.HdID == hd.ID); dcc.OutStoreBillDtl.DeleteAllOnSubmit(lstHd); foreach (OutStoreBillDtl item in dtl) { item.ID = Guid.NewGuid(); item.HdID = hd.ID; } dcc.OutStoreBillDtl.InsertAllOnSubmit(dtl); dcc.SubmitChanges(); ts.Complete(); } }
public void Update(DCC dcc, OutStoreBillHd hd) { dcc.OutStoreBillHd.Attach(hd); dcc.Refresh(System.Data.Linq.RefreshMode.KeepCurrentValues, hd); }