NoticeBLL.cs 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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 NoticeBLL
  22. {
  23. private INoticeService service = new NoticeService();
  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="keyValue">主键值</param>
  39. /// <returns></returns>
  40. public NewsEntity GetEntity(string keyValue)
  41. {
  42. NewsEntity newsEntity = service.GetEntity(keyValue);
  43. newsEntity.NewsContent = WebHelper.HtmlDecode(newsEntity.NewsContent);
  44. return newsEntity;
  45. }
  46. /// <summary>
  47. /// 获取所有数据
  48. /// </summary>
  49. /// <param name="condition"></param>
  50. /// <returns></returns>
  51. public IEnumerable<NewsEntity> GetList(Expression<Func<NewsEntity, bool>> condition)
  52. {
  53. return service.GetList(condition);
  54. }
  55. #endregion
  56. #region 提交数据
  57. /// <summary>
  58. /// 删除公告
  59. /// </summary>
  60. /// <param name="keyValue">主键</param>
  61. public void RemoveForm(string keyValue)
  62. {
  63. try
  64. {
  65. service.RemoveForm(keyValue);
  66. }
  67. catch (Exception)
  68. {
  69. throw;
  70. }
  71. }
  72. /// <summary>
  73. /// 保存公告表单(新增、修改)
  74. /// </summary>
  75. /// <param name="keyValue">主键值</param>
  76. /// <param name="newsEntity">公告实体</param>
  77. /// <returns></returns>
  78. public void SaveForm(string keyValue, NewsEntity newsEntity)
  79. {
  80. try
  81. {
  82. newsEntity.NewsContent = WebHelper.HtmlEncode(newsEntity.NewsContent);
  83. service.SaveForm(keyValue, newsEntity);
  84. }
  85. catch (Exception)
  86. {
  87. throw;
  88. }
  89. }
  90. #endregion
  91. }
  92. }