Пример #1
0
 public DataTable QueryVirtualLocate(ArrayList ParameterList)
 {
     try
     {
         DBO.VDS_IVM30_DBO PickVirtual = new VDS_IVM30_DBO(ref USEDB);
         return PickVirtual.QueryVirtualLocate(ParameterList);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #2
0
        public bool CREATE_VDS_IVM_PICK_VIRTUAL(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

                VDS_IVM30_DBO DBO = new VDS_IVM30_DBO(ref USEDB);
                bool bool_Result = DBO.CREATE_VDS_IVM_PICK_VIRTUAL(ParameterList, DBT);

                #region 交易成功

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

                #endregion

                return bool_Result;

            }
            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
            }
        }
Пример #3
0
        /// <summary>
        /// 基本表單更新BCO
        /// </summary>
        /// <param name="DetailData">更新變數</param>
        /// <param name="RootDBT">是否有主交易,無主交易輸入null</param>
        /// <returns>回傳成功與否</returns>
        public bool UpdateDetail(string strUID, DataTable DetailData, DbTransaction RootDBT)
        {
            bool IsRootTranscation = false;
            bool bResult = false;
            try
            {
                DBO.VDS_IVM30_DBO DBO = new VDS_IVM30_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

                ArrayList ParameterList = new ArrayList();

                for (Int32 i = 0; i <= DetailData.Rows.Count - 1; i++)
                {
                    if (DetailData.Rows[i]["VIRTUAL_LOCATE_OLD"].ToString() != DetailData.Rows[i]["VIRTUAL_LOCATE"].ToString())//要更新
                    {
                        ParameterList.Clear();
                        ParameterList.Add(strUID);
                        ParameterList.Add(DetailData.Rows[i]["ST_ACCEPT_DATE"]);
                        ParameterList.Add(DetailData.Rows[i]["ITEM"]);
                        ParameterList.Add(DetailData.Rows[i]["PERIOD"]);
                        ParameterList.Add(DetailData.Rows[i]["VIRTUAL_CODE"]);
                        ParameterList.Add(DetailData.Rows[i]["PICK_BATCH"]);
                        ParameterList.Add(DetailData.Rows[i]["VIRTUAL_LOCATE"]);

                        string[] strReturn = DBO.UPDATE_VDS_IVM_PICK_VIRTUAL(ParameterList, DBT);
                        if (strReturn[0] != "0")
                        {
                            throw new Exception(strReturn[1]);
                        }
                    }
                }

                #region 交易成功

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

                #endregion

                bResult = true;

                return bResult;
            }
            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
            }
        }