public DataTable QuerySwitch(QueryType QT, ArrayList ParameterList) { CGD.VDS_CGD_PICK_SPEC_STORE_DBO CGDM = new VDS_CGD_PICK_SPEC_STORE_DBO(ref USEDB); DataTable Dt; try { switch (QT) { case QueryType.Empty: Dt = CGDM.doQueryEmpty(); break; case QueryType.QueryStoreData: Dt = CGDM.QueryStoreData(ParameterList); break; case QueryType.ChanNoName: Dt = CGDM.getChanNoName(ParameterList); break; case QueryType.StoreName: Dt = CGDM.getStoreName(ParameterList); break; case QueryType.StoreDate: Dt = CGDM.getStoreDate(ParameterList); break; case QueryType.Label: Dt = CGDM.getSpecStoreLabel(ParameterList); break; default: Dt = new DataTable(); break; } return Dt; } catch (Exception ex) { throw ex; } }
/// <summary> /// 查詢所有該PICK_BATCH的資料 /// </summary> public string DeletePICK_SPEC_STORE(ArrayList ParameterList, DbTransaction RootDBT) { bool IsRootTranscation = false; string MSG = ""; try { CGD.VDS_CGD_PICK_SPEC_STORE_DBO CGDM = new VDS_CGD_PICK_SPEC_STORE_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 } }