public int GetOperID() { int iRet = 0; using (SqlConnection conn = ConnectionPool.BorrowConnection()) { //conn.Open(); SqlTransaction trans = conn.BeginTransaction(); try { iRet = OperIDAccess.GetOperID(trans); trans.Commit(); } catch (SqlException sex) { trans.Rollback(); throw sex; } catch (Exception ex) { trans.Rollback(); throw ex; } finally { ConnectionPool.ReturnConnection(conn); } } return(iRet); }
public int AddOper(Oper oper, BusiLog busiLog) { int iRet = 0; using (SqlConnection conn = ConnectionPool.BorrowConnection()) { //conn.Open(); SqlTransaction trans = conn.BeginTransaction(); try { iRet = OperIDAccess.GetOperID(trans); oper.cnnOperID = iRet; oper.cnvcPwd = DataSecurity.Encrypt(oper.cnvcPwd); OperAccess.AddOper(trans, oper); BusiLogAccess.AddBusiLog(trans, busiLog); trans.Commit(); } catch (SqlException sex) { trans.Rollback(); throw sex; } catch (Exception ex) { trans.Rollback(); throw ex; } finally { ConnectionPool.ReturnConnection(conn); } } return(iRet); }