AttachmentService.cs 2.8 KB

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