public string GenRequestBill(string billNo, string userID, string sysDate) { string newNo = null; using (PersistentManager pm = new PersistentManager()) { BillDao billDao = new BillDao(); DataTable masterTable = billDao.FindMaster(billNo); DataTable detailTable = billDao.FindDetail(billNo); try { pm.BeginTransaction(); if (masterTable.Rows.Count != 0) { DataRow masterRow = masterTable.Rows[0]; newNo = billDao.FindNewBillNo("C", sysDate); billDao.InsertMaster(newNo, sysDate, "002", masterRow["SCHEDULENO"].ToString(), billNo, "", "", "1", "1", userID); billDao.InsertAlchoholizeDetail(newNo, detailTable); //billDao.UpdateOutBillNo(billNo, newNo); } pm.Commit(); } catch (Exception e) { pm.Rollback(); throw new Exception(e.Message); } } return newNo; }