46 lines
1.2 KiB
C#
46 lines
1.2 KiB
C#
|
|
using Cowain.Bake.Common.Interface;
|
|||
|
|
using Cowain.Bake.Model;
|
|||
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Data;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Threading.Tasks;
|
|||
|
|
using Unity;
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
namespace Cowain.Bake.BLL
|
|||
|
|
{
|
|||
|
|
public class ElectricEnergyService:ServiceBase
|
|||
|
|
{
|
|||
|
|
public ElectricEnergyService(IUnityContainer unityContainer) : base(unityContainer)
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
public DataTable GetYestodayEnergy()
|
|||
|
|
{
|
|||
|
|
string sql = $@"CALL ProcGetYestodayEnergy()";
|
|||
|
|
return GetDataTable(sql);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public List<TElectricEnergy> Query(int maincheId, DateTime dtStart, DateTime dtEnd)
|
|||
|
|
{
|
|||
|
|
using (var Context = new BakingEntities())
|
|||
|
|
{
|
|||
|
|
return Context.Set<TElectricEnergy>().Where(x => x.CreateTime >= dtStart
|
|||
|
|
&& x.CreateTime <= dtEnd
|
|||
|
|
&& x.StationId == maincheId).ToList();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public int Insert(TElectricEnergy model)
|
|||
|
|
{
|
|||
|
|
using (var Context = new BakingEntities())
|
|||
|
|
{
|
|||
|
|
Context.Set<TElectricEnergy>().Add(model);
|
|||
|
|
return Context.SaveChanges();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|