public DataTable QueryCopyErrorCount(ArrayList ParameterList) { #region try { VDS_ALO_DISCOPY_MAIN_DBO ALOM = new VDS_ALO_DISCOPY_MAIN_DBO(ref USEDB); DataTable dt = ALOM.doQueryCopyErrorCount(ParameterList); return dt; } catch (Exception ex) { throw GetNewException(ex); } #endregion }
/// <summary> /// 基本表單更新BCO /// </summary> /// <param name="ParameterList">輸入變數</param> /// <param name="RootDBT">是否有主交易,無主交易輸入null</param> /// <returns>回傳更新成功與否</returns> public bool UpdateMasterAndDetail(ArrayList ParameterList, DataTable DetailData, string strUIDForLog, DataTable dtForDetailDeleted, DbTransaction RootDBT) { #region bool IsRootTranscation = false; bool bResult = false; try { VDS_ALO_DISCOPY_MAIN_DBO ALOM = new VDS_ALO_DISCOPY_MAIN_DBO(ref USEDB); //判斷是否有傳入Root Transcation IsRootTranscation = (RootDBT == null) ? true : false; #region 啟動交易或指定RootTranscation if (IsRootTranscation) { //獨立呼叫啟動Transcation Conn = USEDB.CreateConnection(); Conn.Open(); DBT = Conn.BeginTransaction(); } else { DBT = RootDBT; } #endregion bResult = UpdateMaster(ParameterList, DBT); if (bResult) { if (DetailData != null || dtForDetailDeleted != null) bResult = UpdateDetail(DetailData, strUIDForLog, dtForDetailDeleted, DBT); #region 交易成功 if (IsRootTranscation) { //獨立呼叫Transcation成立 DBT.Commit(); } #endregion } else { throw new Exception("新增0筆資料!"); } return bResult; } catch (Exception ex) { #region 交易失敗 if (IsRootTranscation) { //獨立呼叫Transcation失敗 DBT.Rollback(); } #endregion throw GetNewException(ex); } finally { #region 判斷是否關閉交易連線 if (IsRootTranscation) { //獨立呼叫Transcation,關閉連線 if (Conn.State == ConnectionState.Connecting) { Conn.Close(); } } #endregion } #endregion }
public bool CheckDisCopyCanAdd(ArrayList ParameterList, ref string strErrMsg) { #region bool bResult = false; try { VDS_ALO_DISCOPY_MAIN_DBO DBO = new VDS_ALO_DISCOPY_MAIN_DBO(ref USEDB); DataTable dtTemp = DBO.doCheckDisCopyCanAdd(ParameterList); if (dtTemp != null && dtTemp.Rows.Count > 0) { strErrMsg = dtTemp.Rows[0][1].ToString().Trim(); if (strErrMsg.Trim().Length > 0) { if (strErrMsg.Substring(strErrMsg.Length - 1, 1) == ",") { strErrMsg = strErrMsg.Substring(0, strErrMsg.Length - 1); } } if (strErrMsg.Trim() != "") { bResult = false; } else { bResult = true; } } } catch (Exception ex) { throw GetNewException(ex); } return bResult; #endregion }
/// <summary> /// 基本表單新增BCO /// </summary> /// <param name="ParameterList">輸入變數</param> /// <param name="RootDBT">是否有主交易,無主交易輸入null</param> /// <returns>回傳新增之ID</returns> public int CreateMasterAndDetail(ArrayList ParameterList, DataTable DetailData, DbTransaction RootDBT) { #region bool IsRootTranscation = false; Int32 PID = 0; try { VDS_ALO_DISCOPY_MAIN_DBO ALOM = new VDS_ALO_DISCOPY_MAIN_DBO(ref USEDB); //判斷是否有傳入Root Transcation IsRootTranscation = (RootDBT == null) ? true : false; #region 啟動交易或指定RootTranscation if (IsRootTranscation) { //獨立呼叫啟動Transcation Conn = USEDB.CreateConnection(); Conn.Open(); DBT = Conn.BeginTransaction(); } else { DBT = RootDBT; } #endregion PID = CreateMaster(ParameterList, DBT); if (PID != 0) { if (DetailData != null) CreateDetail(PID, DetailData, DBT); #region 交易成功 if (IsRootTranscation) { //獨立呼叫Transcation成立 DBT.Commit(); } #endregion } else { throw new Exception("新增0筆資料!"); } return PID; } catch (Exception ex) { #region 交易失敗 if (IsRootTranscation) { //獨立呼叫Transcation失敗 DBT.Rollback(); } #endregion throw GetNewException(ex); } finally { #region 判斷是否關閉交易連線 if (IsRootTranscation) { //獨立呼叫Transcation,關閉連線 if (Conn.State == ConnectionState.Connecting) { Conn.Close(); } } #endregion } #endregion }
public bool DeleteMasterAndLog(ArrayList ParameterList, DbTransaction RootDBT) { bool IsRootTranscation = false; bool bResult = false; try { VDS_ALO_DISCOPY_MAIN_DBO DBO = new VDS_ALO_DISCOPY_MAIN_DBO(ref USEDB); //判斷是否有傳入Root Transcation IsRootTranscation = (RootDBT == null) ? true : false; #region 啟動交易或指定RootTranscation if (IsRootTranscation) { //獨立呼叫啟動Transcation Conn = USEDB.CreateConnection(); Conn.Open(); DBT = Conn.BeginTransaction(); } else { DBT = RootDBT; } #endregion DBO.doDelAndLogbyPID(ParameterList, DBT); #region 交易成功 if (IsRootTranscation) { //獨立呼叫Transcation成立 DBT.Commit(); } #endregion bResult = true; return bResult; } catch (Exception ex) { #region 交易失敗 if (IsRootTranscation) { //獨立呼叫Transcation失敗 DBT.Rollback(); } #endregion throw GetNewException(ex); } finally { #region 判斷是否關閉交易連線 if (IsRootTranscation) { //獨立呼叫Transcation,關閉連線 if (Conn.State == ConnectionState.Connecting) { Conn.Close(); } } #endregion } }
public bool ProcessCopyDisRecord(ArrayList ParameterList, ref string strResult, ref string strNewDisNo, ref string strErrMsg, ref Int32 iErrCount, DbTransaction RootDBT) { #region bool bResult = false; bool IsRootTranscation = false; try { VDS_ALO_DISCOPY_MAIN_DBO ALOM = new VDS_ALO_DISCOPY_MAIN_DBO(ref USEDB); //判斷是否有傳入Root Transcation IsRootTranscation = (RootDBT == null) ? true : false; #region 啟動交易或指定RootTranscation if (IsRootTranscation) { //獨立呼叫啟動Transcation Conn = USEDB.CreateConnection(); Conn.Open(); DBT = Conn.BeginTransaction(); } else { DBT = RootDBT; } #endregion bResult = ALOM.doProcessCopyDisRecord(ParameterList, ref strResult, ref strNewDisNo, ref strErrMsg, ref iErrCount, DBT); #region 交易成功 if (IsRootTranscation) { //獨立呼叫Transcation成立 DBT.Commit(); } #endregion return bResult; } catch (Exception ex) { #region 交易失敗 if (IsRootTranscation) { //獨立呼叫Transcation失敗 DBT.Rollback(); } #endregion throw GetNewException(ex); } finally { #region 判斷是否關閉交易連線 if (IsRootTranscation) { //獨立呼叫Transcation,關閉連線 if (Conn.State == ConnectionState.Connecting) { Conn.Close(); } } #endregion } #endregion }