Example #1
0
        private static DataAudit GetDataAuditLog(string userId, string collectionName, string entityId, string entityKeyField, DataAuditType auditType, string contractNumber)
        {
            DataAudit auditLog = new DataAudit()
            {
                EntityID   = entityId,
                UserId     = userId,
                Contract   = contractNumber,
                EntityType = collectionName,
                Type       = auditType.ToString(),
                Entity     = GetMongoEntity(contractNumber, collectionName, entityId, entityKeyField)
            };

            return(auditLog);
        }
Example #2
0
        private static void DataAuditAsynch(string userId, string collectionName, string entityId, string entityKeyField, DataAuditType auditType, string contractNumber)
        {
            //throw new SystemException("test error in new thread starts");

            DataAudit data = GetDataAuditLog(userId, collectionName, entityId, entityKeyField, auditType, contractNumber);

            AuditDispatcher.WriteAudit(data, string.Format("{0}_{1}", data.Type, data.EntityType));
        }
Example #3
0
 public static void LogDataAudit(string userId, string collectionName, List <string> entityIds, DataAuditType auditType, string contractNumber)
 {
     new Thread(() =>
     {
         foreach (string entityId in entityIds)
         {
             AuditHelper.LogDataAuditNoThread(userId, collectionName, entityId, "_id", auditType, contractNumber);
         }
     }).Start();
 }
Example #4
0
        public static void LogDataAudit(string userId, string collectionName, string entityId, string entityKeyField, DataAuditType auditType, string contractNumber)
        {
            //hand to a new thread here, and immediately return this thread to caller
            try
            {
                //throw new SystemException("test before new thread starts");
                new Thread(() =>
                {
                    try
                    {
                        DataAuditAsynch(userId, collectionName, entityId, entityKeyField, auditType, contractNumber);
                    }
                    catch (Exception newthreadex)
                    {
                        //if there's an error from the new thread, handle it here, so we don't black the main thread
                        string aseAPIURL = ConfigurationManager.AppSettings.Get("ASEAPI");
                        int procID       = int.Parse(ConfigurationManager.AppSettings.Get("ASEProcessID"));
                        //Log.LogError(aseAPIURL, procID, newthreadex, LogErrorCode.Error, LogErrorSeverity.Medium);
                    }
                }).Start();
            }
            catch (Exception ex)
            {
                //handle the exception here, to make sure we don't block the main thread?
            }

            return;
        }
Example #5
0
 public static void LogDataAudit(string userId, string collectionName, string entityId, DataAuditType auditType, string contractNumber)
 {
     AuditHelper.LogDataAudit(userId, collectionName, entityId, "_id", auditType, contractNumber);
 }