44 lines
1.4 KiB
C#
44 lines
1.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Linq.Dynamic;
|
|
using System.Text;
|
|
using Domain;
|
|
using Dao;
|
|
|
|
namespace Service.Implement
|
|
{
|
|
public class SysSystemLogsManager : GenericManagerBase<SysSystemLogs>, ISysSystemLogsManager
|
|
{
|
|
public ISysSystemLogsRepository SysSystemLogsRepository { get; set; }
|
|
|
|
public IList<SysSystemLogs> LoadAllByPage(out long total, int page, int rows, string order, string sort, int? authorityId, DateTime? startDate, DateTime? endDate, string keyword, int currentHotelID)
|
|
{
|
|
var list = CurrentRepository.LoadAll().Where(r => r.Detail.Contains(keyword) && r.HotelID == currentHotelID);
|
|
|
|
if (authorityId.HasValue)
|
|
{
|
|
list = list.Where(r => r.AuthorityID == authorityId);
|
|
}
|
|
|
|
if (startDate.HasValue && endDate.HasValue)
|
|
{
|
|
list = list.Where(r => r.Time >= startDate && r.Time <= endDate);
|
|
}
|
|
|
|
total = list.LongCount();
|
|
|
|
list = list.OrderBy(sort + " " + order);
|
|
|
|
list = list.Skip((page - 1) * rows).Take(rows);
|
|
|
|
return list.ToList();
|
|
}
|
|
|
|
public void DeleteAll(int currentHotelID)
|
|
{
|
|
Delete(LoadAll().Where(r => r.HotelID == currentHotelID).Select(r => r.ID as object).ToList());
|
|
}
|
|
}
|
|
}
|