//adding new event private void AddNewEventToDB(SystemEventTypeEnum eventType, string eventText) { try { int newID = GetNewIdentity(); _realm.Write(() => { _realm.Add(new SystemEventDefinition() { Identity = newID, DateTime = TimeStampConverter.ConvertToInteger(DateTime.Now), Text = eventText, EventType = SystemEventTypeConverter.ConvertEnumToInteger(eventType), }); }); } catch (Exception ex) { _logger.Error($"Error while trying to save new system event to DB. EventType: {eventType.ToString()}, text: {eventText}. Error: {ex.Message}."); } }
public void SaveNewEvent(SystemEventTypeEnum eventType, string eventText) { _logger.Info($"Method for saving new system event to DB fired. Event type: {eventType.ToString()}."); AddNewEventToDB(eventType, eventText); }