FeedbackService.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. using Lottomat.Application.Entity.SystemManage;
  2. using Lottomat.Application.IService.SystemManage;
  3. using Lottomat.Data.Repository;
  4. using Lottomat.Util.WebControl;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using Lottomat.Application.Code;
  8. using Lottomat.Application.Entity.LotteryNumberManage;
  9. using Lottomat.Util.Extension;
  10. using Lottomat.Utils.Date;
  11. using Newtonsoft.Json.Linq;
  12. namespace Lottomat.Application.Service.SystemManage
  13. {
  14. /// <summary>
  15. /// 版 本 1.0
  16. /// Copyright (c) 2016-2017
  17. /// 创 建:超级管理员
  18. /// 日 期:2017-12-18 10:55
  19. /// 描 述:意见反馈
  20. /// </summary>
  21. public class FeedbackService : RepositoryFactory<FeedbackEntity>, IFeedbackService
  22. {
  23. #region 获取数据
  24. /// <summary>
  25. /// 获取列表
  26. /// </summary>
  27. /// <param name="pagination">分页</param>
  28. /// <param name="queryJson">查询参数</param>
  29. /// <returns>返回分页列表</returns>
  30. public IEnumerable<FeedbackEntity> GetPageList(Pagination pagination, string queryJson)
  31. {
  32. var expression = LinqExtensions.True<FeedbackEntity>();
  33. JObject queryParam = queryJson.ToJObject();
  34. if (queryParam != null)
  35. {
  36. if (!queryParam["NickName"].IsEmpty())
  37. {
  38. string NickName = queryParam["NickName"].ToString();
  39. expression = expression.And(t => t.NickName.Contains(NickName));
  40. }
  41. if (!queryParam["Contact"].IsEmpty())
  42. {
  43. string Contact = queryParam["Contact"].ToString();
  44. expression = expression.And(t => t.Contact.Contains(Contact));
  45. }
  46. }
  47. return this.BaseRepository().FindList(expression, pagination);
  48. }
  49. /// <summary>
  50. /// 获取列表
  51. /// </summary>
  52. /// <param name="queryJson">查询参数</param>
  53. /// <returns>返回列表</returns>
  54. public IEnumerable<FeedbackEntity> GetList(string queryJson)
  55. {
  56. return this.BaseRepository().IQueryable().ToList();
  57. }
  58. /// <summary>
  59. /// 获取实体
  60. /// </summary>
  61. /// <param name="keyValue">主键值</param>
  62. /// <returns></returns>
  63. public FeedbackEntity GetEntity(string keyValue)
  64. {
  65. return this.BaseRepository().FindEntity(keyValue);
  66. }
  67. #endregion
  68. #region 提交数据
  69. /// <summary>
  70. /// 删除数据
  71. /// </summary>
  72. /// <param name="keyValue">主键</param>
  73. public void RemoveForm(string keyValue)
  74. {
  75. this.BaseRepository().Delete(keyValue);
  76. }
  77. /// <summary>
  78. /// 保存表单(新增、修改)
  79. /// </summary>
  80. /// <param name="keyValue">主键值</param>
  81. /// <param name="entity">实体对象</param>
  82. /// <returns></returns>
  83. public int SaveForm(string keyValue, FeedbackEntity entity, string which)
  84. {
  85. if (!string.IsNullOrEmpty(keyValue))
  86. {
  87. if (which == "1")
  88. {
  89. entity.IsReply = true;
  90. entity.ReplyTime = DateTimeHelper.Now;
  91. entity.ReplyUserName = entity.ReplyUserName == ""
  92. ? OperatorProvider.Provider.Current().UserName
  93. : entity.ReplyUserName;
  94. }
  95. entity.Modify(keyValue);
  96. return this.BaseRepository().Update(entity);
  97. }
  98. else
  99. {
  100. entity.Create();
  101. return this.BaseRepository().Insert(entity);
  102. }
  103. }
  104. #endregion
  105. }
  106. }