NewsBLL.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. using Lottomat.Application.Entity.PublicInfoManage;
  2. using Lottomat.Application.IService.PublicInfoManage;
  3. using Lottomat.Application.Service.PublicInfoManage;
  4. using Lottomat.Util;
  5. using Lottomat.Util.WebControl;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Linq;
  9. using System.Linq.Expressions;
  10. using Lottomat.Utils;
  11. using Lottomat.Utils.Web;
  12. namespace Lottomat.Application.Busines.PublicInfoManage
  13. {
  14. /// <summary>
  15. /// 版 本 1.0
  16. /// Copyright (c) 2016-2017
  17. /// 创建人:赵轶
  18. /// 日 期:2015.12.7 16:40
  19. /// 描 述:新闻中心
  20. /// </summary>
  21. public class NewsBLL
  22. {
  23. private INewsService service = new NewsService();
  24. #region 获取数据
  25. /// <summary>
  26. /// 新闻列表
  27. /// </summary>
  28. /// <param name="pagination">分页</param>
  29. /// <param name="queryJson">查询参数</param>
  30. /// <returns></returns>
  31. public IEnumerable<NewsEntity> GetPageList(Pagination pagination, string queryJson)
  32. {
  33. return service.GetPageList(pagination, queryJson);
  34. }
  35. /// <summary>
  36. ///
  37. /// </summary>
  38. /// <param name="condition"></param>
  39. /// <param name="pagination"></param>
  40. /// <returns></returns>
  41. public IEnumerable<NewsEntity> GetPageList(Expression<Func<NewsEntity, bool>> condition, Pagination pagination)
  42. {
  43. return service.GetPageList(condition, pagination);
  44. }
  45. /// <summary>
  46. /// 新闻实体
  47. /// </summary>
  48. /// <param name="keyValue">主键值</param>
  49. /// <returns></returns>
  50. public NewsEntity GetEntity(string keyValue)
  51. {
  52. NewsEntity newsEntity = service.GetEntity(keyValue);
  53. if (newsEntity != null)
  54. newsEntity.NewsContent = WebHelper.HtmlDecode(newsEntity.NewsContent);
  55. return newsEntity;
  56. }
  57. public NewsEntity GetEntity(Expression<Func<NewsEntity, bool>> condition)
  58. {
  59. NewsEntity newsEntity = service.GetEntity(condition);
  60. if (newsEntity != null)
  61. newsEntity.NewsContent = WebHelper.HtmlDecode(newsEntity.NewsContent);
  62. return newsEntity;
  63. }
  64. /// <summary>
  65. /// 获取所有数据
  66. /// </summary>
  67. /// <param name="condition"></param>
  68. /// <returns></returns>
  69. public List<NewsEntity> GetList(Expression<Func<NewsEntity, bool>> condition)
  70. {
  71. return service.GetList(condition).ToList();
  72. }
  73. public IEnumerable<T> FindList<T>(Expression<Func<T, bool>> condition, string orderField, bool isAsc, int pageSize, int pageIndex,
  74. out int total) where T : class, new()
  75. {
  76. return service.FindList(condition, orderField, isAsc, pageSize, pageIndex, out total);
  77. }
  78. #endregion
  79. #region 提交数据
  80. /// <summary>
  81. /// 删除新闻
  82. /// </summary>
  83. /// <param name="keyValue">主键</param>
  84. public void RemoveForm(string keyValue)
  85. {
  86. try
  87. {
  88. service.RemoveForm(keyValue);
  89. }
  90. catch (Exception)
  91. {
  92. throw;
  93. }
  94. }
  95. /// <summary>
  96. /// 保存新闻表单(新增、修改)
  97. /// </summary>
  98. /// <param name="keyValue">主键值</param>
  99. /// <param name="newsEntity">新闻实体</param>
  100. /// <returns></returns>
  101. public void SaveForm(string keyValue, NewsEntity newsEntity)
  102. {
  103. try
  104. {
  105. newsEntity.NewsContent = WebHelper.HtmlEncode(newsEntity.NewsContent);
  106. service.SaveForm(keyValue, newsEntity);
  107. }
  108. catch (Exception)
  109. {
  110. throw;
  111. }
  112. }
  113. /// <summary>
  114. /// 修改
  115. /// </summary>
  116. /// <param name="newsEntity">新闻实体</param>
  117. /// <returns></returns>
  118. public void UpdateForm(NewsEntity newsEntity)
  119. {
  120. service.UpdateForm(newsEntity);
  121. }
  122. #endregion
  123. #region 修改数据
  124. /// <summary>
  125. /// 批量修改
  126. /// </summary>
  127. /// <param name="modelModifyProps">要修改的列及修改后列的值集合</param>
  128. /// <param name="where">修改的条件</param>
  129. /// <param name="paramModifyStrings">修改列的名称的集合</param>
  130. /// <returns>返回受影响行数</returns>
  131. public int Modify(NewsEntity modelModifyProps, Expression<Func<NewsEntity, bool>> where, params string[] paramModifyStrings)
  132. {
  133. return service.Modify(modelModifyProps, where, paramModifyStrings);
  134. }
  135. #endregion
  136. }
  137. }