public bool AddLogMessage(LogMessage logMessage, bool bSave)
        {
            Debug.WriteLine(GetType().FullName + "." + MethodBase.GetCurrentMethod().Name);

            //want to force this to hit the db if the model is invalid
            logMessage = (LogMessage) logMessage.ForceValidData();

            _context.LogMessages.Add(logMessage);
            return !bSave || Save();
        }
Пример #2
0
        public bool LogMessage(string strLogMessage)
        {
            Debug.WriteLine(GetType().FullName + "." + MethodBase.GetCurrentMethod().Name);

            var logMessage = new LogMessage
            {
                StrLogMessage = strLogMessage,
                DtCreated = DateTime.UtcNow
            };

            return _logMessageRepository.AddLogMessage(logMessage, true);
        }
        private static LogMessage CreateJItem(dynamic jItem)
        {
            var logMessage = new LogMessage()
            {
                DtCreated = jItem.dtCreated == null ? DateTime.UtcNow : DateTime.Parse(jItem.dtCreated.ToString()),
                StrLogMessage = jItem.strLogMessage
            };

            return logMessage;
        }
        public bool UpdateLogMessage(LogMessage item, bool bSave)
        {
            Debug.WriteLine(GetType().FullName + "." + MethodBase.GetCurrentMethod().Name);

            //want to force this to hit the db if the model is invalid
            item = (LogMessage)item.ForceValidData();

            var oldItem = _context.LogMessages.FirstOrDefault(x => x.Id == item.Id);
            if (oldItem != null && oldItem.Id != default(int))
            {
                _context.LogMessages.Remove(oldItem);
                _context.LogMessages.Add(item);
                return !bSave || Save();
            }
            else
                return false;
        }
Пример #5
0
        public bool UpdateLogMessage(LogMessage logMessage)
        {
            Debug.WriteLine(GetType().FullName + "." + MethodBase.GetCurrentMethod().Name);

            return _logMessageRepository.UpdateLogMessage(logMessage, true);
        }