using HighWayIot.Log4net; using HighWayIot.Repository.domain; using Models; 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 ZxDailyReportService { private static readonly Lazy lazy = new Lazy(() => new ZxDailyReportService()); public static ZxDailyReportService Instance { get { return lazy.Value; } } private LogHelper log = LogHelper.Instance; Repository _repository => new Repository("sqlserver"); /// /// 查询报表信息 /// /// public List Get50DailyReportInfos() { try { List entity = _repository.GetList().Take(50).ToList(); return entity; } catch (Exception ex) { log.Error("配方信息获取异常", ex); return null; } } /// /// 根据条件查询报表信息 /// /// /// public List GetDailyReportInfos(Expression> whereExpression) { try { List entity = _repository.GetList(whereExpression); return entity; } catch(Exception ex) { log.Error("配发信息获取异常", ex); return null; } } /// /// 新增报表信息 /// /// /// public bool InsertDailyReportInfo(ZxDailyReportEntity entity) { try { return _repository.Insert(entity); } catch (Exception ex) { log.Error("报表信息添加异常", ex); return false; } } /// /// 删除报表信息 /// /// /// public bool UpdateDailyReportInfo(ZxDailyReportEntity entity) { try { return _repository.Update(entity); } catch (Exception ex) { log.Error("报表信息修改异常", ex); return false; } } } }