using Learun.Application.OA.File.FileInfo; using Learun.DataBase.Repository; using Learun.Util; using System; using System.Collections.Generic; using System.Linq; namespace Learun.Application.OA.File.FileFolder { /// /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园 /// Copyright (c) 2013-2017 /// 创建人:陈彬彬 /// 日 期:2018.06.20 /// 描 述:文件管理 /// public class FileFolderService : RepositoryFactory { #region 获取数据 /// /// 文件夹列表 /// /// 用户Id /// public IEnumerable GetList(string userId) { var expression = LinqExtensions.True(); expression = expression.And(t => t.F_CreateUserId == userId); return this.BaseRepository().IQueryable(expression).ToList(); } /// /// 文件夹实体 /// /// 主键值 /// public FileFolderEntity GetEntity(string keyValue) { return this.BaseRepository().FindEntity(keyValue); } #endregion #region 提交数据 /// /// 还原文件夹 /// /// 主键 public void RestoreFile(string keyValue) { FileFolderEntity fileFolderEntity = new FileFolderEntity(); fileFolderEntity.Modify(keyValue); fileFolderEntity.F_DeleteMark = 0; this.BaseRepository().Update(fileFolderEntity); } /// /// 删除文件夹 /// /// 主键 public void RemoveForm(string keyValue) { FileFolderEntity fileFolderEntity = new FileFolderEntity(); fileFolderEntity.Modify(keyValue); fileFolderEntity.F_DeleteMark = 1; this.BaseRepository().Update(fileFolderEntity); } /// /// 彻底删除文件夹 /// /// 主键 public void ThoroughRemoveForm(string keyValue) { this.BaseRepository().Delete(t => t.F_FolderId == keyValue); } /// /// 清空回收站 /// public void EmptyRecycledForm() { var db = this.BaseRepository().BeginTrans(); try { db.Delete(t => t.F_DeleteMark == 1); db.Delete(t => t.F_DeleteMark == 1); db.Commit(); } catch (Exception ex) { db.Rollback(); throw ExceptionEx.ThrowServiceException(ex); } } /// /// 保存文件夹表单(新增、修改) /// /// 主键值 /// 文件夹实体 /// public void SaveForm(string keyValue, FileFolderEntity fileFolderEntity) { if (!string.IsNullOrEmpty(keyValue)) { fileFolderEntity.Modify(keyValue); this.BaseRepository().Update(fileFolderEntity); } else { fileFolderEntity.Create(); this.BaseRepository().Insert(fileFolderEntity); } } /// /// 共享文件夹 /// /// 主键 /// 是否共享:1-共享 0取消共享 public void ShareFolder(string keyValue, int IsShare) { FileFolderEntity fileFolderEntity = new FileFolderEntity(); fileFolderEntity.F_FolderId = keyValue; fileFolderEntity.F_IsShare = IsShare; fileFolderEntity.F_ShareTime = DateTime.Now; this.BaseRepository().Update(fileFolderEntity); } #endregion } }