DF20x5HeBeiService.cs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. using Lottomat.Application.Entity.LotteryNumberManage;
  2. using Lottomat.Application.IService.LotteryNumberManage;
  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.Util.Extension;
  9. using Newtonsoft.Json.Linq;
  10. namespace Lottomat.Application.Service.LotteryNumberManage
  11. {
  12. /// <summary>
  13. /// 版 本 1.0
  14. /// Copyright (c) 2016-2017
  15. /// 创 建:超级管理员
  16. /// 日 期:2017-11-27 10:23
  17. /// 描 述:地方彩-河北20选5
  18. /// </summary>
  19. public class DF20x5HeBeiService : RepositoryFactory<DF20x5HeBeiEntity>, IDF20x5HeBeiService
  20. {
  21. #region 获取数据
  22. /// <summary>
  23. /// 获取列表
  24. /// </summary>
  25. /// <param name="pagination">分页</param>
  26. /// <param name="queryJson">查询参数</param>
  27. /// <returns>返回分页列表</returns>
  28. public IEnumerable<DF20x5HeBeiEntity> GetPageList(Pagination pagination, string queryJson)
  29. {
  30. var expression = LinqExtensions.True<DF20x5HeBeiEntity>();
  31. JObject queryParam = queryJson.ToJObject();
  32. if (queryParam != null)
  33. {
  34. if (!queryParam["Term"].IsEmpty())
  35. {
  36. long Term = queryParam["Term"].TryToInt32();
  37. expression = expression.And(t => t.Term == Term);
  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<DF20x5HeBeiEntity> 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 DF20x5HeBeiEntity 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(DatabaseLinksEnum.LotteryNumber).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, DF20x5HeBeiEntity entity,string isCheck)
  77. {
  78. if (!string.IsNullOrEmpty(keyValue))
  79. {
  80. if (isCheck == "1")
  81. {
  82. entity.IsChecked = true;
  83. entity.IsPassed = true;
  84. }
  85. entity.Modify(keyValue);
  86. this.BaseRepository(DatabaseLinksEnum.LotteryNumber).Update(entity);
  87. }
  88. else
  89. {
  90. entity.Create();
  91. this.BaseRepository(DatabaseLinksEnum.LotteryNumber).Insert(entity);
  92. }
  93. }
  94. #endregion
  95. }
  96. }