/// <summary> /// 更新文件 /// </summary> /// <param name="userInfo">用户</param> /// <param name="id">文件主键</param> /// <param name="fileName">文件名</param> /// <param name="file">文件内容</param> /// <param name="statusCode">返回状态</param> /// <param name="statusMessage">反悔信息</param> /// <returns></returns> public int UpdateFile(BaseUserInfo userInfo, string id, string fileName, byte[] file, 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.UpdateFile(id, fileName, file, out returnCode); returnMessage = manager.GetStateMessage(returnCode); }); statusCode = returnCode; statusMessage = returnMessage; return(result); }
/// <summary> /// 更新文件 /// </summary> /// <param name="userInfo">用户</param> /// <param name="id">文件主键</param> /// <param name="fileName">文件名</param> /// <param name="file">文件内容</param> /// <param name="statusCode">返回状态</param> /// <param name="statusMessage">反悔信息</param> /// <returns></returns> public int UpdateFile(BaseUserInfo userInfo, string id, string fileName, byte[] file, 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); BaseFileManager fileManager = new BaseFileManager(dbHelper, userInfo); returnValue = fileManager.UpdateFile(id, fileName, file, 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); }