public DataTable QueryStOutAcceptData(ArrayList ParameterList, out string strErrMsg)
 {
     #region
     try
     {
         VDS_ALO21_DBO DBO = new VDS_ALO21_DBO(ref USEDB);
         return DBO.doQueryStOutAcceptData(ParameterList, out  strErrMsg);
     }
     catch (Exception ex)
     {
         throw GetNewException(ex);
     }
     #endregion
 }
 public DataTable CheckDisRecordDiff(ArrayList ParameterList, out string strErrMsg)
 {
     #region
     try
     {
         VDS_ALO21_DBO DBO = new VDS_ALO21_DBO(ref USEDB);
         return DBO.doCheckDisRecordDiff(ParameterList, out  strErrMsg);
     }
     catch (Exception ex)
     {
         throw GetNewException(ex);
     }
     #endregion
 }
        /// <summary>
        /// ProcessCreateMultiStoreAccepts Step3
        /// </summary>
        /// <param name="ParameterList"></param>
        /// <param name="strStAcceptNoArr"></param>
        /// <param name="strErrMsg"></param>
        /// <param name="RootDBT"></param>
        /// <returns></returns>
        public bool ProcessCreateStoreAccepts_3(ArrayList ParameterList, out string strStAcceptNoArr, out string strErrMsg, DbTransaction RootDBT)
        {
            #region
            bool IsRootTranscation = false;
            bool bResult = false;

            try
            {
                VDS_ALO21_DBO DBO = new VDS_ALO21_DBO(ref USEDB);

                //判斷是否有傳入Root Transcation 
                IsRootTranscation = (RootDBT == null) ? true : false;

                #region 啟動交易或指定RootTranscation

                if (IsRootTranscation)
                {
                    //獨立呼叫啟動Transcation
                    Conn = USEDB.CreateConnection();
                    Conn.Open();
                    DBT = Conn.BeginTransaction();
                    //System.Web.HttpContext.Current.Trace.Warn(string.Format("使用者:{0} 於{1}.ProcessCreateStoreAccepts_3.轉單開始:{2} ",
                    //                                                 System.Web.HttpContext.Current.Session["UID"].ToString(),
                    //                                                  DateTime.Now.ToString(),
                    //                                                  DBT.GetHashCode().ToString())
                    //                                          );

                }
                else
                {
                    DBT = RootDBT;
                    //System.Web.HttpContext.Current.Trace.Warn(string.Format("使用者:{0} 於{1}.ProcessCreateStoreAccepts_3.Old 轉單開始:{2} ",
                    //                                                 System.Web.HttpContext.Current.Session["UID"].ToString(),
                    //                                                  DateTime.Now.ToString(),
                    //                                                  DBT.GetHashCode().ToString())
                    //                                          );
                }

                #endregion

                bResult = DBO.doProcessCreateStoreAccepts_3(ParameterList, out strStAcceptNoArr, out strErrMsg, DBT);

                #region 交易成功

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

                #endregion

                return bResult;

            }
            catch (Exception ex)
            {
                #region 交易失敗

                if (IsRootTranscation)
                {
                    //獨立呼叫Transcation失敗
                    DBT.Rollback();
                }

                #endregion

                throw GetNewException(ex);
            }
            finally
            {
                //System.Web.HttpContext.Current.Trace.Warn(string.Format("使用者:{0} 於{1}.ProcessCreateStoreAccepts_3.轉單結束:{2} ",
                //                                                 System.Web.HttpContext.Current.Session["UID"].ToString(),
                //                                                  DateTime.Now.ToString(),
                //                                                  DBT.GetHashCode().ToString())
                //                                          );

                #region 判斷是否關閉交易連線

                if (IsRootTranscation)
                {
                    //獨立呼叫Transcation,關閉連線
                    if (Conn.State == ConnectionState.Connecting)
                    {
                        Conn.Close();
                    }
                }

                #endregion


            }

            #endregion
        }
        /// <summary>
        /// 2010/04/28 新增多載
        /// </summary>
        /// <param name="ParameterList"></param>
        /// <param name="RootDBT"></param>
        /// <returns></returns>
        public ArrayList ProcessCreateMultiStoreAccepts(ArrayList ParameterList, DbTransaction RootDBT)
        {
            #region
            ArrayList aryResult = new ArrayList();
            bool bResult = false;
            string strStAcceptNoArr = "", strErrMsg = "";

            try
            {


                VDS_ALO21_DBO DBO = new VDS_ALO21_DBO(ref USEDB);

                //按順序進行Package- new
                DBT = RootDBT;//皆傳null
                bResult = ProcessCreateStoreAccepts_1(ParameterList, out strStAcceptNoArr, out strErrMsg, DBT);
                if (!bResult && strErrMsg == "")
                { strErrMsg = "轉單失敗:ProcessCreateStoreAccepts_1異常!"; }
                //if (strErrMsg != "")
                //{ throw new Exception(strErrMsg); }

                if (strErrMsg == "")
                {
                    DBT = RootDBT;//皆傳null
                    bResult = ProcessCreateStoreAccepts_2(ParameterList, out strStAcceptNoArr, out strErrMsg, DBT);
                    if (!bResult && strErrMsg == "")
                    { strErrMsg = "轉單失敗:ProcessCreateStoreAccepts_3異常!"; }
                    //if (strErrMsg != "")
                    //{ throw new Exception(strErrMsg); }
                    if (strErrMsg == "")
                    {

                        DBT = RootDBT;//皆傳null
                        bResult = ProcessCreateStoreAccepts_3(ParameterList, out strStAcceptNoArr, out strErrMsg, DBT);
                        if (!bResult && strErrMsg == "")
                        { strErrMsg = "轉單失敗:ProcessCreateStoreAccepts_3異常!"; }
                        //if (strErrMsg != "")
                        //{ throw new Exception(strErrMsg); }
                    }
                }

                aryResult.Add(bResult);
                aryResult.Add(strStAcceptNoArr);
                aryResult.Add(strErrMsg);

            }
            catch (Exception ex)
            {
                throw GetNewException(ex);
            }

            return aryResult;

            #endregion
        }
        /// <summary>
        /// 20090804 改為個別Commit獨立呼叫Method
        /// </summary>
        /// <param name="ParameterList"></param>
        /// <param name="strStAcceptNoArr"></param>
        /// <param name="strErrMsg"></param>
        /// <param name="RootDBT"></param>
        /// <returns></returns>
        public bool ProcessCreateMultiStoreAccepts(ArrayList ParameterList, out string strStAcceptNoArr, out string strErrMsg, DbTransaction RootDBT)
        {
            #region
            bool bResult = false;

            try
            {
                VDS_ALO21_DBO DBO = new VDS_ALO21_DBO(ref USEDB);

                
                //System.Web.HttpContext.Current.Trace.Warn(string.Format("使用者:{0} 於{1}.ProcessCreateMultiStoreAccepts.轉單開始:{2} ",
                //                                                 System.Web.HttpContext.Current.Session["UID"].ToString(),
                //                                                  DateTime.Now.ToString(),
                //                                                  "")
                //                                          );


                ////按順序進行Package
                //if (DBO.doProcessCreateStoreAccepts_1(ParameterList, out strStAcceptNoArr, out strErrMsg, DBT))
                //    if (DBO.doProcessCreateStoreAccepts_2(ParameterList, out strStAcceptNoArr, out strErrMsg, DBT))
                //        if (DBO.doProcessCreateStoreAccepts_3(ParameterList, out strStAcceptNoArr, out strErrMsg, DBT))
                //            bResult = true;

                //按順序進行Package- new
                DBT = RootDBT;//皆傳null
                bResult = ProcessCreateStoreAccepts_1(ParameterList, out strStAcceptNoArr, out strErrMsg, DBT);
                if (!bResult && strErrMsg == "")
                {   strErrMsg = "轉單失敗:ProcessCreateStoreAccepts_1異常!";}

                if (strErrMsg != "")
                { throw new Exception(strErrMsg); }
                DBT = RootDBT;//皆傳null
                bResult = ProcessCreateStoreAccepts_2(ParameterList, out strStAcceptNoArr, out strErrMsg, DBT);
                if (!bResult && strErrMsg == "")
                { strErrMsg = "轉單失敗:ProcessCreateStoreAccepts_3異常!"; }

                if (strErrMsg != "")
                { throw new Exception(strErrMsg); }
                DBT = RootDBT;//皆傳null
                bResult = ProcessCreateStoreAccepts_3(ParameterList, out strStAcceptNoArr, out strErrMsg, DBT);
                if (!bResult && strErrMsg == "")
                { strErrMsg = "轉單失敗:ProcessCreateStoreAccepts_3異常!"; }

                if (strErrMsg != "")
                { throw new Exception(strErrMsg); }
 

            }
            catch (Exception ex)
            {
                throw GetNewException(ex);
            }
            //System.Web.HttpContext.Current.Trace.Warn(string.Format("使用者:{0} 於{1}.ProcessCreateMultiStoreAccepts.轉單結束:{2} ",
            //                                                 System.Web.HttpContext.Current.Session["UID"].ToString(),
            //                                                  DateTime.Now.ToString(),
            //                                                  "")
            //                                          );

            return bResult;

            #endregion
        }
        public bool ProcessCreateMultiStoreAcceptsOld(ArrayList ParameterList, out string strStAcceptNoArr, out string strErrMsg, DbTransaction RootDBT)
        {
            #region
            bool IsRootTranscation = false;
            bool bResult = false;

            try
            {
                VDS_ALO21_DBO DBO = new VDS_ALO21_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

                bResult = DBO.doProcessCreateMultiStoreAccepts(ParameterList, out strStAcceptNoArr, out strErrMsg, DBT);

                #region 交易成功

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

                #endregion

                return bResult;

            }
            catch (Exception ex)
            {
                #region 交易失敗

                if (IsRootTranscation)
                {
                    //獨立呼叫Transcation失敗
                    DBT.Rollback();
                }

                #endregion

                throw GetNewException(ex);
            }
            finally
            {
                #region 判斷是否關閉交易連線

                if (IsRootTranscation)
                {
                    //獨立呼叫Transcation,關閉連線
                    if (Conn.State == ConnectionState.Connecting)
                    {
                        Conn.Close();
                    }
                }

                #endregion

            }

            #endregion
        }
        public void CLEAR_PROCESS_FLAG(ArrayList ParameterList, DbTransaction RootDBT)
        {
            #region
            bool IsRootTranscation = false;

            try
            {
                VDS_ALO21_DBO DBO = new VDS_ALO21_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

                DBO.doCLEAR_PROCESS_FLAG(ParameterList, DBT);

                #region 交易成功

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

                #endregion
            }
            catch (Exception ex)
            {
                #region 交易失敗

                if (IsRootTranscation)
                {
                    //獨立呼叫Transcation失敗
                    DBT.Rollback();
                }

                #endregion

                throw GetNewException(ex);
            }
            finally
            {
                #region 判斷是否關閉交易連線

                if (IsRootTranscation)
                {
                    //獨立呼叫Transcation,關閉連線
                    if (Conn.State == ConnectionState.Connecting)
                    {
                        Conn.Close();
                    }
                }

                #endregion

            }

            #endregion
        }
 /// <summary>
 /// 計算手開單品項
 /// </summary>
 /// <param name="ParameterList"></param>
 /// <returns></returns>
 public DataTable QueryOnHandResult(ArrayList ParameterList)
 {
     #region
     try
     {
         VDS_ALO21_DBO DBO = new VDS_ALO21_DBO(ref USEDB);
         return DBO.doQueryOnHandResult(ParameterList);
     }
     catch (Exception ex)
     {
         throw GetNewException(ex);
     }
     #endregion
 }