예제 #1
0
 /// <summary>
 /// 參照商品清單
 /// </summary>
 /// <param name="ParameterList">輸入變數</param>
 /// <returns>回傳查詢結果</returns>
 public DataTable QueryDisItemReferFor111(ArrayList ParameterList)
 {
     #region
     try
     {
         VDS_ALO_DIS_ITEM_REFER_DBO DBO = new VDS_ALO_DIS_ITEM_REFER_DBO(ref USEDB);
         return DBO.doQueryDisItemReferFor111(ParameterList);
     }
     catch (Exception ex)
     {
         throw GetNewException(ex);
     }
     #endregion
 }
예제 #2
0
 public DataTable GetDisItemReferSchema()
 {
     #region
     try
     {
         VDS_ALO_DIS_ITEM_REFER_DBO DBO = new VDS_ALO_DIS_ITEM_REFER_DBO(ref USEDB);
         return DBO.doGetDisItemReferSchema();
     }
     catch (Exception ex)
     {
         throw GetNewException(ex);
     }
     #endregion
 }
예제 #3
0
        public bool UpdateDisItemReferFor111_2(ArrayList ParameterList, DbTransaction RootDBT)
        {
            #region
            bool bResult = false;
            bool IsRootTranscation = false;

            try
            {
                VDS_ALO_DIS_ITEM_REFER_DBO ALOM = new VDS_ALO_DIS_ITEM_REFER_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 = ALOM.doUpdateDisItemReferFor111_2(ParameterList, DBT);

                #region 交易成功

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

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

                bResult = false;

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

                #endregion

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

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

                #endregion

            }

            return bResult;
            #endregion
        }
예제 #4
0
        public bool CreateDisItemReferForAll(DataTable dtDisItemRefer, DataTable dtDisChan, string vDisNo, string vItem, string vPeriod, DbTransaction RootDBT)
        {
            #region
            bool bResult = false;
            bool IsRootTranscation = false;

            try
            {
                VDS_ALO_DIS_ITEM_REFER_DBO ALOM = new VDS_ALO_DIS_ITEM_REFER_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}.CreateDisItemReferForAll.Open Connetction:{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}.CreateDisItemReferForAll.Used Old Connetction:{2} ",
                                                                     System.Web.HttpContext.Current.Session["UID"].ToString(),
                                                                      DateTime.Now.ToString(),
                                                                      DBT.GetHashCode().ToString())
                                                              );
                }

                #endregion


                //a) 建立新資料
                bResult = CreateItemAndChanRefer(dtDisItemRefer, dtDisChan, vDisNo, vItem, vPeriod, DBT);

                #region 交易成功

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

                bResult = true;
                #endregion
            }
            catch (Exception ex)
            {
                #region 交易失敗

                bResult = false;

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

                #endregion

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

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

                #endregion

            }

            return bResult;
            #endregion
        }