/// <summary> /// ITM042 條碼重複檢查 /// </summary> /// <param name="ParameterList"></param> /// <returns></returns> public DataTable QueryBARCODE(ArrayList ParameterList) { try { ITM04_DBO ITM04 = new ITM04_DBO(ref USEDB); return ITM04.doQueryBARCODE(ParameterList); } catch (Exception ex) { throw ex; } }
/// <summary> /// ITM041 按下Button[匯出]鈕 /// </summary> /// <param name="ParameterList"></param> /// <returns></returns> public DataTable QUERY_ITM041_EXCEL(ArrayList ParameterList) { try { ITM04_DBO ITM04 = new ITM04_DBO(ref USEDB); return ITM04.QUERY_ITM041_EXCEL(ParameterList); } catch (Exception ex) { throw ex; } }
/// <summary> /// 查詢[SYS_ENUMBASE]代碼 /// </summary> /// <param name="ParameterList"></param> /// <returns></returns> public DataTable QUERY_SYS_ENUMBASE_CODE(ArrayList ParameterList) { try { ITM04_DBO ITM04 = new ITM04_DBO(ref USEDB); return ITM04.QUERY_SYS_ENUMBASE_CODE(ParameterList); } catch (Exception ex) { throw ex; } }
/// <summary> /// ITM041, 按下BUTTON[確定匯入],將TempTable的資料寫入正式Table /// </summary> /// <param name="RootDBT"></param> /// <param name="ParameterList"></param> /// <returns></returns> public DataTable TmpToDB(DbTransaction RootDBT, ArrayList ParameterList) { bool IsRootTranscation = false; DataTable dt_Return = new DataTable(); try { //判斷是否有傳入Root Transcation IsRootTranscation = (RootDBT == null) ? true : false; #region 啟動交易或指定RootTranscation if (IsRootTranscation) { //獨立呼叫啟動Transcation Conn = USEDB.CreateConnection(); Conn.Open(); DBT = Conn.BeginTransaction(); } else { DBT = RootDBT; } #endregion #region 設定變數 ITM04_DBO ITM04 = new ITM04_DBO(ref USEDB); #endregion #region 將TempTable的資料寫入正式Table dt_Return = ITM04.TmpToDB(DBT, ParameterList); #endregion #region 將文字檔資料,由"UpdTmp"資料夾移動至"UpdBak"資料夾 string s_SourcePath = string.Empty; string s_DestinationPath = string.Empty; DataRow[] dr_Row = dt_Return.Select("STATUS = 'FILE_NAME'"); if (dr_Row.Length == 1) { s_SourcePath = ParameterList[2].ToString() + dr_Row[0]["count"].ToString(); s_DestinationPath = ParameterList[3].ToString() + dr_Row[0]["count"].ToString(); } else { throw new Exception("移動檔案至正式資料夾發生錯誤"); } System.IO.File.Move(s_SourcePath, s_DestinationPath); #endregion #region 交易成功 if (IsRootTranscation) { //獨立呼叫Transcation成立 DBT.Commit(); } #endregion return dt_Return; } 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 } }
/// <summary> /// 新增商品資料至資料庫 /// ITM042,新增模式下,按下Button[儲存]鈕 /// </summary> /// <param name="RootDBT"></param> /// <param name="ParameterList"></param> public string ADD_ITM042_ITEM(DbTransaction RootDBT, ArrayList ParameterList) { bool IsRootTranscation = false; try { //判斷是否有傳入Root Transcation IsRootTranscation = (RootDBT == null) ? true : false; #region 啟動交易或指定RootTranscation if (IsRootTranscation) { //獨立呼叫啟動Transcation Conn = USEDB.CreateConnection(); Conn.Open(); DBT = Conn.BeginTransaction(); } else { DBT = RootDBT; } #endregion #region 設定變數 ITM04_DBO ITM04 = new ITM04_DBO(ref USEDB); string s_ITEM = string.Empty; #endregion #region 新增商品至資料庫 s_ITEM = ITM04.ADD_ITM042_ITEM(DBT, ParameterList); #endregion #region 交易成功 if (IsRootTranscation) { //獨立呼叫Transcation成立 DBT.Commit(); } #endregion return s_ITEM; } 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 } }
/// <summary> /// ITM041, 按下BUTTON[載入檔案],AP端資料匯入至TempTable /// </summary> /// <param name="RootDBT"></param> /// <param name="s_LogUser"></param> /// <param name="dt_VDS_CAA_COLL_TMP"></param> /// <returns></returns> public DataTable FileToTmp(DbTransaction RootDBT, string s_LogUser, DataTable dt_Temp) { bool IsRootTranscation = false; DataTable dt_Return = new DataTable(); try { //判斷是否有傳入Root Transcation IsRootTranscation = (RootDBT == null) ? true : false; #region 啟動交易或指定RootTranscation if (IsRootTranscation) { //獨立呼叫啟動Transcation Conn = USEDB.CreateConnection(); Conn.Open(); DBT = Conn.BeginTransaction(); } else { DBT = RootDBT; } #endregion #region 設定變數 ITM04_DBO ITM04 = new ITM04_DBO(ref USEDB); #endregion #region 刪除 VDS_ITM_ITEM_TMP 的資料 ITM04.DELETE_VDS_ITM_ITEM_TMP(DBT, s_LogUser); #endregion #region 新增 VDS_ITM_ITEM_TMP 的資料 foreach (DataRow dr_Temp in dt_Temp.Rows) { ITM04.ADD_VDS_ITM_ITEM_TMP(DBT, dr_Temp); } #endregion #region 檢查文字檔資料是否正確 ITM04.CHECK_FILETOTMP(DBT, s_LogUser); #endregion #region 交易成功 if (IsRootTranscation) { //獨立呼叫Transcation成立 DBT.Commit(); } #endregion #region 取得處理結果 dt_Return = ITM04.GET_THERESULTS(s_LogUser); #endregion return dt_Return; } 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 } }
/// <summary> /// 取得 VDS_ITM_ITEM_TMP SCHEMA /// </summary> /// <param name="ParameterList"></param> /// <returns></returns> public DataTable GET_ITM_ITEM_TMP_SCHEMA(ArrayList ParameterList) { try { ITM04_DBO ITM04 = new ITM04_DBO(ref USEDB); return ITM04.GET_ITM_ITEM_TMP_SCHEMA(ParameterList); } catch (Exception ex) { throw ex; } }
/// <summary> /// 檢查[群分類][大分類][中分類][小分類]的階層關係是否正確 /// </summary> /// <param name="ParameterList"></param> /// <returns>回傳Table欄位[result],"YES"代表階層關係正確,,"NO"代表階層關係不正確</returns> public DataTable CHK_ITM042_PATTERN_NO(ArrayList ParameterList) { try { ITM04_DBO ITM04 = new ITM04_DBO(ref USEDB); return ITM04.CHK_ITM042_PATTERN_NO(ParameterList); } catch (Exception ex) { throw ex; } }
/// <summary> /// ITM042編輯模式下,按下 Button [產生異動序號]鈕 /// </summary> /// <param name="RootDBT"></param> /// <param name="dt_UpdateDB">更新 VDS_ITM_ITEM 的資料</param> public string UPDATE_ITM042_EDIT_NO(DbTransaction RootDBT, DataTable dt_UpdateDB) { bool IsRootTranscation = false; try { //判斷是否有傳入Root Transcation IsRootTranscation = (RootDBT == null) ? true : false; #region 啟動交易或指定RootTranscation if (IsRootTranscation) { //獨立呼叫啟動Transcation Conn = USEDB.CreateConnection(); Conn.Open(); DBT = Conn.BeginTransaction(); } else { DBT = RootDBT; } #endregion #region 設定變數 ITM04_DBO ITM04 = new ITM04_DBO(ref USEDB); string s_ITEM = string.Empty; #endregion #region 更新 VDS_ITM_ITEM 資料 s_ITEM = ITM04.UPDATE_ITM042_EDIT_NO(DBT, dt_UpdateDB); #endregion #region 更新 VDS_ITM_PERIOD_MAIN 資料 ITM04.UPDATE_ITM042_PERIOD_MAIN(DBT, dt_UpdateDB); #endregion #region 交易成功 if (IsRootTranscation) { //獨立呼叫Transcation成立 DBT.Commit(); } #endregion return s_ITEM; } 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 } }
/// <summary> /// ITM042 POP UP,頁籤=期別明細,按下HyperLink[檢視]鈕 /// </summary> /// <param name="ParameterList"></param> /// <returns></returns> public DataTable QUERY_ITM042_POPUP_PERIOD_VIEW(ArrayList ParameterList) { try { ITM04_DBO ITM04 = new ITM04_DBO(ref USEDB); return ITM04.QUERY_ITM042_POPUP_PERIOD_VIEW(ParameterList); } catch (Exception ex) { throw ex; } }