/// <summary>
        /// 傳入參數:@畫面上所有欄位資料
        /// 
        /// 處理:
        /// 1.查詢此月份資料是否己月結
        ///   呼叫ChanMonthCloseYN.ChanMonthCloseYN
        ///   傳入參數:月結功能號=CAA12、月結月份=@收票日取年月
        ///  1.1 是 :
        ///      回傳訊息:「此月份己月結,不允許新增支票」。
        ///  1.2 否 :
        ///      1.2.1 新增一筆資料至資料庫VDS_CAA_BOND_MAIN(欄位對應資料請參閱畫面規格)
        ///        (A) BOND_NO   = 系統產生(BDYYMMDDXXXX)
        ///        (D) STORE_ID  = @客戶代號
        ///        (F) BOND_ID   = @票據號碼
        ///        (G) BOND_TYPE = @方式
        ///        (H) ACCEPT_BOND_DATE = @收票日
        ///        (I) DUE_DATE  = @到期日
        ///        (J) BOND_AMT  = @金額
        ///        (K) POSTAGE   = @郵資
        ///        (L) PAY_BANK  = @付款銀行
        ///        (M) PAY_ACCOUNT = @付款帳號
        ///        (N) COLL_BANK = @託收銀行
        ///        (O) COLL_ID   = @託收人員
        ///        (P) NB_COLL_DATE = @票據托收日/交換日
        ///        (Q) MEMO      = @注意事項
        ///      1.2.3 判斷是否新增成功
        ///        (A) 是:回傳訊息:「新增支票成功」
        ///        (B) 否:回傳訊息:「新增支票失敗」
        /// </summary>
        public ArrayList CreateBondRecord(ArrayList ParameterList,
                                          DbTransaction RootDBT
                                         )
        {
            bool IsRootTranscation = false;

            try
            {
                CAA_BondRecordDBO DBO = new CAA_BondRecordDBO(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

                ArrayList ary = DBO.CreateBondRecord(ParameterList, DBT);

                #region 交易成功

                if (IsRootTranscation)
                {
                    //獨立呼叫Transcation成立
                    DBT.Commit();
                }

                #endregion

                return ary;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 public DataTable QueryWashData(ArrayList ParameterList)
 {
     try
     {
         CAA_BondRecordDBO DBO = new CAA_BondRecordDBO(ref USEDB);
         DataTable dt = DBO.QueryWashData(ParameterList);
         return dt;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        /// <summary>
        /// 傳入參數:@收款單號、@暫不月結註記選項
        /// 處理:
        /// 1.判斷@暫不月結註記選項是否勾選:
        ///  1.1 是:
        ///      依欄位BOND_NO=@收款單號,異動資料庫VDS_CAA_BOND_MAIN欄位UN_MONTH_CLOSE='Y'
        ///  1.2 否:
        ///      依欄位BOND_NO=@收款單號,異動資料庫VDS_CAA_BOND_MAIN欄位UN_MONTH_CLOSE='Y'
        /// </summary>
        public ArrayList UNMonthCLSBondRecord(ArrayList ParameterList,
                                              DbTransaction RootDBT
                                             )
        {
            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

                CAA_BondRecordDBO DBO = new CAA_BondRecordDBO(ref USEDB);
                ArrayList ary = DBO.UnMonthCLSBondRecord(ParameterList, DBT);

                #region 交易成功

                if (IsRootTranscation)
                {
                    //獨立呼叫Transcation成立
                    DBT.Commit();
                }
                return ary;

                #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>
        /// 傳入參數:@兌現日期
        /// 
        ///處理:
        ///2.依欄位NB_COLL_DATE(票據托收日)=@兌現日期且UN_MONTH_CLS='1',異動資料庫VDS_CAA_BOND_MAIN欄位如下:
        ///  1.1 EX_DUE_FLG='1'
        ///  1.2 EX_DUE_DATE=自然日(APL_DATE)

        ///2.回傳異動結果
        ///  2.1 成功:系統需顯示『整批兌現作業成功』之訊息
        ///  2.2 失敗:系統需顯示『整批兌現作業失敗,請稍後再試』之訊息。
        /// </summary>
        public void BondBatchDueAll(ArrayList ParameterList, DbTransaction RootDBT)
        {
            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 設定變數

                CAACommon CAAComm = new CAACommon();
                CAA_BondRecordDBO DBO = new CAA_BondRecordDBO(ref USEDB);
                DataRow[] dr_Checked = (DataRow[])ParameterList[0];
                ArrayList arl_DBO = new ArrayList();

                #endregion

                #region 修改 VDS_CAA_BOND_MAIN 資料

                for (int i = 0; i < dr_Checked.Length; i++)
                {
                    arl_DBO.Clear();
                    arl_DBO.Add(CAAComm.GetValueSetParameter(dr_Checked[i]["BOND_NO"].ToString(), "string", false));
                    arl_DBO.Add(CAAComm.GetValueSetParameter(dr_Checked[i]["UPDATEUID"].ToString(), "string", false));
                    arl_DBO.Add(CAAComm.GetValueSetParameter(dr_Checked[i]["UPDATEDATE"].ToString(), "datetime", false));
                    arl_DBO.Add(ParameterList[1]);//兌現日期
                    arl_DBO.Add(ParameterList[2]);//更新人員
                    arl_DBO.Add(ParameterList[3]);//更新日期

                    DBO.BondBatchDueAll(arl_DBO, DBT);
                }

                #endregion

                #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>
 /// 檢查[票據號碼]是否重複
 /// </summary>
 /// <param name="ParameterList"></param>
 /// <returns></returns>
 public DataTable CHECK_BOND_ID(ArrayList ParameterList)
 {
     try
     {
         CAA_BondRecordDBO DBO = new CAA_BondRecordDBO(ref USEDB);
         return DBO.CHECK_BOND_ID(ParameterList);
     }
     catch (Exception ex)
     { throw ex; }
 }
 /// <summary>
 /// 依照畫面輸入的[店號],取得相關資料
 /// </summary>
 /// <param name="ParameterList"></param>
 /// <returns></returns>
 public DataTable GET_STORE_RELATE_DATA(ArrayList ParameterList)
 {
     try
     {
         CAA_BondRecordDBO DBO = new CAA_BondRecordDBO(ref USEDB);
         return DBO.GET_STORE_RELATE_DATA(ParameterList);
     }
     catch (Exception ex)
     { throw ex; }
 }
 /// <summary>
 /// 判斷此月份是否月結
 /// </summary>
 public string CheckBondRecord(ArrayList ParameterList)
 {
     try
     {
         CAA_BondRecordDBO DBO = new CAA_BondRecordDBO(ref USEDB);
         string strResult = DBO.CheckBondRecord(ParameterList);
         return strResult;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 /// <summary>
 /// CAA121頁籤[整批兌現],按下[查詢]鈕
 /// </summary>
 /// <param name="ParameterList"></param>
 /// <returns></returns>
 public DataTable QUERY_CAA121_BULK(ArrayList ParameterList)
 {
     try
     {
         CAA_BondRecordDBO DBO = new CAA_BondRecordDBO(ref USEDB);
         DataTable dt = DBO.QUERY_CAA121_BULK(ParameterList);
         return dt;
     }
     catch (Exception ex)
     { throw ex; }
 }
 /// <summary>
 /// 傳入參數:
 /// 〔@依照頁面輸入的查詢條件〕
 /// 傳回訊息:
 /// 〔@回傳gridview 參照web ui spec〕
 /// 
 /// Table:
 /// VB=VDS_CAA_BOND_MAIN(支票檔)
 /// AP=VDS_STM_ACCOUNT_PROPERTY(帳務特性主檔)
 /// SS=VDS_STM_STORE(門市主檔)
 /// 
 /// 查詢條件:(若有輸入則組成過濾條件,無輸入則不過濾)
 /// (1) 收款單號	= BM.BOND_NO
 /// (2) 營業所	    = SS.Z_O
 /// (3) 營業人員	= SS.SAL_ID
 /// (4) 客戶店號	= BM.STORE_ID
 /// (5) 統一編號	= AP.RFNO
 /// (6) 票據號碼    = BM.BOND_ID
 /// (7) 方式    	= BM.BOND_TYPE
 /// (8) 收票日  	= BM.ACCEPTBOND_DATE
 /// (9) 到期日  	= BM.DUE-DATE
 /// (10) 金額	    = BM.BOND_AMT
 /// (11) 郵資   	= BM.POSTAGE
 /// (12) 付款銀行	= BM.PAY_BANK
 /// (13) 付款帳號	= BM.PAY_ACCOUNT
 /// (14) 託收銀行	= BM.COLL_BANK
 /// (15) 託收人員   = BM.COLL_ID
 /// (16) 票據託收日/交換日 = BM.NB_COLL_DATE
 /// (17) 注意事項	= BM.MEMO
 /// (18) 退票日     = BM.REJECT_DATE
 /// (19) 退票原因   = BM.REJECT_MEMO
 /// (20) 暫不月結註記 = BM.UN_MONTH_CLOSE
 /// (21) 兌現註記   = BM.EX_DUE_FLG
 /// (17) 建立日期	= BM.CREATEDATE
 /// (18) 建立人員	= BM.CREATEUID
 /// (19) 維護日期	= BM.UPDATEDATE
 /// (20) 維護人員	= BM.UPDATEUID
 /// (21) BM.ENABLE = 1
 /// (22) BM.STORE_ID = AA.STORE
 /// (23) BM.STORE_ID = AP.STORE
 /// (24) SS.MDC_STAR_DATE <= BM.CREATEDATE AND SS.MDC_END_DATE >=BM.CREATEDATE
 /// (25) AP.EFF_DATE_FROM <= BM.CREATEDATE AND AP.EFF_DATE_TO >=BM.CREATDATE
 /// 
 /// 
 /// 欄位:
 /// (1) 營業所 = SS.Z_O
 /// (2) 客戶代號 = BM.STORE_ID
 /// (3) 統一編號 = AP.RFNO
 /// (4) 票據號碼 = BM.BOND_ID
 /// (5) 收票日 = BM.ACCEPT_BOND_DATE
 /// (6) 到期日 = BM.DUE_DATE
 /// (7) 托收日 = BM.NB_COLL_DATE
 /// </summary>
 public DataTable QueryByLike(ArrayList ParameterList,
                              DbTransaction RootDBT
                             )
 {
     try
     {
         CAA_BondRecordDBO DBO = new CAA_BondRecordDBO(ref USEDB);
         DataTable dt = DBO.QueryByLike(ParameterList);
         return dt;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }