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

91 lines
2.4 KiB
C#

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 ZxSchedulingService
{
private static readonly Lazy<ZxSchedulingService> lazy = new Lazy<ZxSchedulingService>(() => new ZxSchedulingService());
public static ZxSchedulingService Instance
{
get
{
return lazy.Value;
}
}
private LogHelper log = LogHelper.Instance;
Repository<ZxScheduling> _repository => new Repository<ZxScheduling>("sqlserver");
/// <summary>
/// 查询所有排程信息
/// </summary>
/// <returns></returns>
public List<ZxScheduling> GetSchedulingInfo(Expression<Func<ZxScheduling, bool>> expression = null)
{
try
{
List<ZxScheduling> entity;
if (expression != null)
{
entity = _repository.GetList(expression);
}
else
{
entity = _repository.GetList();
}
return entity;
}
catch (Exception ex)
{
log.Error("排程信息获取异常", ex);
return null;
}
}
///// <summary>
///// 添加排程信息
///// </summary>
///// <param name="entity"></param>
///// <returns></returns>
//public bool InsertSchedulingInfo(ZxScheduling entity)
//{
// try
// {
// return _repository.Insert(entity);
// }
// catch (Exception ex)
// {
// log.Error("排程信息插入异常", ex);
// return false;
// }
//}
/// <summary>
/// 修改排程信息
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
public bool UpdateSchedulingInfo(ZxScheduling entity)
{
try
{
return _repository.Update(entity);
}
catch (Exception ex)
{
log.Error("排程信息修改异常", ex);
return false;
}
}
}
}