2019-05-01 11:36:24 +08:00
|
|
|
|
using Longbow.Data;
|
2019-05-01 16:46:24 +08:00
|
|
|
|
using Longbow.Web.Mvc;
|
|
|
|
|
using PetaPoco;
|
|
|
|
|
using System;
|
2019-05-25 14:52:14 +08:00
|
|
|
|
using System.Collections.Generic;
|
2019-05-01 16:46:24 +08:00
|
|
|
|
|
2018-10-19 23:09:52 +08:00
|
|
|
|
namespace Bootstrap.DataAccess
|
|
|
|
|
{
|
2018-10-28 15:03:59 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
2018-10-19 23:09:52 +08:00
|
|
|
|
public static class LogHelper
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 查询所有日志信息
|
|
|
|
|
/// </summary>
|
2019-05-01 11:36:24 +08:00
|
|
|
|
/// <param name="op"></param>
|
2019-06-24 10:42:59 +08:00
|
|
|
|
/// <param name="startTime"></param>
|
|
|
|
|
/// <param name="endTime"></param>
|
|
|
|
|
/// <param name="opType"></param>
|
2018-10-19 23:09:52 +08:00
|
|
|
|
/// <returns></returns>
|
2019-05-25 14:52:14 +08:00
|
|
|
|
public static Page<Log> RetrievePages(PaginationOption op, DateTime? startTime, DateTime? endTime, string opType) => DbContextManager.Create<Log>().RetrievePages(op, startTime, endTime, opType);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 查询所有日志信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static IEnumerable<Log> RetrieveAll(DateTime? startTime, DateTime? endTime, string opType) => DbContextManager.Create<Log>().RetrieveAll(startTime, endTime, opType);
|
2019-01-11 23:20:28 +08:00
|
|
|
|
|
2018-10-19 23:09:52 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 保存新增的日志信息
|
|
|
|
|
/// </summary>
|
2019-05-18 21:21:03 +08:00
|
|
|
|
/// <param name="log"></param>
|
2018-10-19 23:09:52 +08:00
|
|
|
|
/// <returns></returns>
|
2019-05-18 21:21:03 +08:00
|
|
|
|
public static bool Save(Log log)
|
|
|
|
|
{
|
2019-05-24 21:25:47 +08:00
|
|
|
|
if (log.Id == string.Empty) log.Id = null;
|
2019-05-18 21:21:03 +08:00
|
|
|
|
log.LogTime = DateTime.Now;
|
|
|
|
|
return DbContextManager.Create<Log>().Save(log);
|
|
|
|
|
}
|
2018-10-19 23:09:52 +08:00
|
|
|
|
}
|
|
|
|
|
}
|