/// <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(BaseUserInfo userInfo, string id, string newName, bool enabled, out string statusCode, out string statusMessage) { // 写入调试信息 #if (DEBUG) int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod()); #endif // 加强安全验证防止未授权匿名调用 #if (!DEBUG) LogOnService.UserIsLogOn(userInfo); #endif statusCode = string.Empty; statusMessage = string.Empty; int returnValue = 0; using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType)) { try { dbHelper.Open(UserCenterDbConnection); BaseFileEntity fileEntity = new BaseFileEntity(); BaseFileManager fileManager = new BaseFileManager(dbHelper, userInfo); DataTable dataTable = fileManager.GetDataTableById(id); fileEntity.GetSingle(dataTable); fileEntity.FileName = newName; fileEntity.Enabled = enabled ? 1 : 0; returnValue = fileManager.Update(fileEntity, out statusCode); statusMessage = fileManager.GetStateMessage(statusCode); BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, MethodBase.GetCurrentMethod()); } catch (Exception ex) { BaseExceptionManager.LogException(dbHelper, userInfo, ex); throw ex; } finally { dbHelper.Close(); } } // 写入调试信息 #if (DEBUG) BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart); #endif return(returnValue); }
/// <summary> /// 更新 /// </summary> /// <param name="userInfo">用户</param> /// <param name="id"></param> /// <param name="folderId"></param> /// <param name="fileName"></param> /// <param name="description"></param> /// <param name="enabled"></param> /// <param name="statusCode"></param> /// <param name="statusMessage"></param> /// <returns></returns> public int Update(BaseUserInfo userInfo, string id, string folderId, string fileName, string description, bool enabled, out string statusCode, out string statusMessage) { string returnCode = string.Empty; string returnMessage = string.Empty; int result = 0; var parameter = ServiceInfo.Create(userInfo, MethodBase.GetCurrentMethod()); ServiceUtil.ProcessUserCenterWriteDb(userInfo, parameter, (dbHelper) => { var manager = new BaseFileManager(dbHelper, userInfo); result = manager.Update(id, folderId, fileName, description, enabled, out returnCode); returnMessage = manager.GetStateMessage(returnCode); }); statusCode = returnCode; statusMessage = returnMessage; return(result); }
/// <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(BaseUserInfo userInfo, string id, string newName, bool enabled, out string statusCode, out string statusMessage) { string returnCode = string.Empty; string returnMessage = string.Empty; int result = 0; var parameter = ServiceInfo.Create(userInfo, MethodBase.GetCurrentMethod()); ServiceUtil.ProcessUserCenterWriteDb(userInfo, parameter, (dbHelper) => { BaseFileEntity fileEntity = new BaseFileEntity(); var manager = new BaseFileManager(dbHelper, userInfo); var dt = manager.GetDataTableById(id); fileEntity.GetSingle(dt); fileEntity.FileName = newName; fileEntity.Enabled = enabled ? 1 : 0; result = manager.Update(fileEntity, out returnCode); returnMessage = manager.GetStateMessage(returnCode); }); statusCode = returnCode; statusMessage = returnMessage; return(result); }