public bool CreateChainItemInfo(ArrayList ParameterList, out string strID, DbTransaction RootDBT)
        {
            bool IsRootTranscation = false;
            int iResult = 0;
            bool bResult = false;
            try
            {

                MKT_ChainItemInfoDBO DBO = new MKT_ChainItemInfoDBO(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


                iResult = DBO.doCreateChainItemInfo(DBT, ParameterList);
                //6.CHAN_NO
                //7.ITEM
                //8.PERIOD
                //9.CHAN_CODE
                ArrayList Para = new ArrayList();
                Para.Clear();
                Para.Add(ParameterList[6].ToString());
                Para.Add(ParameterList[7].ToString());
                Para.Add(ParameterList[8].ToString());
                Para.Add(ParameterList[9].ToString());
                iResult = DBO.doUpdateITEM_MAP(DBT, Para);
                #region 交易成功

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

                #endregion

                //6.CHAN_NO
                //7.ITEM
                //8.PERIOD
                Para.Clear();
                Para.Add(ParameterList[6].ToString());
                Para.Add(ParameterList[7].ToString());
                Para.Add(ParameterList[8].ToString());
                DataTable dt = QueryID(Para);

                strID = dt.Rows[0]["ID"].ToString().Trim();

            }
            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
            }
            return bResult;
        }
        public bool UpdateChainItemInfo(ArrayList ParameterList, DbTransaction RootDBT)
        {
            bool IsRootTranscation = false;
            int iResult = 0;
            bool bResult = false;
            string strID = string.Empty;
            try
            {

                MKT_ChainItemInfoDBO DBO = new MKT_ChainItemInfoDBO(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

                //0.NAME
                //1.OLD_UPDATEDATE
                //2.OLD_UPDATEUID
                //3.UPDATEDATE
                //4.UPDATEUID
                //5.ENABLE
                //6.CHAN_NO
                //7.ITEM
                //8.PERIOD
                //9.CHAN_CODE
                //10.EAN_CODE
                //11.BARCODE
                //12.PERIOD_BARCODE
                //13.DATASOURCE
                //14.MEMO
                //15.PRICES
                //16.COVER_PRICE
                //17.COST_PRICE
                //18.CHECK_FLAG
                //19.VDS_PRICE   

                iResult = DBO.doUpdateChainItemInfo(DBT, ParameterList);

                //更新 [期別通路檔].對應通路之通路對照號
                //6.CHAN_NO
                //7.ITEM
                //8.PERIOD
                //9.CHAN_CODE
                ArrayList Para = new ArrayList();
                Para.Clear();
                Para.Add(ParameterList[6].ToString());
                Para.Add(ParameterList[7].ToString());
                Para.Add(ParameterList[8].ToString());
                Para.Add(ParameterList[9].ToString());
                iResult = DBO.doUpdateITEM_MAP(DBT, Para);


                #region 交易成功

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

                #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
            }
            return bResult;
        }
        public ArrayList TmpToDB(string strLoginUser, string strStoreChain)
        {
            ArrayList arl_Return = new ArrayList();
            int i_Total_count = 0;
            int i_Right_count = 0;
            int i_Wrong_count = 0;

            string strErrMsg = "";

            Int32 iErrCount = 0;
            ArrayList ParameterList = new ArrayList();
            ArrayList pList = new ArrayList();

            try
            {

                //獨立呼叫啟動Transcation
                Conn = USEDB.CreateConnection();
                Conn.Open();
                DBT = Conn.BeginTransaction();

                ParameterList.Clear();
                DBO.MKT_ChainItemInfoDBO dbo = new MKT_ChainItemInfoDBO(ref USEDB);

                //0.V_NAME           
                //1.V_CREATEDATE     
                //2.V_CREATEUID      
                //3.V_UPDATEDATE     
                //4.V_UPDATEUID      
                //5.V_ENABLE         
                //6.V_CHAN_NO        
                //7.V_ITEM           
                //8.V_PERIOD         
                //9.V_CHAN_CODE      
                //10.V_EAN_CODE       
                //11.V_BARCODE        
                //12.V_PERIOD_BARCODE 
                //13.V_DATASOURCE     
                //14.V_MEMO           
                //15.V_PRICES         
                //16.V_COVER_PRICE    
                //18.17.V_COST_PRICE     
                //19.V_CHECK_FLAG     
                //20.V_VDS_PRICE 

                string strNowTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                ParameterList.Clear();
                ParameterList.Add(strLoginUser);
                DataTable dt = dbo.doQueryTemp(ParameterList);

                foreach (DataRow dr in dt.Rows)
                {
                    i_Total_count++;
                    string strMemo = "";
                    string strITEM = dr["ITEM"].ToString().Trim();
                    string strBARCODE = dr["BARCODE"].ToString().Trim();
                    string strPERIOD_BARCODE = dr["PERIOD_BARCODE"].ToString().Trim();
                    int iCheckState = 0;
                    string strExistTmp2 = dr["t2_exist"].ToString().Trim();
                    if (strExistTmp2 != "")
                    {
                        iCheckState = CheckData(strITEM, strBARCODE, strPERIOD_BARCODE, dr["PRICES"].ToString(), dr["COVER_PRICE"].ToString(), dr["COST_PRICE"].ToString());
                    }
                    else
                    {
                        iCheckState = 1;//新增 Tmp1有 Tmp2沒有
                    }

                    //新增到 vds_mkt_chainiteminfo 通路對照檔
                    if (dr["PERIOD"].ToString().Trim() != "XXXXXX")
                    {
                        ParameterList.Clear();
                        ParameterList.Add(dr["ITEM"].ToString());          //0.V_NAME
                        ParameterList.Add(strNowTime);                     //1.V_CREATEDATE 
                        ParameterList.Add(strLoginUser);                   //2.V_CREATEUID                                  
                        ParameterList.Add(strNowTime);                     //3.V_UPDATEDATE     
                        ParameterList.Add(strLoginUser);                   //4.V_UPDATEUID    
                        ParameterList.Add("1");                            //5.V_ENABLE         
                        ParameterList.Add(dr["CHAN_NO"].ToString());       //6.V_CHAN_NO        
                        ParameterList.Add(dr["ITEM"].ToString());          //7.V_ITEM           
                        ParameterList.Add(dr["PERIOD"].ToString());        //8.V_PERIOD         
                        ParameterList.Add(dr["CHAN_CODE"].ToString());     //9.V_CHAN_CODE      
                        ParameterList.Add(dr["EAN_CODE"].ToString());      //10.V_EAN_CODE       
                        ParameterList.Add(dr["BARCODE"].ToString());       //11.V_BARCODE        
                        ParameterList.Add(dr["PERIOD_BARCODE"].ToString());//12.V_PERIOD_BARCODE 
                        ParameterList.Add("2");                            //13.V_DATASOURCE     
                        ParameterList.Add(dr["MEMO"].ToString());          //14.V_MEMO           
                        ParameterList.Add(dr["PRICES"].ToString());        //15.V_PRICES         
                        ParameterList.Add(dr["COVER_PRICE"].ToString());   //16.V_COVER_PRICE    
                        ParameterList.Add(dr["COST_PRICE"].ToString());    //18.17.V_COST_PRICE     
                        ParameterList.Add(iCheckState);                    //19.V_CHECK_FLAG 1:新增 2:異動 3:即有品項
                        ParameterList.Add("0");                            //20.V_VDS_PRICE 
                        dbo.doCreateChainItemInfo(DBT, ParameterList);
                    }

                    if (iCheckState == 3)
                    {
                        //假如是既有商品 更新 [期別通路檔].對應通路之通路對照號
                        //0.CHAN_NO
                        //1.ITEM
                        //2.PERIOD
                        //3.CHAN_CODE                        
                        ParameterList.Clear();
                        ParameterList.Add(dr["CHAN_NO"].ToString());
                        ParameterList.Add(dr["ITEM"].ToString());
                        ParameterList.Add(dr["PERIOD"].ToString());
                        ParameterList.Add(dr["CHAN_CODE"].ToString());
                        dbo.doUpdateITEM_MAP(DBT, ParameterList);
                    }

                    //更新 VDS_MKT_CHAINITEMINFO_TMP1 的 DATATYPE 變成 2:TMP TO DB
                    //0.V_ID
                    //1.V_UID
                    //2.V_STATUS
                    //3.V_DATATYPE
                    //4.V_ERROR_MEMO
                    if (iCheckState == 2)
                    {
                        strMemo = "調價";
                    }
                    else if (iCheckState == 4)
                    {
                        strMemo = "其他例外錯誤";
                    }
                    ParameterList.Clear();
                    ParameterList.Add(dr["ID"].ToString());
                    ParameterList.Add(strLoginUser);
                    ParameterList.Add("");
                    ParameterList.Add("2");
                    ParameterList.Add(strMemo);

                    dbo.doUpdateTmp(DBT, ParameterList);
                    i_Right_count++;

                    //i_Wrong_count++;                    
                }

                DBT.Commit();

                arl_Return.Add("TRUE");
                arl_Return.Add(i_Total_count);
                arl_Return.Add(i_Right_count);
                arl_Return.Add(i_Wrong_count);

            }
            catch (Exception ex)
            {
                DBT.Rollback();
                arl_Return.Add("FALSE");
                arl_Return.Add(ex.Message);
                throw ex;
            }

            return arl_Return;
        }