/// <summary> /// 添加 /// </summary> /// <param name="userInfo">用户</param> /// <param name="folderId">文件夹主键</param> /// <param name="fileName">文件名</param> /// <param name="file"></param> /// <param name="description"></param> /// <param name="enabled"></param> /// <param name="statusCode"></param> /// <param name="statusMessage"></param> /// <returns></returns> public string Add(BaseUserInfo userInfo, string folderId, string fileName, byte[] file, string description, bool enabled, out string statusCode, out string statusMessage) { string returnCode = string.Empty; string returnMessage = string.Empty; string result = string.Empty; var parameter = ServiceInfo.Create(userInfo, MethodBase.GetCurrentMethod()); ServiceUtil.ProcessUserCenterWriteDb(userInfo, parameter, (dbHelper) => { var manager = new BaseFileManager(dbHelper, userInfo); result = manager.Add(folderId, fileName, file, description, enabled, out returnCode); returnMessage = manager.GetStateMessage(returnCode); }); statusCode = returnCode; statusMessage = returnMessage; return(result); }
/// <summary> /// 添加 /// </summary> /// <param name="userInfo">用户</param> /// <param name="folderId">文件夹主键</param> /// <param name="fileName">文件名</param> /// <param name="file"></param> /// <param name="description"></param> /// <param name="enabled"></param> /// <param name="statusCode"></param> /// <param name="statusMessage"></param> /// <returns></returns> public string Add(BaseUserInfo userInfo, string folderId, string fileName, byte[] file, string description, 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; string returnValue = string.Empty; using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType)) { try { dbHelper.Open(UserCenterDbConnection); BaseFileManager fileManager = new BaseFileManager(dbHelper, userInfo); returnValue = fileManager.Add(folderId, fileName, file, description, enabled, 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); }