using Lottomat.Application.Entity.PublicInfoManage; using Lottomat.Application.IService.PublicInfoManage; using Lottomat.Data.Repository; using Lottomat.Util.Extension; using System; using System.Collections.Generic; using System.Linq; using Lottomat.Application.Code; using Lottomat.Util; using Lottomat.Utils.Date; namespace Lottomat.Application.Service.PublicInfoManage { /// /// 版 本 1.0 /// Copyright (c) 2016-2017 /// 创建人:赵轶 /// 日 期:2015.12.15 10:56 /// 描 述:文件夹 /// public class FileFolderService : RepositoryFactory, IFileFolderService { #region 获取数据 /// /// 文件夹列表 /// /// 用户Id /// public IEnumerable GetList(string userId) { var expression = LinqExtensions.True(); expression = expression.And(t => t.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.DeleteMark = (int)DeleteMarkEnum.NotDelete; this.BaseRepository().Update(fileFolderEntity); } /// /// 删除文件夹 /// /// 主键 public void RemoveForm(string keyValue) { FileFolderEntity fileFolderEntity = new FileFolderEntity(); fileFolderEntity.Modify(keyValue); fileFolderEntity.DeleteMark = (int)DeleteMarkEnum.Delete; this.BaseRepository().Update(fileFolderEntity); } /// /// 彻底删除文件夹 /// /// 主键 public void ThoroughRemoveForm(string keyValue) { this.BaseRepository().Delete(keyValue); } /// /// 保存文件夹表单(新增、修改) /// /// 主键值 /// 文件夹实体 /// 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.FolderId = keyValue; fileFolderEntity.IsShare = IsShare; fileFolderEntity.ShareTime = DateTimeHelper.Now; this.BaseRepository().Update(fileFolderEntity); } #endregion } }