Exemplo n.º 1
0
        /// <summary>
        /// 撰寫APLOG方法(DB)
        /// </summary>
        /// <param name="ParameterList">輸入變數</param>
        /// <param name="RootDBT">是否有主交易,無主交易輸入null</param>        
        public void WriteApLog(ArrayList ParameterList,
                               DbTransaction RootDBT
                               )
        {
            bool IsRootTranscation = false;

            try
            {
                DBO.SYS_LOGDBO LOG = new SYS_LOGDBO(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

                LOG.AddApLog(ParameterList, RootDBT);

                #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

            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// AP稽核軌跡(個資稽核)
 /// </summary>
 /// <param name="ParameterList"></param>
 public void AddSafeLog(ArrayList ParameterList)
 {
     try
     {
         DBO.SYS_LOGDBO dbo = new SYS_LOGDBO(ref USEDB);
         dbo.AddSafeLog(ParameterList);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// 寫入LOG
        /// </summary>
        /// <param name="FunctionName">模組+功能代號</param>
        /// <param name="RS">OK:成功,NG:失敗</param>
        /// <param name="StepStr">步驟</param>
        public void LogAdd(string FunctionName,
                           bool ResultStatus,
                           string StepStr
                           )
        {
            DbTransaction DBT = null;
            try
            {
                SYS_LOGDBO LOG = new SYS_LOGDBO(ref USEDB);

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

                ArrayList ParameterList = new ArrayList();

                ParameterList.Add(1);
                ParameterList.Add(FunctionName);
                ParameterList.Add((ResultStatus) ? "OK" : "NG");
                ParameterList.Add(StepStr);

                LOG.AddApLog(ParameterList, DBT);

                DBT.Commit();


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

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

                #endregion

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

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

                #endregion

            }

        }