FileFolderService.cs 3.7 KB

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