using System;
using System.Collections.Generic;
using System.Text;
using Edu.Model.Entity.System;
using Edu.Repository.System;
using VT.FW.DB;
namespace Edu.Module.System
{
public class HolidayModule
{
///
/// 订单学员仓储层对象
///
private readonly RB_System_HolidayRepository holidayRepository = new RB_System_HolidayRepository();
///
/// 节假日列表
///
/// 当前页
/// 每页显示条数
/// 查询条件
/// 总条数
///
public List GetPageList(int pageIndex, int pageSize, RB_System_Holiday model, out long count)
{
return holidayRepository.GetPageList(pageIndex, pageSize, model, out count);
}
///
/// 判断某一天是否在节假日里
///
///
///
public List GetDayhList(string NowDay)
{
return holidayRepository.GetDayhList(NowDay);
}
///
/// 判断某一个时间段是否在节假日里
///
///
///
public List GetExistHoliday(string startTime, string endTime)
{
return holidayRepository.GetExistHoliday(startTime, endTime);
}
///
/// 获取节假日详情
///
///
///
public RB_System_Holiday GetEntity(object id)
{
return holidayRepository.GetEntity(id);
}
///
/// 新增/修改节假日
///
///
///
public bool SetHoliday(RB_System_Holiday model)
{
if (model.HolidayId == 0)
{
return holidayRepository.Insert(model) > 0;
}
else
{
Dictionary fileds = new Dictionary()
{
{nameof(RB_System_Holiday.StartTime),model.StartTime},
{nameof(RB_System_Holiday.EndTime),model.EndTime },
{nameof(RB_System_Holiday.DayType),model.DayType }
};
return holidayRepository.Update(fileds, new WhereHelper(nameof(model.HolidayId), model.HolidayId));
}
}
///
/// 删除节假日
///
///
///
public bool DelHoliday(int HolidayId)
{
Dictionary fileds = new Dictionary()
{
{nameof(RB_System_Holiday.Status),1}
};
return holidayRepository.Update(fileds, new WhereHelper(nameof(HolidayId), HolidayId));
}
///
///批量新增节假日
///
///
///
public bool SetHoliday(List list)
{
return holidayRepository.InsertBatch(list);
}
}
}