/// <summary> /// Saves an event / exception to database /// </summary> /// <param name="ex">Exception</param> public void AddEvent(string message) { var ev = new EventLog { EventLogTime = DateTime.Now, Message = message }; db.Add(ev); db.Save(); }
/// <summary> /// Saves an event / exception to database /// </summary> /// <param name="accessCode">Access code</param> /// <param name="message">Message</param> /// <param name="page">Calling page</param> public void AddEvent(string accessCode, string message, string page) { var ev = new EventLog { EventLogTime = DateTime.Now, AccessCode = accessCode, Message = message, Page = page }; db.Add(ev); db.Save(); }
/// <summary> /// Save events / exceptions on this page /// </summary> private void SaveExceptions(string message, string method) { using (var db = new PersistedRepository()) { var evlog = new EventLog { EventLogTime = DateTime.Now, Message = message, PlayerId = 0, AccessCode = LblAccessCode.Text, Page = "default", PageStep = 0, Method = method }; db.Add(evlog); } }
/// <summary> /// Remove a event log entry from database /// </summary> public void Remove(EventLog eventLog) { db.EventLogs.Remove(eventLog); db.SaveChanges(); }
/// <summary> /// Add an event log entry to the database /// </summary> public void Add(EventLog eventLog) { db.EventLogs.Add(eventLog); db.SaveChanges(); }