Ejemplo n.º 1
0
 public DataTable QueryDisTypeTmp(ArrayList ParameterList)
 {
     #region
     try
     {
         VDS_ALO_DISTYPE_TMP_DBO DBO = new VDS_ALO_DISTYPE_TMP_DBO(ref USEDB);
         return DBO.doQueryDisTypeTmp(ParameterList);
     }
     catch (Exception ex)
     {
         throw GetNewException(ex);
     }
     #endregion
 }
Ejemplo n.º 2
0
 public DataTable GetDisTypeTmpSchema()
 {
     #region
     try
     {
         VDS_ALO_DISTYPE_TMP_DBO DBO = new VDS_ALO_DISTYPE_TMP_DBO(ref USEDB);
         return DBO.doGetDisTypeTmpSchema();
     }
     catch (Exception ex)
     {
         throw GetNewException(ex);
     }
     #endregion
 }
Ejemplo n.º 3
0
        public bool SaveDisTypeTmp(DataTable dtDisTypeTmp, string V_DIS_NO, string V_ITEM, string V_PERIOD, DbTransaction RootDBT)
        {
            bool bResult = false;
            bool IsRootTranscation = false;
            VDS_ALO_DISTYPE_TMP_DBO DBO = new VDS_ALO_DISTYPE_TMP_DBO(ref USEDB);

            ArrayList ParameterList = new ArrayList();

            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


                ParameterList.Clear();
                ParameterList.Add(V_DIS_NO);
                ParameterList.Add(V_ITEM);
                ParameterList.Add(V_PERIOD);

                if (dtDisTypeTmp != null && dtDisTypeTmp.Rows.Count > 0)
                {
                    ParameterList.Add(dtDisTypeTmp.Rows[0]["DIS_TYPE"]);
                    ParameterList.Add(dtDisTypeTmp.Rows[0]["DIS_QTY"]);
                    ParameterList.Add(dtDisTypeTmp.Rows[0]["UPDATEDATE"]);
                    ParameterList.Add(dtDisTypeTmp.Rows[0]["UPDATEUID"]);  
                }


                bResult = DBO.doCreateOne(ParameterList, 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;
        }