/// <summary> /// 批量保存 /// </summary> /// <param name="userInfo">用户</param> /// <param name="dataTable">数据表</param> /// <returns>影响行数</returns> public int BatchSave(UserInfo userInfo, DataTable dataTable) { int returnValue = 0; var parameter = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, "BatchSave"); ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider => { var folderManager = new CiFolderManager(dbProvider, userInfo); returnValue = folderManager.BatchSave(dataTable); }); return(returnValue); }
/// <summary> /// 批量移动 /// </summary> /// <param name="userInfo">用户</param> /// <param name="folderIds">文件夹主键数组</param> /// <param name="parentId">目标主键</param> /// <returns>影响行数</returns> public int BatchMoveTo(UserInfo userInfo, string[] folderIds, string parentId) { int returnValue = 0; var parameter = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, "BatchMoveTo", "ParentId:" + parentId); ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider => { var folderManager = new CiFolderManager(dbProvider, userInfo); returnValue += folderIds.Sum(t => folderManager.MoveTo(t, parentId)); }); return(returnValue); }
/// <summary> /// 获取数据表 /// </summary> /// <param name="userInfo">用户</param> /// <param name="name">字段名</param> /// <param name="value">字段值</param> /// <returns>数据表</returns> public DataTable GetDT(UserInfo userInfo, string name, string value) { var dataTable = new DataTable(CiFolderTable.TableName); var parameter = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, string.Empty); parameter.IsAddLog = false; ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider => { var folderManager = new CiFolderManager(dbProvider, userInfo); dataTable = folderManager.GetDT(name, value); }); return(dataTable); }
/// <summary> /// 获取实体 /// </summary> /// <param name="userInfo">用户</param> /// <param name="id">主键</param> /// <returns>实体</returns> public CiFolderEntity GetEntity(UserInfo userInfo, string id) { CiFolderEntity folderEntity = null; var parameter = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, string.Empty); parameter.IsAddLog = false; ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider => { var folderManager = new CiFolderManager(dbProvider, userInfo); folderEntity = folderManager.GetEntity(id); }); return(folderEntity); }
/// <summary> /// 删除 /// </summary> /// <param name="userInfo">用户</param> /// <param name="id">主键</param> /// <returns>影响行数</returns> public int Delete(UserInfo userInfo, string id) { int returnValue = 0; var parameter = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, "Delete"); parameter.IsAddLog = false; ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider => { var folderManager = new CiFolderManager(dbProvider, userInfo); returnValue = folderManager.Delete(id); }); return(returnValue); }
/// <summary> /// 更新文件夹 /// </summary> /// <param name="userInfo">用户</param> /// <param name="folderEntity">文件夹</param> /// <param name="statusCode">状态码</param> /// <param name="statusMessage">状态信息</param> /// <returns>影响行数</returns> public int Update(UserInfo userInfo, CiFolderEntity folderEntity, out string statusCode, out string statusMessage) { string returnCode = string.Empty; string returnMessage = string.Empty; int returnValue = 0; var parameter = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, string.Empty); parameter.IsAddLog = false; ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider => { var folderManager = new CiFolderManager(dbProvider, userInfo); returnValue = folderManager.Update(folderEntity, out returnCode); returnMessage = folderManager.GetStateMessage(returnCode); }); statusCode = returnCode; statusMessage = returnMessage; return(returnValue); }
/// <summary> /// 添加 /// </summary> /// <param name="userInfo">用户</param> /// <param name="parentId">父主键</param> /// <param name="folderName">文件夹名称</param> /// <param name="enabled">有效</param> /// <param name="statusCode">状态码</param> /// <param name="statusMessage">状态信息</param> /// <returns></returns> public string AddByFolderName(UserInfo userInfo, string parentId, string folderName, bool enabled, out string statusCode, out string statusMessage) { string returnCode = string.Empty; string returnMessage = string.Empty; string returnValue = string.Empty; var parameter = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, string.Empty); parameter.IsAddLog = false; ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider => { var folderEntity = new CiFolderEntity(); var folderManager = new CiFolderManager(dbProvider, userInfo); folderEntity.ParentId = parentId; folderEntity.FolderName = folderName; folderEntity.Enabled = enabled ? 1: 0; returnValue = folderManager.Add(folderEntity, out returnCode); returnMessage = folderManager.GetStateMessage(returnCode); }); statusCode = returnCode; statusMessage = returnMessage; return(returnValue); }
/// <summary> /// 重命名 /// </summary> /// <param name="userInfo">用户</param> /// <param name="id">主键</param> /// <param name="newName">新名称</param> /// <param name="enabled">有效</param> /// <param name="statusCode">状态码</param> /// <param name="statusMessage">状态信息</param> /// <returns>影响行数</returns> public int Rename(UserInfo userInfo, string id, string newName, bool enabled, out string statusCode, out string statusMessage) { string returnCode = string.Empty; string returnMessage = string.Empty; int returnValue = 0; var parameter = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, string.Empty); parameter.IsAddLog = false; ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider => { var folderEntity = new CiFolderEntity(); var folderManager = new CiFolderManager(dbProvider, userInfo); DataTable dataTable = folderManager.GetDTById(id); folderEntity.GetFrom(dataTable); folderEntity.FolderName = newName; folderEntity.Enabled = enabled ? 1 : 0; returnValue = folderManager.Update(folderEntity, out returnCode); returnMessage = folderManager.GetStateMessage(returnCode); }); statusCode = returnCode; statusMessage = returnMessage; return(returnValue); }