public void QueryDisCountStartDate(ArrayList ParameterList, out int N_RESULT)
 {
     try
     {
         DBO.STM_STM19_DBO dbo = new STM_STM19_DBO(ref USEDB);
         dbo.doQueryDisCountStartDate(ParameterList, out N_RESULT);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public DataTable QueryItem(string V_ITEM)
 {
     try
     {
         DBO.STM_STM19_DBO dbo = new STM_STM19_DBO(ref USEDB);
         return dbo.doQueryForSLP(V_ITEM);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 /// <summary>
 /// 【功能】:查詢店群折扣維護資料
 /// 
 /// 【傳入值】:
 /// 〔@依照傳入的查詢條件〕
 /// 
 /// 【回傳值】:
 /// 〔@參考web ui spec〕
 /// 
 /// 
 /// 【主要TABLE】:
 /// VDS_STM_PRICEDISCOUNT_SG
 /// 
 /// 【說明】:正確回傳查詢的dataset,欄位請參照web ui spec。
 /// 回傳的值要依照不同的折扣類型顯示在編輯頁中不同的TAB。
 /// 1.商品大分類,折扣類型=1
 /// 2.商品中分類,折扣類型=2
 /// 3.商品,折扣類型=4
 /// </summary>
 public DataTable QueryStoreDiscount(ArrayList ParameterList)
 {
     try
     {
         DBO.STM_STM19_DBO dbo = new STM_STM19_DBO(ref USEDB);
         return dbo.doQueryPriceDiscountS(ParameterList);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public void QueryStoreGroupByStore(string sStore, out string sStoreGroup, out string sStoreGName, out int intCNT)
        {
            try
            {
                DBO.STM_STM19_DBO dbo = new STM_STM19_DBO(ref USEDB);
                dbo.doQueryStoreGroupByStore(sStore, out sStoreGroup, out sStoreGName, out intCNT);
            }
            catch (Exception ex)
            {
                throw ex;
            }


        }
 public string QueryVdsPssHistory(ArrayList ParameterList)
 {
     try
     {
         DBO.STM_STM19_DBO dbo = new STM_STM19_DBO(ref USEDB);
         return dbo.doQueryVdsPssHistory(ParameterList);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        /// <summary>
        /// 【功能】:更新店群折扣維護資料
        /// 
        /// 【傳入值】:
        /// 〔@參考web ui spec欄位〕
        /// 
        /// 【回傳值】:
        /// 〔@更新是否成功〕
        /// 
        /// 【主要TABLE】:
        /// VDS_STM_PRICEDISCOUNT_SG
        /// 
        /// 【檢查】:
        /// 1.屬於同一店群內的折扣設定檢查
        /// IF DISCOUNT_TYPE=1 THEN //店群對大分類
        /// 如果更新的ROOT_NO||PMA已經存在,則檢查【有效開始日】要小於上一筆資料的【有效結束日】,否則顯示錯誤訊息,《有效開始日期輸入有誤,應小於相同大分類折扣
        /// 的有效結束日》。
        /// 
        /// ELSE IF DISCOUNT_TYPE=2 THEN //店群對中分類
        /// 如果更新的ROOT_NO||PMA||CATEGORY已經存在,則檢查【有效開始日】要小於上一筆資料的【有效結束日】,否則顯示錯誤訊息,《有效開始日期輸入有誤,
        /// 應小於相同折扣的有效結束日》。
        /// 
        /// ELSE DISCOUNT_TYPE=4  //店群對單品
        /// 如果更新的ITEM已經存在,則檢查【有效開始日】要小於上一筆資料的【有效結束日】,否則顯示錯誤訊息,《有效開始日期輸入有誤,應小於相同大分類折扣的有效結束日》。
        /// 
        /// END IF
        /// 
        /// 【說明】:
        /// 1.必填的欄位如果是空值,則INSERT空白,長度參照Table Schema。
        /// 2.如果檢查無誤,則正確更新資料,如有錯誤則要回傳錯誤訊息。
        /// 3.如果群分類=2(圖書),PERIOD期別欄位='000000'
        /// </summary>
        public void UpdateStoreDiscount(DataTable dtA, DataTable dtB, DataTable dtC, string UID, DbTransaction RootDBT)
        {
            bool IsRootTranscation = false;
            try
            {
                DBO.STM_STM19_DBO dbo = new STM_STM19_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

                DataTable dtA_i = dtA.GetChanges(DataRowState.Added);
                DataTable dtA_m = dtA.GetChanges(DataRowState.Modified);
                DataTable dtA_d = dtA.GetChanges(DataRowState.Deleted);
                ArrayList arrayList = new ArrayList();
                int N_ID;
                string V_CODE;

                if (dtA_i != null)
                {
                    for (int i = 0; i < dtA_i.Rows.Count; i++)
                    {
                        arrayList.Clear();
                        arrayList = this.GetArrayList(dtA_i.Rows[i], UID);
                        dbo.doCreateStoreDiscount(arrayList, DBT, out N_ID, out V_CODE);
                    }
                }
                if (dtA_m != null)
                {
                    for (int i = 0; i <= dtA_m.Rows.Count - 1; i++)//店群折扣 -> 修改
                    {
                        arrayList.Clear();
                        arrayList.Add(Convert.ToInt32(dtA_m.Rows[i]["ID"].ToString()));
                        arrayList.Add(DateTime.Parse(dtA_m.Rows[i]["CREATEDATE", DataRowVersion.Original].ToString()));
                        arrayList.Add(dtA_m.Rows[i]["CREATEUID", DataRowVersion.Original].ToString());
                        arrayList.Add(DateTime.Parse(dtA_m.Rows[i]["UPDATEDATE", DataRowVersion.Original].ToString()));
                        arrayList.Add(dtA_m.Rows[i]["UPDATEUID", DataRowVersion.Original].ToString());
                        arrayList.Add(dtA_m.Rows[i]["CODE"].ToString());//V_NEW_CODE
                        arrayList.Add(dtA_m.Rows[i]["STORE"].ToString());//V_NEW_GROUP_NO 
                        arrayList.Add(Convert.ToDateTime(dtA_m.Rows[i]["EFF_START"].ToString()));//D_NEW_EFF_START
                        arrayList.Add(Convert.ToDateTime(dtA_m.Rows[i]["EFF_END"].ToString()));//D_NEW_EFF_END
                        arrayList.Add(Convert.ToInt32(dtA_m.Rows[i]["DISCOUNT_KIND"].ToString()));//N_NEW_DISCOUNT_KIND
                        arrayList.Add(GetValueSetParameter(dtA_m.Rows[i]["ROOT_NO"].ToString(), "string", false));//V_NEW_ROOT_NO
                        arrayList.Add(GetValueSetParameter(dtA_m.Rows[i]["PMA"].ToString(), "string", false));//V_NEW_PMA
                        arrayList.Add(GetValueSetParameter(dtA_m.Rows[i]["CATEGORY"].ToString(), "string", false));//V_NEW_CATEGORY
                        arrayList.Add(GetValueSetParameter(dtA_m.Rows[i]["ITEM"].ToString(), "string", false));//V_NEW_ITEM
                        arrayList.Add(GetValueSetParameter(dtA_m.Rows[i]["PERIOD"].ToString(), "string", false));//V_NEW_PERIOD
                        arrayList.Add(GetValueSetParameter(dtA_m.Rows[i]["PERIOD_END"].ToString(), "string", false));//V_NEW_PERIOD_END
                        arrayList.Add(GetValueSetParameter(dtA_m.Rows[i]["PRICE_DISCOUNT"].ToString(), "float", false));//N_NEW_PRICE_DISCOUNT
                        arrayList.Add(GetValueSetParameter(dtA_m.Rows[i]["FIX_PRICE_DISCOUNT"].ToString(), "float", false));//N_NEW_FIX_PRICE_DISCOUNT
                        arrayList.Add(GetValueSetParameter(dtA_m.Rows[i]["VENDOR_SUBSIDY_PERCENT"].ToString(), "float", false));//N_NEW_VENDOR_SUBSIDY_PERCENT
                        arrayList.Add(GetValueSetParameter(dtA_m.Rows[i]["COST_PERCENT"].ToString(), "float", false));//N_NEW_COST_PERCENT
                        arrayList.Add(Convert.ToInt32(dtA_m.Rows[i]["CONFIRM_CODE"].ToString()));//N_NEW_CONFIRM_CODE
                        arrayList.Add(System.DateTime.Now);//D_NEW_UPDATEDATE
                        arrayList.Add(dtA_m.Rows[i]["UPDATEUID"].ToString());//V_NEW_UPDATEUID
                        dbo.doUpdate(arrayList, DBT);
                    }
                    dtA_m.Clear();
                }

                if (dtA_d != null)
                {
                    for (int i = 0; i <= dtA_d.Rows.Count - 1; i++)//店群折扣 -> 修改
                    {
                        arrayList.Clear();
                        arrayList.Add(Convert.ToInt32(dtA_d.Rows[i]["ID", DataRowVersion.Original].ToString()));
                        arrayList.Add(DateTime.Parse(dtA_d.Rows[i]["CREATEDATE", DataRowVersion.Original].ToString()));
                        arrayList.Add(dtA_d.Rows[i]["CREATEUID", DataRowVersion.Original].ToString());
                        arrayList.Add(DateTime.Parse(dtA_d.Rows[i]["UPDATEDATE", DataRowVersion.Original].ToString()));
                        arrayList.Add(dtA_d.Rows[i]["UPDATEUID", DataRowVersion.Original].ToString());
                        arrayList.Add(System.DateTime.Now);//D_NEW_UPDATEDATE
                        arrayList.Add(UID);//V_NEW_UPDATEUID
                        dbo.doDelete(arrayList, DBT);
                    }
                    dtA_d.Clear();
                }


                DataTable dtB_i = dtB.GetChanges(DataRowState.Added);
                DataTable dtB_m = dtB.GetChanges(DataRowState.Modified);
                DataTable dtB_d = dtB.GetChanges(DataRowState.Deleted);

                if (dtB_i != null)
                {
                    for (int i = 0; i < dtB_i.Rows.Count; i++)
                    {
                        arrayList.Clear();
                        arrayList = this.GetArrayList(dtB_i.Rows[i], UID);
                        dbo.doCreateStoreDiscount(arrayList, DBT, out N_ID, out V_CODE);
                    }
                }
                if (dtB_m != null)
                {
                    for (int i = 0; i <= dtB_m.Rows.Count - 1; i++)//店群折扣 -> 修改
                    {
                        arrayList.Clear();
                        arrayList.Add(Convert.ToInt32(dtB_m.Rows[i]["ID"].ToString()));
                        arrayList.Add(DateTime.Parse(dtB_m.Rows[i]["CREATEDATE", DataRowVersion.Original].ToString()));
                        arrayList.Add(dtB_m.Rows[i]["CREATEUID", DataRowVersion.Original].ToString());
                        arrayList.Add(DateTime.Parse(dtB_m.Rows[i]["UPDATEDATE", DataRowVersion.Original].ToString()));
                        arrayList.Add(dtB_m.Rows[i]["UPDATEUID", DataRowVersion.Original].ToString());
                        arrayList.Add(dtB_m.Rows[i]["CODE"].ToString());//V_NEW_CODE
                        arrayList.Add(dtB_m.Rows[i]["STORE"].ToString());//V_NEW_GROUP_NO 
                        arrayList.Add(Convert.ToDateTime(dtB_m.Rows[i]["EFF_START"].ToString()));//D_NEW_EFF_START
                        arrayList.Add(Convert.ToDateTime(dtB_m.Rows[i]["EFF_END"].ToString()));//D_NEW_EFF_END
                        arrayList.Add(Convert.ToInt32(dtB_m.Rows[i]["DISCOUNT_KIND"].ToString()));//N_NEW_DISCOUNT_KIND
                        arrayList.Add(GetValueSetParameter(dtB_m.Rows[i]["ROOT_NO"].ToString(), "string", false));//V_NEW_ROOT_NO
                        arrayList.Add(GetValueSetParameter(dtB_m.Rows[i]["PMA"].ToString(), "string", false));//V_NEW_PMA
                        arrayList.Add(GetValueSetParameter(dtB_m.Rows[i]["CATEGORY"].ToString(), "string", false));//V_NEW_CATEGORY
                        arrayList.Add(GetValueSetParameter(dtB_m.Rows[i]["ITEM"].ToString(), "string", false));//V_NEW_ITEM
                        arrayList.Add(GetValueSetParameter(dtB_m.Rows[i]["PERIOD"].ToString(), "string", false));//V_NEW_PERIOD
                        arrayList.Add(GetValueSetParameter(dtB_m.Rows[i]["PERIOD_END"].ToString(), "string", false));//V_NEW_PERIOD_END
                        arrayList.Add(GetValueSetParameter(dtB_m.Rows[i]["PRICE_DISCOUNT"].ToString(), "float", false));//N_NEW_PRICE_DISCOUNT
                        arrayList.Add(GetValueSetParameter(dtB_m.Rows[i]["FIX_PRICE_DISCOUNT"].ToString(), "float", false));//N_NEW_FIX_PRICE_DISCOUNT
                        arrayList.Add(GetValueSetParameter(dtB_m.Rows[i]["VENDOR_SUBSIDY_PERCENT"].ToString(), "float", false));//N_NEW_VENDOR_SUBSIDY_PERCENT
                        arrayList.Add(GetValueSetParameter(dtB_m.Rows[i]["COST_PERCENT"].ToString(), "float", false));//N_NEW_COST_PERCENT
                        arrayList.Add(Convert.ToInt32(dtB_m.Rows[i]["CONFIRM_CODE"].ToString()));//N_NEW_CONFIRM_CODE
                        arrayList.Add(System.DateTime.Now);//D_NEW_UPDATEDATE
                        arrayList.Add(dtB_m.Rows[i]["UPDATEUID"].ToString());//V_NEW_UPDATEUID
                        dbo.doUpdate(arrayList, DBT);
                    }
                    dtB_m.Clear();
                }

                if (dtB_d != null)
                {
                    for (int i = 0; i <= dtB_d.Rows.Count - 1; i++)//店群折扣 -> 修改
                    {
                        arrayList.Clear();
                        arrayList.Add(Convert.ToInt32(dtB_d.Rows[i]["ID", DataRowVersion.Original].ToString()));
                        arrayList.Add(DateTime.Parse(dtB_d.Rows[i]["CREATEDATE", DataRowVersion.Original].ToString()));
                        arrayList.Add(dtB_d.Rows[i]["CREATEUID", DataRowVersion.Original].ToString());
                        arrayList.Add(DateTime.Parse(dtB_d.Rows[i]["UPDATEDATE", DataRowVersion.Original].ToString()));
                        arrayList.Add(dtB_d.Rows[i]["UPDATEUID", DataRowVersion.Original].ToString());
                        arrayList.Add(System.DateTime.Now);//D_NEW_UPDATEDATE
                        arrayList.Add(UID);//V_NEW_UPDATEUID
                        dbo.doDelete(arrayList, DBT);
                    }
                    dtB_d.Clear();
                }

                if (dtC != null)
                {
                    DataTable dtC_i = dtC.GetChanges(DataRowState.Added);
                    DataTable dtC_m = dtC.GetChanges(DataRowState.Modified);
                    DataTable dtC_d = dtC.GetChanges(DataRowState.Deleted);

                    if (dtC_i != null)
                    {
                        for (int i = 0; i < dtC_i.Rows.Count; i++)
                        {
                            arrayList.Clear();
                            arrayList = this.GetArrayList(dtC_i.Rows[i], UID);
                            dbo.doCreateStoreDiscount(arrayList, DBT, out N_ID, out V_CODE);
                        }
                    }
                    if (dtC_m != null)
                    {
                        for (int i = 0; i <= dtC_m.Rows.Count - 1; i++)//店群折扣 -> 修改
                        {
                            arrayList.Clear();
                            arrayList.Add(Convert.ToInt32(dtC_m.Rows[i]["ID"].ToString()));
                            arrayList.Add(DateTime.Parse(dtC_m.Rows[i]["CREATEDATE", DataRowVersion.Original].ToString()));
                            arrayList.Add(dtC_m.Rows[i]["CREATEUID", DataRowVersion.Original].ToString());
                            arrayList.Add(DateTime.Parse(dtC_m.Rows[i]["UPDATEDATE", DataRowVersion.Original].ToString()));
                            arrayList.Add(dtC_m.Rows[i]["UPDATEUID", DataRowVersion.Original].ToString());
                            arrayList.Add(dtC_m.Rows[i]["CODE"].ToString());//V_NEW_CODE
                            arrayList.Add(dtC_m.Rows[i]["STORE"].ToString());//V_NEW_GROUP_NO 
                            arrayList.Add(Convert.ToDateTime(dtC_m.Rows[i]["EFF_START"].ToString()));//D_NEW_EFF_START
                            arrayList.Add(Convert.ToDateTime(dtC_m.Rows[i]["EFF_END"].ToString()));//D_NEW_EFF_END
                            arrayList.Add(Convert.ToInt32(dtC_m.Rows[i]["DISCOUNT_KIND"].ToString()));//N_NEW_DISCOUNT_KIND
                            arrayList.Add(GetValueSetParameter(dtC_m.Rows[i]["ROOT_NO"].ToString(), "string", false));//V_NEW_ROOT_NO
                            arrayList.Add(GetValueSetParameter(dtC_m.Rows[i]["PMA"].ToString(), "string", false));//V_NEW_PMA
                            arrayList.Add(GetValueSetParameter(dtC_m.Rows[i]["CATEGORY"].ToString(), "string", false));//V_NEW_CATEGORY
                            arrayList.Add(GetValueSetParameter(dtC_m.Rows[i]["ITEM"].ToString(), "string", false));//V_NEW_ITEM
                            arrayList.Add(GetValueSetParameter(dtC_m.Rows[i]["PERIOD"].ToString(), "string", false));//V_NEW_PERIOD
                            arrayList.Add(GetValueSetParameter(dtC_m.Rows[i]["PERIOD_END"].ToString(), "string", false));//V_NEW_PERIOD_END
                            arrayList.Add(GetValueSetParameter(dtC_m.Rows[i]["PRICE_DISCOUNT"].ToString(), "float", false));//N_NEW_PRICE_DISCOUNT
                            arrayList.Add(GetValueSetParameter(dtC_m.Rows[i]["FIX_PRICE_DISCOUNT"].ToString(), "float", false));//N_NEW_FIX_PRICE_DISCOUNT
                            arrayList.Add(GetValueSetParameter(dtC_m.Rows[i]["VENDOR_SUBSIDY_PERCENT"].ToString(), "float", false));//N_NEW_VENDOR_SUBSIDY_PERCENT
                            arrayList.Add(GetValueSetParameter(dtC_m.Rows[i]["COST_PERCENT"].ToString(), "float", false));//N_NEW_COST_PERCENT
                            arrayList.Add(Convert.ToInt32(dtC_m.Rows[i]["CONFIRM_CODE"].ToString()));//N_NEW_CONFIRM_CODE
                            arrayList.Add(System.DateTime.Now);//D_NEW_UPDATEDATE
                            arrayList.Add(dtC_m.Rows[i]["UPDATEUID"].ToString());//V_NEW_UPDATEUID
                            dbo.doUpdate(arrayList, DBT);
                        }
                        dtC_m.Clear();
                    }

                    if (dtC_d != null)
                    {
                        for (int i = 0; i <= dtC_d.Rows.Count - 1; i++)//店群折扣 -> 修改
                        {
                            arrayList.Clear();
                            arrayList.Add(Convert.ToInt32(dtC_d.Rows[i]["ID", DataRowVersion.Original].ToString()));
                            arrayList.Add(DateTime.Parse(dtC_d.Rows[i]["CREATEDATE", DataRowVersion.Original].ToString()));
                            arrayList.Add(dtC_d.Rows[i]["CREATEUID", DataRowVersion.Original].ToString());
                            arrayList.Add(DateTime.Parse(dtC_d.Rows[i]["UPDATEDATE", DataRowVersion.Original].ToString()));
                            arrayList.Add(dtC_d.Rows[i]["UPDATEUID", DataRowVersion.Original].ToString());
                            arrayList.Add(System.DateTime.Now);//D_NEW_UPDATEDATE
                            arrayList.Add(UID);//V_NEW_UPDATEUID
                            dbo.doDelete(arrayList, DBT);
                        }
                        dtC_d.Clear();
                    }
                }

                #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>
        /// 【功能】:新增店群折扣維護資料
        /// 
        /// 傳入值】:
        /// 〔@參考web ui spec欄位〕
        /// 
        /// 【回傳值】:
        /// 〔@新增是否成功〕
        /// 
        /// 【主要TABLE】:
        /// VDS_STM_PRICEDISCOUNT_SG
        /// 
        /// 【檢查】:
        /// 1.屬於同一店群內的折扣設定檢查
        /// IF DISCOUNT_TYPE=1 THEN //店群對大分類
        /// 如果新增的ROOT_NO||PMA已經存在,則檢查【有效開始日】要小於上一筆資料的【有效結束日】,否則顯示錯誤訊息,《有效開始日期輸入有誤,應小於相同大分類折扣
        /// 的有效結束日》。
        /// 
        /// ELSE IF DISCOUNT_TYPE=2 THEN //店群對中分類
        /// 如果新增的ROOT_NO||PMA||CATEGORY已經存在,則檢查【有效開始日】要小於上一筆資料的【有效結束日】,否則顯示錯誤訊息,《有效開始日期輸入有誤,
        /// 應小於相同折扣的有效結束日》。
        /// 
        /// ELSE DISCOUNT_TYPE=4  //店群對單品
        /// 如果新增的ITEM已經存在,則檢查【有效開始日】要小於上一筆資料的【有效結束日】,否則顯示錯誤訊息,《有效開始日期輸入有誤,應小於相同大分類折扣的有效結束日》。
        /// 
        /// END IF
        /// 
        /// 【說明】:
        /// 1.必填的欄位如果是空值,則INSERT空白,長度參照Table Schema。
        /// 2.如果檢查無誤,則正確新增資料,如有錯誤則要回傳錯誤訊息。
        /// 3.如果群分類=2(圖書),PERIOD期別欄位='000000'
        /// </summary>
        public void CreateStoreDiscount(DataTable dtA, DataTable dtB, DataTable dtC, string UID, DbTransaction RootDBT)
        {
            bool IsRootTranscation = false;

            try
            {
                DBO.STM_STM19_DBO dbo = new STM_STM19_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
                int N_ID;
                string V_CODE;
                ArrayList ParameterList = new ArrayList();

                if (dtA != null)
                {
                    for (int i = 0; i < dtA.Rows.Count; i++)
                    {
                        ParameterList.Clear();
                        ParameterList = this.GetArrayList(dtA.Rows[i], UID);
                        dbo.doCreateStoreDiscount(ParameterList, DBT, out N_ID, out V_CODE);
                    }
                }
                if (dtB != null)
                {
                    for (int i = 0; i < dtB.Rows.Count; i++)
                    {
                        ParameterList.Clear();
                        ParameterList = this.GetArrayList(dtB.Rows[i], UID);
                        dbo.doCreateStoreDiscount(ParameterList, DBT, out N_ID, out V_CODE);
                    }
                }
                if (dtC != null)
                {
                    for (int i = 0; i < dtC.Rows.Count; i++)
                    {
                        ParameterList.Clear();
                        ParameterList = this.GetArrayList(dtC.Rows[i], UID);
                        dbo.doCreateStoreDiscount(ParameterList, DBT, out N_ID, out V_CODE);
                    }
                }
                if (IsRootTranscation)
                {
                    //獨立呼叫Transcation成立
                    DBT.Commit();
                }




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

                DBT.Rollback();
                #endregion

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

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

                #endregion

            }
        }