internal BusinessObjectActionReport <DataRepositoryActionStatus> CreateTemporaryFile(CMSFile cmsFile) { BusinessObjectActionReport <DataRepositoryActionStatus> businessObjectActionReport = new BusinessObjectActionReport <DataRepositoryActionStatus>(DataRepositoryActionStatus.Success); businessObjectActionReport.ValidationResult = BusinessObjectManager.Validate(cmsFile); if (businessObjectActionReport.ValidationResult.IsValid) { DateTime utcNow = DateTime.UtcNow; int num = -1; try { using (IDataStoreContext dataStoreContext = this._DataStore.CreateContext()) { num = dataStoreContext.cms_FilesTemp_Insert(cmsFile.ApplicationId, cmsFile.CMSUserId, cmsFile.CMSFileType, cmsFile.FileName, cmsFile.Content , cmsFile.ContentType, cmsFile.ContentSize, cmsFile.FriendlyFileName, cmsFile.CMSHeight, cmsFile.CMSWidth); } } catch (Exception ex) { _Log.Error("Error at cms_FilesTemp_Insert", ex); throw new DataStoreException(ex, true); } if (num > 0) { cmsFile.CMSFileId = num; cmsFile.IsTemporary = true; cmsFile.DateCreatedUtc = DateTime.UtcNow; } else { businessObjectActionReport.Status = DataRepositoryActionStatus.SqlError; _Log.ErrorFormat("Temporary CMSFile {0} was not inserted at the database (ErrorCode: {1}).", cmsFile.CMSFileId, num); } } else { businessObjectActionReport.Status = DataRepositoryActionStatus.ValidationFailed; _Log.WarnFormat("Temporary CMSFile {0} was not inserted at the database because the validation failed.\nReport: {1}", cmsFile.CMSFileId, businessObjectActionReport.ValidationResult.ToString(TextFormat.ASCII)); } return(businessObjectActionReport); }