public DataTable QuerySwitch(QueryType QT, ArrayList ParameterList ) { DBO.STM_PromoteExhibitionDBO dbo = new STM_PromoteExhibitionDBO(ref USEDB); DataTable Dt; try { switch (QT) { case QueryType.ALL: Dt = dbo.doQueryAll(); break; case QueryType.CODE: Dt = dbo.doQueryByCode(ParameterList); break; case QueryType.ID: Dt = dbo.doQueryByID(ParameterList); break; case QueryType.Custom: Dt = dbo.doQueryByFind(ParameterList); break; case QueryType.STORE: Dt = dbo.doQueryPromoteGroupStoreInfo(ParameterList); break; case QueryType.ITEM: Dt = dbo.doQueryPromoteItemInfo(ParameterList); break; case QueryType.QueryByLike: Dt = dbo.doQueryPromoteExhibition(ParameterList); break; default: Dt = new DataTable(); break; } return Dt; } catch (Exception ex) { throw ex; } }
/// <summary> /// 基本表單刪除BCO /// </summary> /// <param name="ParameterList">刪除變數</param> /// <param name="RootDBT">是否有主交易,無主交易輸入null</param> /// <returns>回傳影響筆數</returns> public void DeleteStoreBase(ArrayList ParameterList, DbTransaction RootDBT ) { bool IsRootTranscation = false; string s_Log_User = string.Empty; DateTime d_Now; try { DBO.STM_PromoteExhibitionDBO dbo_MST = new STM_PromoteExhibitionDBO(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_MST.doDelete(ParameterList, DBT); #region 交易成功 if (IsRootTranscation) { //獨立呼叫Transcation成立 DBT.Commit(); } #endregion } 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> /// 基本表單更新BCO /// </summary> /// <param name="ParameterList">更新變數</param> /// <param name="RootDBT">是否有主交易,無主交易輸入null</param> /// <returns>回傳影響筆數</returns> public void UpdateStoreBase(ArrayList ParameterList, DbTransaction RootDBT, DataTable detail ) { bool IsRootTranscation = false; string s_Log_User = string.Empty; string PID = string.Empty; DateTime d_Now; ArrayList ParameterList_Detail = new ArrayList(); try { DBO.STM_PromoteExhibitionDBO dbo_MST = new STM_PromoteExhibitionDBO(ref USEDB); DBO.STM_PromoteExhibitionDBO dbo_DTL = new STM_PromoteExhibitionDBO(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_MST.doUpdate(ParameterList, DBT); d_Now = DateTime.Now; s_Log_User = ParameterList[19].ToString(); PID = ParameterList[0].ToString(); foreach (DataRow dRow in detail.Rows) { if (dRow.RowState == DataRowState.Added) { dbo_DTL.doCreate_DTL(dRow, DBT, s_Log_User, d_Now,PID); } if (dRow.RowState == DataRowState.Modified) { ParameterList_Detail.Clear(); ParameterList_Detail.Add(dRow["PROMOTE_CODE", DataRowVersion.Original]); ParameterList_Detail.Add(dRow["GROUP_NO", DataRowVersion.Original]); ParameterList_Detail.Add(dRow["STORE", DataRowVersion.Original]); ParameterList_Detail.Add(dRow["ITEM", DataRowVersion.Original]); ParameterList_Detail.Add(dRow["PERIOD", DataRowVersion.Original]); ParameterList_Detail.Add(dRow["CREATEDATE", DataRowVersion.Original]); ParameterList_Detail.Add(dRow["CREATEUID", DataRowVersion.Original]); ParameterList_Detail.Add(dRow["UPDATEDATE", DataRowVersion.Original]); ParameterList_Detail.Add(dRow["UPDATEUID", DataRowVersion.Original]); ParameterList_Detail.Add(dRow["PROMOTE_CODE", DataRowVersion.Current]); ParameterList_Detail.Add(dRow["GROUP_NO", DataRowVersion.Current]); ParameterList_Detail.Add(dRow["STORE", DataRowVersion.Current]); ParameterList_Detail.Add(dRow["ITEM", DataRowVersion.Current]); ParameterList_Detail.Add(dRow["PERIOD", DataRowVersion.Current]); ParameterList_Detail.Add(dRow["COST_SUBSIDY_PERCENT", DataRowVersion.Current]); ParameterList_Detail.Add(dRow["PRICE_SUBSIDY_PERCENT", DataRowVersion.Current]); ParameterList_Detail.Add(d_Now); ParameterList_Detail.Add(s_Log_User); dbo_DTL.doUpdate_DTL(ParameterList_Detail, DBT); } if (dRow.RowState == DataRowState.Deleted) { dbo_DTL.doDelete_DTL(dRow, DBT, s_Log_User, d_Now); } } dbo_MST.doConfirmVaildStoreItem(DBT, PID); #region 交易成功 if (IsRootTranscation) { //獨立呼叫Transcation成立 DBT.Commit(); } #endregion } 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> /// 基本表單新增BCO /// </summary> /// <param name="ParameterList">輸入變數</param> /// <param name="RootDBT">是否有主交易,無主交易輸入null</param> /// <returns>回傳影響筆數</returns> public string CreateStoreBase(ArrayList ParameterList, DbTransaction RootDBT, DataTable detail ) { string PID = ""; bool IsRootTranscation = false; string s_Log_User = string.Empty; DateTime d_Now; try { DBO.STM_PromoteExhibitionDBO dbo_MST = new STM_PromoteExhibitionDBO(ref USEDB); DBO.STM_PromoteExhibitionDBO dbo_DTL = new STM_PromoteExhibitionDBO(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 = dbo_MST.doCreate(ParameterList, DBT); d_Now = DateTime.Now; s_Log_User = ParameterList[18].ToString(); foreach (DataRow dRow in detail.Rows) { dbo_DTL.doCreate_DTL(dRow, DBT, s_Log_User, d_Now,PID); } dbo_MST.doConfirmVaildStoreItem(DBT,PID); #region 交易成功 if (IsRootTranscation) { //獨立呼叫Transcation成立 DBT.Commit(); } #endregion return PID; } 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> /// 取得商品折扣Table /// </summary> public DataTable GETPRICEINFOLIST(ArrayList ParameterList) { try { DBO.STM_PromoteExhibitionDBO dbo = new STM_PromoteExhibitionDBO(ref USEDB); return dbo.GETPRICEINFOLIST(ParameterList); } catch (Exception ex) { throw ex; } }
/// <summary> /// 將商品資料寫入DB暫存Table /// </summary> public void PREPPRICEINFOLIST(ArrayList ParameterList) { try { DBO.STM_PromoteExhibitionDBO dbo = new STM_PromoteExhibitionDBO(ref USEDB); dbo.PREPPRICEINFOLIST(ParameterList); } catch (Exception ex) { throw ex; } }
/// <summary> /// 審核解除 /// </summary> public void RevokePromoteExhibition(ArrayList ParameterList) { try { DBO.STM_PromoteExhibitionDBO dbo = new STM_PromoteExhibitionDBO(ref USEDB); dbo.RevokePromoteExhibition(ParameterList); } catch (Exception ex) { throw ex; } }
/// <summary> /// 取得供應商商品資料 /// </summary> public DataTable ExpandStoreItemDiscount(ArrayList ParameterList) { try { DBO.STM_PromoteExhibitionDBO dbo = new STM_PromoteExhibitionDBO(ref USEDB); return dbo.ExpandStoreItemDiscount(ParameterList); } catch (Exception ex) { throw ex; } }
/// <summary> /// 捉取商品資料 /// </summary> public ArrayList GetItemInfo(ArrayList ParameterList) { try { DBO.STM_PromoteExhibitionDBO dbo = new STM_PromoteExhibitionDBO(ref USEDB); return dbo.GetItemInfo(ParameterList); } catch (Exception ex) { throw ex; } }
/// <summary> /// 捉取門市資料 /// </summary> public DataTable GetGroupStoreInfo(ArrayList ParameterList) { try { DBO.STM_PromoteExhibitionDBO dbo = new STM_PromoteExhibitionDBO(ref USEDB); return dbo.GetGroupStoreInfo(ParameterList); } catch (Exception ex) { throw ex; } }
public bool CheckDcDate(string Store, string ACCEPT_FIRST_DATE) { try { DBO.STM_PromoteExhibitionDBO dbo = new STM_PromoteExhibitionDBO(ref USEDB); return dbo.doCheckDCDate(Store, ACCEPT_FIRST_DATE); } catch (Exception ex) { throw ex; } }