public void UpdateStockTaking(NZString UserCD, NZString MachineCD) { CommonLib.Common.CurrentDatabase.KeepConnection = true; CommonLib.Common.CurrentDatabase.BeginTransaction(); try { StockTakingDAO dao = new StockTakingDAO(CommonLib.Common.CurrentDatabase); dao.UpdateStockTaking(UserCD, MachineCD); dao.DeleteStockTakingTemp(UserCD, MachineCD); CommonLib.Common.CurrentDatabase.Commit(); } catch (Exception ex) { CommonLib.Common.CurrentDatabase.Rollback(); throw ex; } finally { CommonLib.Common.CurrentDatabase.KeepConnection = false; } }
public void InsertStockTakingTemp(List<ImportStockTakingDTO> listData) { CommonLib.Common.CurrentDatabase.KeepConnection = true; CommonLib.Common.CurrentDatabase.BeginTransaction(); try { StockTakingDAO dao = new StockTakingDAO(CommonLib.Common.CurrentDatabase); dao.DeleteStockTakingTemp(Common.CurrentUserInfomation.UserCD, Common.CurrentUserInfomation.Machine); foreach (ImportStockTakingDTO dto in listData) { dao.InsertStockTakingTemp(dto); } CommonLib.Common.CurrentDatabase.Commit(); } catch (Exception ex) { CommonLib.Common.CurrentDatabase.Rollback(); throw ex; } finally { CommonLib.Common.CurrentDatabase.KeepConnection = false; } }