ToolsService.cs 2.8 KB

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