namespace IStation.Service
{
///
///
///
public partial class HydraulicRecord
{
#region Cache
private static List GetCache()
{
return CacheHelper.GetSet(() =>
{
var dal = DALCreateHelper.CreateDAL();
var entity_list = dal.GetAll();
var model_list = Entity2Models(entity_list);
if (model_list == null)
{
model_list = new List();
}
return model_list;
}, ConfigHelper.CacheKeepTime, ConfigHelper.CacheRandomTime);
}
#endregion
///
/// 获取所有
///
public List GetAll()
{
var all = GetCache();
return all.ToList();
}
///
/// 根据时间获取
///
public List GetByDate(DateTime start, DateTime end)
{
var dal = DALCreateHelper.CreateDAL();
var entity_list = dal.GetByDate(start, end);
var model_list = Entity2Models(entity_list);
return model_list;
}
///
/// 插入多条
///
public bool Inserts(List list)
{
if (list == null || list.Count < 1)
return default;
var dal = DALCreateHelper.CreateDAL();
var entity_list = Model2Entities(list);
var bol = dal.Inserts(entity_list);
return bol;
}
///
/// 大批量插入
///
///
///
public bool BulkInserts(List list)
{
if (list == null || list.Count < 1)
return default;
var dal = DALCreateHelper.CreateDAL();
var entity_list = Model2Entities(list);
var bol = dal.BulkInserts(entity_list);
return bol;
}
}
}