using System.Data; using System.Text; using System.Data.SqlClient; using Monitor.Models; using Monitor.IRepositories; using Monitor.Repositories; namespace DataBase.MySql.Tool { /// /// 电表小时能耗操作类 /// public class SEgEMeterHourEnergyValue { private TEgEmeterHourEnergyValueRepository _dalEgEMeterHourEnergyValueRepository; public SEgEMeterHourEnergyValue() { _dalEgEMeterHourEnergyValueRepository = new TEgEmeterHourEnergyValueRepository(DBTool.Instance.MyDbContext()); } public async Task AddEMeterHourEnergyValue(TEgEmeterHourEnergyValue val) { return await _dalEgEMeterHourEnergyValueRepository.Insert(val); } /// /// 获取仪表当天累计值(多个仪表) /// /// public async Task> GetEMeterCurrDayEnergyValueList() { return await _dalEgEMeterHourEnergyValueRepository.GetListBy(a => a.FStartTime >= DateTime.Now.Date && a.FStartTime <= DateTime.Now.Date.AddDays(1)); } /// /// 获取仪表前一天累计值(多个仪表) /// /// public async Task> GetEMeterPreDayEnergyValueList() { return await _dalEgEMeterHourEnergyValueRepository.GetListBy(a => a.FStartTime >= DateTime.Now.Date.AddDays(-1) && a.FStartTime <= DateTime.Now.Date); } } }