FileFolderService.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. using Lottomat.Application.Entity.PublicInfoManage;
  2. using Lottomat.Application.IService.PublicInfoManage;
  3. using Lottomat.Data.Repository;
  4. using Lottomat.Util.Extension;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using Lottomat.Application.Code;
  9. using Lottomat.Util;
  10. using Lottomat.Utils.Date;
  11. namespace Lottomat.Application.Service.PublicInfoManage
  12. {
  13. /// <summary>
  14. /// 版 本 1.0
  15. /// Copyright (c) 2016-2017
  16. /// 创建人:赵轶
  17. /// 日 期:2015.12.15 10:56
  18. /// 描 述:文件夹
  19. /// </summary>
  20. public class FileFolderService : RepositoryFactory<FileFolderEntity>, IFileFolderService
  21. {
  22. #region 获取数据
  23. /// <summary>
  24. /// 文件夹列表
  25. /// </summary>
  26. /// <param name="userId">用户Id</param>
  27. /// <returns></returns>
  28. public IEnumerable<FileFolderEntity> GetList(string userId)
  29. {
  30. var expression = LinqExtensions.True<FileFolderEntity>();
  31. expression = expression.And(t => t.CreateUserId == userId);
  32. return this.BaseRepository().IQueryable(expression).ToList();
  33. }
  34. /// <summary>
  35. /// 文件夹实体
  36. /// </summary>
  37. /// <param name="keyValue">主键值</param>
  38. /// <returns></returns>
  39. public FileFolderEntity GetEntity(string keyValue)
  40. {
  41. return this.BaseRepository().FindEntity(keyValue);
  42. }
  43. #endregion
  44. #region 提交数据
  45. /// <summary>
  46. /// 还原文件夹
  47. /// </summary>
  48. /// <param name="keyValue">主键</param>
  49. public void RestoreFile(string keyValue)
  50. {
  51. FileFolderEntity fileFolderEntity = new FileFolderEntity();
  52. fileFolderEntity.Modify(keyValue);
  53. fileFolderEntity.DeleteMark = (int)DeleteMarkEnum.NotDelete;
  54. this.BaseRepository().Update(fileFolderEntity);
  55. }
  56. /// <summary>
  57. /// 删除文件夹
  58. /// </summary>
  59. /// <param name="keyValue">主键</param>
  60. public void RemoveForm(string keyValue)
  61. {
  62. FileFolderEntity fileFolderEntity = new FileFolderEntity();
  63. fileFolderEntity.Modify(keyValue);
  64. fileFolderEntity.DeleteMark = (int)DeleteMarkEnum.Delete;
  65. this.BaseRepository().Update(fileFolderEntity);
  66. }
  67. /// <summary>
  68. /// 彻底删除文件夹
  69. /// </summary>
  70. /// <param name="keyValue">主键</param>
  71. public void ThoroughRemoveForm(string keyValue)
  72. {
  73. this.BaseRepository().Delete(keyValue);
  74. }
  75. /// <summary>
  76. /// 保存文件夹表单(新增、修改)
  77. /// </summary>
  78. /// <param name="keyValue">主键值</param>
  79. /// <param name="fileFolderEntity">文件夹实体</param>
  80. /// <returns></returns>
  81. public void SaveForm(string keyValue, FileFolderEntity fileFolderEntity)
  82. {
  83. if (!string.IsNullOrEmpty(keyValue))
  84. {
  85. fileFolderEntity.Modify(keyValue);
  86. this.BaseRepository().Update(fileFolderEntity);
  87. }
  88. else
  89. {
  90. fileFolderEntity.Create();
  91. this.BaseRepository().Insert(fileFolderEntity);
  92. }
  93. }
  94. /// <summary>
  95. /// 共享文件夹
  96. /// </summary>
  97. /// <param name="keyValue">主键</param>
  98. /// <param name="IsShare">是否共享:1-共享 0取消共享</param>
  99. public void ShareFolder(string keyValue, int IsShare)
  100. {
  101. FileFolderEntity fileFolderEntity = new FileFolderEntity();
  102. fileFolderEntity.FolderId = keyValue;
  103. fileFolderEntity.IsShare = IsShare;
  104. fileFolderEntity.ShareTime = DateTimeHelper.Now;
  105. this.BaseRepository().Update(fileFolderEntity);
  106. }
  107. #endregion
  108. }
  109. }