LotterySkillService.cs 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. /// 日 期:2018-04-25 09:53
  17. /// 描 述:彩种技巧
  18. /// </summary>
  19. public class LotterySkillService : RepositoryFactory<LotterySkillEntity>, ILotterySkillService
  20. {
  21. #region 获取数据
  22. /// <summary>
  23. /// 获取列表
  24. /// </summary>
  25. /// <param name="pagination">分页</param>
  26. /// <param name="queryJson">查询参数</param>
  27. /// <returns>返回分页列表</returns>
  28. public IEnumerable<LotterySkillEntity> GetPageList(Pagination pagination, string queryJson)
  29. {
  30. var expression = LinqExtensions.True<LotterySkillEntity>();
  31. JObject queryParam = queryJson.ToJObject();
  32. if (queryParam != null)
  33. {
  34. if (!queryParam["TypeName"].IsEmpty())
  35. {
  36. string TypeName = queryParam["TypeName"].ToString();
  37. expression = expression.And(t => t.TypeName == TypeName);
  38. }
  39. if (!queryParam["Title"].IsEmpty())
  40. {
  41. string Title = queryParam["Title"].ToString();
  42. expression = expression.And(t => t.Title.Contains(Title));
  43. }
  44. }
  45. expression = expression.And(e => e.IsDelete == false);
  46. return this.BaseRepository(DatabaseLinksEnum.LotteryNumber).FindList(expression, pagination);
  47. }
  48. /// <summary>
  49. /// 获取列表
  50. /// </summary>
  51. /// <param name="queryJson">查询参数</param>
  52. /// <returns>返回列表</returns>
  53. public IEnumerable<LotterySkillEntity> GetList(string queryJson)
  54. {
  55. return this.BaseRepository(DatabaseLinksEnum.LotteryNumber).IQueryable().ToList();
  56. }
  57. /// <summary>
  58. /// 获取实体
  59. /// </summary>
  60. /// <param name="keyValue">主键值</param>
  61. /// <returns></returns>
  62. public LotterySkillEntity GetEntity(string keyValue)
  63. {
  64. return this.BaseRepository(DatabaseLinksEnum.LotteryNumber).FindEntity(keyValue);
  65. }
  66. #endregion
  67. #region 提交数据
  68. /// <summary>
  69. /// 删除数据
  70. /// </summary>
  71. /// <param name="keyValue">主键</param>
  72. public void RemoveForm(string keyValue)
  73. {
  74. this.BaseRepository(DatabaseLinksEnum.LotteryNumber).Delete(keyValue);
  75. }
  76. /// <summary>
  77. /// 保存表单(新增、修改)
  78. /// </summary>
  79. /// <param name="keyValue">主键值</param>
  80. /// <param name="entity">实体对象</param>
  81. /// <returns></returns>
  82. public void SaveForm(string keyValue, LotterySkillEntity entity)
  83. {
  84. if (!string.IsNullOrEmpty(keyValue))
  85. {
  86. entity.Modify(keyValue);
  87. this.BaseRepository(DatabaseLinksEnum.LotteryNumber).Update(entity);
  88. }
  89. else
  90. {
  91. entity.Create();
  92. this.BaseRepository(DatabaseLinksEnum.LotteryNumber).Insert(entity);
  93. }
  94. }
  95. #endregion
  96. }
  97. }