public DataTable QuerySwitch(QueryType QT, ArrayList ParameterList) { CGD.VDS_CGD_PICK_WORKSTATION_DBO CGDM = new VDS_CGD_PICK_WORKSTATION_DBO(ref USEDB); DataTable Dt; try { switch (QT) { case QueryType.ALL: Dt = CGDM.doQueryAll(); break; case QueryType.CODE: Dt = CGDM.doQueryByCode(ParameterList); break; case QueryType.ID: Dt = CGDM.doQueryByID(ParameterList); break; case QueryType.Custom: Dt = CGDM.doQueryByFind(ParameterList); break; case QueryType.Empty: Dt = CGDM.doQueryEmpty(); break; default: Dt = new DataTable(); break; } return Dt; } catch (Exception ex) { throw ex; } }
/// <summary> /// 查詢所有該DPS_CODE的資料 /// </summary> public string DeletePick_Workstation(ArrayList ParameterList, DbTransaction RootDBT) { bool IsRootTranscation = false; string MSG = ""; try { CGD.VDS_CGD_PICK_WORKSTATION_DBO CGDM = new VDS_CGD_PICK_WORKSTATION_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 MSG = CGDM.doDelete(ParameterList, DBT); #region 交易成功 if (IsRootTranscation) { //獨立呼叫Transcation成立 DBT.Commit(); } #endregion return MSG; } catch (Exception ex) { #region 交易失敗 if (IsRootTranscation) { //獨立呼叫Transcation失敗 DBT.Rollback(); } #endregion throw ex; } finally { #region 判斷是否關閉交易連線 if (IsRootTranscation) { //獨立呼叫Transcation,關閉連線 if (Conn.State == ConnectionState.Connecting) { Conn.Close(); } } #endregion } }