using HighWayIot.Log4net; using HighWayIot.Repository.domain; using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Text; using System.Threading.Tasks; namespace HighWayIot.Repository.service { public class SysErrorLogService { private static readonly Lazy lazy = new Lazy(() => new SysErrorLogService()); public static SysErrorLogService Instance { get { return lazy.Value; } } private LogHelper log = LogHelper.Instance; Repository _repository => new Repository("sqlserver"); /// /// 查询所有报警日志信息 /// /// public List GetErrorLogInfos(Expression> expression = null) { try { List entity; if (expression != null) { entity = _repository.GetList(expression); } else { entity = _repository.GetList(); } return entity; } catch (Exception ex) { log.Error("报警日志信息获取异常", ex); return null; } } /// /// 添加报警日志 /// /// /// public bool InsertErrorLogInfo(SysErrorLogEntity entity) { try { return _repository.Insert(entity); } catch (Exception ex) { log.Error("报警日志信息插入异常", ex); return false; } } } }