public string QueryRankChangeStoreQty(ArrayList ParameterList) //ALO123
 {
     #region
     try
     {
         VDS_ALO12_DBO DBO = new VDS_ALO12_DBO(ref USEDB);
         return DBO.QueryRankChangeStoreQty(ParameterList);
     }
     catch (Exception ex)
     {
         throw GetNewException(ex);
     }
     #endregion
 }
        /// <summary>
        /// 新開店121 、122 暫存檔及配本門市檔配量調整ALO122
        /// </summary>
        /// <param name="ParameterList"></param>
        /// <param name="DBT"></param>
        public void UpdateDisStoreFrom122Tmp(ArrayList ParameterList, DbTransaction RootDBT) //ALO122
        {
            #region
            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

                VDS_ALO12_DBO DBO = new VDS_ALO12_DBO(ref USEDB);
                DBO.UpdateDisStoreFrom122Tmp(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 QueryDisStoreByReturnRate(ArrayList ParameterList) //ALO125
 {
     #region
     try
     {
         VDS_ALO12_DBO DBO = new VDS_ALO12_DBO(ref USEDB);
         return DBO.QueryDisStoreByReturnRate(ParameterList);
     }
     catch (Exception ex)
     {
         throw GetNewException(ex);
     }
     #endregion
 }
 /// <summary>
 /// 加減本數及查詢(畫面估算)
 /// </summary>
 /// <param name="ParameterList"></param>
 /// <returns></returns>
 public DataTable PreCalculteRankFor123(ArrayList ParameterList) //ALO123
 {
     #region
     try
     {
         VDS_ALO12_DBO DBO = new VDS_ALO12_DBO(ref USEDB);
         return DBO.PreCalculteRankFor123(ParameterList);
     }
     catch (Exception ex)
     {
         throw GetNewException(ex);
     }
     #endregion
 }
 /// <summary>
 /// 查詢通路及路線的配本門市數量
 /// </summary>
 /// <param name="ParameterList"></param>
 /// <returns></returns>
 public DataTable QueryChanAndRouteSumFor122(ArrayList ParameterList) //ALO122
 {
     #region
     try
     {
         VDS_ALO12_DBO DBO = new VDS_ALO12_DBO(ref USEDB);
         return DBO.QueryChanAndRouteSumFor122(ParameterList);
     }
     catch (Exception ex)
     {
         throw GetNewException(ex);
     }
     #endregion
 }
 /// <summary>
 /// 新增及查詢配本門市121暫存檔資料
 /// </summary>
 /// <param name="ParameterList"></param>
 /// <returns></returns>
 public DataTable CreateAndQueryDisStoreFor121(ArrayList ParameterList) //ALO121
 {
     #region
     try
     {
         VDS_ALO12_DBO DBO = new VDS_ALO12_DBO(ref USEDB);
         return DBO.CreateAndQueryDisStoreFor121(ParameterList);
     }
     catch (Exception ex)
     {
         throw GetNewException(ex);
     }
     #endregion
 }
 /// <summary>
 /// 取得相符配本主檔資料(只查未確認的資料)
 /// </summary>
 /// <param name="ParameterList"></param>
 /// <param name="type">0:一般查詢、1:第一筆、2:下一筆、3:上一筆、4:最後一筆</param>
 /// <returns></returns>
 public DataTable QueryDisMainFor121(ArrayList ParameterList, char type) //ALO121
 {
     #region
     try
     {
         VDS_ALO12_DBO DBO = new VDS_ALO12_DBO(ref USEDB);
         return DBO.QueryDisMainFor121(ParameterList, type);
     }
     catch (Exception ex)
     {
         throw GetNewException(ex);
     }
     #endregion
 }
        public void SaveRankFo123(ArrayList ParameterList, DbTransaction RootDBT, DataTable dt, DateTime Dt) //ALO123
        {
            #region

            bool IsRootTranscation = false;
            try
            {
                VDS_ALO12_DBO DBO = new VDS_ALO12_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.DeleteOldRankFor123(ParameterList, DBT);
                ArrayList Array = new ArrayList();
                foreach (DataRow dr in dt.Rows)
                {
                    Array.Clear();
                    Array.Add(ParameterList[0]);//V_PG_ID
                    Array.Add(ParameterList[1]);//V_SESSION_ID
                    Array.Add(ParameterList[2]);//V_DIS_NO
                    Array.Add(ParameterList[3]);//V_ITEM
                    Array.Add(ParameterList[5]);//V_CHAN_NO
                    Array.Add(ParameterList[4]);//V_PERIOD
                    Array.Add(dr["START_RANKQTY"]); //V_START_RANKQTY
                    Array.Add(dr["END_RANKQTY"]); //V_START_RANKQTY
                    Array.Add(dr["ADJ_QTY"]); //V_START_RANKQTY
                    Array.Add(Dt);//V_UPDATEDATE
                    Array.Add(ParameterList[6]);//V_UPDATEUID
                    DBO.CreateRankFor123(Array, 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>
        /// 畫面調整OR整批調整
        /// </summary>
        /// <param name="ParameterList"></param>
        /// <param name="RootDBT"></param>
        /// <param name="type">1:比例調整、2:數量調整、3:加減本數</param>
        public void UpdateALO123(ArrayList ParameterList, DbTransaction RootDBT, char type) //ALO123
        {
            #region
            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

                VDS_ALO12_DBO DBO = new VDS_ALO12_DBO(ref USEDB);
                if (type == '1') //比例調整
                    DBO.UpdateRatioDisStoreFor12(ParameterList, DBT);
                else if (type == '2') //數量調整
                    DBO.UpdateChangeQtyDisStoreFor12(ParameterList, DBT);
                else if (type == '3') //加減本數
                    DBO.UpdateRankDisStoreFor12(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
        }