You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.6 KiB

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