Beispiel #1
0
        /// <summary>
        /// todoComment
        /// </summary>
        /// <param name="AErrorCode"></param>
        /// <param name="AContext"></param>
        /// <param name="AMessageLine1"></param>
        /// <param name="AMessageLine2"></param>
        /// <param name="AMessageLine3"></param>
        /// <param name="AUserID"></param>
        /// <param name="AProcessID"></param>
        public void AddErrorLogEntry(String AErrorCode,
                                     String AContext,
                                     String AMessageLine1,
                                     String AMessageLine2,
                                     String AMessageLine3,
                                     String AUserID,
                                     Int32 AProcessID)
        {
            SErrorLogTable ErrorLogTable;
            SErrorLogRow   NewErrorLogRow;
            DateTime       ErrorLogDateTime;
            String         Context;

            ErrorLogTable    = new SErrorLogTable();
            NewErrorLogRow   = ErrorLogTable.NewRowTyped(false);
            ErrorLogDateTime = DateTime.Now;

            if (AContext != "")
            {
                Context = AContext;
            }
            else
            {
                Context = UNKNOWN_CONTEXT;
            }

            // Set DataRow values
            NewErrorLogRow.ErrorCode     = AErrorCode;
            NewErrorLogRow.UserId        = AUserID.ToUpper();
            NewErrorLogRow.Date          = ErrorLogDateTime;
            NewErrorLogRow.Time          = Conversions.DateTimeToInt32Time(ErrorLogDateTime);
            NewErrorLogRow.ReleaseNumber = TSrvSetting.ApplicationVersion.ToString();
            NewErrorLogRow.FileName      = Context;
            NewErrorLogRow.ProcessId     = AProcessID.ToString();
            NewErrorLogRow.MessageLine1  = AMessageLine1;
            NewErrorLogRow.MessageLine2  = AMessageLine2;
            NewErrorLogRow.MessageLine3  = AMessageLine3;
            ErrorLogTable.Rows.Add(NewErrorLogRow);

            TDataBase      db = DBAccess.Connect("AddErrorLogEntry");
            TDBTransaction WriteTransaction = db.BeginTransaction(IsolationLevel.Serializable);

            // Save DataRow
            try
            {
                SErrorLogAccess.SubmitChanges(ErrorLogTable, WriteTransaction);

                WriteTransaction.Commit();
            }
            catch (Exception Exc)
            {
                TLogging.Log("An Exception occured during the saving of the Error Log:" + Environment.NewLine + Exc.ToString());

                WriteTransaction.Rollback();

                throw;
            }
        }
Beispiel #2
0
        /// <summary>
        /// todoComment
        /// </summary>
        /// <param name="AErrorCode"></param>
        /// <param name="AContext"></param>
        /// <param name="AMessageLine1"></param>
        /// <param name="AMessageLine2"></param>
        /// <param name="AMessageLine3"></param>
        /// <param name="AUserID"></param>
        /// <param name="AProcessID"></param>
        public void AddErrorLogEntry(String AErrorCode,
            String AContext,
            String AMessageLine1,
            String AMessageLine2,
            String AMessageLine3,
            String AUserID,
            Int32 AProcessID)
        {
            TDBTransaction WriteTransaction;

            SErrorLogTable ErrorLogTable;
            SErrorLogRow NewErrorLogRow;
            DateTime ErrorLogDateTime;
            Boolean NewTransaction;
            String Context;

            ErrorLogTable = new SErrorLogTable();
            NewErrorLogRow = ErrorLogTable.NewRowTyped(false);
            ErrorLogDateTime = DateTime.Now;

            if (AContext != "")
            {
                Context = AContext;
            }
            else
            {
                Context = UNKNOWN_CONTEXT;
            }

            // Set DataRow values
            NewErrorLogRow.ErrorCode = AErrorCode;
            NewErrorLogRow.UserId = AUserID.ToUpper();
            NewErrorLogRow.Date = ErrorLogDateTime;
            NewErrorLogRow.Time = Conversions.DateTimeToInt32Time(ErrorLogDateTime);
            NewErrorLogRow.ReleaseNumber = TSrvSetting.ApplicationVersion.ToString();
            NewErrorLogRow.FileName = Context;
            NewErrorLogRow.ProcessId = AProcessID.ToString();
            NewErrorLogRow.MessageLine1 = AMessageLine1;
            NewErrorLogRow.MessageLine2 = AMessageLine2;
            NewErrorLogRow.MessageLine3 = AMessageLine3;
            ErrorLogTable.Rows.Add(NewErrorLogRow);

            // Save DataRow
            WriteTransaction = DBAccess.GDBAccessObj.GetNewOrExistingTransaction(IsolationLevel.ReadCommitted,
                TEnforceIsolationLevel.eilMinimum,
                out NewTransaction);

            try
            {
                SErrorLogAccess.SubmitChanges(ErrorLogTable, WriteTransaction);

                if (NewTransaction)
                {
                    DBAccess.GDBAccessObj.CommitTransaction();
                }
            }
            catch (Exception Exc)
            {
                TLogging.Log("An Exception occured during the saving of the Error Log:" + Environment.NewLine + Exc.ToString());

                if (NewTransaction)
                {
                    DBAccess.GDBAccessObj.RollbackTransaction();
                }

                throw;
            }
        }
Beispiel #3
0
        /// <summary>
        /// todoComment
        /// </summary>
        /// <param name="AErrorCode"></param>
        /// <param name="AContext"></param>
        /// <param name="AMessageLine1"></param>
        /// <param name="AMessageLine2"></param>
        /// <param name="AMessageLine3"></param>
        /// <param name="AUserID"></param>
        /// <param name="AProcessID"></param>
        public void AddErrorLogEntry(String AErrorCode,
                                     String AContext,
                                     String AMessageLine1,
                                     String AMessageLine2,
                                     String AMessageLine3,
                                     String AUserID,
                                     Int32 AProcessID)
        {
            TDBTransaction WriteTransaction;

            SErrorLogTable ErrorLogTable;
            SErrorLogRow   NewErrorLogRow;
            DateTime       ErrorLogDateTime;
            Boolean        NewTransaction;
            String         Context;

            ErrorLogTable    = new SErrorLogTable();
            NewErrorLogRow   = ErrorLogTable.NewRowTyped(false);
            ErrorLogDateTime = DateTime.Now;

            if (AContext != "")
            {
                Context = AContext;
            }
            else
            {
                Context = UNKNOWN_CONTEXT;
            }

            // Set DataRow values
            NewErrorLogRow.ErrorCode     = AErrorCode;
            NewErrorLogRow.UserId        = AUserID.ToUpper();
            NewErrorLogRow.Date          = ErrorLogDateTime;
            NewErrorLogRow.Time          = Conversions.DateTimeToInt32Time(ErrorLogDateTime);
            NewErrorLogRow.ReleaseNumber = TSrvSetting.ApplicationVersion.ToString();
            NewErrorLogRow.FileName      = Context;
            NewErrorLogRow.ProcessId     = AProcessID.ToString();
            NewErrorLogRow.MessageLine1  = AMessageLine1;
            NewErrorLogRow.MessageLine2  = AMessageLine2;
            NewErrorLogRow.MessageLine3  = AMessageLine3;
            ErrorLogTable.Rows.Add(NewErrorLogRow);

            // Save DataRow
            WriteTransaction = DBAccess.GDBAccessObj.GetNewOrExistingTransaction(IsolationLevel.ReadCommitted,
                                                                                 TEnforceIsolationLevel.eilMinimum,
                                                                                 out NewTransaction);

            try
            {
                SErrorLogAccess.SubmitChanges(ErrorLogTable, WriteTransaction);

                if (NewTransaction)
                {
                    DBAccess.GDBAccessObj.CommitTransaction();
                }
            }
            catch (Exception Exc)
            {
                TLogging.Log("An Exception occured during the saving of the Error Log:" + Environment.NewLine + Exc.ToString());

                if (NewTransaction)
                {
                    DBAccess.GDBAccessObj.RollbackTransaction();
                }

                throw;
            }
        }