Exemplo n.º 1
0
        private List <int> ConvertEntriesListToIntList(List <SystemEventTypeEnum> entriesList)
        {
            List <int> entriesIntList = new List <int>();

            foreach (var item in entriesList)
            {
                entriesIntList.Add(SystemEventTypeConverter.ConvertEnumToInteger(item));
            }

            return(entriesIntList);
        }
Exemplo n.º 2
0
        private SystemEventGUImodel ConvertRawModelToGUImodel(SystemEventDefinition model)
        {
            SystemEventGUImodel guiModel = new SystemEventGUImodel()
            {
                Identity  = model.Identity,
                Timestamp = TimeStampConverter.UnixTimeStampToDateTime(model.DateTime),
                Text      = model.Text,
                Entry     = SystemEventTypeConverter.ConvertIntegerToEnum(model.EventType).ToString(),
            };

            return(guiModel);
        }
        //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}.");
            }
        }