Пример #1
0
        protected void btnCreateSchema_Click(object sender, EventArgs e)
        {
            List <OHTarget> OHTargets = App.Logger.NLogUtilities.GetOHTargets();

            foreach (var target in OHTargets)
            {
                OHDbBaseClient dbClient = OHDbFactory.GetDbClient(target);
                dbClient.CreateDBSchema();
                break;
            }
        }
Пример #2
0
        protected void btnGetVersion_Click(object sender, EventArgs e)
        {
            List <OHTarget> OHTargets = App.Logger.NLogUtilities.GetOHTargets();

            foreach (var target in OHTargets)
            {
                OHDbBaseClient dbClient = OHDbFactory.GetDbClient(target);
                gridResult.DataSource = dbClient.GetVersion(typeof(Customer), "2", new DateTime(2010, 5, 22, 3, 0, 0)).AsDataTable();
                gridResult.DataBind();
                break;
            }
        }
Пример #3
0
        protected void btnGetHistory_Click(object sender, EventArgs e)
        {
            List <OHTarget> OHTargets = App.Logger.NLogUtilities.GetOHTargets();

            foreach (var target in OHTargets)
            {
                OHDbBaseClient dbClient = OHDbFactory.GetDbClient(target);

                gridResult.DataSource = dbClient.GetHistory(typeof(Supplier), "4").AsDataTable();
                gridResult.DataBind();
                break;
            }
        }
Пример #4
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;
        }
Пример #5
0
 public void CreateDatabase()
 {
     ValidateMandatoryOptions();
     Data.OHDbBaseClient dbClient = OHDbFactory.GetDbClient(this);
     dbClient.CreateDBSchema();
 }