public async Task CreatePRHeaderAsync(PRHeaderModel header) { using (var db = HibernateSession.GetCurrentSession()) { using (var tx = db.BeginTransaction()) { db.Save(header); var pra = new PRAccessor(); header.RequisitionNo = pra.GetRequisitionNo(header.Requestor, header.Id); db.Update(header); tx.Commit(); db.Flush(); } } }
public async Task SaveOrUpdatePOHeaderAsync(POHeaderModel header) { using (var db = HibernateSession.GetCurrentSession()) { using (var tx = db.BeginTransaction()) { db.SaveOrUpdate(header); var poa = new PRAccessor(); if (header.RequisitionNo == null) { header.RequisitionNo = poa.GetRequisitionNo(header.Requestor, header.Id); db.Update(header); } tx.Commit(); db.Flush(); } } }