Exemplo n.º 1
0
 public OHPropertyInfo(string name, string value, PropertyInfo propInfo, OHInfo objInfo)
 {
     Name     = name;
     ObjInfo  = ObjInfo;
     PropInfo = propInfo;
     Value    = value;
 }
Exemplo n.º 2
0
        protected override void Write(NLog.LogEventInfo logEvent)
        {
            ValidateMandatoryOptions();

            if (AutoCreateDatabase)
            {
                CreateDatabase();
            }

            List <OHInfo> objectsToLog = new List <OHInfo>();
            OHAuditInfo   auditInfo    = null;

            if (logEvent.Parameters != null && logEvent.Parameters.Length > 0)
            {
                for (int p = 0; p < logEvent.Parameters.Length; p++)
                {
                    if (logEvent.Parameters[p] is OHAuditInfo)
                    {
                        auditInfo = (OHAuditInfo)logEvent.Parameters[p];
                    }
                    else
                    {
                        OHInfo info = new OHInfo(logEvent.Parameters[p], this);
                        if (info.IsLoggable)
                        {
                            objectsToLog.Add(info);
                        }
                    }
                }

                Data.OHDbBaseClient dbClient = OHDbFactory.GetDbClient(this);

                for (int i = 0; i < objectsToLog.Count; i++)
                {
                    if (auditInfo != null)
                    {
                        objectsToLog[i].User = auditInfo.UserName;
                    }
                    dbClient.SaveObject(objectsToLog[i], this);
                }
            }

            string cs = ConnectionString;
        }