LotteryGlossaryService.cs 3.1 KB

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