LogBLL.cs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. using Lottomat.Application.Entity.SystemManage;
  2. using Lottomat.Application.IService.SystemManage;
  3. using Lottomat.Application.Service.SystemManage;
  4. using Lottomat.Util.WebControl;
  5. using System;
  6. using System.Collections.Generic;
  7. using Lottomat.Application.Code;
  8. using Lottomat.Util;
  9. using Lottomat.Util.Extension;
  10. namespace Lottomat.Application.Busines.SystemManage
  11. {
  12. /// <summary>
  13. /// 版 本 1.0
  14. /// Copyright (c) 2016-2017
  15. /// 创建人:赵轶
  16. /// 日 期:2016.1.8 9:56
  17. /// 描 述:系统日志
  18. /// </summary>
  19. public static class LogBLL
  20. {
  21. private static ILogService service = new LogService();
  22. #region 获取数据
  23. /// <summary>
  24. /// 日志列表
  25. /// </summary>
  26. /// <param name="pagination">分页</param>
  27. /// <param name="queryJson">查询参数</param>
  28. /// <returns></returns>
  29. public static IEnumerable<LogEntity> GetPageList(Pagination pagination, string queryJson)
  30. {
  31. return service.GetPageList(pagination, queryJson);
  32. }
  33. /// <summary>
  34. /// 日志实体
  35. /// </summary>
  36. /// <param name="keyValue">主键值</param>
  37. /// <returns></returns>
  38. public static LogEntity GetEntity(string keyValue)
  39. {
  40. return service.GetEntity(keyValue);
  41. }
  42. #endregion
  43. #region 提交数据
  44. /// <summary>
  45. /// 清空日志
  46. /// </summary>
  47. /// <param name="categoryId">日志分类Id</param>
  48. /// <param name="keepTime">保留时间段内</param>
  49. public static void RemoveLog(int categoryId, string keepTime)
  50. {
  51. try
  52. {
  53. service.RemoveLog(categoryId, keepTime);
  54. }
  55. catch (Exception)
  56. {
  57. throw;
  58. }
  59. }
  60. /// <summary>
  61. /// 写日志
  62. /// </summary>
  63. /// <param name="logEntity">对象</param>
  64. public static void WriteLog(this LogEntity logEntity)
  65. {
  66. try
  67. {
  68. service.WriteLog(logEntity);
  69. }
  70. catch (Exception)
  71. {
  72. LogEntity log = new LogEntity
  73. {
  74. CategoryId = (int)CategoryType.Exception,
  75. OperateTypeId = ((int)OperationType.Exception).ToString(),
  76. OperateType = OperationType.Exception.GetEnumDescription(),
  77. OperateAccount = OperatorProvider.Provider.Current().Account,
  78. OperateUserId = OperatorProvider.Provider.Current().UserId,
  79. ExecuteResult = 1,
  80. ExecuteResultJson = "写日志",
  81. Module = ConfigHelper.GetValue("SoftName")
  82. };
  83. service.WriteLog(log);
  84. }
  85. }
  86. #endregion
  87. }
  88. }